AsdfTypeIndex

class asdf.asdftypes.AsdfTypeIndex[source]

Bases: object

An index of the known ExtensionType classes.

In the future this class may be renamed to ExtensionTypeIndex, since it is not specific to classes that inherit AsdfType.

Attributes Summary

has_hook Returns True if the given hook name exists on any of the managed types.

Methods Summary

add_type(asdftype, extension) Add a type to the index.
fix_yaml_tag(ctx, tag[, ignore_version_mismatch]) Given a YAML tag, adjust it to the best supported version.
from_custom_type(custom_type[, version]) Given a custom type, return the corresponding ExtensionType definition.
from_yaml_tag(ctx, tag) From a given YAML tag string, return the corresponding AsdfType definition.
get_extensions_used([version])
get_hook_for_type(hookname, typ[, version]) Get the hook function for the given type, if it exists, else return None.
get_real_tag(tag)

Attributes Documentation

has_hook[source]

Returns True if the given hook name exists on any of the managed types.

Methods Documentation

add_type(asdftype, extension)[source]

Add a type to the index.

fix_yaml_tag(ctx, tag, ignore_version_mismatch=True)[source]

Given a YAML tag, adjust it to the best supported version.

If there is no exact match, this finds the newest version understood that is still less than the version in file. Or, the earliest understood version if none are less than the version in the file.

If ignore_version_mismatch==False, this function raises a warning if it could not find a match where the major and minor numbers are the same.

from_custom_type(custom_type, version=Version('1.2.0'))[source]

Given a custom type, return the corresponding ExtensionType definition.

from_yaml_tag(ctx, tag)[source]

From a given YAML tag string, return the corresponding AsdfType definition.

get_extensions_used(version=Version('1.2.0'))[source]
get_hook_for_type(hookname, typ, version=Version('1.2.0'))[source]

Get the hook function for the given type, if it exists, else return None.

get_real_tag(tag)[source]