AsdfConfig

class asdf.config.AsdfConfig[source]

Bases: object

Container for ASDF configuration options. Users are not intended to construct this object directly; instead, use the asdf.get_config and asdf.config_context module methods.

Attributes Summary

default_version

Get the default ASDF Standard version used for new files.

extensions

Get the list of registered extensions.

legacy_fill_schema_defaults

Get the configuration that controls filling defaults from schemas for older ASDF Standard versions.

resource_manager

Get the ResourceManager instance.

resource_mappings

Get the list of registered resource mapping instances.

validate_on_read

Get configuration that controls schema validation of ASDF files on read.

Methods Summary

add_extension(extension)

Register a new extension.

add_resource_mapping(mapping)

Register a new resource mapping.

remove_extension([extension, package])

Remove a registered extension.

remove_resource_mapping([mapping, package])

Remove a registered resource mapping.

reset_extensions()

Reset extensions to the default list registered via entry points.

reset_resources()

Reset registered resource mappings to the default list provided as entry points.

Attributes Documentation

default_version

Get the default ASDF Standard version used for new files.

Returns
str
extensions

Get the list of registered extensions.

Returns
list of asdf.extension.ExtensionProxy
legacy_fill_schema_defaults

Get the configuration that controls filling defaults from schemas for older ASDF Standard versions. If True, missing default values will be filled from the schema when reading files from ASDF Standard <= 1.5.0. Later versions of the standard do not support removing or filling schema defaults.

Returns
bool
resource_manager

Get the ResourceManager instance. Includes resources from registered resource mappings and any mappings added at runtime.

Returns
asdf.resource.ResourceManager
resource_mappings

Get the list of registered resource mapping instances. Unless overridden by user configuration, this list contains every mapping registered with an entry point.

Returns
list of asdf.resource.ResourceMappingProxy
validate_on_read

Get configuration that controls schema validation of ASDF files on read.

Returns
bool

Methods Documentation

add_extension(extension)[source]

Register a new extension. The new extension will take precedence over all previously registered extensions.

Parameters
extensionasdf.extension.AsdfExtension or asdf.extension.Extension
add_resource_mapping(mapping)[source]

Register a new resource mapping. The new mapping will take precedence over all previously registered mappings.

Parameters
mappingcollections.abc.Mapping

Map of str resource URI to bytes content

remove_extension(extension=None, *, package=None)[source]

Remove a registered extension.

Parameters
extensionasdf.extension.AsdfExtension or asdf.extension.Extension or str, optional

An extension instance or URI pattern to remove.

packagestr, optional

Remove only extensions provided by this package. If the extension argument is omitted, then all extensions from this package will be removed.

remove_resource_mapping(mapping=None, *, package=None)[source]

Remove a registered resource mapping.

Parameters
mappingcollections.abc.Mapping, optional

Mapping to remove.

packagestr, optional

Remove only extensions provided by this package. If the mapping argument is omitted, then all mappings from this package will be removed.

reset_extensions()[source]

Reset extensions to the default list registered via entry points.

reset_resources()[source]

Reset registered resource mappings to the default list provided as entry points.