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
DM-15721: Refactor config hierarchy access and add __delitem__ #88
Merged
Conversation
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
TallJimbo
force-pushed
the
tickets/DM-15721
branch
from
September 13, 2018 16:04
ec68f00
to
533f601
Compare
TallJimbo
approved these changes
Sep 13, 2018
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.
Everything looks good, and it's a clear improvement.
I've pushed two more commits of my own:
- more unit tests (I'm afraid I just ended up overwriting your latest ones, as mine were a bit more complete);
- documentation for the edge case we just discussed on Slack.
Thanks for the extra tests. I've also removed UserDict completely. Running Jenkins now. |
to include the presence of the key itself in the toplevel of the Config object.
They do actually work... until `names()` is used and converts everything to a string which can no longer be found. It's not worth trying to check for integers as keys as a special case since it should never happen when reading from a config file. Therefore remove the test code that was exploiting it.
UserDict requires we use a data attribute but we do not want this to be public. UserDict is not really recommended for new code and MutableMapping is more consistent with modern usage.
Now that we are not using UserDict we can name the properties anything we like. Now make it explicitly internal that we store a dict inside Config.
timj
force-pushed
the
tickets/DM-15721
branch
from
September 13, 2018 21:38
867bfad
to
425910a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@TallJimbo noted that
__delitem__
was missing. Rather than copy the hierarchy access code to a new method this PR factors it out so it is shared for multiple dunder methods and__delitem__
is then implemented on top of that.