Improved comments of environment
This commit is contained in:
parent
a604fca5cc
commit
d1f1627214
@ -11,7 +11,7 @@ from cpl.configuration.console_argument import ConsoleArgument
|
||||
from cpl.console.console import Console
|
||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||
from cpl.environment.application_environment import ApplicationEnvironment
|
||||
from cpl.environment.environment_abc import EnvironmentABC
|
||||
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||
from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class Configuration(ConfigurationABC):
|
||||
self._handled_args = []
|
||||
|
||||
@property
|
||||
def environment(self) -> EnvironmentABC:
|
||||
def environment(self) -> ApplicationEnvironmentABC:
|
||||
return self._hosting_environment
|
||||
|
||||
@property
|
||||
|
@ -4,7 +4,7 @@ from typing import Type, Union, Optional
|
||||
|
||||
from cpl.configuration.console_argument import ConsoleArgument
|
||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
from cpl.environment.environment_abc import EnvironmentABC
|
||||
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||
|
||||
|
||||
class ConfigurationABC(ABC):
|
||||
@ -14,7 +14,7 @@ class ConfigurationABC(ABC):
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def environment(self) -> EnvironmentABC: pass
|
||||
def environment(self) -> ApplicationEnvironmentABC: pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
|
@ -8,7 +8,7 @@ from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
from cpl.database.context.database_context_abc import DatabaseContextABC
|
||||
from cpl.dependency_injection.service_abc import ServiceABC
|
||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||
from cpl.environment.environment_abc import EnvironmentABC
|
||||
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||
|
||||
|
||||
class ServiceProvider(ServiceProviderABC):
|
||||
@ -31,7 +31,7 @@ class ServiceProvider(ServiceProviderABC):
|
||||
if issubclass(parameter.annotation, ApplicationRuntimeABC):
|
||||
params.append(self._app_runtime)
|
||||
|
||||
elif issubclass(parameter.annotation, EnvironmentABC):
|
||||
elif issubclass(parameter.annotation, ApplicationEnvironmentABC):
|
||||
params.append(self._app_runtime.configuration.environment)
|
||||
|
||||
elif issubclass(parameter.annotation, DatabaseContextABC):
|
||||
|
@ -20,7 +20,7 @@ __version__ = '2021.4.1.post1'
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
from .environment_abc import EnvironmentABC
|
||||
from .environment_abc import ApplicationEnvironmentABC
|
||||
from .environment_name_enum import EnvironmentNameEnum
|
||||
from .application_environment import ApplicationEnvironment
|
||||
|
||||
|
@ -1,14 +1,19 @@
|
||||
from socket import gethostname
|
||||
from typing import Optional
|
||||
|
||||
from cpl.environment.environment_abc import EnvironmentABC
|
||||
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||
from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
||||
|
||||
|
||||
class ApplicationEnvironment(EnvironmentABC):
|
||||
class ApplicationEnvironment(ApplicationEnvironmentABC):
|
||||
|
||||
def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'):
|
||||
EnvironmentABC.__init__(self)
|
||||
"""
|
||||
Represents environment of the application
|
||||
:param name:
|
||||
:param crp:
|
||||
"""
|
||||
ApplicationEnvironmentABC.__init__(self)
|
||||
|
||||
self._environment_name: Optional[EnvironmentNameEnum] = name
|
||||
self._app_name: Optional[str] = None
|
||||
|
@ -1,10 +1,14 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class EnvironmentABC(ABC):
|
||||
class ApplicationEnvironmentABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
def __init__(self):
|
||||
"""
|
||||
ABC of application environment
|
||||
"""
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
|
@ -2,7 +2,7 @@ import ssl
|
||||
from smtplib import SMTP
|
||||
from typing import Optional
|
||||
|
||||
from cpl.environment.environment_abc import EnvironmentABC
|
||||
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||
from cpl.logging.logger_abc import LoggerABC
|
||||
from cpl.mailing.email import EMail
|
||||
from cpl.mailing.email_client_abc import EMailClientABC
|
||||
@ -12,7 +12,7 @@ from cpl.utils.credential_manager import CredentialManager
|
||||
|
||||
class EMailClient(EMailClientABC):
|
||||
|
||||
def __init__(self, environment: EnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings):
|
||||
def __init__(self, environment: ApplicationEnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings):
|
||||
"""
|
||||
Service to send emails
|
||||
:param environment:
|
||||
|
Loading…
Reference in New Issue
Block a user