ws.config module¶
- class ws.config.ConfigParser(configfile, **kwargs)¶
Bases:
configparser.ConfigParser
Drop-in replacement for
configparser.Configparser
.- fetch_section(section=None, to_list=True)¶
Fetches a specific section from a config file.
- static set_argparser(argparser)¶
- ws.config.argtype_bool(string)¶
- ws.config.argtype_config(string)¶
Compute config filepath and check its existence.
- ws.config.argtype_dirname_must_exist(string)¶
- ws.config.argtype_existing_dir(string)¶
- ws.config.getArgParser(**kwargs)¶
Create an instance of
argparse.ArgumentParser
and set the global arguments (e.g. for logging).- Parameters
kwargs – passed to
argparse.ArgumentParser()
constructor.- Returns
an instance of
argparse.ArgumentParser
.
- ws.config.object_from_argparser(klass, section=None, **kwargs)¶
Create an instance of
klass
using itsklass.from_argparser()
factory and an instance ofargparse.ArgumentParser
.- Parameters
klass – the class to instantiate
section (str) – passed to
parse_args()
kwargs – passed to
getArgParser()
- Returns
an instance of
klass