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.asdftypes Module

Functions

format_tag(organization, standard, version, …) Format a YAML tag.

Classes

CustomType Base class for all user-defined types.
AsdfTypeIndex() An index of the known ExtensionType classes.

Class Inheritance Diagram

Inheritance diagram of asdf.asdftypes.CustomType, asdf.asdftypes.AsdfTypeIndex

asdf.extension Module

Classes

AsdfExtension Abstract base class defining an extension to ASDF.
AsdfExtensionList(extensions) Manage a set of extensions that are in effect.

Class Inheritance Diagram

Inheritance diagram of asdf.extension.AsdfExtension, asdf.extension.AsdfExtensionList

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.

asdf.versioning Module

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

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