We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema_info
If a node is contained in a list schema_info returns unexpected results.
import asdf MY_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") class MyExtension: 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}) class Thing: _tag = MY_TAG_URI def __asdf_traverse__(self): return [] ext = MyExtension() with asdf.config_context() as cfg: cfg.add_extension(ext) af = asdf.AsdfFile({ "my_list": [ 0, # not a Thing Thing(), ] }) print(af.schema_info("title"))
Outputs:
{'my_list': [{'title': some title}]}
Note that the 'title' containing dict is the 0th item in the list, not the 1st (as would match the tree). Passing preserve_list=False results in:
preserve_list=False
{'my_list': {1: {'title': some title}}}
which is closer to the truth but (as the argument describes) returns a structure that does not match the tree (my_list is a dict in the result).
my_list
dict
asdf version: main python version: 3.12 operating system: macosx
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description of the problem
If a node is contained in a list
schema_info
returns unexpected results.Example of the problem
Outputs:
Note that the 'title' containing dict is the 0th item in the list, not the 1st (as would match the tree).
Passing
preserve_list=False
results in:which is closer to the truth but (as the argument describes) returns a structure that does not match the tree (
my_list
is adict
in the result).System information
asdf version: main
python version: 3.12
operating system: macosx
The text was updated successfully, but these errors were encountered: