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

Add __getitem__ and __contains__ method to Config object #2

Merged
merged 2 commits into from
Dec 24, 2018

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Dec 24, 2018

These methods allow for bracket syntax access of config keys (ex. mypkg_config['a']) and in checks (ex. 'a' in mypkg_config). These should make it easier for dask to migrate away from using the config dictionary that should be considered internal use only.

As far as I can tell these should work in all of the expected cases since they are just wrappers around the more complicated get method. I'm not sure if there is a cleaner looking way to do the try/except inside contains without doing self[item].

@mrocklin @jhamman

@djhoese djhoese added the enhancement New feature or request label Dec 24, 2018
@djhoese djhoese self-assigned this Dec 24, 2018
@coveralls
Copy link

coveralls commented Dec 24, 2018

Pull Request Test Coverage Report for Build 21

  • 34 of 34 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.9%) to 93.849%

Totals Coverage Status
Change from base Build 18: 0.9%
Covered Lines: 473
Relevant Lines: 504

💛 - Coveralls

@codecov
Copy link

codecov bot commented Dec 24, 2018

Codecov Report

Merging #2 into master will increase coverage by 0.85%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #2      +/-   ##
==========================================
+ Coverage   92.99%   93.84%   +0.85%     
==========================================
  Files           4        4              
  Lines         471      504      +33     
==========================================
+ Hits          438      473      +35     
+ Misses         33       31       -2
Impacted Files Coverage Δ
donfig/config_obj.py 90.94% <100%> (+1.15%) ⬆️
donfig/tests/test_config.py 98.7% <100%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e76796...8e73ddf. Read the comment docs.

@djhoese djhoese merged commit 3705f0a into pytroll:master Dec 24, 2018
@djhoese djhoese deleted the feature-contains-getitem branch December 24, 2018 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants