pkgcore.config.basics module¶
configuration subsystem primitives
all callables can/may throw a pkgcore.config.errors.ConfigurationError
- class pkgcore.config.basics.ConfigSection[source]¶
Bases:
object
Single Config section, returning typed values from a key.
Not much of an object this, if we were using zope.interface it’d be an Interface.
- class pkgcore.config.basics.ConfigType(func_obj: Callable)[source]¶
Bases:
object
A configurable type.
- Variables:
name – string specifying the protocol the instantiated object conforms to.
callable – callable used to instantiate this type.
types – dict mapping key names to type strings.
positional – container holding positional arguments.
required – container holding required arguments.
allow_unknowns – controls whether unknown settings should error.
- class pkgcore.config.basics.DictConfigSection(conversion_func: Callable, source_dict: dict[str, Any])[source]¶
Bases:
ConfigSection
Turns a dict and a conversion function into a ConfigSection.
- class pkgcore.config.basics.LazyNamedSectionRef(central, typename: str, name: str)[source]¶
Bases:
LazySectionRef
- class pkgcore.config.basics.LazySectionRef(central, typename: str)[source]¶
Bases:
object
Abstract base class for lazy-loaded section references.
- pkgcore.config.basics.convert_asis(central, value, arg_type: str)[source]¶
“Conversion” func assuming the types are already correct.
- pkgcore.config.basics.convert_hybrid(central, value, arg_type: str)[source]¶
Automagically switch between
convert_string
andconvert_asis
.convert_asis
is used for arg_type str and if value is not a string.convert_string
is used for the rest.Be careful about handing in escaped strings: they are not unescaped (for arg_type str).
- pkgcore.config.basics.convert_string(central, value, arg_type: str)[source]¶
Conversion func for a string-based DictConfigSection.
- pkgcore.config.basics.section_alias(target, typename: str) -> functools.partial(<class 'pkgcore.config.basics.DictConfigSection'>, <function convert_hybrid at 0x7f857d563ec0>)[source]¶
Build a ConfigSection that instantiates a named reference.
Because of central’s caching our instantiated value will be identical to our target’s.