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 method for JSON3.write specifically for ACSets #79

Merged
merged 6 commits into from
Nov 13, 2023

Conversation

quffaro
Copy link
Member

@quffaro quffaro commented Nov 9, 2023

I've added a method onto JSON3.write for writing ACSets. This saves using from composing generate_json_acset into JSON3.write

@@ -92,7 +92,7 @@ Inverse to [`read_json_acset`](@ref).
"""
function write_json_acset(x::ACSet, fname::AbstractString)
open(fname, "w") do f
write(f, JSON.json(generate_json_acset(x)))
write(f, JSON3.json(generate_json_acset(x)))
Copy link
Member

Choose a reason for hiding this comment

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

this should be

write_json_acset(x::ACSet, fname::AbstractString) = JSON3.write(fname, x)

because JSON3 has a method for this now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!


Dispatches write to accept ACSets
"""
JSON3.write(io::IO, acs::ACSet; kwargs...) = JSON3.write(io, generate_json_acset(acs); kwargs...)
Copy link
Member

Choose a reason for hiding this comment

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

move this snippet up to near the other write method on line 93

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@jpfairbanks
Copy link
Member

Also remove JSON from Project.toml before merging.

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (a7b19ff) 87.55% compared to head (de26af7) 87.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #79      +/-   ##
==========================================
+ Coverage   87.55%   87.60%   +0.04%     
==========================================
  Files          22       22              
  Lines        1840     1839       -1     
==========================================
  Hits         1611     1611              
+ Misses        229      228       -1     
Files Coverage Δ
src/serialization/JSONACSets.jl 93.65% <85.71%> (-0.10%) ⬇️

... and 3 files with indirect coverage changes

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

Copy link
Member

@jpfairbanks jpfairbanks left a comment

Choose a reason for hiding this comment

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

LGTM

@jpfairbanks jpfairbanks merged commit 0f4fd2c into main Nov 13, 2023
9 checks passed
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.

2 participants