ConverterProxy

class asdf.extension.ConverterProxy(delegate, extension)[source]

Bases: Converter

Proxy that wraps a Converter and provides default implementations of optional methods.

Attributes Summary

class_name

Get the fully qualified class name of this converter.

delegate

Get the wrapped converter instance.

extension

Get the extension that provided this converter.

package_name

Get the name of the Python package of this converter's extension.

package_version

Get the version of the Python package of this converter's extension.

tags

Get the list of tag URIs that this converter is capable of handling.

types

Get the Python types that this converter is capable of handling.

Methods Summary

from_yaml_tree(node, tag, ctx)

Convert a YAML node into an instance of a custom type.

select_tag(obj, ctx)

Select the tag to use when converting an object to YAML.

to_yaml_tree(obj, tag, ctx)

Convert an object into a node suitable for YAML serialization.

Attributes Documentation

class_name

Get the fully qualified class name of this converter.

Returns:
str
delegate

Get the wrapped converter instance.

Returns:
asdf.extension.Converter
extension

Get the extension that provided this converter.

Returns:
asdf.extension.ExtensionProxy
package_name

Get the name of the Python package of this converter’s extension. This may not be the same package that implements the converter’s class.

Returns:
str or None

Package name, or None if the extension was added at runtime.

package_version

Get the version of the Python package of this converter’s extension. This may not be the same package that implements the converter’s class.

Returns:
str or None

Package version, or None if the extension was added at runtime.

tags

Get the list of tag URIs that this converter is capable of handling.

Returns:
list of str
types

Get the Python types that this converter is capable of handling.

Returns:
list of type or str

Methods Documentation

from_yaml_tree(node, tag, ctx)[source]

Convert a YAML node into an instance of a custom type.

Parameters:
treedict or list or str

The YAML node to convert.

tagstr

The YAML tag of the object being converted.

ctxasdf.asdf.SerializationContext

Serialization parameters.

Returns:
object
select_tag(obj, ctx)[source]

Select the tag to use when converting an object to YAML.

Parameters:
objobject

Instance of the custom type being converted.

ctxasdf.asdf.SerializationContext

Serialization parameters.

Returns:
str

Selected tag.

to_yaml_tree(obj, tag, ctx)[source]

Convert an object into a node suitable for YAML serialization.

Parameters:
objobject

Instance of a custom type to be serialized.

tagstr

The tag identifying the YAML type that obj should be converted into.

ctxasdf.asdf.SerializationContext

Serialization parameters.

Returns:
object

The YAML node representation of the object.