-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
src/serialization/JSONACSets.jl
Outdated
@@ -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))) |
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.
this should be
write_json_acset(x::ACSet, fname::AbstractString) = JSON3.write(fname, x)
because JSON3 has a method for this now.
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.
Done!
src/serialization/JSONACSets.jl
Outdated
|
||
Dispatches write to accept ACSets | ||
""" | ||
JSON3.write(io::IO, acs::ACSet; kwargs...) = JSON3.write(io, generate_json_acset(acs); kwargs...) |
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.
move this snippet up to near the other write method on line 93
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.
Done!
Also remove JSON from Project.toml before merging. |
Codecov ReportAttention:
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
☔ View full report in Codecov by Sentry. |
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.
LGTM
I've added a method onto
JSON3.write
for writing ACSets. This saves using from composinggenerate_json_acset
intoJSON3.write