2021.4 #19
@ -20,7 +20,6 @@ __version__ = '2021.4.2.dev1'
|
|||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
from .service_abc import ServiceABC
|
|
||||||
from .service_collection import ServiceCollection
|
from .service_collection import ServiceCollection
|
||||||
from .service_collection_abc import ServiceCollectionABC
|
from .service_collection_abc import ServiceCollectionABC
|
||||||
from .service_descriptor import ServiceDescriptor
|
from .service_descriptor import ServiceDescriptor
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
|
|
||||||
class ServiceABC(ABC):
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
"""
|
|
||||||
ABC to represent a service
|
|
||||||
"""
|
|
||||||
pass
|
|
@ -1,8 +1,6 @@
|
|||||||
from abc import abstractmethod, ABC
|
from abc import abstractmethod, ABC
|
||||||
from collections import Callable
|
from collections import Callable
|
||||||
from typing import Type
|
from typing import Type, Optional
|
||||||
|
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
|
||||||
|
|
||||||
|
|
||||||
class ServiceProviderABC(ABC):
|
class ServiceProviderABC(ABC):
|
||||||
@ -24,7 +22,7 @@ class ServiceProviderABC(ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_service(self, instance_type: Type) -> Callable[ServiceABC]:
|
def get_service(self, instance_type: Type) -> Optional[Callable[object]]:
|
||||||
"""
|
"""
|
||||||
Returns instance of given type
|
Returns instance of given type
|
||||||
:param instance_type:
|
:param instance_type:
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod, ABC
|
||||||
|
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
|
||||||
|
|
||||||
|
|
||||||
class LoggerABC(ServiceABC):
|
class LoggerABC(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
ABC for logging
|
ABC for logging
|
||||||
"""
|
"""
|
||||||
ServiceABC.__init__(self)
|
ABC.__init__(self)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def header(self, string: str):
|
def header(self, string: str):
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod, ABC
|
||||||
|
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
|
||||||
from cpl.mailing.email import EMail
|
from cpl.mailing.email import EMail
|
||||||
|
|
||||||
|
|
||||||
class EMailClientABC(ServiceABC):
|
class EMailClientABC(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
ABC to send emails
|
ABC to send emails
|
||||||
"""
|
"""
|
||||||
ServiceABC.__init__(self)
|
ABC.__init__(self)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def connect(self):
|
def connect(self):
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod, ABC
|
||||||
|
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
|
||||||
|
|
||||||
|
|
||||||
class CommandABC(ServiceABC):
|
class CommandABC(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
ServiceABC.__init__(self)
|
ABC.__init__(self)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def run(self, args: list[str]): pass
|
def run(self, args: list[str]): pass
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import os
|
import os
|
||||||
|
from abc import ABC
|
||||||
|
|
||||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
|
||||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||||
from cpl_cli.error import Error
|
from cpl_cli.error import Error
|
||||||
from cpl_cli.command_model import CommandModel
|
from cpl_cli.command_model import CommandModel
|
||||||
|
|
||||||
|
|
||||||
class CommandHandler(ServiceABC):
|
class CommandHandler(ABC):
|
||||||
|
|
||||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||||
"""
|
"""
|
||||||
@ -16,7 +16,7 @@ class CommandHandler(ServiceABC):
|
|||||||
:param config:
|
:param config:
|
||||||
:param services:
|
:param services:
|
||||||
"""
|
"""
|
||||||
ServiceABC.__init__(self)
|
ABC.__init__(self)
|
||||||
|
|
||||||
self._config = config
|
self._config = config
|
||||||
self._env = self._config.environment
|
self._env = self._config.environment
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from abc import ABC
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
|
|
||||||
import psutil as psutil
|
import psutil as psutil
|
||||||
@ -7,13 +8,12 @@ from watchdog.events import FileSystemEventHandler
|
|||||||
from watchdog.observers import Observer
|
from watchdog.observers import Observer
|
||||||
|
|
||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
|
||||||
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl_cli.configuration.build_settings import BuildSettings
|
from cpl_cli.configuration.build_settings import BuildSettings
|
||||||
from cpl_cli.live_server.live_server_thread import LiveServerThread
|
from cpl_cli.live_server.live_server_thread import LiveServerThread
|
||||||
|
|
||||||
|
|
||||||
class LiveServerService(ServiceABC, FileSystemEventHandler):
|
class LiveServerService(ABC, FileSystemEventHandler):
|
||||||
|
|
||||||
def __init__(self, env: ApplicationEnvironmentABC, build_settings: BuildSettings):
|
def __init__(self, env: ApplicationEnvironmentABC, build_settings: BuildSettings):
|
||||||
"""
|
"""
|
||||||
@ -21,7 +21,7 @@ class LiveServerService(ServiceABC, FileSystemEventHandler):
|
|||||||
:param env:
|
:param env:
|
||||||
:param build_settings:
|
:param build_settings:
|
||||||
"""
|
"""
|
||||||
ServiceABC.__init__(self)
|
ABC.__init__(self)
|
||||||
FileSystemEventHandler.__init__(self)
|
FileSystemEventHandler.__init__(self)
|
||||||
|
|
||||||
self._env = env
|
self._env = env
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod, ABC
|
||||||
|
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
|
||||||
|
|
||||||
|
|
||||||
class PublisherABC(ServiceABC):
|
class PublisherABC(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
ServiceABC.__init__(self)
|
ABC.__init__(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
|
from abc import ABC
|
||||||
|
|
||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
from cpl.dependency_injection import ServiceABC, ServiceProviderABC
|
from cpl.dependency_injection import ServiceProviderABC
|
||||||
|
|
||||||
|
|
||||||
class TestService(ServiceABC):
|
class TestService(ABC):
|
||||||
|
|
||||||
def __init__(self, provider: ServiceProviderABC):
|
def __init__(self, provider: ServiceProviderABC):
|
||||||
ServiceABC.__init__(self)
|
ABC.__init__(self)
|
||||||
|
|
||||||
self._provider = provider
|
self._provider = provider
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user