Removed service abc

This commit is contained in:
Sven Heidemann 2021-03-29 13:29:26 +02:00
parent d0e3e1792f
commit f3be927440
10 changed files with 25 additions and 44 deletions

View File

@ -20,7 +20,6 @@ __version__ = '2021.4.2.dev1'
from collections import namedtuple
# imports:
from .service_abc import ServiceABC
from .service_collection import ServiceCollection
from .service_collection_abc import ServiceCollectionABC
from .service_descriptor import ServiceDescriptor

View File

@ -1,11 +0,0 @@
from abc import ABC, abstractmethod
class ServiceABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC to represent a service
"""
pass

View File

@ -1,8 +1,6 @@
from abc import abstractmethod, ABC
from collections import Callable
from typing import Type
from cpl.dependency_injection.service_abc import ServiceABC
from typing import Type, Optional
class ServiceProviderABC(ABC):
@ -24,7 +22,7 @@ class ServiceProviderABC(ABC):
pass
@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
:param instance_type:

View File

@ -1,16 +1,14 @@
from abc import abstractmethod
from cpl.dependency_injection.service_abc import ServiceABC
from abc import abstractmethod, ABC
class LoggerABC(ServiceABC):
class LoggerABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC for logging
"""
ServiceABC.__init__(self)
ABC.__init__(self)
@abstractmethod
def header(self, string: str):

View File

@ -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
class EMailClientABC(ServiceABC):
class EMailClientABC(ABC):
@abstractmethod
def __init__(self):
"""
ABC to send emails
"""
ServiceABC.__init__(self)
ABC.__init__(self)
@abstractmethod
def connect(self):

View File

@ -1,13 +1,11 @@
from abc import abstractmethod
from cpl.dependency_injection.service_abc import ServiceABC
from abc import abstractmethod, ABC
class CommandABC(ServiceABC):
class CommandABC(ABC):
@abstractmethod
def __init__(self):
ServiceABC.__init__(self)
ABC.__init__(self)
@abstractmethod
def run(self, args: list[str]): pass

View File

@ -1,14 +1,14 @@
import os
from abc import ABC
from cpl.configuration.configuration_abc import ConfigurationABC
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_cli.error import Error
from cpl_cli.command_model import CommandModel
class CommandHandler(ServiceABC):
class CommandHandler(ABC):
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
"""
@ -16,7 +16,7 @@ class CommandHandler(ServiceABC):
:param config:
:param services:
"""
ServiceABC.__init__(self)
ABC.__init__(self)
self._config = config
self._env = self._config.environment

View File

@ -1,5 +1,6 @@
import os
import time
from abc import ABC
from contextlib import suppress
import psutil as psutil
@ -7,13 +8,12 @@ from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from cpl.console.console import Console
from cpl.dependency_injection.service_abc import ServiceABC
from cpl.environment.application_environment_abc import ApplicationEnvironmentABC
from cpl_cli.configuration.build_settings import BuildSettings
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):
"""
@ -21,7 +21,7 @@ class LiveServerService(ServiceABC, FileSystemEventHandler):
:param env:
:param build_settings:
"""
ServiceABC.__init__(self)
ABC.__init__(self)
FileSystemEventHandler.__init__(self)
self._env = env

View File

@ -1,13 +1,11 @@
from abc import abstractmethod
from cpl.dependency_injection.service_abc import ServiceABC
from abc import abstractmethod, ABC
class PublisherABC(ServiceABC):
class PublisherABC(ABC):
@abstractmethod
def __init__(self):
ServiceABC.__init__(self)
ABC.__init__(self)
@property
@abstractmethod

View File

@ -1,11 +1,13 @@
from abc import ABC
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):
ServiceABC.__init__(self)
ABC.__init__(self)
self._provider = provider