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

Adding an option to ConfigBase.__call__ to preserve implicit values #45

Merged
merged 2 commits into from
Dec 17, 2018

Conversation

jsiirola
Copy link
Contributor

Summary/Motivation:

When using ConfigBlocks for configuring complex objects (like solvers in Pyomo), it becomes convenient to create temporary ConfigBlocks for holding transient options. We do that by calling the ConfigBlock. The catch is that if the block permits implicit keys, then we will want to preserve those implicit keys.

This PR adds a new option to __call__ to cause the copy to preserve all implicitly-defined keys.

Changes proposed in this PR:

  • add preserve_implicit option to ConfigBase.__call__()

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.004%) to 64.004% when pulling f910407 on configblock-implicit-duplication into ea05379 on master.

@codecov-io
Copy link

codecov-io commented Dec 17, 2018

Codecov Report

Merging #45 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
+ Coverage   64.92%   64.94%   +0.01%     
==========================================
  Files          87       87              
  Lines        8725     8726       +1     
==========================================
+ Hits         5665     5667       +2     
+ Misses       3060     3059       -1
Impacted Files Coverage Δ
pyutilib/misc/config.py 94.96% <100%> (ø) ⬆️
pyutilib/misc/comparison.py 88.56% <0%> (+0.36%) ⬆️

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 ea05379...f910407. Read the comment docs.

Copy link
Contributor

@blnicho blnicho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine.

@blnicho blnicho merged commit 2e25e1d into master Dec 17, 2018
@jsiirola jsiirola deleted the configblock-implicit-duplication branch December 17, 2018 19:30
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

4 participants