AsdfConfig¶
- class asdf.config.AsdfConfig[source]¶
Bases:
objectContainer for ASDF configuration options. Users are not intended to construct this object directly; instead, use the
asdf.get_configandasdf.config_contextmodule methods.Attributes Summary
Override the compression type on all binary blocks in the file.
Dictionary of keyword arguments provided to the compressor during block compression (or
Nonefor no keyword arguments)Override the array storage type of all blocks in the file immediately before writing.
Get the threshold below which arrays are automatically written as inline YAML literals instead of binary blocks.
Option to control if when saving arrays the base array should be saved (so views of the same array will refer to offsets/strides of the same block).
Get the default ASDF core schemas version used for new files.
Get the list of registered extensions.
Get the block size used when reading and writing files.
Get configuration that controls if ASDF tree contents are lazily converted to custom objects or if all custom objects are created when the file is opened.
Get the configuration that controls filling defaults from schemas for older ASDF core schemas versions.
Get the
asdf.resource.ResourceManagerinstance.Get the list of registered resource mapping instances.
Get configuration that controls schema validation of ASDF files on read.
Get configuration that controls if errors during conversion are converted to warnings.
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 to the default list registered via entry points.
Reset registered resource mappings to the default list provided as entry points.
Attributes Documentation
- all_array_compression¶
Override the compression type on all binary blocks in the file. Must be one of the following strings,
Noneor a label supported by aasdf.extension.Compressor:''orNone: No compression.zlib: Use zlib compression.bzp2: Use bzip2 compression.lz4: Use lz4 compression.input: Use the same compression as in the file read. If there is no prior file, acts as None
- all_array_compression_kwargs¶
Dictionary of keyword arguments provided to the compressor during block compression (or
Nonefor no keyword arguments)
- all_array_storage¶
Override the array storage type of all blocks in the file immediately before writing. Must be one of the following strings or
None:internal: The default. The array data will be stored in a binary block in the same ASDF file.external: Store the data in a binary block in a separate ASDF file.inline: Store the data as YAML inline in the tree.
- 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_array_save_base¶
Option to control if when saving arrays the base array should be saved (so views of the same array will refer to offsets/strides of the same block).
- default_version¶
Get the default ASDF core schemas 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.
- lazy_tree¶
Get configuration that controls if ASDF tree contents are lazily converted to custom objects or if all custom objects are created when the file is opened. See the
lazy_treeargument forasdf.open.- Returns:
- bool
- legacy_fill_schema_defaults¶
Get the configuration that controls filling defaults from schemas for older ASDF core schemas versions. If
True, missing default values will be filled from the schema when reading files from ASDF core schemas <= 1.5.0. Later versions of the core schemas do not support removing or filling schema defaults.- Returns:
- bool
- resource_manager¶
Get the
asdf.resource.ResourceManagerinstance. Includes resources from registered resource mappings and any mappings added at runtime.- Returns:
- 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
- warn_on_failed_conversion¶
Get configuration that controls if errors during conversion are converted to warnings.
Enabling this can be helpful when opening old files that contain tags that are no longer supported.
- 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.Extension
- add_resource_mapping(mapping)[source]¶
Register a new resource mapping. The new mapping will take precedence over all previously registered mappings.
- remove_extension(extension=None, *, package=None)[source]¶
Remove a registered extension.
- Parameters:
- extensionasdf.extension.Extension or str, optional
An extension instance or URI pattern to remove.
- packagestr, optional
Remove only extensions provided by this package. If the
extensionargument 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
mappingargument is omitted, then all mappings from this package will be removed.