-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add argument none_value
for None
representation in loading and dumping
#53
Conversation
None
representation in loading and dumpingnone
for None
representation in loading and dumping
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 29 29
Branches 5 5
=========================================
Hits 29 29 |
Looking good, suggestions:
|
none
for None
representation in loading and dumpingnone_value
for None
representation in loading and dumping
Revised. |
This looks awesome, I'll review properly when I'm at a computer. |
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.
otherwise LGTM.
The I know it's a sort of different functionality but it costs tiny modifications on the current code base. I can submit a separate PR if you want. |
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.
a few more things to change.
We also need to update the readme.
As for the readme file, I think this |
I agree on both, we should say "at the time of writing" just in case. Feel free to update here or in another PR. |
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.
Looking good, I noticed you still need to update table_key
to use none_value
, also could you add tests for {None: 'foobar'}
, both with none_value='custom-value'
and none_value=None
?
That and readme updates, and I think we're done. 🎉
What happened to this PR? |
I got very busy 😄. Fixing now. |
Thanks so much for this @pwwang. |
Related: #23, toml-lang/toml#30
Reproducibility between loading and dumping using the same
none_value
:The PR modifies the visitor at rust end, and no re-visit is needed to covert the values at python end (like suggested by #23). So it barely affects the speed.
I think the only "drawback" is that only string
None
-representation is supported. You can't convert0
(integer) toNone
, for example, while loading, or vice versa while dumping.You can also omit
None
values or items that are associated withNone
value withomit_none=True
. See #23 (comment)