Skip to content

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

@fergusL

Description

@fergusL

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions