Compare commits
No commits in common. "f9f26123567b8d528846cfb93006966fbf4a4146" and "6b8491eea2b3d8344a048f9f26697746816a2ac2" have entirely different histories.
f9f2612356
...
6b8491eea2
@ -22,7 +22,6 @@ from cpl_core.dependency_injection.service_provider_abc import ServiceProviderAB
|
|||||||
from cpl_core.environment.application_environment import ApplicationEnvironment
|
from cpl_core.environment.application_environment import ApplicationEnvironment
|
||||||
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_core.environment.environment_name_enum import EnvironmentNameEnum
|
from cpl_core.environment.environment_name_enum import EnvironmentNameEnum
|
||||||
from cpl_core.typing import T
|
|
||||||
|
|
||||||
|
|
||||||
class Configuration(ConfigurationABC):
|
class Configuration(ConfigurationABC):
|
||||||
@ -268,7 +267,7 @@ class Configuration(ConfigurationABC):
|
|||||||
configuration.from_dict(value)
|
configuration.from_dict(value)
|
||||||
self.add_configuration(sub, configuration)
|
self.add_configuration(sub, configuration)
|
||||||
|
|
||||||
def add_configuration(self, key_type: Union[str, type], value: any):
|
def add_configuration(self, key_type: Union[str, type], value: Union[str, ConfigurationModelABC]):
|
||||||
self._config[key_type] = value
|
self._config[key_type] = value
|
||||||
|
|
||||||
def create_console_argument(self, arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str],
|
def create_console_argument(self, arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str],
|
||||||
@ -281,7 +280,8 @@ class Configuration(ConfigurationABC):
|
|||||||
for arg in self._argument_types:
|
for arg in self._argument_types:
|
||||||
call(arg)
|
call(arg)
|
||||||
|
|
||||||
def get_configuration(self, search_type: Type[T]) -> Optional[T]:
|
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> \
|
||||||
|
Optional[Union[str, ConfigurationModelABC]]:
|
||||||
if type(search_type) is str:
|
if type(search_type) is str:
|
||||||
if search_type == ConfigurationVariableNameEnum.environment.value:
|
if search_type == ConfigurationVariableNameEnum.environment.value:
|
||||||
return self._application_environment.environment_name
|
return self._application_environment.environment_name
|
||||||
|
@ -6,7 +6,6 @@ from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
|||||||
from cpl_core.configuration.argument_abc import ArgumentABC
|
from cpl_core.configuration.argument_abc import ArgumentABC
|
||||||
from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum
|
from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum
|
||||||
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_core.typing import T
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationABC(ABC):
|
class ConfigurationABC(ABC):
|
||||||
@ -76,14 +75,14 @@ class ConfigurationABC(ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def add_configuration(self, key_type: Union[str, type], value: any):
|
def add_configuration(self, key_type: Union[str, type], value: Union[str, ConfigurationModelABC]):
|
||||||
r"""Add configuration object
|
r"""Add configuration object
|
||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
---------
|
---------
|
||||||
key_type: Union[:class:`str`, :class:`type`]
|
key_type: Union[:class:`str`, :class:`type`]
|
||||||
Type of the value
|
Type of the value
|
||||||
value: any
|
value: Union[:class:`str`, :class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]
|
||||||
Object of the value
|
Object of the value
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
@ -126,7 +125,8 @@ class ConfigurationABC(ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Optional[T]:
|
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[
|
||||||
|
str, ConfigurationModelABC]:
|
||||||
r"""Returns value from configuration by given type
|
r"""Returns value from configuration by given type
|
||||||
|
|
||||||
Parameter
|
Parameter
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
from typing import TypeVar
|
|
||||||
|
|
||||||
T = TypeVar('T')
|
|
Loading…
Reference in New Issue
Block a user