cpl_core.configuration package
Submodules
cpl_core.configuration.argument_abc module
- class cpl_core.configuration.argument_abc.ArgumentABC(token: str, name: str, aliases: list[str], prevent_next_executable: bool = False, console_arguments: Optional[list['ArgumentABC']] = None)
 Bases:
ABC- add_console_argument(arg_type: ArgumentTypeEnum, *args, **kwargs) ArgumentABC
 Creates and adds a console argument to known console arguments
- Parameter:
 - arg_type: 
str Specifies the specific type of the argument
- arg_type: 
 - Returns:
 self
cpl_core.configuration.console_argument.ConsoleArgumentnot created argument!
- property aliases: list[str]
 
- property console_arguments: list['ArgumentABC']
 
- property name: str
 
- property prevent_next_executable: bool
 
- property token: str
 
cpl_core.configuration.argument_builder module
- class cpl_core.configuration.argument_builder.ArgumentBuilder
 Bases:
object- static build_argument(arg_type: ArgumentTypeEnum, *args, **kwargs) Union[ExecutableArgument, FlagArgument, VariableArgument]
 
cpl_core.configuration.argument_executable_abc module
cpl_core.configuration.argument_type_enum module
cpl_core.configuration.configuration module
- class cpl_core.configuration.configuration.Configuration
 Bases:
ConfigurationABC- add_configuration(key_type: T, value: any)
 Add configuration object
- Parameter:
 - key_type: Union[
str,type] Type of the value
- value: any
 Object of the value
- key_type: Union[
 
- add_console_argument(argument: ArgumentABC)
 Adds console argument to known console arguments
- Parameter:
 - argument: 
cpl_core.configuration.console_argument.ConsoleArgumentABC Specifies the console argument
- argument: 
 
- add_environment_variables(prefix: str)
 Reads the environment variables
- Parameter:
 - 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
- Parameter:
 - 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
- Parameter:
 - 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
- token: 
 - Returns:
 Object of
cpl_core.configuration.console_argument.ConsoleArgumentABC
- property environment: ApplicationEnvironmentABC
 
- for_each_argument(call: Callable)
 Iterates through all arguments and calls the call function
- Parameter:
 - call: 
Callable Call for each argument
- call: 
 
- get_configuration(search_type: Type[T]) Optional[T]
 Returns value from configuration by given type
- Parameter:
 - search_type: Union[
str, Type[cpl_core.configuration.configuration_model_abc.ConfigurationModelABC]] Type to search for
- search_type: Union[
 - Returns:
 Object of Union[
str,cpl_core.configuration.configuration_model_abc.ConfigurationModelABC]
- parse_console_arguments(services: ServiceProviderABC, error: Optional[bool] = None) bool
 Reads the console arguments
- Parameter:
 - error: 
bool Defines is invalid argument error will be shown or not
- error: 
 - Returns:
 Bool to specify if executables were executed or not.
cpl_core.configuration.configuration_abc module
- class cpl_core.configuration.configuration_abc.ConfigurationABC
 Bases:
ABC- abstract add_configuration(key_type: T, value: any)
 Add configuration object
- Parameter:
 - key_type: Union[
str,type] Type of the value
- value: any
 Object of the value
- key_type: Union[
 
- abstract add_console_argument(argument: ArgumentABC)
 Adds console argument to known console arguments
- Parameter:
 - argument: 
cpl_core.configuration.console_argument.ConsoleArgumentABC Specifies the console argument
- argument: 
 
- abstract add_environment_variables(prefix: str)
 Reads the environment variables
- Parameter:
 - 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
- Parameter:
 - 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
- Parameter:
 - 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
- token: 
 - Returns:
 Object of
cpl_core.configuration.console_argument.ConsoleArgumentABC
- abstract property environment: ApplicationEnvironmentABC
 
- abstract for_each_argument(call: Callable)
 Iterates through all arguments and calls the call function
- Parameter:
 - call: 
Callable Call for each argument
- call: 
 
- abstract get_configuration(search_type: Type[T]) Optional[T]
 Returns value from configuration by given type
- Parameter:
 - search_type: Union[
str, Type[cpl_core.configuration.configuration_model_abc.ConfigurationModelABC]] Type to search for
- search_type: Union[
 - Returns:
 Object of Union[
str,cpl_core.configuration.configuration_model_abc.ConfigurationModelABC]
- abstract parse_console_arguments(services: ServiceProviderABC, error: bool = None) bool
 Reads the console arguments
- Parameter:
 - error: 
bool Defines is invalid argument error will be shown or not
- error: 
 - Returns:
 Bool to specify if executables were executed or not.
cpl_core.configuration.configuration_model_abc module
cpl_core.configuration.configuration_variable_name_enum module
cpl_core.configuration.executable_argument module
- class cpl_core.configuration.executable_argument.ExecutableArgument(token: str, name: str, aliases: list[str], executable: Type[ArgumentExecutableABC], prevent_next_executable: bool = False, validators: Optional[list[Type[cpl_core.configuration.validator_abc.ValidatorABC]]] = None, console_arguments: Optional[list['ArgumentABC']] = None)
 Bases:
ArgumentABC- property executable_type: type
 
- run(args: list[str])
 Executes runnable if exists
- set_executable(executable: ArgumentExecutableABC)
 
- property validators: list[Type[cpl_core.configuration.validator_abc.ValidatorABC]]
 
cpl_core.configuration.flag_argument module
- class cpl_core.configuration.flag_argument.FlagArgument(token: str, name: str, aliases: list[str], prevent_next_executable: bool = False, console_arguments: Optional[list['ArgumentABC']] = None)
 Bases:
ArgumentABC
cpl_core.configuration.validator_abc module
cpl_core.configuration.variable_argument module
- class cpl_core.configuration.variable_argument.VariableArgument(token: str, name: str, aliases: list[str], value_token: str, prevent_next_executable: bool = False, console_arguments: Optional[list['ArgumentABC']] = None)
 Bases:
ArgumentABC- set_value(value: str)
 
- property value: str
 
- property value_token: str
 
Module contents
cpl-core CPL core
CPL core package
- copyright
 2020 - 2023 sh-edraft.de
- license
 MIT, see LICENSE for more details.