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

DM-15721: Refactor config hierarchy access and add __delitem__ #88

Merged
merged 10 commits into from Sep 13, 2018

Conversation

timj
Copy link
Member

@timj timj commented Sep 13, 2018

@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.

Copy link
Member

@TallJimbo TallJimbo left a 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.

@timj
Copy link
Member Author

timj commented Sep 13, 2018

Thanks for the extra tests. I've also removed UserDict completely. Running Jenkins now.

timj and others added 10 commits September 13, 2018 14:38
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 timj merged commit b7d8b87 into master Sep 13, 2018
@timj timj deleted the tickets/DM-15721 branch September 13, 2018 22:03
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.

None yet

2 participants