Improved structure and added basics for database module
This commit is contained in:
@@ -20,7 +20,6 @@ __version__ = '2020.12.5'
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
from .service_provider import ServiceProvider
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major=2020, minor=12, micro=5)
|
||||
|
||||
@@ -21,7 +21,6 @@ from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
from .service_base import ServiceBase
|
||||
from .service_provider_base import ServiceProviderBase
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major=2020, minor=12, micro=5)
|
||||
|
||||
@@ -20,7 +20,6 @@ __version__ = '2020.12.5'
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
from .provide_state import ProvideState
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major=2020, minor=12, micro=5)
|
||||
|
||||
3
src/sh_edraft/service/providing/__init__.py
Normal file
3
src/sh_edraft/service/providing/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# imports:
|
||||
|
||||
from .service_provider import ServiceProviderBase
|
||||
3
src/sh_edraft/service/providing/base/__init__.py
Normal file
3
src/sh_edraft/service/providing/base/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# imports:
|
||||
|
||||
from .service_provider_base import ServiceProviderBase
|
||||
3
src/sh_edraft/service/providing/model/__init__.py
Normal file
3
src/sh_edraft/service/providing/model/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# imports:
|
||||
|
||||
from .provide_state import ProvideState
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Type
|
||||
|
||||
from sh_edraft.service.base import ServiceBase
|
||||
from sh_edraft.service.base.service_base import ServiceBase
|
||||
|
||||
|
||||
class ProvideState:
|
||||
@@ -4,7 +4,7 @@ from typing import Type
|
||||
|
||||
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
|
||||
from sh_edraft.hosting.base.application_runtime_base import ApplicationRuntimeBase
|
||||
from sh_edraft.service.base.service_provider_base import ServiceProviderBase
|
||||
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase
|
||||
from sh_edraft.service.base.service_base import ServiceBase
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ class ServiceProvider(ServiceProviderBase):
|
||||
|
||||
def add_singleton(self, service_type: Type[ServiceBase], service: Callable[ServiceBase]):
|
||||
for known_service in self._singleton_services:
|
||||
if type(known_service) == type(service_type):
|
||||
raise Exception(f'Service with type {type(service_type)} already exists')
|
||||
if type(known_service) == service_type:
|
||||
raise Exception(f'Service with type {service_type} already exists')
|
||||
|
||||
self._singleton_services[service_type] = self._create_instance(service)
|
||||
|
||||
Reference in New Issue
Block a user