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

ConfigBlock: allow overriding attributes when copying #44

Closed jsiirola closed 5 years ago

jsiirola commented 5 years ago

Summary/Motivation:

This change was motivated by @jghouse88 where he was using a ConfigBlock as a template for several sections of a Config and wanted to overwrite the doc field. This PR supports the following:

template = ConfigBlock()
template.declare('a', ConfigValue( #...
    )
# ....
config = ConfigBlock()
config.declare("thing 1", template(doc="configuration for thing 1"))
config.declare("thing 2", template(doc="configuration for thing 2"))

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.02%) to 64.0% when pulling 5dfe8ad762d2314f15b51529a8f645ff2b7b1cdf on configblock_call_opts into 7657d3e56adcf959fc4c4c7b03f8878853765d43 on master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.02%) to 64.0% when pulling 5dfe8ad762d2314f15b51529a8f645ff2b7b1cdf on configblock_call_opts into 7657d3e56adcf959fc4c4c7b03f8878853765d43 on master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.02%) to 64.0% when pulling 5dfe8ad762d2314f15b51529a8f645ff2b7b1cdf on configblock_call_opts into 7657d3e56adcf959fc4c4c7b03f8878853765d43 on master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.02%) to 64.0% when pulling 5dfe8ad762d2314f15b51529a8f645ff2b7b1cdf on configblock_call_opts into 7657d3e56adcf959fc4c4c7b03f8878853765d43 on master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.02%) to 64.0% when pulling 5dfe8ad762d2314f15b51529a8f645ff2b7b1cdf on configblock_call_opts into 7657d3e56adcf959fc4c4c7b03f8878853765d43 on master.