sh_cpl/src/cpl/configuration/configuration_abc.py

39 lines
1.1 KiB
Python
Raw Normal View History

from abc import abstractmethod, ABC
2020-11-25 21:41:45 +01:00
from collections import Callable
2021-03-03 18:37:39 +01:00
from typing import Type, Union
2020-11-25 21:41:45 +01:00
2021-03-03 10:47:52 +01:00
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.environment.environment_abc import EnvironmentABC
2020-11-25 21:41:45 +01:00
2021-03-03 10:47:52 +01:00
class ConfigurationABC(ABC):
2020-11-25 21:41:45 +01:00
@abstractmethod
def __init__(self): pass
2020-11-25 21:41:45 +01:00
@property
2020-11-25 21:41:45 +01:00
@abstractmethod
2021-03-03 10:47:52 +01:00
def environment(self) -> EnvironmentABC: pass
2020-11-25 21:41:45 +01:00
2021-03-03 18:37:39 +01:00
@property
@abstractmethod
def additional_arguments(self) -> list[str]: pass
2020-11-25 21:41:45 +01:00
@abstractmethod
def add_environment_variables(self, prefix: str): pass
@abstractmethod
2021-03-03 18:37:39 +01:00
def add_console_argument(self, token: str, name: str, aliases: list[str], value_token: str): pass
@abstractmethod
def add_console_arguments(self): pass
@abstractmethod
def add_json_file(self, name: str, optional: bool = None): pass
@abstractmethod
def add_configuration(self, key_type: type, value: object): pass
@abstractmethod
2021-03-03 18:37:39 +01:00
def get_configuration(self, search_type: Union[str, Type[ConfigurationModelABC]]) -> Union[str, Callable[ConfigurationModelABC]]: pass