You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
info (and search and schema_info) do not use the extension manager of the AsdfFile instance from which they're called. This can lead to a number of issues including:
ignoring extensions passed to AsdfFile.__init__ (seen below)
ignoring the standard version of AsdfFile (can be seen with small modifications to the below example)
Example of the problem
importasdfMY_TAG_URI="asdf://somewhere.org/tags/foo-1.0.0"MY_SCHEMA_URI="asdf://somewhere.org/tags/foo-1.0.0"schema_bytes=f"""%YAML 1.1---$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"id: {MY_SCHEMA_URI}title: "some title"""".encode("ascii")
classMyExtension:
extension_uri="asdf://somewhere.org/extensions/foo-1.0.0"tags= [asdf.extension.TagDefinition(
MY_TAG_URI,
schema_uris=[MY_SCHEMA_URI],
)]
asdf.get_config().add_resource_mapping({MY_SCHEMA_URI: schema_bytes})
classThing:
_tag=MY_TAG_URIdef__asdf_traverse__(self):
return []
ext=MyExtension()
print("=== Extension not registered ===")
# if we don't register the extensionaf=asdf.AsdfFile({"t": Thing()})
# we don't see the titleaf.info()
print("=== Extension registered with config ===")
withasdf.config_context() ascfg:
# if we register the extension with configcfg.add_extension(ext)
af=asdf.AsdfFile({"t": Thing()})
# we see the titleaf.info()
# if we pass the extension to __init__...print("=== Extension passed to __init__ ===")
af=asdf.AsdfFile({"t": Thing()}, extensions=[ext])
# we don't see the titleaf.info()
Output:
=== Extension not registered ===
root (AsdfObject)
└─t (Thing): <__main__.Thing object at 0x103535030>
=== Extension registered with config ===
root (AsdfObject)
└─t (Thing): <__main__.Thing object at 0x10486a440> # some title
=== Extension passed to __init__ ===
root (AsdfObject)
└─t (Thing): <__main__.Thing object at 0x104b9d8d0>
System information
asdf version: main
python version: 3.12
operating system: mac osx
The text was updated successfully, but these errors were encountered:
Description of the problem
info
(andsearch
andschema_info
) do not use the extension manager of theAsdfFile
instance from which they're called. This can lead to a number of issues including:AsdfFile.__init__
(seen below)AsdfFile
(can be seen with small modifications to the below example)Example of the problem
Output:
System information
asdf version: main
python version: 3.12
operating system: mac osx
The text was updated successfully, but these errors were encountered: