PyUtilib / pyutilib

A collection of general Python utilities, including logging and file IO, subprocess management, plugin systems, and workflow management.
BSD 3-Clause "New" or "Revised" License
34 stars 21 forks source link

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

Closed jsiirola closed 5 years ago

jsiirola commented 5 years ago

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:

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 commented 5 years ago

Coverage Status

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

codecov-io commented 5 years ago

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%> (ø) :arrow_up:
pyutilib/misc/comparison.py 88.56% <0%> (+0.36%) :arrow_up:

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.