leads.config.registry#

Module Contents#

Functions#

set_on_register_config

Set the root node of the callback chain that is triggered when a configuration is registered. :param callback: the callback interface

load_config

Load a configuration from a file. :param file: the file to load from :param constructor: the constructor or an equivalent function :return: the configuration

register_config

Register a configuration. :param config: the configuration :exception RuntimeError: duplicated registration

get_config

Get the registered configuration. :return: the configuration if registered or else None

require_config

Require the registered configuration. :return: the configuration :exception RuntimeError: no configuration is registered

Data#

API#

leads.config.registry.T = '_TypeVar(...)'#
leads.config.registry._config_instance: leads.config.registry.T | None = None#
leads.config.registry._on_register_config: leads.types.OnRegister[leads.config.registry.T] = None[source]#
leads.config.registry.set_on_register_config(callback: leads.types.OnRegisterChain[leads.config.registry.T]) None[source]#

Set the root node of the callback chain that is triggered when a configuration is registered. :param callback: the callback interface

leads.config.registry.load_config(file: str | TextIO, constructor: Callable[[dict[str, leads.types.SupportedConfig]], leads.config.registry.T]) leads.config.registry.T[source]#

Load a configuration from a file. :param file: the file to load from :param constructor: the constructor or an equivalent function :return: the configuration

leads.config.registry.register_config(config: leads.config.registry.T) None[source]#

Register a configuration. :param config: the configuration :exception RuntimeError: duplicated registration

leads.config.registry.get_config() leads.config.registry.T | None[source]#

Get the registered configuration. :return: the configuration if registered or else None

leads.config.registry.require_config() leads.config.registry.T[source]#

Require the registered configuration. :return: the configuration :exception RuntimeError: no configuration is registered