cpl_core.configuration
cpl_core.configuration.configuration
- class cpl_core.configuration.configuration.Configuration
Bases:
ConfigurationABC
- add_configuration(key_type: Union[str, type], value: Union[str, ConfigurationModelABC])
Add configuration object
- key_type: Union[
str
,type
] Type of the value
- value: Union[
str
,cpl_core.configuration.configuration_model_abc.ConfigurationModelABC
] Object of the value
- key_type: Union[
- add_console_argument(argument: ArgumentABC)
Adds console argument to known console arguments
- argument:
cpl_core.configuration.console_argument.ConsoleArgumentABC
Specifies the console argument
- argument:
- add_environment_variables(prefix: str)
Reads the environment variables
- prefix:
str
Prefix of the variables
- prefix:
- add_json_file(name: str, optional: Optional[bool] = None, output: bool = True, path: Optional[str] = None)
Reads and saves settings from given json file
- name:
str
Name of the file
- optional:
str
Specifies whether an error should occur if the file was not found
- output:
bool
Specifies whether an output should take place
- path:
str
Path in which the file should be stored
- name:
- property additional_arguments: list[str]
- property argument_error_function: Optional[Callable]
- property arguments: list[cpl_core.configuration.argument_abc.ArgumentABC]
- create_console_argument(arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str], *args, **kwargs) ArgumentABC
Creates and adds a console argument to known console arguments
- token:
str
Specifies optional beginning of argument
- name
str
Specifies name of argument
- aliases list[
str
] Specifies possible aliases of name
- value_token
str
Specifies were the value begins
- is_value_token_optional
bool
Specifies if values are optional
- runnable:
cpl_core.configuration.console_argument.ConsoleArgumentABC
Specifies class to run when called if value is not None
Object of
cpl_core.configuration.console_argument.ConsoleArgumentABC
- token:
- property environment: ApplicationEnvironmentABC
- for_each_argument(call: Callable)
Iterates through all arguments and calls the call function
- call:
Callable
Call for each argument
- call:
- get_configuration(search_type: Union[str, Type[ConfigurationModelABC]]) Optional[Union[str, ConfigurationModelABC]]
Returns value from configuration by given type
- search_type: Union[
str
, Type[cpl_core.configuration.configuration_model_abc.ConfigurationModelABC
]] Type to search for
Object of Union[
str
,cpl_core.configuration.configuration_model_abc.ConfigurationModelABC
]- search_type: Union[
- parse_console_arguments(services: ServiceProviderABC, error: Optional[bool] = None) bool
Reads the console arguments
- error:
bool
Defines is invalid argument error will be shown or not
Bool to specify if executables were executed or not.
- error:
cpl_core.configuration.configuration_abc
- class cpl_core.configuration.configuration_abc.ConfigurationABC
Bases:
ABC
- abstract add_configuration(key_type: Union[str, type], value: Union[str, ConfigurationModelABC])
Add configuration object
- key_type: Union[
str
,type
] Type of the value
- value: Union[
str
,cpl_core.configuration.configuration_model_abc.ConfigurationModelABC
] Object of the value
- key_type: Union[
- abstract add_console_argument(argument: ArgumentABC)
Adds console argument to known console arguments
- argument:
cpl_core.configuration.console_argument.ConsoleArgumentABC
Specifies the console argument
- argument:
- abstract add_environment_variables(prefix: str)
Reads the environment variables
- prefix:
str
Prefix of the variables
- prefix:
- abstract add_json_file(name: str, optional: Optional[bool] = None, output: bool = True, path: Optional[str] = None)
Reads and saves settings from given json file
- name:
str
Name of the file
- optional:
str
Specifies whether an error should occur if the file was not found
- output:
bool
Specifies whether an output should take place
- path:
str
Path in which the file should be stored
- name:
- abstract property additional_arguments: list[str]
- abstract property argument_error_function: Optional[Callable]
- abstract property arguments: list[cpl_core.configuration.argument_abc.ArgumentABC]
- abstract create_console_argument(arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str], *args, **kwargs) ArgumentABC
Creates and adds a console argument to known console arguments
- token:
str
Specifies optional beginning of argument
- name
str
Specifies name of argument
- aliases list[
str
] Specifies possible aliases of name
- value_token
str
Specifies were the value begins
- is_value_token_optional
bool
Specifies if values are optional
- runnable:
cpl_core.configuration.console_argument.ConsoleArgumentABC
Specifies class to run when called if value is not None
Object of
cpl_core.configuration.console_argument.ConsoleArgumentABC
- token:
- abstract property environment: ApplicationEnvironmentABC
- abstract for_each_argument(call: Callable)
Iterates through all arguments and calls the call function
- call:
Callable
Call for each argument
- call:
- abstract get_configuration(search_type: Union[str, Type[ConfigurationModelABC]]) Union[str, ConfigurationModelABC]
Returns value from configuration by given type
- search_type: Union[
str
, Type[cpl_core.configuration.configuration_model_abc.ConfigurationModelABC
]] Type to search for
Object of Union[
str
,cpl_core.configuration.configuration_model_abc.ConfigurationModelABC
]- search_type: Union[
- abstract parse_console_arguments(services: ServiceProviderABC, error: bool = None) bool
Reads the console arguments
- error:
bool
Defines is invalid argument error will be shown or not
Bool to specify if executables were executed or not.
- error: