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

Disallow null values in input YAML #387

Merged
merged 1 commit into from
Nov 30, 2021

Conversation

apragsdale
Copy link
Member

@apragsdale apragsdale commented Nov 28, 2021

Closes #340

@codecov
Copy link

codecov bot commented Nov 28, 2021

Codecov Report

Merging #387 (08fd822) into main (fb694c3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 08fd822 differs from pull request most recent head 7d39cff. Consider uploading reports for the commit 7d39cff to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main     #387   +/-   ##
=======================================
  Coverage   99.86%   99.86%           
=======================================
  Files           5        5           
  Lines        1529     1536    +7     
=======================================
+ Hits         1527     1534    +7     
  Misses          2        2           
Impacted Files Coverage Δ
demes/load_dump.py 100.00% <100.00%> (ø)
demes/demes.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb694c3...7d39cff. Read the comment docs.

@apragsdale
Copy link
Member Author

Essentially what I've done here is add a function to load_dump.py that iterates through the loaded data dict and checks for any None values, raising an error if it finds one. There may be a much more elegant way of doing this, and this solution feels a bit hacky. It does seem to work though, and if we're just forbidding null entries in the YAML until we make a final decision on what they mean and how they should be handled, this could be a reasonable stopgap.

Thoughts @jeromekelleher @grahamgower @molpopgen?

Copy link
Member

@grahamgower grahamgower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I can't think of a cleaner way to do this, and your approach is at least simple and self contained. Can you update the commit message to indicate the change before you merge this?

demes/load_dump.py Outdated Show resolved Hide resolved
@apragsdale apragsdale merged commit 347c7bf into popsim-consortium:main Nov 30, 2021
@apragsdale apragsdale changed the title First pass at fixing #340 Disallow null values in input YAML Nov 30, 2021
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

Successfully merging this pull request may close these issues.

Reject YAML files with values set to null.
2 participants