Config

A configuration object which basically just supports a dictionary interface, but which also can automatically filter itself so that it only provides the keywords supported by a from_config method.

config_file_name: str
config_file_extensions: list

 

__init__(self, config, serializer=None, extra_params=None): 

Loads the config from a file

  • config: str
  • serializer: None | BaseSerializer

 

find_config(config, name=None, extensions=None): 

Finds configuration file (if config isn’t a file)

  • config: Any
  • :returns: _

 

get_serializer(file): 

 

new(loc, init=None): 

 

serialize(self, file, ops): 

 

deserialize(self, file): 

 

save(self): 

 

load(self): 

 

@property
name(self): 

 

@property
opt_dict(self): 

 

filter(self, keys, strict=True): 

Returns a filtered option dictionary according to keys. Strict mode will raise an error if there is a key in the config that isn’t in keys.

  • keys: Iterable[str] | function
  • strict: bool
  • :returns: _

 

apply(self, func, strict=True): 

Applies func to stored parameters

  • func: Any
  • :returns: _

 

update(self, **kw): 

 

load_opts(self): 

 

get_conf_attr(self, item): 

 

__getattr__(self, item): 

Feedback

Examples

Templates

Documentation