-
Notifications
You must be signed in to change notification settings - Fork 60
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
None types are not preserved #536
Comments
This appears to be an issue with ASDF and not with the underlying YAML implementation: >>> import yaml
>>> tree = dict(a=1, b='hello', c=None)
>>> result = yaml.dump(tree)
>>> result
'a: 1\nb: hello\nc: null\n'
>>> yaml.safe_load(result)
{'a': 1, 'b': 'hello', 'c': None} So this is probably a bug and should be addressed. |
I just ran into this issue as well. I think things go wrong when converting the tree to a tagged tree. >>> import asdf
>>> tree = {"a": 1, "b": None}
>>> af = asdf.AsdfFile(tree)
>>> af.tree
{'a': 1}
>>> tree_tagged = asdf.yamlutil.custom_tree_to_tagged_tree(tree, af)
>>> tree_tagged
{'a': 1}
>>> tree
{'a': 1, 'b': None} I haven't been able to check, but it seems like in line 138 of |
The callback is allowed to return @jdavies-st maybe we should define a special value that can be returned instead of |
It's not clear why The fact that serialization with |
So based on discussions with Perry and an email from Mike, it seems the driver of If you're not using schemas to validate your ASDF tree, then this probably unexpected. I think we need to think more about how we might make |
This just bit me as I expected None to be stored in the tree but it wasn't and my parser choked on a non-existing key. Would it not be better to perhaps tag missing values with nan and leave None intact? |
I think some solution is needed to deal with this. NaN is probably not the right solution but perhaps some asdf-defined special value indicating missing. |
Alternatively, would you consider implementing a
|
As @vmarkovtsev pointed out in #534,
None
types are currently stripped from the tree.I don't think the standard has anything to say about this at the moment. Would it be useful if
None
values are preserved in the tree? This would probably require the definition of aNone
orNull
tag. I need to think through the implications a little more.cc @perrygreenfield
The text was updated successfully, but these errors were encountered: