def _get_base_conf(self, conf): try: base_conf = {} for key_path in self._base_key_paths: val = self._get_base_key_val(conf, key_path) set_nested_key(base_conf, key_path, val) return base_conf except KeyError as e: raise MissingBaseKeyError('Missing value for base key "{base_key}" in order to compute derived key "{derived_key}": {msg}'.format( derived_key=self.qualname, base_key=e.args[1], msg=e.args[0], )) from e
def _get_default_conf(sig, kwargs_key_map): """ Get a default configuration source based on the the default parameter values. """ default_conf = {} for param, param_desc in sig.parameters.items(): try: conf_path = kwargs_key_map[param] except KeyError: continue else: default = param_desc.default if default is not param_desc.empty: set_nested_key(default_conf, conf_path, default) return default_conf