sh_cpl/src/cpl/configuration/configuration_abc.py

51 lines
1.4 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-04 06:53:38 +01:00
from typing import Type, Union, Optional
2020-11-25 21:41:45 +01:00
2021-03-09 14:35:45 +01:00
from cpl.configuration.console_argument import ConsoleArgument
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
2021-03-04 06:53:38 +01:00
@property
@abstractmethod
def argument_error_function(self) -> Optional[Callable]: pass
@argument_error_function.setter
@abstractmethod
def argument_error_function(self, argument_error_function: Callable): pass
2021-03-09 14:35:45 +01:00
@abstractmethod
def allow_multiple_args(self): pass
2020-11-25 21:41:45 +01:00
@abstractmethod
def add_environment_variables(self, prefix: str): pass
@abstractmethod
2021-03-09 14:35:45 +01:00
def add_console_argument(self, argument: ConsoleArgument): pass
2021-03-03 18:37:39 +01:00
@abstractmethod
def add_console_arguments(self): pass
@abstractmethod
2021-03-04 19:06:16 +01:00
def add_json_file(self, name: str, optional: bool = None, output: bool = True): 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