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

array_inline_threshold

Get the threshold below which arrays are automatically written as inline YAML literals instead of binary blocks.

default_version

Get the default ASDF Standard version used for new files.

extensions

Get the list of registered extensions.

io_block_size

Get the block size used when reading and writing files.

legacy_fill_schema_defaults

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

resource_manager

Get the asdf.resource.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

array_inline_threshold

Get the threshold below which arrays are automatically written as inline YAML literals instead of binary blocks. This number is compared to number of elements in the array.

Returns:
int or None

Integer threshold, or None to disable automatic selection of the array storage type.

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
io_block_size

Get the block size used when reading and writing files.

Returns:
int

Block size, or -1 to use the filesystem’s preferred block size.

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 asdf.resource.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.