config_resolver.handler package
Submodules
config_resolver.handler.base module
This module contains helpers for type hinting
-
class config_resolver.handler.base.Handler[TConfig: Any]
Bases: Generic[TConfig]
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()
Create an empty configuration instance.
- Return type:
TConfig
-
static from_filename(filename)
Create a configuration instance from a file-name.
- Return type:
TConfig
-
static from_string(data)
Create a configuration instance from a text-string
- Return type:
TConfig
-
static get_version(config)
Retrieve the parsed version number from a given config instance.
- Return type:
Version | None
-
static update_from_file(config, filename)
Updates an existing config instance from a given filename.
The config instance in data will be modified in-place!
- Return type:
None
config_resolver.handler.ini module
Handler for INI files
-
class config_resolver.handler.ini.IniHandler
Bases: Handler[ConfigParser]
A config-resolver handler capable of reading “.ini” files.
-
DEFAULT_FILENAME =
'app.ini'
The filename that is used when the user did not specify a filename when
retrieving the config instance
-
static empty()
Create an empty configuration instance.
- Return type:
ConfigParser
-
static from_filename(filename)
Create a configuration instance from a file-name.
- Return type:
ConfigParser
-
static from_string(data)
Create a configuration instance from a text-string
- Return type:
ConfigParser
-
static get_version(config)
Retrieve the parsed version number from a given config instance.
- Return type:
Version | None
-
static update_from_file(config, filename)
Updates an existing config instance from a given filename.
The config instance in data will be modified in-place!
- Return type:
None
config_resolver.handler.json module
Handler for JSON files
-
class config_resolver.handler.json.JsonHandler
Bases: Handler[Dict[str, Any]]
A config-resolver handler capable of reading “.json” files.
-
DEFAULT_FILENAME =
'app.json'
The filename that is used when the user did not specify a filename when
retrieving the config instance
-
static empty()
Create an empty configuration instance.
- Return type:
Dict[str, Any]
-
static from_filename(filename)
Create a configuration instance from a file-name.
- Return type:
Dict[str, Any]
-
static from_string(data)
Create a configuration instance from a text-string
- Return type:
Dict[str, Any]
-
static get_version(config)
Retrieve the parsed version number from a given config instance.
- Return type:
Version | None
-
static update_from_file(config, filename)
Updates an existing config instance from a given filename.
The config instance in data will be modified in-place!
- Return type:
None
Module contents
Container package for “handlers”. See Custom Handlers.