bloc.chem.config_access#
Shared dict-or-attribute config access helper.
STONE configs show up in two shapes across the codebase: plain nested dicts
(cfg["settings"]["get_carbon_yield"]["n_C_min"]) and attrs-style objects
with the same structure as attributes (config.settings.get_carbon_yield.n_C_min).
get_attr_or_key() probes both without the caller needing to know which
shape it was handed.
Functions#
|
Return |
|
Walk a chain of |
Module Contents#
- bloc.chem.config_access.get_attr_or_key(obj, key)#
Return
obj[key](mapping) orobj.key(attribute), elseNone.Mirrors the dual-access pattern originally local to
bloc.reporting.orchestrator._config_mechanism_names().
- bloc.chem.config_access.get_path(obj, *path)#
Walk a chain of
get_attr_or_key()lookups, short-circuiting onNone.get_path(config, "settings", "get_carbon_yield", "n_C_min")works whetherconfig(and each nested level) is a dict or an attrs-style object.