config

Functions

jnrbase.config.read_configs(__pkg, __name='config', *, local=True)[source]

Process configuration file stack.

We export the time parsing functionality of jnrbase as custom converters for configparser.ConfigParser:

Method

Function

.getdatetime()

parse_datetime()

.gethumantime()

parse_timedelta()

.gettimedelta()

parse_delta()

Parameters
  • __pkg (str) – Package name to use as base for config files

  • __name (str) – File name to search for within config directories

  • local (bool) – Whether to include config files from current directory

Return type

ConfigParser

Returns

Parsed configuration files

Examples

>>> cfg = read_configs('jnrbase')
>>> assert cfg.colour
>>> with patch.dict('os.environ', {'NO_COLOUR': 'true'}):
...     cfg = read_configs('jnrbase')
>>> assert not cfg.colour