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 a YAML tag. |
Classes¶
Base class for all user-defined types. |
Class Inheritance Diagram¶
digraph inheritance0c97bba666 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CustomType" [URL="../../api/asdf.types.CustomType.html#asdf.types.CustomType",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all user-defined types."]; "ExtensionType" -> "CustomType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ExtensionType" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="The base class of all custom types in the tree."]; }asdf.extension Package¶
Support for plugins that extend asdf to serialize additional custom types.
Functions¶
|
Get a previously created ExtensionManager for the specified extensions, or create and cache one if necessary. |
Get the resolver that includes mappings from all installed extensions. |
|
|
Get a previously created AsdfExtensionList for the specified extensions, or create and cache one if necessary. |
Classes¶
Abstract base class defining an extension to ASDF. |
|
|
Proxy that wraps an extension, provides default implementations of optional methods, and carries additional information on the package that provided the extension. |
|
Extension implementation that reads the extension URI, ASDF Standard requirement, and tag list from a manifest document. |
|
Wraps a list of extensions and indexes their converters by tag and by Python type. |
|
Container for properties of a custom YAML tag. |
Abstract base class for plugins that convert nodes from the parsed YAML tree into custom objects, and vice versa. |
|
|
Proxy that wraps a |
Abstract base class for plugins that compress binary data. |
|
Abstract base class defining a (legacy) extension to ASDF. |
|
|
Manage a set of extensions that are in effect. |
This is the "extension" to ASDF that includes all the built-in tags. |
Class Inheritance Diagram¶
digraph inheritanceeb404f2579 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AsdfExtension" [URL="../../api/asdf.extension.AsdfExtension.html#asdf.extension.AsdfExtension",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class defining a (legacy) extension to ASDF."]; "AsdfExtensionList" [URL="../../api/asdf.extension.AsdfExtensionList.html#asdf.extension.AsdfExtensionList",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Manage a set of extensions that are in effect."]; "BuiltinExtension" [URL="../../api/asdf.extension.BuiltinExtension.html#asdf.extension.BuiltinExtension",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This is the \"extension\" to ASDF that includes all the built-in"]; "Compressor" [URL="../../api/asdf.extension.Compressor.html#asdf.extension.Compressor",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for plugins that compress binary data."]; "ABC" -> "Compressor" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Converter" [URL="../../api/asdf.extension.Converter.html#asdf.extension.Converter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for plugins that convert nodes from the"]; "ABC" -> "Converter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ConverterProxy" [URL="../../api/asdf.extension.ConverterProxy.html#asdf.extension.ConverterProxy",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Proxy that wraps a `Converter` and provides default"]; "Converter" -> "ConverterProxy" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Extension" [URL="../../api/asdf.extension.Extension.html#asdf.extension.Extension",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class defining an extension to ASDF."]; "ABC" -> "Extension" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ExtensionManager" [URL="../../api/asdf.extension.ExtensionManager.html#asdf.extension.ExtensionManager",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wraps a list of extensions and indexes their converters"]; "ExtensionProxy" [URL="../../api/asdf.extension.ExtensionProxy.html#asdf.extension.ExtensionProxy",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Proxy that wraps an extension, provides default implementations"]; "Extension" -> "ExtensionProxy" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsdfExtension" -> "ExtensionProxy" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ManifestExtension" [URL="../../api/asdf.extension.ManifestExtension.html#asdf.extension.ManifestExtension",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Extension implementation that reads the extension URI, ASDF"]; "Extension" -> "ManifestExtension" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TagDefinition" [URL="../../api/asdf.extension.TagDefinition.html#asdf.extension.TagDefinition",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Container for properties of a custom YAML tag."]; }asdf.resource Module¶
Support for plugins that provide access to resources such as schemas.
Functions¶
Classes¶
|
Wrapper around a resource mapping that carries additional information on the package that provided the mapping. |
|
Resource mapping that reads resource content from a directory or directory tree. Parameters ---------- root : str or importlib.abc.Traversable Root directory (or directory-like Traversable) of the resource files. |
|
Wraps multiple resource mappings into a single interface with some friendlier error handling. |
Resource mapping that fetches metaschemas from the jsonschema package. |
Class Inheritance Diagram¶
digraph inheritance43b00fdd6e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Collection" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Sized" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Iterable" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Container" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Container" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Iterable" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "JsonschemaResourceMapping" [URL="../../api/asdf.resource.JsonschemaResourceMapping.html#asdf.resource.JsonschemaResourceMapping",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Resource mapping that fetches metaschemas from"]; "Mapping" -> "JsonschemaResourceMapping" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Mapping" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Collection" -> "Mapping" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ResourceManager" [URL="../../api/asdf.resource.ResourceManager.html#asdf.resource.ResourceManager",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wraps multiple resource mappings into a single interface"]; "Mapping" -> "ResourceManager" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ResourceMappingProxy" [URL="../../api/asdf.resource.ResourceMappingProxy.html#asdf.resource.ResourceMappingProxy",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wrapper around a resource mapping that carries"]; "Mapping" -> "ResourceMappingProxy" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Sized" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; }asdf.yamlutil Module¶
Functions¶
|
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. |
|
Convert a tree containing only basic data types, annotated with tags, to a tree containing custom data types. |
asdf.util Module¶
Functions¶
|
Formats a list for human readability. |
|
For a given Numpy array, finds the base array that "owns" the actual data. |
|
For a given URI, return the part without any fragment. |
|
For a given local file path, return a file:// url. |
|
Returns all subclasses of a class. |
|
Calculates the amount of extra space to add to a block given the user's request for the amount of extra space. |
|
Resolve a name like |
|
Determine if a value is an instance of a "primitive" type. |
|
Determine if a URI matches a URI pattern with possible wildcards. |
|
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 a tag into its base and version. |
|
Join the root and version of a tag back together. |
Classes¶
|
This class adds features to the existing |
|
Class Inheritance Diagram¶
digraph inheritance15fe5152ac { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AsdfSpec" [URL="../../api/asdf.versioning.AsdfSpec.html#asdf.versioning.AsdfSpec",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "SimpleSpec" -> "AsdfSpec" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsdfVersion" [URL="../../api/asdf.versioning.AsdfVersion.html#asdf.versioning.AsdfVersion",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class adds features to the existing ``Version`` class from the"]; "AsdfVersionMixin" -> "AsdfVersion" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Version" -> "AsdfVersion" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsdfVersionMixin" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="This mix-in is required in order to impose the total ordering that we"]; "BaseSpec" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A specification of compatible versions."]; "SimpleSpec" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "BaseSpec" -> "SimpleSpec" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Version" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; }asdf.tests.helpers Module¶
Functions¶
|
|
|
Assert that two ASDF trees match. |
|
Assert that a given tree saves to ASDF and, when loaded back, the tree matches the original tree. |
|
Given a string of YAML content, adds the extra pre- and post-amble to make it an ASDF file. |
|
Get the file sizes in a directory. |
|
Return a string that displays a list of unexpected warnings |