weaver.config
Module Contents
- class weaver.config.WeaverConfiguration[source]
Configuration mode for which the Weaver instance should operate to provide different functionalities.
- class weaver.config.WeaverFeature[source]
Features enabled accordingly to different combinations of
WeaverConfiguration
modes.
- weaver.config.get_weaver_configuration(container: weaver.typedefs.AnySettingsContainer) str [source]
Obtains the defined operation configuration mode.
- Returns:
one value amongst
weaver.config.WEAVER_CONFIGURATIONS
.
- weaver.config.get_weaver_config_file(file_path: str | None, default_config_file: str, generate_default_from_example: bool = True) str [source]
Validates that the specified configuration file can be found, or falls back to the default one.
Handles ‘relative’ paths for settings in
WEAVER_DEFAULT_INI_CONFIG
referring to other configuration files. Default file must be one ofWEAVER_DEFAULT_CONFIGS
.If both the specified file and the default file cannot be found, default file under
WEAVER_DEFAULT_INI_CONFIG
is auto-generated from the corresponding.example
file ifgenerate_default_from_example
isTrue
. If it isFalse
, an empty string is returned instead without generation since no existing file can be guaranteed, and it is up to the caller to handle this situation as it explicitly disabled generation.- Parameters:
file_path – path to a configuration file (can be relative if resolvable or matching a default file name)
default_config_file – one of
WEAVER_DEFAULT_CONFIGS
.generate_default_from_example – enable fallback copy of default configuration file from corresponding example.
- Returns:
absolute path of the resolved file.