-
Notifications
You must be signed in to change notification settings - Fork 4
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
#104: Skip serialization of empty INI properties when configured #336
Merged
priscavdsluis
merged 12 commits into
main
from
fix/104-skip-serialization-empty-properties
Oct 13, 2022
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f0101c9
#104: Fix documentation; the default is False.
priscavdsluis 24c5ca6
#104: Add skip_empty_properties property to SerializerConfig and add …
priscavdsluis 7fc7c85
#104: Skip empty properties during serialization when skip_empty_prop…
priscavdsluis e46dc40
autoformat: isort & black
priscavdsluis 260df7e
#104: Set SerializerConfig skip_empty_properties property to False fo…
priscavdsluis 4fcc59c
autoformat: isort & black
priscavdsluis 48992e9
#104: Fix documentation
priscavdsluis 86571ae
#104: Add property with white space value to test case.
priscavdsluis c0bc9b2
Merge branch 'main' into fix/104-skip-serialization-empty-properties
priscavdsluis c06fb3f
Merge branch 'main' into fix/104-skip-serialization-empty-properties
priscavdsluis 8e3cb2c
#104: Add documentation to _serialize
priscavdsluis 8b8656e
Merge branch 'main' into fix/104-skip-serialization-empty-properties
priscavdsluis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Visual Studio gives the following error for
self._resolved_filepath
:Argument of type "Path | None" cannot be assigned to parameter "path" of type "Path" in function "write_ini" Type "Path | None" cannot be assigned to type "Path" Type "None" cannot be assigned to type "Path"
I think it is because
_resolved_filepath
isOptional
andwrite_ini()
expects a non-optional path.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.
before this method is called, the
_resolved_filepath
property is checked for None, so it cannot be None here.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.
Is that so? I see such a check only in
ParsableFileModel._serialize()
, but that will not be called if a subclass overrides that method, for example inINIModel._serialize()
.I think the place that now makes sure everything runs well is this:
Should we not add documentation that
_serialize()
should always only be called viasave()
and never directly?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.
@priscavdsluis wrote that the latter is implicitly so, because
_serialize()
is a private function. That is true for end-user APIdocs. But amongst core-developers, it is good to know that other private functions should probably also not call_serialize
directly. Maybe some one-liner docs in the function body?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.
I added some docs and will close this PR.