Added docs for cpl.configuration

This commit is contained in:
2021-05-16 16:57:59 +02:00
parent 4209055d62
commit cda1fabd4f
29 changed files with 204 additions and 242 deletions

View File

@@ -11,9 +11,7 @@ class ConfigurationABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC of configuration
"""
r"""ABC for the :class:`cpl.configuration.configuration.Configuration`"""
pass
@property
@@ -34,58 +32,73 @@ class ConfigurationABC(ABC):
@abstractmethod
def add_environment_variables(self, prefix: str):
"""
Reads the environment variables
:param prefix:
:return:
r"""Reads the environment variables
Parameter
---------
prefix: :class:`str`
"""
pass
@abstractmethod
def add_console_argument(self, argument: ConsoleArgument):
"""
Adds console argument to known console arguments
:param argument:
:return:
r"""Adds console argument to known console arguments
Parameter
---------
argument: :class:`cpl.configuration.console_argument.ConsoleArgument`
"""
pass
@abstractmethod
def add_console_arguments(self, error: bool = None):
"""
Reads the console arguments
:param error: defines is invalid argument error will be shown or not
:return:
r"""Reads the console arguments
Parameter
---------
error: :class:`bool`
Defines is invalid argument error will be shown or not
"""
pass
@abstractmethod
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
"""
Reads and saves settings from given json file
:param name:
:param optional:
:param output:
:param path:
:return:
r"""Reads and saves settings from given json file
Parameter
---------
name: :class:`str`
Name of the file
optional: :class:`str`
Specifies whether an error should occur if the file was not found
output: :class:`bool`
Specifies whether an output should take place
path: :class:`str`
Path in which the file should be stored
"""
pass
@abstractmethod
def add_configuration(self, key_type: Union[str, type], value: object):
"""
Add configuration object
:param key_type:
:param value:
:return:
def add_configuration(self, key_type: Union[str, type], value: ConfigurationModelABC):
r"""Add configuration object
Parameter
---------
key_type: Union[:class:`str`, :class:`type`]
value: :class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`
"""
pass
@abstractmethod
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[str, Callable[ConfigurationModelABC]]:
"""
Returns value in configuration by given type
:param search_type:
:return:
r"""Returns value from configuration by given type
Parameter
---------
search_type: Union[:class:`str`, Type[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]]
Returns
-------
Object of Union[:class:`str`, Callable[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]]
"""
pass