Skip to content
New issue

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

panoptes.utils.serializers.from_yaml fails to parse astropy quantities #303

Open
fergusL opened this issue Oct 20, 2022 · 0 comments
Open

Comments

@fergusL
Copy link
Collaborator

fergusL commented Oct 20, 2022

The from_yaml function is intended to be able to parse a yaml config for astropy quantities, however this fails as when the yaml object is created here, it is created as a ruamel.yaml.comments.CommentedSeq object. When this object is parsed by the deserialize_all_objects function, it checks if the object is a dict or OrderedDict instance before attempting to parse any entries intended as astropy quantities. As the object is not an instance of either type, it will never be parsed.

In [1]: from panoptes.utils.serializers import from_yaml

In [2]: with open('./fields.yaml', 'r') as f:
    ...:   c = from_yaml(f.read())
    ...: 

In [3]: type(c)
Out[3]: ruamel.yaml.comments.CommentedSeq

In [4]: isinstance(c, (dict, OrderedDict))
Out[4]: False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant