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

added error handling for JSON duplicate IDs #538

Merged
merged 4 commits into from
May 10, 2024
Merged

added error handling for JSON duplicate IDs #538

merged 4 commits into from
May 10, 2024

Conversation

nwlandry
Copy link
Collaborator

@nwlandry nwlandry commented May 6, 2024

If we construct a hypergraph as

>>> import xgi
>>> H = xgi.Hypergraph()
>>> H.add_nodes_from(["2", 2])
>>> xgi.write_json(H, "test.json")

>>> H2 = xgi.read_json("test.json")
>>> H2.nodes
NodeView(("2"))

These will get mapped to a single node when we cast IDs to strings for the JSON. This will raise an error instead.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.35%. Comparing base (9140f10) to head (d7ff176).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #538      +/-   ##
==========================================
+ Coverage   92.29%   92.35%   +0.05%     
==========================================
  Files          60       60              
  Lines        4493     4500       +7     
==========================================
+ Hits         4147     4156       +9     
+ Misses        346      344       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@thomasrobiglio thomasrobiglio left a comment

Choose a reason for hiding this comment

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

Thank you @nwlandry, looks good!

@nwlandry
Copy link
Collaborator Author

Thanks so much, @thomasrobiglio!!

@nwlandry nwlandry merged commit 6495dcc into main May 10, 2024
24 checks passed
@nwlandry nwlandry deleted the json-warning branch May 10, 2024 12:40
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.

None yet

2 participants