Option Merge
This provides the MergedOptions
class, which allows you to treat multiple python dictionaries as one.
Usage is either from the classmethod shortcut:
options = MergedOptions.using(options1, options2)
Or with the update method:
options = MergedOptions()
options.update(options1)
options.update(options2)
This object will otherwise behave like a dictionary. Note that When options are added, copies are made.
When you delete a key, it removes it from the first dictionary it can find. This means a key can change value when deleted rather than disappearing altogether
So:
options1 = {'a':{'b':1, 'c':3}, 'b':5}
options2 = {'a':{'b':4, 'c':9}, 'd':7}
options = MergedOptions.using(options1, options2)
# options['a'] == MergedOptions(prefix='a', <same_options>, <same_overrides>)
# options['a']['b'] == 4
# options['a']['c'] == 9
# options['d'] == 7
del options['a']['c']
# options['a']['c'] == 3
- Design
- Api
- MergedOptions
- Instantiation
- Instance Methods
MergedOptions
MergedOptions.__contains__()
MergedOptions.__delitem__()
MergedOptions.__eq__()
MergedOptions.__getitem__()
MergedOptions.__iter__()
MergedOptions.__len__()
MergedOptions.__setitem__()
MergedOptions.add_converter()
MergedOptions.as_dict()
MergedOptions.get()
MergedOptions.install_converters()
MergedOptions.items()
MergedOptions.keys()
MergedOptions.source_for()
MergedOptions.update()
MergedOptions.values()
MergedOptions.wrapped()
- Storage
- Path
- Instantiation
- Instance Methods
Path
Path.__add__()
Path.__eq__()
Path.__getitem__()
Path.__hash__()
Path.__iter__()
Path.__len__()
Path.__ne__()
Path.__nonzero__()
Path.__str__()
Path.__unicode__()
Path.clone()
Path.converted()
Path.converted_val()
Path.do_conversion()
Path.endswith()
Path.find_converter()
Path.first_part_is()
Path.ignoring_converters()
Path.joined()
Path.prefixed()
Path.startswith()
Path.waiting()
Path.without()
- Formatter
- Converter
- Collector
- Hooks
Collector
Collector.BadConfigurationErrorKls
Collector.BadFileErrorKls
Collector.add_configuration()
Collector.alter_clone_args_dict()
Collector.extra_configuration_collection()
Collector.extra_prepare()
Collector.extra_prepare_after_activation()
Collector.find_missing_config()
Collector.home_dir_configuration_location()
Collector.read_file()
Collector.setup()
Collector.start_configuration()
- Usage
- Hooks
- MergedOptions