Closed pgierz closed 1 month ago
This pull request introduces a new inheritance feature to the pymorize
CLI, allowing rules to inherit global values from a new inherit
section in the configuration file. The most important changes include updates to the documentation, the addition of an inheritance configuration section, and modifications to the Rule
class to support this feature.
doc/pymorize_building_blocks.rst
: Updated the configuration file structure to include a new inherit
section and added a new "Inheritance" section to explain how rules can inherit global values. [1] [2]src/pymorize/cmorizer.py
: Added support for the inherit_cfg
parameter in the __init__
method and implemented the _post_init_inherit_rules
method to apply inherited values to rules. [1] [2] [3]src/pymorize/rule.py
: Added a set
method to the Rule
class to allow setting new attributes, with options to force overwrite and issue warnings.
This allows for inheritance of global attributes to Rule objects.
For example:
This would give a
Rule
object like so:It also ensures that an attribute specifically set on the rule will be used instead of the global setting (local version wins):
Gives: