-
Notifications
You must be signed in to change notification settings - Fork 14
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
Replace tags in attribute lists and dicts #352
Replace tags in attribute lists and dicts #352
Conversation
Also corrected the test from the previous commits. The `components` attribute is a list of one-element dictionaries in the yaml file, but is apparently flattened during parsing and becomes a simple dict instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @korsbakken, very nice - just a few suggestions for consistency...
Co-authored-by: Daniel Huppmann <[email protected]>
Thanks @danielhuppmann, those suggestions make good sense, I have added and committed them to the PR now. |
The suggested changes appear to cause tests to fail, not clear why. It introduces an unintentional blank line in the middle of a definition, and an inconsistency in the CO2 and CH4 unit definitions, but new less obvious failures appear after fixing that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, the "/yr" was specified both in the code itself and the tag...
The last commit contained an unintentional blank line in test_codelist.py, and inconsistent indentation in data/tagged_codelis/tag_species.yaml that was causing an error when creating the CodeList.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
This PR (hopefully) solves issue #342 . It modifies
Code.replace_tag
to descend into attribute lists and dicts, replaing each string in list elements of dict values that contain a tag. Adds a test and test data that contains a code with tags in thecomponents
attribute.