jbasko/configmanager

v2: ConfigValues

jbasko opened this issue · 1 comments

Further to #108:

ConfigValues:

Represents a tree of configuration values.

  • is a read-only, ordered dictionary with few extras
  • does NOT contain any meta information about the configuration items which provide these values.
  • does NOT include values for items with no values (or defaults)
  • Provides ConfigParser-like get(section1, section2, name, fallback=) method
  • user will not see any <NotSet> values or configmanager-specific exceptions raised;
    instead missing values will be just excluded and accessing values of non-existent sections or items
    will raise AttributeError or KeyError if no fallback is provided with the get access.
  • attribute-like access to any section and item: config.<section1>.<section2>,
    config.<section1>.<section2>.item.
  • sections accessed via attributes or via config_values[section1][section2] notation
    are essentially dictionaries (so can be passed as kwargs to functions) with attribute-like access
    to contents, but not much more functionality.

The only difference of the object above over a dictionary is the getter and the "read-only" feature (which of course is not truly enforced). So maybe this isn't a useful idea really.

Reverting this as this was not a great idea at all. User can always do to_dict() if they need plain dictionaries and work with that almost like with ConfigParser