Developer API

The classes and functions documented here will be of use to developers who wish to create their own custom ASDF types and extensions.

asdf.types Module

Functions

format_tag(organization, standard, version, ...)

Format a YAML tag.

Classes

CustomType()

Base class for all user-defined types.

Class Inheritance Diagram

Inheritance diagram of asdf.types.CustomType

asdf.extension Package

Support for plugins that extend asdf to serialize additional custom types.

Functions

get_cached_extension_manager(extensions)

Get a previously created ExtensionManager for the specified extensions, or create and cache one if necessary.

get_default_resolver()

Get the resolver that includes mappings from all installed extensions.

get_cached_asdf_extension_list(extensions)

Get a previously created AsdfExtensionList for the specified extensions, or create and cache one if necessary.

Classes

Extension()

Abstract base class defining an extension to ASDF.

ExtensionProxy(delegate[, package_name, ...])

Proxy that wraps an extension, provides default implementations of optional methods, and carries additional information on the package that provided the extension.

ManifestExtension(manifest, *[, ...])

Extension implementation that reads the extension URI, ASDF Standard requirement, and tag list from a manifest document.

ExtensionManager(extensions)

Wraps a list of extensions and indexes their converters by tag and by Python type.

TagDefinition(tag_uri, *[, schema_uris, ...])

Container for properties of a custom YAML tag.

Converter()

Abstract base class for plugins that convert nodes from the parsed YAML tree into custom objects, and vice versa.

ConverterProxy(delegate, extension)

Proxy that wraps a Converter and provides default implementations of optional methods.

Compressor()

Abstract base class for plugins that compress binary data.

AsdfExtension()

Abstract base class defining a (legacy) extension to ASDF.

AsdfExtensionList(extensions)

Manage a set of extensions that are in effect.

BuiltinExtension()

This is the "extension" to ASDF that includes all the built-in tags.

Class Inheritance Diagram

Inheritance diagram of asdf.extension._extension.Extension, asdf.extension._extension.ExtensionProxy, asdf.extension._manifest.ManifestExtension, asdf.extension._manager.ExtensionManager, asdf.extension._tag.TagDefinition, asdf.extension._converter.Converter, asdf.extension._converter.ConverterProxy, asdf.extension._compressor.Compressor, asdf.extension._legacy.AsdfExtension, asdf.extension._legacy.AsdfExtensionList, asdf.extension._legacy.BuiltinExtension

asdf.resource Module

Support for plugins that provide access to resources such as schemas.

Functions

get_core_resource_mappings()

Get the resource mapping instances for the core schemas.

Classes

ResourceMappingProxy(delegate[, ...])

Wrapper around a resource mapping that carries additional information on the package that provided the mapping.

DirectoryResourceMapping(root, uri_prefix[, ...])

Resource mapping that reads resource content from a directory or directory tree.

ResourceManager(resource_mappings)

Wraps multiple resource mappings into a single interface with some friendlier error handling.

JsonschemaResourceMapping()

Resource mapping that fetches metaschemas from the jsonschema package.

Class Inheritance Diagram

Inheritance diagram of asdf.resource.ResourceMappingProxy, asdf.resource.DirectoryResourceMapping, asdf.resource.ResourceManager, asdf.resource.JsonschemaResourceMapping

asdf.yamlutil Module

Functions

custom_tree_to_tagged_tree(tree, ctx[, ...])

Convert a tree, possibly containing custom data types that aren't directly representable in YAML, to a tree of basic data types, annotated with tags.

tagged_tree_to_custom_tree(tree, ctx[, ...])

Convert a tree containing only basic data types, annotated with tags, to a tree containing custom data types.

asdf.util Module

Functions

human_list(l[, separator])

Formats a list for human readability.

get_array_base(arr)

For a given Numpy array, finds the base array that "owns" the actual data.

get_base_uri(uri)

For a given URI, return the part without any fragment.

filepath_to_url(path)

For a given local file path, return a file:// url.

iter_subclasses(cls)

Returns all subclasses of a class.

calculate_padding(content_size, pad_blocks, ...)

Calculates the amount of extra space to add to a block given the user's request for the amount of extra space.

resolve_name(name)

Resolve a name like module.object to an object and return it.

is_primitive(value)

Determine if a value is an instance of a "primitive" type.

uri_match(pattern, uri)

Determine if a URI matches a URI pattern with possible wildcards.

get_class_name(obj[, instance])

Given a class or instance of a class, returns a string representing the fully specified path of the class.

asdf.versioning Module

This module deals with things that change between different versions of the ASDF spec.

Functions

split_tag_version(tag)

Split a tag into its base and version.

join_tag_version(name, version)

Join the root and version of a tag back together.

Classes

AsdfVersion(version)

This class adds features to the existing Version class from the semantic_version module.

AsdfSpec(*args, **kwargs)

Class Inheritance Diagram

Inheritance diagram of asdf.versioning.AsdfVersion, asdf.versioning.AsdfSpec

asdf.tests.helpers Module

Functions

get_test_data_path(name[, module])

assert_tree_match(old_tree, new_tree[, ctx, ...])

Assert that two ASDF trees match.

assert_roundtrip_tree(*args, **kwargs)

Assert that a given tree saves to ASDF and, when loaded back, the tree matches the original tree.

yaml_to_asdf(yaml_content[, yaml_headers, ...])

Given a string of YAML content, adds the extra pre- and post-amble to make it an ASDF file.

get_file_sizes(dirname)

Get the file sizes in a directory.

display_warnings(_warnings)

Return a string that displays a list of unexpected warnings