From f2f797aaa38a56cf56441b3e7c081599e2d7d255 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 26 Nov 2020 10:45:02 +0100 Subject: [PATCH] Improved project structure --- .../{source_code => coding}/__init__.py | 4 ++-- .../{source_code => coding}/model/__init__.py | 4 ++-- .../{source_code => coding}/model/version.py | 4 ++-- .../model/version_enum.py | 0 src/sh_edraft/configuration/__init__.py | 1 - .../configuration/{model => base}/__init__.py | 4 ++-- .../{model => base}/configuration_base.py | 4 ++-- .../configuration_model_base.py | 0 src/sh_edraft/configuration/configuration.py | 4 ++-- .../model/application_host_base.py | 8 ------- src/sh_edraft/hosting/__init__.py | 3 +++ .../application_host.py | 8 +++---- src/sh_edraft/hosting/base/__init__.py | 2 ++ .../hosting/base/application_host_base.py | 22 +++++++++++++++++++ src/sh_edraft/hosting/model/__init__.py | 0 src/sh_edraft/logging/base/logger_base.py | 2 +- src/sh_edraft/logging/logger.py | 2 +- src/sh_edraft/logging/model/__init__.py | 4 ++-- .../logging/model/logging_settings.py | 2 +- src/sh_edraft/publishing/model/__init__.py | 4 ++-- .../model/publish_settings_model.py | 2 +- src/sh_edraft/publishing/model/template.py | 4 ++-- src/sh_edraft/service/model/__init__.py | 4 ++-- src/sh_edraft/service/service_provider.py | 5 ++--- src/sh_edraft/time/model/__init__.py | 4 ++-- .../time/model/time_format_settings.py | 2 +- src/tests/logging/logger.py | 3 +-- src/tests/publisher.py | 2 +- src/tests/publishing/publisher.py | 4 ++-- .../service_providing/service_provider.py | 3 +-- 30 files changed, 65 insertions(+), 50 deletions(-) rename src/sh_edraft/{source_code => coding}/__init__.py (87%) rename src/sh_edraft/{source_code => coding}/model/__init__.py (87%) rename src/sh_edraft/{source_code => coding}/model/version.py (87%) rename src/sh_edraft/{source_code => coding}/model/version_enum.py (100%) rename src/sh_edraft/configuration/{model => base}/__init__.py (86%) rename src/sh_edraft/configuration/{model => base}/configuration_base.py (79%) rename src/sh_edraft/configuration/{model => base}/configuration_model_base.py (100%) delete mode 100644 src/sh_edraft/configuration/model/application_host_base.py create mode 100644 src/sh_edraft/hosting/__init__.py rename src/sh_edraft/{configuration => hosting}/application_host.py (80%) create mode 100644 src/sh_edraft/hosting/base/__init__.py create mode 100644 src/sh_edraft/hosting/base/application_host_base.py create mode 100644 src/sh_edraft/hosting/model/__init__.py diff --git a/src/sh_edraft/source_code/__init__.py b/src/sh_edraft/coding/__init__.py similarity index 87% rename from src/sh_edraft/source_code/__init__.py rename to src/sh_edraft/coding/__init__.py index 1df505f4..375dc28f 100644 --- a/src/sh_edraft/source_code/__init__.py +++ b/src/sh_edraft/coding/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_edraft.source_code +sh_edraft.coding ~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ sh_edraft.source_code """ -__title__ = 'sh_edraft.source_code' +__title__ = 'sh_edraft.coding' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 sh-edraft.de' diff --git a/src/sh_edraft/source_code/model/__init__.py b/src/sh_edraft/coding/model/__init__.py similarity index 87% rename from src/sh_edraft/source_code/model/__init__.py rename to src/sh_edraft/coding/model/__init__.py index 5e7c6981..32344b00 100644 --- a/src/sh_edraft/source_code/model/__init__.py +++ b/src/sh_edraft/coding/model/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_edraft.source_code.model +sh_edraft.coding.base ~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ sh_edraft.source_code.model """ -__title__ = 'sh_edraft.source_code.model' +__title__ = 'sh_edraft.coding.base' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 sh-edraft.de' diff --git a/src/sh_edraft/source_code/model/version.py b/src/sh_edraft/coding/model/version.py similarity index 87% rename from src/sh_edraft/source_code/model/version.py rename to src/sh_edraft/coding/model/version.py index a7ba870e..26e4f9c0 100644 --- a/src/sh_edraft/source_code/model/version.py +++ b/src/sh_edraft/coding/model/version.py @@ -1,7 +1,7 @@ from typing import Optional -from sh_edraft.source_code.model.version_enum import VersionEnum -from sh_edraft.configuration.model.configuration_model_base import ConfigurationModelBase +from sh_edraft.coding.model.version_enum import VersionEnum +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase class Version(ConfigurationModelBase): diff --git a/src/sh_edraft/source_code/model/version_enum.py b/src/sh_edraft/coding/model/version_enum.py similarity index 100% rename from src/sh_edraft/source_code/model/version_enum.py rename to src/sh_edraft/coding/model/version_enum.py diff --git a/src/sh_edraft/configuration/__init__.py b/src/sh_edraft/configuration/__init__.py index 12f35645..10389a5b 100644 --- a/src/sh_edraft/configuration/__init__.py +++ b/src/sh_edraft/configuration/__init__.py @@ -20,7 +20,6 @@ __version__ = '2020.12.5' from collections import namedtuple # imports: -from .application_host import ApplicationHost VersionInfo = namedtuple('VersionInfo', 'major minor micro') version_info = VersionInfo(major=2020, minor=12, micro=5) diff --git a/src/sh_edraft/configuration/model/__init__.py b/src/sh_edraft/configuration/base/__init__.py similarity index 86% rename from src/sh_edraft/configuration/model/__init__.py rename to src/sh_edraft/configuration/base/__init__.py index e5226338..b6b73bcd 100644 --- a/src/sh_edraft/configuration/model/__init__.py +++ b/src/sh_edraft/configuration/base/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_edraft.configuration.model +sh_edraft.configuration.base ~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ sh_edraft.configuration.model """ -__title__ = 'sh_edraft.configuration.model' +__title__ = 'sh_edraft.configuration.base' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 sh-edraft.de' diff --git a/src/sh_edraft/configuration/model/configuration_base.py b/src/sh_edraft/configuration/base/configuration_base.py similarity index 79% rename from src/sh_edraft/configuration/model/configuration_base.py rename to src/sh_edraft/configuration/base/configuration_base.py index ecfc21c1..4db03091 100644 --- a/src/sh_edraft/configuration/model/configuration_base.py +++ b/src/sh_edraft/configuration/base/configuration_base.py @@ -1,7 +1,7 @@ from abc import abstractmethod from collections import Callable -from sh_edraft.configuration.model.configuration_model_base import ConfigurationModelBase +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.service.base.service_base import ServiceBase @@ -14,7 +14,7 @@ class ConfigurationBase(ServiceBase): @property @abstractmethod - def config(self): pass + def config(self) -> dict[type, object]: pass @abstractmethod def add_config_by_type(self, key_type: type, value: object): pass diff --git a/src/sh_edraft/configuration/model/configuration_model_base.py b/src/sh_edraft/configuration/base/configuration_model_base.py similarity index 100% rename from src/sh_edraft/configuration/model/configuration_model_base.py rename to src/sh_edraft/configuration/base/configuration_model_base.py diff --git a/src/sh_edraft/configuration/configuration.py b/src/sh_edraft/configuration/configuration.py index 373ab8be..67140807 100644 --- a/src/sh_edraft/configuration/configuration.py +++ b/src/sh_edraft/configuration/configuration.py @@ -1,7 +1,7 @@ from collections import Callable -from sh_edraft.configuration.model.configuration_model_base import ConfigurationModelBase -from sh_edraft.configuration.model.configuration_base import ConfigurationBase +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase +from sh_edraft.configuration.base.configuration_base import ConfigurationBase class Configuration(ConfigurationBase): diff --git a/src/sh_edraft/configuration/model/application_host_base.py b/src/sh_edraft/configuration/model/application_host_base.py deleted file mode 100644 index 8b3bc682..00000000 --- a/src/sh_edraft/configuration/model/application_host_base.py +++ /dev/null @@ -1,8 +0,0 @@ -from abc import ABC, abstractmethod -from datetime import datetime - - -class ApplicationHostBase(ABC): - - @abstractmethod - def __init__(self): pass diff --git a/src/sh_edraft/hosting/__init__.py b/src/sh_edraft/hosting/__init__.py new file mode 100644 index 00000000..ceeb2b0e --- /dev/null +++ b/src/sh_edraft/hosting/__init__.py @@ -0,0 +1,3 @@ +# imports: + +from .application_host import ApplicationHost diff --git a/src/sh_edraft/configuration/application_host.py b/src/sh_edraft/hosting/application_host.py similarity index 80% rename from src/sh_edraft/configuration/application_host.py rename to src/sh_edraft/hosting/application_host.py index 8885ff1e..f9b8fbf9 100644 --- a/src/sh_edraft/configuration/application_host.py +++ b/src/sh_edraft/hosting/application_host.py @@ -1,6 +1,6 @@ from datetime import datetime -from sh_edraft.configuration.model.application_host_base import ApplicationHostBase +from sh_edraft.hosting.base.application_host_base import ApplicationHostBase from sh_edraft.service.service_provider import ServiceProvider @@ -9,8 +9,8 @@ class ApplicationHost(ApplicationHostBase): def __init__(self): ApplicationHostBase.__init__(self) self._services = ServiceProvider() - self._end_time: datetime = datetime.now() self._start_time: datetime = datetime.now() + self._end_time: datetime = datetime.now() @property def services(self): @@ -21,7 +21,7 @@ class ApplicationHost(ApplicationHostBase): return self._end_time @end_time.setter - def end_time(self, end_time: datetime) -> None: + def end_time(self, end_time: datetime): self._end_time = end_time @property @@ -29,7 +29,7 @@ class ApplicationHost(ApplicationHostBase): return self._start_time @start_time.setter - def start_time(self, start_time: datetime) -> None: + def start_time(self, start_time: datetime): self._start_time = start_time @property diff --git a/src/sh_edraft/hosting/base/__init__.py b/src/sh_edraft/hosting/base/__init__.py new file mode 100644 index 00000000..96c21b77 --- /dev/null +++ b/src/sh_edraft/hosting/base/__init__.py @@ -0,0 +1,2 @@ +# imports: +from .application_host_base import ApplicationHostBase diff --git a/src/sh_edraft/hosting/base/application_host_base.py b/src/sh_edraft/hosting/base/application_host_base.py new file mode 100644 index 00000000..20dbd9a5 --- /dev/null +++ b/src/sh_edraft/hosting/base/application_host_base.py @@ -0,0 +1,22 @@ +from abc import ABC, abstractmethod +from datetime import datetime + + +class ApplicationHostBase(ABC): + + @abstractmethod + def __init__(self): pass + + @property + @abstractmethod + def start_time(self) -> datetime: pass + + @start_time.setter + def start_time(self, start_time: datetime): pass + + @property + @abstractmethod + def end_time(self): pass + + @end_time.setter + def end_time(self, end_time: datetime): pass diff --git a/src/sh_edraft/hosting/model/__init__.py b/src/sh_edraft/hosting/model/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/sh_edraft/logging/base/logger_base.py b/src/sh_edraft/logging/base/logger_base.py index 7c178e16..47949898 100644 --- a/src/sh_edraft/logging/base/logger_base.py +++ b/src/sh_edraft/logging/base/logger_base.py @@ -1,6 +1,6 @@ from abc import abstractmethod -from sh_edraft.configuration import ApplicationHost +from sh_edraft.hosting.application_host import ApplicationHost from sh_edraft.logging.model.logging_settings import LoggingSettings from sh_edraft.service.base.service_base import ServiceBase from sh_edraft.time.model.time_format_settings import TimeFormatSettings diff --git a/src/sh_edraft/logging/logger.py b/src/sh_edraft/logging/logger.py index 2c0e5f60..f7a0a361 100644 --- a/src/sh_edraft/logging/logger.py +++ b/src/sh_edraft/logging/logger.py @@ -4,7 +4,7 @@ import traceback from collections import Callable from string import Template -from sh_edraft.configuration import ApplicationHost +from sh_edraft.hosting.application_host import ApplicationHost from sh_edraft.logging.base.logger_base import LoggerBase from sh_edraft.logging.model import LoggingSettings from sh_edraft.logging.model.logging_level import LoggingLevel diff --git a/src/sh_edraft/logging/model/__init__.py b/src/sh_edraft/logging/model/__init__.py index 06f98905..6712752d 100644 --- a/src/sh_edraft/logging/model/__init__.py +++ b/src/sh_edraft/logging/model/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_edraft.logging.model +sh_edraft.logging.base ~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ sh_edraft.logging.model """ -__title__ = 'sh_edraft.logging.model' +__title__ = 'sh_edraft.logging.base' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 sh-edraft.de' diff --git a/src/sh_edraft/logging/model/logging_settings.py b/src/sh_edraft/logging/model/logging_settings.py index 70d23645..c5d1d77e 100644 --- a/src/sh_edraft/logging/model/logging_settings.py +++ b/src/sh_edraft/logging/model/logging_settings.py @@ -1,7 +1,7 @@ import traceback from typing import Optional -from sh_edraft.configuration.model.configuration_model_base import ConfigurationModelBase +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.logging.model.logging_settings_name import LogSettingsName from sh_edraft.utils.console import Console from sh_edraft.logging.model.logging_level import LoggingLevel diff --git a/src/sh_edraft/publishing/model/__init__.py b/src/sh_edraft/publishing/model/__init__.py index b18feff0..91e2bd18 100644 --- a/src/sh_edraft/publishing/model/__init__.py +++ b/src/sh_edraft/publishing/model/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_edraft.publishing.model +sh_edraft.publishing.base ~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ sh_edraft.publishing.model """ -__title__ = 'sh_edraft.publishing.model' +__title__ = 'sh_edraft.publishing.base' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 sh-edraft.de' diff --git a/src/sh_edraft/publishing/model/publish_settings_model.py b/src/sh_edraft/publishing/model/publish_settings_model.py index 8c2ae8ee..898d01d9 100644 --- a/src/sh_edraft/publishing/model/publish_settings_model.py +++ b/src/sh_edraft/publishing/model/publish_settings_model.py @@ -1,7 +1,7 @@ import traceback from typing import Optional -from sh_edraft.configuration.model import ConfigurationModelBase +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.publishing.model import Template from sh_edraft.publishing.model.publish_settings_name import PublishSettingsName from sh_edraft.utils import Console diff --git a/src/sh_edraft/publishing/model/template.py b/src/sh_edraft/publishing/model/template.py index 05a37f31..922a5df5 100644 --- a/src/sh_edraft/publishing/model/template.py +++ b/src/sh_edraft/publishing/model/template.py @@ -1,7 +1,7 @@ from typing import Optional -from sh_edraft.source_code.model.version import Version -from sh_edraft.configuration.model import ConfigurationModelBase +from sh_edraft.coding.model.version import Version +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.publishing.model.template_enum import TemplateEnum diff --git a/src/sh_edraft/service/model/__init__.py b/src/sh_edraft/service/model/__init__.py index 9a4effc3..96c24ada 100644 --- a/src/sh_edraft/service/model/__init__.py +++ b/src/sh_edraft/service/model/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_edraft.service.model +sh_edraft.service.base ~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ sh_edraft.service.model """ -__title__ = 'sh_edraft.service.model' +__title__ = 'sh_edraft.service.base' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 sh-edraft.de' diff --git a/src/sh_edraft/service/service_provider.py b/src/sh_edraft/service/service_provider.py index bd4c02a0..66cb567e 100644 --- a/src/sh_edraft/service/service_provider.py +++ b/src/sh_edraft/service/service_provider.py @@ -3,11 +3,10 @@ from inspect import signature, Parameter from typing import Type from sh_edraft.configuration.configuration import Configuration -from sh_edraft.configuration.model.application_host_base import ApplicationHostBase -from sh_edraft.configuration.model.configuration_model_base import ConfigurationModelBase +from sh_edraft.hosting.base.application_host_base import ApplicationHostBase +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.service.base.service_provider_base import ServiceProviderBase from sh_edraft.service.base.service_base import ServiceBase -from sh_edraft.service.model.provide_state import ProvideState class ServiceProvider(ServiceProviderBase): diff --git a/src/sh_edraft/time/model/__init__.py b/src/sh_edraft/time/model/__init__.py index e786e832..6686c3d3 100644 --- a/src/sh_edraft/time/model/__init__.py +++ b/src/sh_edraft/time/model/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_edraft.time.model +sh_edraft.time.base ~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ sh_edraft.time.model """ -__title__ = 'sh_edraft.time.model' +__title__ = 'sh_edraft.time.base' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 sh-edraft.de' diff --git a/src/sh_edraft/time/model/time_format_settings.py b/src/sh_edraft/time/model/time_format_settings.py index 9c6b33ce..f092e27b 100644 --- a/src/sh_edraft/time/model/time_format_settings.py +++ b/src/sh_edraft/time/model/time_format_settings.py @@ -1,7 +1,7 @@ import traceback from typing import Optional -from sh_edraft.configuration.model import ConfigurationModelBase +from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.time.model.time_format_settings_names import TimeFormatSettingsNames from sh_edraft.utils.console import Console diff --git a/src/tests/logging/logger.py b/src/tests/logging/logger.py index 75173742..37ea1346 100644 --- a/src/tests/logging/logger.py +++ b/src/tests/logging/logger.py @@ -4,9 +4,8 @@ import unittest from datetime import datetime from string import Template -from sh_edraft.configuration import ApplicationHost +from sh_edraft.hosting import ApplicationHost from sh_edraft.logging import Logger -from sh_edraft.logging.base import LoggerBase from sh_edraft.logging.model import LoggingSettings from sh_edraft.time.model import TimeFormatSettings diff --git a/src/tests/publisher.py b/src/tests/publisher.py index 086299ce..847d76b4 100644 --- a/src/tests/publisher.py +++ b/src/tests/publisher.py @@ -3,7 +3,7 @@ import os from sh_edraft.logging.base.logger_base import LoggerBase from sh_edraft.publishing.base import PublisherBase from sh_edraft.service.base import ServiceProviderBase -from sh_edraft.source_code.model import Version +from sh_edraft.coding.model import Version from sh_edraft.publishing import Publisher from sh_edraft.publishing.model import Template diff --git a/src/tests/publishing/publisher.py b/src/tests/publishing/publisher.py index 427fa686..ff64d0ae 100644 --- a/src/tests/publishing/publisher.py +++ b/src/tests/publishing/publisher.py @@ -2,7 +2,7 @@ import os import shutil import unittest -from sh_edraft.configuration import ApplicationHost +from sh_edraft.hosting import ApplicationHost from sh_edraft.logging import Logger from sh_edraft.logging.base import LoggerBase from sh_edraft.logging.model import LoggingSettings @@ -10,7 +10,7 @@ from sh_edraft.publishing import Publisher from sh_edraft.publishing.base import PublisherBase from sh_edraft.publishing.model import Template from sh_edraft.publishing.model.publish_settings_model import PublishSettingsModel -from sh_edraft.source_code.model import Version +from sh_edraft.coding.model import Version from sh_edraft.time.model import TimeFormatSettings diff --git a/src/tests/service_providing/service_provider.py b/src/tests/service_providing/service_provider.py index 19a39349..1c136976 100644 --- a/src/tests/service_providing/service_provider.py +++ b/src/tests/service_providing/service_provider.py @@ -1,7 +1,6 @@ import unittest -from sh_edraft.configuration import ApplicationHost -from sh_edraft.configuration.model.application_host_base import ApplicationHostBase +from sh_edraft.hosting import ApplicationHost from sh_edraft.logging import Logger from sh_edraft.logging.base import LoggerBase from sh_edraft.logging.model import LoggingSettings