config_resolver.handler package

Submodules

config_resolver.handler.base module

This module contains helpers for type hinting

class config_resolver.handler.base.Handler[source]

Bases: typing.Generic

A generic config file handler. Concrete classes should be created in order to support new file formats.

DEFAULT_FILENAME = 'unknown'

The filename that is used when the user did not specify a filename when retrieving the config instance

static empty() → TConfig[source]

Create an empty configuration instance.

static from_filename(filename: str) → TConfig[source]

Create a configuration instance from a file-name.

static from_string(data: str) → TConfig[source]

Create a configuration instance from a text-string

static get_version(config: TConfig) → Optional[packaging.version.Version][source]

Retrieve the parsed version number from a given config instance.

static update_from_file(config: TConfig, filename: str) → None[source]

Updates an existing config instance from a given filename.

The config instance in data will be modified in-place!

config_resolver.handler.ini module

Handler for INI files

class config_resolver.handler.ini.IniHandler[source]

Bases: config_resolver.handler.base.Handler

A config-resolver handler capable of reading “.ini” files.

DEFAULT_FILENAME = 'app.ini'
static empty() → configparser.ConfigParser[source]

Create an empty configuration instance.

static from_filename(filename: str) → configparser.ConfigParser[source]

Create a configuration instance from a file-name.

static from_string(data: str) → configparser.ConfigParser[source]

Create a configuration instance from a text-string

static get_version(config: configparser.ConfigParser) → Optional[packaging.version.Version][source]

Retrieve the parsed version number from a given config instance.

static update_from_file(config: configparser.ConfigParser, filename: str) → None[source]

Updates an existing config instance from a given filename.

The config instance in data will be modified in-place!

config_resolver.handler.json module

Handler for JSON files

class config_resolver.handler.json.JsonHandler[source]

Bases: config_resolver.handler.base.Handler

A config-resolver handler capable of reading “.json” files.

DEFAULT_FILENAME = 'app.json'
static empty() → Dict[str, Any][source]

Create an empty configuration instance.

static from_filename(filename: str) → Dict[str, Any][source]

Create a configuration instance from a file-name.

static from_string(data: str) → Dict[str, Any][source]

Create a configuration instance from a text-string

static get_version(config: Dict[str, Any]) → Optional[packaging.version.Version][source]

Retrieve the parsed version number from a given config instance.

static update_from_file(config: Dict[str, Any], filename: str) → None[source]

Updates an existing config instance from a given filename.

The config instance in data will be modified in-place!

Module contents

Container package for “handlers”. See Custom Handlers.