From be6838f97ba8993a3fa03bdd52e026fc47f4f2aa Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 24 Jul 2021 17:24:01 +0200 Subject: [PATCH 01/49] Added logic to handle custom scripts from workspaces --- cpl-workspace.json | 3 ++ scripts/hello_world.py | 1 + src/cpl_cli/cli.py | 9 +++++ src/cpl_cli/command/custom_script_service.py | 39 +++++++++++++++++++ src/cpl_cli/command_handler_service.py | 2 +- .../configuration/workspace_settings.py | 6 +++ .../workspace_settings_name_enum.py | 1 + src/cpl_cli/startup.py | 11 ++++++ .../custom/general/src/general/__init__.py | 0 9 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 scripts/hello_world.py create mode 100644 src/cpl_cli/command/custom_script_service.py delete mode 100644 src/tests/custom/general/src/general/__init__.py diff --git a/cpl-workspace.json b/cpl-workspace.json index 28077a0b..7f294573 100644 --- a/cpl-workspace.json +++ b/cpl-workspace.json @@ -4,6 +4,9 @@ "Projects": { "cpl": "src/cpl/cpl.json", "cpl_cli": "src/cpl_cli/cpl_cli.json" + }, + "Scripts": { + "hello-world": "python3 scripts/hello_world.py" } } } \ No newline at end of file diff --git a/scripts/hello_world.py b/scripts/hello_world.py new file mode 100644 index 00000000..d3e46f27 --- /dev/null +++ b/scripts/hello_world.py @@ -0,0 +1 @@ +print('Hello World') \ No newline at end of file diff --git a/src/cpl_cli/cli.py b/src/cpl_cli/cli.py index a4e029f7..3b121d9e 100644 --- a/src/cpl_cli/cli.py +++ b/src/cpl_cli/cli.py @@ -1,11 +1,14 @@ +import os from typing import Optional from cpl.application.application_abc import ApplicationABC +from cpl.configuration.console_argument import ConsoleArgument from cpl.configuration.configuration_abc import ConfigurationABC from cpl.console.console import Console from cpl.dependency_injection import ServiceProviderABC from cpl_cli.command.add_service import AddService from cpl_cli.command.build_service import BuildService +from cpl_cli.command.custom_script_service import CustomScriptService from cpl_cli.command.generate_service import GenerateService from cpl_cli.command.install_service import InstallService from cpl_cli.command.new_service import NewService @@ -16,6 +19,7 @@ from cpl_cli.command.uninstall_service import UninstallService from cpl_cli.command.update_service import UpdateService from cpl_cli.command_handler_service import CommandHandler from cpl_cli.command_model import CommandModel +from cpl_cli.configuration.workspace_settings import WorkspaceSettings from cpl_cli.error import Error from cpl_cli.command.help_service import HelpService from cpl_cli.command.version_service import VersionService @@ -48,6 +52,11 @@ class CLI(ApplicationABC): self._command_handler.add_command(CommandModel('update', ['u', 'U'], UpdateService, False, True, True)) self._command_handler.add_command(CommandModel('version', ['v', 'V'], VersionService, False, False, False)) + if os.path.isfile(os.path.join(self._environment.working_directory, 'cpl-workspace.json')): + workspace: Optional[WorkspaceSettings] = self._configuration.get_configuration(WorkspaceSettings) + for script in workspace.scripts: + self._command_handler.add_command(CommandModel(script, [], CustomScriptService, True, True, False)) + self._command_handler.add_command(CommandModel('--help', ['-h', '-H'], HelpService, False, False, False)) self._options.append('--help') diff --git a/src/cpl_cli/command/custom_script_service.py b/src/cpl_cli/command/custom_script_service.py new file mode 100644 index 00000000..c03f6368 --- /dev/null +++ b/src/cpl_cli/command/custom_script_service.py @@ -0,0 +1,39 @@ +import os +import subprocess +import sys + +from cpl.configuration.configuration_abc import ConfigurationABC +from cpl.console.console import Console +from cpl_cli.command_abc import CommandABC +from cpl_cli.configuration.workspace_settings import WorkspaceSettings + + +class CustomScriptService(CommandABC): + + def __init__(self, config: ConfigurationABC, ws: WorkspaceSettings): + """ + Service for CLI scripts + """ + CommandABC.__init__(self) + + self._config = config + self._workspace = ws + + @property + def help_message(self) -> str: + return '' + + def run(self, args: list[str]): + cmd = args[0] if len(args) > 0 else self._config.additional_arguments[0] + + for script in self._workspace.scripts: + if script == cmd: + command = self._workspace.scripts[script] + try: + run_command = [] + for word in command.split(' '): + run_command.append(word) + + subprocess.run(run_command) + except Exception as e: + Console.error(str(e)) diff --git a/src/cpl_cli/command_handler_service.py b/src/cpl_cli/command_handler_service.py index 852345fd..0f53df43 100644 --- a/src/cpl_cli/command_handler_service.py +++ b/src/cpl_cli/command_handler_service.py @@ -57,7 +57,7 @@ class CommandHandler(ABC): workspace: Optional[WorkspaceSettings] = None if os.path.isfile(os.path.join(self._env.working_directory, 'cpl-workspace.json')): - self._config.add_json_file('cpl-workspace.json', optional=True, output=False) + # self._config.add_json_file('cpl-workspace.json', optional=True, output=False) workspace = self._config.get_configuration(WorkspaceSettings) if command.is_project_needed: diff --git a/src/cpl_cli/configuration/workspace_settings.py b/src/cpl_cli/configuration/workspace_settings.py index ff40999a..2b358218 100644 --- a/src/cpl_cli/configuration/workspace_settings.py +++ b/src/cpl_cli/configuration/workspace_settings.py @@ -13,6 +13,7 @@ class WorkspaceSettings(ConfigurationModelABC): self._default_project: Optional[str] = None self._projects: dict[str, str] = {} + self._scripts: dict[str, str] = {} @property def default_project(self) -> str: @@ -22,10 +23,15 @@ class WorkspaceSettings(ConfigurationModelABC): def projects(self) -> dict[str, str]: return self._projects + @property + def scripts(self): + return self._scripts + def from_dict(self, settings: dict): try: self._default_project = settings[WorkspaceSettingsNameEnum.default_project.value] self._projects = settings[WorkspaceSettingsNameEnum.projects.value] + self._scripts = settings[WorkspaceSettingsNameEnum.scripts.value] except Exception as e: Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings') Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}') diff --git a/src/cpl_cli/configuration/workspace_settings_name_enum.py b/src/cpl_cli/configuration/workspace_settings_name_enum.py index 57bbdd20..7e16f65e 100644 --- a/src/cpl_cli/configuration/workspace_settings_name_enum.py +++ b/src/cpl_cli/configuration/workspace_settings_name_enum.py @@ -5,3 +5,4 @@ class WorkspaceSettingsNameEnum(Enum): default_project = 'DefaultProject' projects = 'Projects' + scripts = 'Scripts' diff --git a/src/cpl_cli/startup.py b/src/cpl_cli/startup.py index 3e0cf9c9..56a70e04 100644 --- a/src/cpl_cli/startup.py +++ b/src/cpl_cli/startup.py @@ -1,4 +1,5 @@ import os +from typing import Optional from cpl.application.startup_abc import StartupABC from cpl.configuration.console_argument import ConsoleArgument @@ -7,6 +8,7 @@ from cpl.dependency_injection.service_collection_abc import ServiceCollectionABC from cpl.dependency_injection.service_provider_abc import ServiceProviderABC from cpl_cli.command.add_service import AddService from cpl_cli.command.build_service import BuildService +from cpl_cli.command.custom_script_service import CustomScriptService from cpl_cli.command.generate_service import GenerateService from cpl_cli.command.install_service import InstallService from cpl_cli.command.new_service import NewService @@ -18,6 +20,7 @@ from cpl_cli.command.update_service import UpdateService from cpl_cli.command_handler_service import CommandHandler from cpl_cli.command.help_service import HelpService from cpl_cli.command.version_service import VersionService +from cpl_cli.configuration.workspace_settings import WorkspaceSettings from cpl_cli.error import Error from cpl_cli.live_server.live_server_service import LiveServerService from cpl_cli.publish.publisher_service import PublisherService @@ -72,6 +75,13 @@ class Startup(StartupABC): self._configuration.add_console_argument(ConsoleArgument('', '--help', ['-h', '-H'], '')) + if os.path.isfile(os.path.join(self._env.working_directory, 'cpl-workspace.json')): + self._configuration.add_json_file('cpl-workspace.json', optional=True, output=False) + workspace: Optional[WorkspaceSettings] = self._configuration.get_configuration(WorkspaceSettings) + for script in workspace.scripts: + self._configuration.add_console_argument( + ConsoleArgument('', script, [], ' ', is_value_token_optional=True)) + self._configuration.add_console_arguments(error=False) return self._configuration @@ -84,6 +94,7 @@ class Startup(StartupABC): self._services.add_transient(AddService) self._services.add_transient(BuildService) + self._services.add_transient(CustomScriptService) self._services.add_transient(GenerateService) self._services.add_transient(HelpService) self._services.add_transient(InstallService) diff --git a/src/tests/custom/general/src/general/__init__.py b/src/tests/custom/general/src/general/__init__.py deleted file mode 100644 index e69de29b..00000000 From 59f6843ea9e546fd21ff38a36a0ff006cde77f31 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 24 Jul 2021 17:25:06 +0200 Subject: [PATCH 02/49] Changed version --- src/cpl_cli/__init__.py | 4 ++-- src/cpl_cli/_templates/__init__.py | 4 ++-- src/cpl_cli/_templates/build/__init__.py | 4 ++-- src/cpl_cli/_templates/generate/__init__.py | 4 ++-- src/cpl_cli/_templates/new/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/publish/__init__.py | 4 ++-- src/cpl_cli/command/__init__.py | 4 ++-- src/cpl_cli/configuration/__init__.py | 4 ++-- src/cpl_cli/cpl_cli.json | 4 ++-- src/cpl_cli/live_server/__init__.py | 4 ++-- src/cpl_cli/publish/__init__.py | 4 ++-- src/cpl_cli/source_creator/__init__.py | 4 ++-- 20 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/cpl_cli/__init__.py b/src/cpl_cli/__init__.py index b91477ea..7af49608 100644 --- a/src/cpl_cli/__init__.py +++ b/src/cpl_cli/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple @@ -29,4 +29,4 @@ from .main import main from .startup import Startup VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/__init__.py b/src/cpl_cli/_templates/__init__.py index 930f2878..b3432fda 100644 --- a/src/cpl_cli/_templates/__init__.py +++ b/src/cpl_cli/_templates/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/build/__init__.py b/src/cpl_cli/_templates/build/__init__.py index a2b41d9b..2f641018 100644 --- a/src/cpl_cli/_templates/build/__init__.py +++ b/src/cpl_cli/_templates/build/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.build' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/generate/__init__.py b/src/cpl_cli/_templates/generate/__init__.py index a562091e..a625e275 100644 --- a/src/cpl_cli/_templates/generate/__init__.py +++ b/src/cpl_cli/_templates/generate/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.generate' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/__init__.py b/src/cpl_cli/_templates/new/__init__.py index c2f84c8e..ded8c8ed 100644 --- a/src/cpl_cli/_templates/new/__init__.py +++ b/src/cpl_cli/_templates/new/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/__init__.py b/src/cpl_cli/_templates/new/console/__init__.py index 9fcea089..2ed4ea3c 100644 --- a/src/cpl_cli/_templates/new/console/__init__.py +++ b/src/cpl_cli/_templates/new/console/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/source/__init__.py b/src/cpl_cli/_templates/new/console/source/__init__.py index 5fcfaabd..a567a195 100644 --- a/src/cpl_cli/_templates/new/console/source/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/source/name/__init__.py b/src/cpl_cli/_templates/new/console/source/name/__init__.py index 4bc87e31..8200673b 100644 --- a/src/cpl_cli/_templates/new/console/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/console/source/tests/__init__.py b/src/cpl_cli/_templates/new/console/source/tests/__init__.py index b2048068..551c83cb 100644 --- a/src/cpl_cli/_templates/new/console/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/__init__.py b/src/cpl_cli/_templates/new/library/__init__.py index d227a0c7..2c3ea082 100644 --- a/src/cpl_cli/_templates/new/library/__init__.py +++ b/src/cpl_cli/_templates/new/library/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/source/__init__.py b/src/cpl_cli/_templates/new/library/source/__init__.py index 7833280b..da92f04f 100644 --- a/src/cpl_cli/_templates/new/library/source/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/source/name/__init__.py b/src/cpl_cli/_templates/new/library/source/name/__init__.py index 9a2e1d30..f6edde16 100644 --- a/src/cpl_cli/_templates/new/library/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/new/library/source/tests/__init__.py b/src/cpl_cli/_templates/new/library/source/tests/__init__.py index 4082e9d8..509ba102 100644 --- a/src/cpl_cli/_templates/new/library/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/_templates/publish/__init__.py b/src/cpl_cli/_templates/publish/__init__.py index 1991202c..ef3ffab3 100644 --- a/src/cpl_cli/_templates/publish/__init__.py +++ b/src/cpl_cli/_templates/publish/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/command/__init__.py b/src/cpl_cli/command/__init__.py index 0fef3723..ca2ad5c7 100644 --- a/src/cpl_cli/command/__init__.py +++ b/src/cpl_cli/command/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple @@ -28,4 +28,4 @@ from .publish_service import PublishService from .version_service import VersionService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/configuration/__init__.py b/src/cpl_cli/configuration/__init__.py index 5aa3e5fe..856d8c5d 100644 --- a/src/cpl_cli/configuration/__init__.py +++ b/src/cpl_cli/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple @@ -30,4 +30,4 @@ from .workspace_settings import WorkspaceSettings from .workspace_settings_name_enum import WorkspaceSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/cpl_cli.json b/src/cpl_cli/cpl_cli.json index c8b3eab0..ace3e1c0 100644 --- a/src/cpl_cli/cpl_cli.json +++ b/src/cpl_cli/cpl_cli.json @@ -3,8 +3,8 @@ "Name": "sh_cpl-cli", "Version": { "Major": "2021", - "Minor": "4", - "Micro": "0.post3" + "Minor": "10", + "Micro": "2" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_cli/live_server/__init__.py b/src/cpl_cli/live_server/__init__.py index 31ece612..c414dac3 100644 --- a/src/cpl_cli/live_server/__init__.py +++ b/src/cpl_cli/live_server/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/publish/__init__.py b/src/cpl_cli/publish/__init__.py index fbaf36fa..b62f9083 100644 --- a/src/cpl_cli/publish/__init__.py +++ b/src/cpl_cli/publish/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple @@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC from .publisher_service import PublisherService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') diff --git a/src/cpl_cli/source_creator/__init__.py b/src/cpl_cli/source_creator/__init__.py index bea8dcea..4c8d75f1 100644 --- a/src/cpl_cli/source_creator/__init__.py +++ b/src/cpl_cli/source_creator/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.source_creator' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post3' +__version__ = '2021.10.2' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post3') +version_info = VersionInfo(major='2021', minor='10', micro='2') From 0bb272d89ba52f1f643a00554c292a589c15b975 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 25 Jul 2021 11:42:46 +0200 Subject: [PATCH 03/49] Added logic to handle pre and post scripts --- src/cpl_cli/cli.py | 4 ++++ src/cpl_cli/command_handler_service.py | 27 ++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/cpl_cli/cli.py b/src/cpl_cli/cli.py index 3b121d9e..0ffc20c3 100644 --- a/src/cpl_cli/cli.py +++ b/src/cpl_cli/cli.py @@ -109,6 +109,10 @@ class CLI(ApplicationABC): for arg in result_args: args.append(arg) + else: + Error.error(f'Unexpected command') + return + if command is None: Error.error(f'Expected command') return diff --git a/src/cpl_cli/command_handler_service.py b/src/cpl_cli/command_handler_service.py index 0f53df43..afb1e26a 100644 --- a/src/cpl_cli/command_handler_service.py +++ b/src/cpl_cli/command_handler_service.py @@ -1,4 +1,5 @@ import os +import subprocess from abc import ABC from typing import Optional @@ -6,6 +7,7 @@ from cpl.configuration.configuration_abc import ConfigurationABC from cpl.console.console import Console from cpl.dependency_injection.service_provider_abc import ServiceProviderABC from cpl.utils.string import String +from cpl_cli.command.custom_script_service import CustomScriptService from cpl_cli.configuration.workspace_settings import WorkspaceSettings from cpl_cli.error import Error from cpl_cli.command_model import CommandModel @@ -57,7 +59,6 @@ class CommandHandler(ABC): workspace: Optional[WorkspaceSettings] = None if os.path.isfile(os.path.join(self._env.working_directory, 'cpl-workspace.json')): - # self._config.add_json_file('cpl-workspace.json', optional=True, output=False) workspace = self._config.get_configuration(WorkspaceSettings) if command.is_project_needed: @@ -111,5 +112,27 @@ class CommandHandler(ABC): self._config.add_json_file(project_json, optional=True, output=False) - self._services.get_service(command.command).run(args) + # pre scripts Console.write('\n') + self._handle_pre_or_post_scripts(True, workspace, command) + self._services.get_service(command.command).run(args) + # post scripts + Console.write('\n\n') + self._handle_pre_or_post_scripts(False, workspace, command) + Console.write('\n') + + def _handle_pre_or_post_scripts(self, pre: bool, workspace: WorkspaceSettings, command: CommandModel): + script_type = 'pre-' if pre else 'post-' + if workspace is not None and len(workspace.scripts) > 0: + for script in workspace.scripts: + if script_type in script and script.split(script_type)[1] == command.name: + script_name = script + script_cmd = workspace.scripts[script] + if script_cmd in workspace.scripts: + script_name = workspace.scripts[script] + + css: CustomScriptService = self._services.get_service(CustomScriptService) + if css is None: + continue + + css.run([script_name]) From 51efe973e8fa39b1dc7f9270e1d6aaba54a42b0c Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 25 Jul 2021 12:00:12 +0200 Subject: [PATCH 04/49] Improved logic to handle pre and post scripts --- cpl-workspace.json | 1 - src/cpl_cli/command_handler_service.py | 1 - 2 files changed, 2 deletions(-) diff --git a/cpl-workspace.json b/cpl-workspace.json index 7f294573..5ac236f3 100644 --- a/cpl-workspace.json +++ b/cpl-workspace.json @@ -6,7 +6,6 @@ "cpl_cli": "src/cpl_cli/cpl_cli.json" }, "Scripts": { - "hello-world": "python3 scripts/hello_world.py" } } } \ No newline at end of file diff --git a/src/cpl_cli/command_handler_service.py b/src/cpl_cli/command_handler_service.py index afb1e26a..128e796c 100644 --- a/src/cpl_cli/command_handler_service.py +++ b/src/cpl_cli/command_handler_service.py @@ -1,5 +1,4 @@ import os -import subprocess from abc import ABC from typing import Optional From 5c80cf222235efdc1fafa9f56a35e854da8f7f7b Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 25 Jul 2021 12:24:58 +0200 Subject: [PATCH 05/49] Added CPL Query --- cpl-workspace.json | 5 ++--- src/cpl_query/__init__.py | 25 +++++++++++++++++++++ src/cpl_query/cpl_query.json | 43 ++++++++++++++++++++++++++++++++++++ src/cpl_query/main.py | 9 ++++++++ 4 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/cpl_query/__init__.py create mode 100644 src/cpl_query/cpl_query.json create mode 100644 src/cpl_query/main.py diff --git a/cpl-workspace.json b/cpl-workspace.json index 5ac236f3..73799eaa 100644 --- a/cpl-workspace.json +++ b/cpl-workspace.json @@ -3,9 +3,8 @@ "DefaultProject": "cpl_cli", "Projects": { "cpl": "src/cpl/cpl.json", - "cpl_cli": "src/cpl_cli/cpl_cli.json" - }, - "Scripts": { + "cpl_cli": "src/cpl_cli/cpl_cli.json", + "cpl_query": "src/cpl_query/cpl_query.json" } } } \ No newline at end of file diff --git a/src/cpl_query/__init__.py b/src/cpl_query/__init__.py new file mode 100644 index 00000000..bf37461c --- /dev/null +++ b/src/cpl_query/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +""" +cpl_query +~~~~~~~~~~~~~~~~~~~ + + + +:copyright: (c) +:license: + +""" + +__title__ = 'cpl_query' +__author__ = '' +__license__ = '' +__copyright__ = 'Copyright (c) ' +__version__ = '0.0.0' + +from collections import namedtuple + +# imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='0', minor='0', micro='0') diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json new file mode 100644 index 00000000..1603c0c7 --- /dev/null +++ b/src/cpl_query/cpl_query.json @@ -0,0 +1,43 @@ +{ + "ProjectSettings": { + "Name": "cpl_query", + "Version": { + "Major": "2021", + "Minor": "10", + "Micro": "3" + }, + "Author": "Sven Heidemann", + "AuthorEmail": "sven.heidemann@sh-edraft.de", + "Description": "sh-edraft Common Python library Query", + "LongDescription": "sh-edraft Common Python library Python integrated Queries", + "URL": "https://www.sh-edraft.de", + "CopyrightDate": "2020 - 2021", + "CopyrightName": "sh-edraft.de", + "LicenseName": "MIT", + "LicenseDescription": "MIT, see LICENSE for more details.", + "Dependencies": [ + "sh_cpl==2021.4.0.post1" + ], + "PythonVersion": ">=3.9.2", + "PythonPath": { + "linux": "../../cpl-env/bin/python3.9" + }, + "Classifiers": [] + }, + "BuildSettings": { + "ProjectType": "library", + "SourcePath": "", + "OutputPath": "../../dist", + "Main": "cpl_query.main", + "EntryPoint": "cpl_query", + "IncludePackageData": false, + "Included": [], + "Excluded": [ + "*/__pycache__", + "*/logs", + "*/tests" + ], + "PackageData": {}, + "ProjectReferences": [] + } +} \ No newline at end of file diff --git a/src/cpl_query/main.py b/src/cpl_query/main.py new file mode 100644 index 00000000..42e34771 --- /dev/null +++ b/src/cpl_query/main.py @@ -0,0 +1,9 @@ +from cpl.console import Console + + +def main(): + Console.write_line('Hello World') + + +if __name__ == '__main__': + main() From 4e78b9c12b059890ba1e6d644ecdae4344ee9975 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 25 Jul 2021 19:15:02 +0200 Subject: [PATCH 06/49] Added different queries & unittests --- src/cpl_query/_query/__init__.py | 0 src/cpl_query/_query/any_query.py | 7 ++ src/cpl_query/_query/first_query.py | 17 ++++ src/cpl_query/_query/for_each_query.py | 8 ++ src/cpl_query/_query/single_query.py | 21 +++++ src/cpl_query/_query/where_query.py | 13 +++ src/cpl_query/cpl_query.json | 2 +- src/cpl_query/extension/__init__.py | 0 src/cpl_query/extension/iterable_abc.py | 30 +++++++ src/cpl_query/extension/list.py | 40 +++++++++ src/cpl_query/main.py | 9 -- src/cpl_query/tests/__init__.py | 0 src/cpl_query/tests/models.py | 12 +++ src/cpl_query/tests/query_test.py | 111 ++++++++++++++++++++++++ src/cpl_query/tests/tester.py | 23 +++++ 15 files changed, 283 insertions(+), 10 deletions(-) create mode 100644 src/cpl_query/_query/__init__.py create mode 100644 src/cpl_query/_query/any_query.py create mode 100644 src/cpl_query/_query/first_query.py create mode 100644 src/cpl_query/_query/for_each_query.py create mode 100644 src/cpl_query/_query/single_query.py create mode 100644 src/cpl_query/_query/where_query.py create mode 100644 src/cpl_query/extension/__init__.py create mode 100644 src/cpl_query/extension/iterable_abc.py create mode 100644 src/cpl_query/extension/list.py delete mode 100644 src/cpl_query/main.py create mode 100644 src/cpl_query/tests/__init__.py create mode 100644 src/cpl_query/tests/models.py create mode 100644 src/cpl_query/tests/query_test.py create mode 100644 src/cpl_query/tests/tester.py diff --git a/src/cpl_query/_query/__init__.py b/src/cpl_query/_query/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/cpl_query/_query/any_query.py b/src/cpl_query/_query/any_query.py new file mode 100644 index 00000000..8ff9456e --- /dev/null +++ b/src/cpl_query/_query/any_query.py @@ -0,0 +1,7 @@ +from cpl_query._query.where_query import where_query +from cpl_query.extension.iterable_abc import IterableABC + + +def any_query(_list: IterableABC, _func: str) -> bool: + result = where_query(_list, _func) + return len(result) > 0 diff --git a/src/cpl_query/_query/first_query.py b/src/cpl_query/_query/first_query.py new file mode 100644 index 00000000..d0917117 --- /dev/null +++ b/src/cpl_query/_query/first_query.py @@ -0,0 +1,17 @@ +from typing import Optional + +from cpl_query.extension.iterable_abc import IterableABC + + +def first_query(_list: IterableABC) -> any: + if len(_list) == 0: + raise Exception('Index out of range') + + return _list[0] + + +def first_or_default_query(_list: IterableABC) -> Optional[any]: + if len(_list) == 0: + return None + + return _list[0] diff --git a/src/cpl_query/_query/for_each_query.py b/src/cpl_query/_query/for_each_query.py new file mode 100644 index 00000000..6681bd0f --- /dev/null +++ b/src/cpl_query/_query/for_each_query.py @@ -0,0 +1,8 @@ +from collections import Callable + +from cpl_query.extension.iterable_abc import IterableABC + + +def for_each_query(_list: IterableABC, func: Callable): + for element in _list: + func(element) diff --git a/src/cpl_query/_query/single_query.py b/src/cpl_query/_query/single_query.py new file mode 100644 index 00000000..8ad30cef --- /dev/null +++ b/src/cpl_query/_query/single_query.py @@ -0,0 +1,21 @@ +from typing import Optional + +from cpl_query.extension.iterable_abc import IterableABC + + +def single_query(_list: IterableABC) -> any: + if len(_list) > 1: + raise Exception('Found more than one element') + elif len(_list) == 0: + raise Exception('Found no element') + + return _list[0] + + +def single_or_default_query(_list: IterableABC) -> Optional[any]: + if len(_list) > 1: + raise Exception('Index out of range') + elif len(_list) == 0: + return None + + return _list[0] diff --git a/src/cpl_query/_query/where_query.py b/src/cpl_query/_query/where_query.py new file mode 100644 index 00000000..97e3eefc --- /dev/null +++ b/src/cpl_query/_query/where_query.py @@ -0,0 +1,13 @@ +from cpl_query.extension.iterable_abc import IterableABC + + +def where_query(_list: IterableABC, _func: str) -> IterableABC: + result = IterableABC() + for element in _list: + element_type = type(element).__name__ + if element_type in _func: + func = _func.replace(element_type, 'element') + if eval(func): + result.append(element) + + return result diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index 1603c0c7..85334a56 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -20,7 +20,7 @@ ], "PythonVersion": ">=3.9.2", "PythonPath": { - "linux": "../../cpl-env/bin/python3.9" + "linux": "../cpl-env/bin/python3.9" }, "Classifiers": [] }, diff --git a/src/cpl_query/extension/__init__.py b/src/cpl_query/extension/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py new file mode 100644 index 00000000..0aceedf1 --- /dev/null +++ b/src/cpl_query/extension/iterable_abc.py @@ -0,0 +1,30 @@ +from abc import ABC, abstractmethod +from typing import Optional, Callable + + +class IterableABC(ABC, list): + + @abstractmethod + def __init__(self): + list.__init__(self) + + @abstractmethod + def any(self, func: str) -> bool: pass + + @abstractmethod + def first(self) -> any: pass + + @abstractmethod + def first_or_default(self) -> any: pass + + @abstractmethod + def for_each(self, func: Callable): pass + + @abstractmethod + def single(self): pass + + @abstractmethod + def single_or_default(self) -> Optional[any]: pass + + @abstractmethod + def where(self, func: str) -> 'IterableABC': pass diff --git a/src/cpl_query/extension/list.py b/src/cpl_query/extension/list.py new file mode 100644 index 00000000..b8eebcf3 --- /dev/null +++ b/src/cpl_query/extension/list.py @@ -0,0 +1,40 @@ +from typing import Optional, Callable + +from .._query.any_query import any_query +from .._query.first_query import first_or_default_query, first_query +from .._query.for_each_query import for_each_query +from .._query.single_query import single_query, single_or_default_query +from .._query.where_query import where_query +from cpl_query.extension.iterable_abc import IterableABC + + +class List(IterableABC): + + def __init__(self): + IterableABC.__init__(self) + + def any(self, func: str) -> bool: + return any_query(self, func) + + def first(self) -> any: + return first_query(self) + + def first_or_default(self) -> Optional[any]: + return first_or_default_query(self) + + def for_each(self, func: Callable): + for_each_query(self, func) + + def single(self) -> any: + return single_query(self) + + def single_or_default(self) -> Optional[any]: + return single_or_default_query(self) + + def where(self, func: str) -> IterableABC: + res = where_query(self, func) + res.__class__ = List + return res + + def to_list(self) -> list: + return list(self) diff --git a/src/cpl_query/main.py b/src/cpl_query/main.py deleted file mode 100644 index 42e34771..00000000 --- a/src/cpl_query/main.py +++ /dev/null @@ -1,9 +0,0 @@ -from cpl.console import Console - - -def main(): - Console.write_line('Hello World') - - -if __name__ == '__main__': - main() diff --git a/src/cpl_query/tests/__init__.py b/src/cpl_query/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/cpl_query/tests/models.py b/src/cpl_query/tests/models.py new file mode 100644 index 00000000..d3b147dd --- /dev/null +++ b/src/cpl_query/tests/models.py @@ -0,0 +1,12 @@ +class User: + + def __init__(self, name, address): + self.name = name + self.address = address + + +class Address: + + def __init__(self, street, nr): + self.street = street + self.nr = nr \ No newline at end of file diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py new file mode 100644 index 00000000..c85c2dec --- /dev/null +++ b/src/cpl_query/tests/query_test.py @@ -0,0 +1,111 @@ +import string +import unittest +from random import randint + +from cpl.utils import String +from cpl_query.extension.list import List +from cpl_query.tests.models import User, Address + + +class QueryTest(unittest.TestCase): + + def setUp(self) -> None: + self._tests = List() + self._t_user = User( + 'Test user', + Address( + 'teststr.', + 15 + ) + ) + + self._generate_test_data() + + def _generate_test_data(self): + for i in range(0, 100): + user = User( + String.random_string(string.ascii_letters, 8), + Address( + String.random_string(string.ascii_letters, 10), + randint(0, 10) + ) + ) + + self._tests.append(user) + + self._tests.append(self._t_user) + + def test_any(self): + results = [] + for user in self._tests: + if user.address.nr == 10: + results.append(user) + + res = self._tests.any(f'User.address.nr == 10') + n_res = self._tests.any(f'User.address.nr == 100') + + self.assertTrue(res) + self.assertFalse(n_res) + + def test_first(self): + results = [] + for user in self._tests: + if user.address.nr == 10: + results.append(user) + + res = self._tests.where(f'User.address.nr == 10') + s_res = self._tests.where(f'User.address.nr == 10').first() + + self.assertEqual(len(res), len(results)) + self.assertIsNotNone(s_res) + + def test_first_or_default(self): + results = [] + for user in self._tests: + if user.address.nr == 10: + results.append(user) + + res = self._tests.where(f'User.address.nr == 10') + s_res = self._tests.where(f'User.address.nr == 10').first_or_default() + sn_res = self._tests.where(f'User.address.nr == 11').first_or_default() + + self.assertEqual(len(res), len(results)) + self.assertIsNotNone(s_res) + self.assertIsNone(sn_res) + + def test_for_each(self): + users = [] + self._tests.for_each( + lambda user: ( + # Console.write_line(f'User: {user.name} | '), + # Console.write(f'Address: {user.address.street}'), + users.append(user) + ) + ) + + self.assertEqual(len(users), len(self._tests)) + + def test_single(self): + res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}') + s_res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}').single() + + self.assertEqual(len(res), 1) + self.assertEqual(self._t_user, s_res) + + def test_single_or_default(self): + res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}') + s_res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}').single_or_default() + sn_res = self._tests.where(f'User.address.nr == {self._t_user.address.nr + 1}').single_or_default() + + self.assertEqual(len(res), 1) + self.assertEqual(self._t_user, s_res) + self.assertIsNone(sn_res) + + def test_where(self): + results = [] + for user in self._tests: + if user.address.nr == 5: + results.append(user) + + res = self._tests.where('User.address.nr == 5') + self.assertEqual(len(results), len(res)) diff --git a/src/cpl_query/tests/tester.py b/src/cpl_query/tests/tester.py new file mode 100644 index 00000000..98b10ebb --- /dev/null +++ b/src/cpl_query/tests/tester.py @@ -0,0 +1,23 @@ +import unittest + +from cpl_query.tests.query_test import QueryTest + + +class Tester: + + def __init__(self): + self._suite = unittest.TestSuite() + + def create(self): + loader = unittest.TestLoader() + self._suite.addTests(loader.loadTestsFromTestCase(QueryTest)) + + def start(self): + runner = unittest.TextTestRunner() + runner.run(self._suite) + + +if __name__ == '__main__': + tester = Tester() + tester.create() + tester.start() From cc7755bafcc689f94697c80f9c58c312ef40ac98 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 25 Jul 2021 19:18:06 +0200 Subject: [PATCH 07/49] Improved cli project builders --- cpl-workspace.json | 3 ++- src/cpl_cli/source_creator/console_builder.py | 3 ++- src/cpl_cli/source_creator/library_builder.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cpl-workspace.json b/cpl-workspace.json index 73799eaa..a8752234 100644 --- a/cpl-workspace.json +++ b/cpl-workspace.json @@ -5,6 +5,7 @@ "cpl": "src/cpl/cpl.json", "cpl_cli": "src/cpl_cli/cpl_cli.json", "cpl_query": "src/cpl_query/cpl_query.json" - } + }, + "Scripts": {} } } \ No newline at end of file diff --git a/src/cpl_cli/source_creator/console_builder.py b/src/cpl_cli/source_creator/console_builder.py index 2e321b37..a48d0d0b 100644 --- a/src/cpl_cli/source_creator/console_builder.py +++ b/src/cpl_cli/source_creator/console_builder.py @@ -43,7 +43,8 @@ class ConsoleBuilder: ws_dict = { WorkspaceSettings.__name__: { WorkspaceSettingsNameEnum.default_project.value: project_name, - WorkspaceSettingsNameEnum.projects.value: projects + WorkspaceSettingsNameEnum.projects.value: projects, + WorkspaceSettingsNameEnum.scripts: {} } } diff --git a/src/cpl_cli/source_creator/library_builder.py b/src/cpl_cli/source_creator/library_builder.py index 2f410dcb..78f18908 100644 --- a/src/cpl_cli/source_creator/library_builder.py +++ b/src/cpl_cli/source_creator/library_builder.py @@ -43,7 +43,8 @@ class LibraryBuilder: ws_dict = { WorkspaceSettings.__name__: { WorkspaceSettingsNameEnum.default_project.value: project_name, - WorkspaceSettingsNameEnum.projects.value: projects + WorkspaceSettingsNameEnum.projects.value: projects, + WorkspaceSettingsNameEnum.scripts: {} } } From 0cae3428b9b636a2dcb026356cb8bbe592727ce8 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 26 Jul 2021 15:21:57 +0200 Subject: [PATCH 08/49] Added order by functions --- src/cpl_query/_query/order_by.py | 28 ++++++++++ src/cpl_query/extension/iterable.py | 53 +++++++++++++++++++ src/cpl_query/extension/iterable_abc.py | 6 +++ src/cpl_query/extension/list.py | 42 +++------------ src/cpl_query/extension/ordered_iterable.py | 19 +++++++ .../extension/ordered_iterable_abc.py | 20 +++++++ src/cpl_query/tests/query_test.py | 42 +++++++++++++-- 7 files changed, 172 insertions(+), 38 deletions(-) create mode 100644 src/cpl_query/_query/order_by.py create mode 100644 src/cpl_query/extension/iterable.py create mode 100644 src/cpl_query/extension/ordered_iterable.py create mode 100644 src/cpl_query/extension/ordered_iterable_abc.py diff --git a/src/cpl_query/_query/order_by.py b/src/cpl_query/_query/order_by.py new file mode 100644 index 00000000..12cea7b3 --- /dev/null +++ b/src/cpl_query/_query/order_by.py @@ -0,0 +1,28 @@ +from collections import Callable + +from cpl_query.extension.iterable_abc import IterableABC +from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC + + +def order_by_query(_list: IterableABC, _func: Callable) -> OrderedIterableABC: + result = OrderedIterableABC(_func) + _list.sort(key=_func) + result.extend(_list) + return result + + +def order_by_descending_query(_list: IterableABC, _func: Callable) -> OrderedIterableABC: + result = OrderedIterableABC(_func) + _list.sort(key=_func, reverse=True) + result.extend(_list) + return result + + +def then_by_query(_list: OrderedIterableABC, _func: Callable) -> OrderedIterableABC: + _list.sort(key=_func) + return _list + + +def then_by_descending_query(_list: OrderedIterableABC, _func: Callable) -> OrderedIterableABC: + _list.sort(key=_func, reverse=True) + return _list diff --git a/src/cpl_query/extension/iterable.py b/src/cpl_query/extension/iterable.py new file mode 100644 index 00000000..50926fa6 --- /dev/null +++ b/src/cpl_query/extension/iterable.py @@ -0,0 +1,53 @@ +from typing import Optional, Callable + +from .ordered_iterable import OrderedIterable +from .ordered_iterable_abc import OrderedIterableABC +from .._query.any_query import any_query +from .._query.first_query import first_or_default_query, first_query +from .._query.for_each_query import for_each_query +from .._query.order_by import order_by_query, order_by_descending_query +from .._query.single_query import single_query, single_or_default_query +from .._query.where_query import where_query +from cpl_query.extension.iterable_abc import IterableABC + + +class Iterable(IterableABC): + + def __init__(self): + IterableABC.__init__(self) + + def any(self, func: str) -> bool: + return any_query(self, func) + + def first(self) -> any: + return first_query(self) + + def first_or_default(self) -> Optional[any]: + return first_or_default_query(self) + + def for_each(self, func: Callable): + for_each_query(self, func) + + def order_by(self, func: Callable) -> OrderedIterableABC: + res = order_by_query(self, func) + res.__class__ = OrderedIterable + return res + + def order_by_descending(self, func: Callable) -> OrderedIterableABC: + res = order_by_descending_query(self, func) + res.__class__ = OrderedIterable + return res + + def single(self) -> any: + return single_query(self) + + def single_or_default(self) -> Optional[any]: + return single_or_default_query(self) + + def where(self, func: str) -> IterableABC: + res = where_query(self, func) + res.__class__ = Iterable + return res + + def to_list(self) -> list: + return list(self) diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 0aceedf1..e4bf8f80 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -20,6 +20,12 @@ class IterableABC(ABC, list): @abstractmethod def for_each(self, func: Callable): pass + @abstractmethod + def order_by(self, func: Callable): pass + + @abstractmethod + def order_by_descending(self, func: Callable): pass + @abstractmethod def single(self): pass diff --git a/src/cpl_query/extension/list.py b/src/cpl_query/extension/list.py index b8eebcf3..b216b18f 100644 --- a/src/cpl_query/extension/list.py +++ b/src/cpl_query/extension/list.py @@ -1,40 +1,12 @@ -from typing import Optional, Callable - -from .._query.any_query import any_query -from .._query.first_query import first_or_default_query, first_query -from .._query.for_each_query import for_each_query -from .._query.single_query import single_query, single_or_default_query -from .._query.where_query import where_query -from cpl_query.extension.iterable_abc import IterableABC +from cpl_query.extension.iterable import Iterable -class List(IterableABC): +class List(Iterable): - def __init__(self): - IterableABC.__init__(self) + def __init__(self, t: type = None, values: list = None): + Iterable.__init__(self) - def any(self, func: str) -> bool: - return any_query(self, func) + self._type = t - def first(self) -> any: - return first_query(self) - - def first_or_default(self) -> Optional[any]: - return first_or_default_query(self) - - def for_each(self, func: Callable): - for_each_query(self, func) - - def single(self) -> any: - return single_query(self) - - def single_or_default(self) -> Optional[any]: - return single_or_default_query(self) - - def where(self, func: str) -> IterableABC: - res = where_query(self, func) - res.__class__ = List - return res - - def to_list(self) -> list: - return list(self) + if values is not None: + self.extend(values) diff --git a/src/cpl_query/extension/ordered_iterable.py b/src/cpl_query/extension/ordered_iterable.py new file mode 100644 index 00000000..d7c168e9 --- /dev/null +++ b/src/cpl_query/extension/ordered_iterable.py @@ -0,0 +1,19 @@ +from abc import ABC +from collections import Callable + +from .._query.order_by import then_by_query, then_by_descending_query +from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC + + +class OrderedIterable(OrderedIterableABC, ABC): + + def __init__(self): + OrderedIterableABC.__init__(self) + + def then_by(self, _func: Callable) -> OrderedIterableABC: + self._funcs.append(_func) + return then_by_query(self, lambda *args: [f(*args) for f in self._funcs]) + + def then_by_descending(self, _func: Callable) -> OrderedIterableABC: + self._funcs.append(_func) + return then_by_descending_query(self, lambda *args: [f(*args) for f in self._funcs]) diff --git a/src/cpl_query/extension/ordered_iterable_abc.py b/src/cpl_query/extension/ordered_iterable_abc.py new file mode 100644 index 00000000..f64e15bd --- /dev/null +++ b/src/cpl_query/extension/ordered_iterable_abc.py @@ -0,0 +1,20 @@ +from abc import abstractmethod +from collections import Callable + +from cpl_query.extension.iterable_abc import IterableABC + + +class OrderedIterableABC(IterableABC): + + @abstractmethod + def __init__(self, _func: Callable = None): + IterableABC.__init__(self) + self._funcs: list[Callable] = [] + if _func is not None: + self._funcs.append(_func) + + @abstractmethod + def then_by(self, func: Callable) -> 'OrderedIterableABC': pass + + @abstractmethod + def then_by_descending(self, func: Callable) -> 'OrderedIterableABC': pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index c85c2dec..4c9ca6dc 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -10,7 +10,7 @@ from cpl_query.tests.models import User, Address class QueryTest(unittest.TestCase): def setUp(self) -> None: - self._tests = List() + self._tests = List(User) self._t_user = User( 'Test user', Address( @@ -24,9 +24,9 @@ class QueryTest(unittest.TestCase): def _generate_test_data(self): for i in range(0, 100): user = User( - String.random_string(string.ascii_letters, 8), + String.random_string(string.ascii_letters, 8).lower(), Address( - String.random_string(string.ascii_letters, 10), + String.random_string(string.ascii_letters, 10).lower(), randint(0, 10) ) ) @@ -85,6 +85,42 @@ class QueryTest(unittest.TestCase): self.assertEqual(len(users), len(self._tests)) + def test_order_by(self): + res = self._tests.order_by(lambda user: user.address.street) + res2 = self._tests.order_by(lambda user: user.address.nr) + s_res = self._tests + s_res.sort(key=lambda user: user.address.street) + + self.assertEqual(res, s_res) + s_res.sort(key=lambda user: user.address.nr) + self.assertEqual(res2, s_res) + + def test_order_by_descending(self): + res = self._tests.order_by_descending(lambda user: user.address.street) + res2 = self._tests.order_by_descending(lambda user: user.address.nr) + s_res = self._tests + s_res.sort(key=lambda user: user.address.street, reverse=True) + + self.assertEqual(res, s_res) + s_res.sort(key=lambda user: user.address.nr, reverse=True) + self.assertEqual(res2, s_res) + + def test_then_by(self): + res = self._tests.order_by(lambda user: user.address.street[0]).then_by(lambda user: user.address.nr) + + s_res = self._tests + s_res.sort(key=lambda user: (user.address.street[0], user.address.nr)) + + self.assertEqual(res, s_res) + + def test_then_by_descending(self): + res = self._tests.order_by_descending(lambda user: user.address.street[0]).then_by_descending(lambda user: user.address.nr) + + s_res = self._tests + s_res.sort(key=lambda user: (user.address.street[0], user.address.nr), reverse=True) + + self.assertEqual(res, s_res) + def test_single(self): res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}') s_res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}').single() From b7be43938149f1aa8ff7ddf1e28d57a31e1bdbd8 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 26 Jul 2021 15:32:28 +0200 Subject: [PATCH 09/49] Changed func type from str to Callable --- src/cpl_query/_query/any_query.py | 4 +++- src/cpl_query/_query/where_query.py | 14 +++++++---- src/cpl_query/extension/iterable.py | 4 ++-- src/cpl_query/extension/iterable_abc.py | 4 ++-- src/cpl_query/tests/query_test.py | 32 ++++++++++++------------- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/cpl_query/_query/any_query.py b/src/cpl_query/_query/any_query.py index 8ff9456e..ff85fa98 100644 --- a/src/cpl_query/_query/any_query.py +++ b/src/cpl_query/_query/any_query.py @@ -1,7 +1,9 @@ +from collections import Callable + from cpl_query._query.where_query import where_query from cpl_query.extension.iterable_abc import IterableABC -def any_query(_list: IterableABC, _func: str) -> bool: +def any_query(_list: IterableABC, _func: Callable) -> bool: result = where_query(_list, _func) return len(result) > 0 diff --git a/src/cpl_query/_query/where_query.py b/src/cpl_query/_query/where_query.py index 97e3eefc..3c73b5b2 100644 --- a/src/cpl_query/_query/where_query.py +++ b/src/cpl_query/_query/where_query.py @@ -1,13 +1,17 @@ +from collections import Callable + from cpl_query.extension.iterable_abc import IterableABC -def where_query(_list: IterableABC, _func: str) -> IterableABC: +def where_query(_list: IterableABC, _func: Callable) -> IterableABC: result = IterableABC() for element in _list: element_type = type(element).__name__ - if element_type in _func: - func = _func.replace(element_type, 'element') - if eval(func): - result.append(element) + if _func(element): + result.append(element) + # if element_type in _func: + # func = _func.replace(element_type, 'element') + # if eval(func): + # result.append(element) return result diff --git a/src/cpl_query/extension/iterable.py b/src/cpl_query/extension/iterable.py index 50926fa6..d5844620 100644 --- a/src/cpl_query/extension/iterable.py +++ b/src/cpl_query/extension/iterable.py @@ -16,7 +16,7 @@ class Iterable(IterableABC): def __init__(self): IterableABC.__init__(self) - def any(self, func: str) -> bool: + def any(self, func: Callable) -> bool: return any_query(self, func) def first(self) -> any: @@ -44,7 +44,7 @@ class Iterable(IterableABC): def single_or_default(self) -> Optional[any]: return single_or_default_query(self) - def where(self, func: str) -> IterableABC: + def where(self, func: Callable) -> IterableABC: res = where_query(self, func) res.__class__ = Iterable return res diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index e4bf8f80..63d5d97b 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -9,7 +9,7 @@ class IterableABC(ABC, list): list.__init__(self) @abstractmethod - def any(self, func: str) -> bool: pass + def any(self, func: Callable) -> bool: pass @abstractmethod def first(self) -> any: pass @@ -33,4 +33,4 @@ class IterableABC(ABC, list): def single_or_default(self) -> Optional[any]: pass @abstractmethod - def where(self, func: str) -> 'IterableABC': pass + def where(self, func: Callable) -> 'IterableABC': pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 4c9ca6dc..2d0e8784 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -41,8 +41,8 @@ class QueryTest(unittest.TestCase): if user.address.nr == 10: results.append(user) - res = self._tests.any(f'User.address.nr == 10') - n_res = self._tests.any(f'User.address.nr == 100') + res = self._tests.any(lambda u: u.address.nr == 10) + n_res = self._tests.any(lambda u: u.address.nr == 100) self.assertTrue(res) self.assertFalse(n_res) @@ -53,8 +53,8 @@ class QueryTest(unittest.TestCase): if user.address.nr == 10: results.append(user) - res = self._tests.where(f'User.address.nr == 10') - s_res = self._tests.where(f'User.address.nr == 10').first() + res = self._tests.where(lambda u: u.address.nr == 10) + s_res = self._tests.where(lambda u: u.address.nr == 10).first() self.assertEqual(len(res), len(results)) self.assertIsNotNone(s_res) @@ -65,9 +65,9 @@ class QueryTest(unittest.TestCase): if user.address.nr == 10: results.append(user) - res = self._tests.where(f'User.address.nr == 10') - s_res = self._tests.where(f'User.address.nr == 10').first_or_default() - sn_res = self._tests.where(f'User.address.nr == 11').first_or_default() + res = self._tests.where(lambda u: u.address.nr == 10) + s_res = self._tests.where(lambda u: u.address.nr == 10).first_or_default() + sn_res = self._tests.where(lambda u: u.address.nr == 11).first_or_default() self.assertEqual(len(res), len(results)) self.assertIsNotNone(s_res) @@ -77,8 +77,6 @@ class QueryTest(unittest.TestCase): users = [] self._tests.for_each( lambda user: ( - # Console.write_line(f'User: {user.name} | '), - # Console.write(f'Address: {user.address.street}'), users.append(user) ) ) @@ -114,7 +112,8 @@ class QueryTest(unittest.TestCase): self.assertEqual(res, s_res) def test_then_by_descending(self): - res = self._tests.order_by_descending(lambda user: user.address.street[0]).then_by_descending(lambda user: user.address.nr) + res = self._tests.order_by_descending(lambda user: user.address.street[0]).then_by_descending( + lambda user: user.address.nr) s_res = self._tests s_res.sort(key=lambda user: (user.address.street[0], user.address.nr), reverse=True) @@ -122,16 +121,16 @@ class QueryTest(unittest.TestCase): self.assertEqual(res, s_res) def test_single(self): - res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}') - s_res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}').single() + res = self._tests.where(lambda u: u.address.nr == self._t_user.address.nr) + s_res = self._tests.where(lambda u: u.address.nr == self._t_user.address.nr).single() self.assertEqual(len(res), 1) self.assertEqual(self._t_user, s_res) def test_single_or_default(self): - res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}') - s_res = self._tests.where(f'User.address.nr == {self._t_user.address.nr}').single_or_default() - sn_res = self._tests.where(f'User.address.nr == {self._t_user.address.nr + 1}').single_or_default() + res = self._tests.where(lambda u: u.address.nr == self._t_user.address.nr) + s_res = self._tests.where(lambda u: u.address.nr == self._t_user.address.nr).single_or_default() + sn_res = self._tests.where(lambda u: u.address.nr == self._t_user.address.nr + 1).single_or_default() self.assertEqual(len(res), 1) self.assertEqual(self._t_user, s_res) @@ -143,5 +142,6 @@ class QueryTest(unittest.TestCase): if user.address.nr == 5: results.append(user) - res = self._tests.where('User.address.nr == 5') + res = self._tests.where(lambda u: u.address.nr == 5) + # res = self._tests.where('User.address.nr == 5') self.assertEqual(len(results), len(res)) From 94949394de58545ca50bafc20462ae39236e5aea Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 26 Jul 2021 15:48:42 +0200 Subject: [PATCH 10/49] Improved list to handle typing --- src/cpl_query/extension/list.py | 6 ++++++ src/cpl_query/tests/iterable_test.py | 28 ++++++++++++++++++++++++++++ src/cpl_query/tests/query_test.py | 1 - src/cpl_query/tests/tester.py | 2 ++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/cpl_query/tests/iterable_test.py diff --git a/src/cpl_query/extension/list.py b/src/cpl_query/extension/list.py index b216b18f..7496d43c 100644 --- a/src/cpl_query/extension/list.py +++ b/src/cpl_query/extension/list.py @@ -10,3 +10,9 @@ class List(Iterable): if values is not None: self.extend(values) + + def append(self, __object: object) -> None: + if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type): + raise Exception(f'Unexpected type: {type(__object)}') + + super().append(__object) diff --git a/src/cpl_query/tests/iterable_test.py b/src/cpl_query/tests/iterable_test.py new file mode 100644 index 00000000..9b12b28e --- /dev/null +++ b/src/cpl_query/tests/iterable_test.py @@ -0,0 +1,28 @@ +import unittest + +from cpl_query.extension.list import List + + +class IterableTest(unittest.TestCase): + + def setUp(self) -> None: + self._list = List(int) + + def _clear(self): + self._list.clear() + self.assertEqual(self._list, []) + + def test_append(self): + self._list.append(1) + self._list.append(2) + self._list.append(3) + + self.assertEqual(self._list, [1, 2, 3]) + self._clear() + + def test_append_wrong_type(self): + self._list.append(1) + self._list.append(2) + + self.assertRaises(Exception, lambda v: self._list.append(v), '3') + self._clear() diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 2d0e8784..9135c434 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -143,5 +143,4 @@ class QueryTest(unittest.TestCase): results.append(user) res = self._tests.where(lambda u: u.address.nr == 5) - # res = self._tests.where('User.address.nr == 5') self.assertEqual(len(results), len(res)) diff --git a/src/cpl_query/tests/tester.py b/src/cpl_query/tests/tester.py index 98b10ebb..084071c3 100644 --- a/src/cpl_query/tests/tester.py +++ b/src/cpl_query/tests/tester.py @@ -1,5 +1,6 @@ import unittest +from cpl_query.tests.iterable_test import IterableTest from cpl_query.tests.query_test import QueryTest @@ -11,6 +12,7 @@ class Tester: def create(self): loader = unittest.TestLoader() self._suite.addTests(loader.loadTestsFromTestCase(QueryTest)) + self._suite.addTests(loader.loadTestsFromTestCase(IterableTest)) def start(self): runner = unittest.TextTestRunner() From 8dcf3a67681c4f86aa6ffbb182b7cae85ae5f323 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 26 Jul 2021 15:52:27 +0200 Subject: [PATCH 11/49] Refactoring --- src/cpl_query/_extension/__init__.py | 0 src/cpl_query/{extension => _extension}/iterable.py | 4 ++-- src/cpl_query/{extension => _extension}/ordered_iterable.py | 0 src/cpl_query/extension/list.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/cpl_query/_extension/__init__.py rename src/cpl_query/{extension => _extension}/iterable.py (91%) rename src/cpl_query/{extension => _extension}/ordered_iterable.py (100%) diff --git a/src/cpl_query/_extension/__init__.py b/src/cpl_query/_extension/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/cpl_query/extension/iterable.py b/src/cpl_query/_extension/iterable.py similarity index 91% rename from src/cpl_query/extension/iterable.py rename to src/cpl_query/_extension/iterable.py index d5844620..690a8cd3 100644 --- a/src/cpl_query/extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -1,7 +1,7 @@ from typing import Optional, Callable -from .ordered_iterable import OrderedIterable -from .ordered_iterable_abc import OrderedIterableABC +from cpl_query._extension.ordered_iterable import OrderedIterable +from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC from .._query.any_query import any_query from .._query.first_query import first_or_default_query, first_query from .._query.for_each_query import for_each_query diff --git a/src/cpl_query/extension/ordered_iterable.py b/src/cpl_query/_extension/ordered_iterable.py similarity index 100% rename from src/cpl_query/extension/ordered_iterable.py rename to src/cpl_query/_extension/ordered_iterable.py diff --git a/src/cpl_query/extension/list.py b/src/cpl_query/extension/list.py index 7496d43c..94eeeb09 100644 --- a/src/cpl_query/extension/list.py +++ b/src/cpl_query/extension/list.py @@ -1,4 +1,4 @@ -from cpl_query.extension.iterable import Iterable +from .._extension.iterable import Iterable class List(Iterable): From a3fff9c7d7d12039414b21012733c42cc5178676 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 26 Jul 2021 15:55:08 +0200 Subject: [PATCH 12/49] Build package --- src/cpl_query/__init__.py | 18 +++++++++--------- src/cpl_query/_extension/__init__.py | 25 +++++++++++++++++++++++++ src/cpl_query/_query/__init__.py | 25 +++++++++++++++++++++++++ src/cpl_query/cpl_query.json | 4 +--- src/cpl_query/extension/__init__.py | 25 +++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 12 deletions(-) diff --git a/src/cpl_query/__init__.py b/src/cpl_query/__init__.py index bf37461c..4c2a8ace 100644 --- a/src/cpl_query/__init__.py +++ b/src/cpl_query/__init__.py @@ -1,25 +1,25 @@ # -*- coding: utf-8 -*- """ -cpl_query +cpl_query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ +sh-edraft Common Python library Python integrated Queries - -:copyright: (c) -:license: +:copyright: (c) 2020 - 2021 sh-edraft.de +:license: MIT, see LICENSE for more details. """ __title__ = 'cpl_query' -__author__ = '' -__license__ = '' -__copyright__ = 'Copyright (c) ' -__version__ = '0.0.0' +__author__ = 'Sven Heidemann' +__license__ = 'MIT' +__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' +__version__ = '2021.10.3' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='0', minor='0', micro='0') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_query/_extension/__init__.py b/src/cpl_query/_extension/__init__.py index e69de29b..be7ebebb 100644 --- a/src/cpl_query/_extension/__init__.py +++ b/src/cpl_query/_extension/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +""" +cpl_query sh-edraft Common Python library Query +~~~~~~~~~~~~~~~~~~~ + +sh-edraft Common Python library Python integrated Queries + +:copyright: (c) 2020 - 2021 sh-edraft.de +:license: MIT, see LICENSE for more details. + +""" + +__title__ = 'cpl_query._extension' +__author__ = 'Sven Heidemann' +__license__ = 'MIT' +__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' +__version__ = '2021.10.3' + +from collections import namedtuple + +# imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_query/_query/__init__.py b/src/cpl_query/_query/__init__.py index e69de29b..d9873974 100644 --- a/src/cpl_query/_query/__init__.py +++ b/src/cpl_query/_query/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +""" +cpl_query sh-edraft Common Python library Query +~~~~~~~~~~~~~~~~~~~ + +sh-edraft Common Python library Python integrated Queries + +:copyright: (c) 2020 - 2021 sh-edraft.de +:license: MIT, see LICENSE for more details. + +""" + +__title__ = 'cpl_query._query' +__author__ = 'Sven Heidemann' +__license__ = 'MIT' +__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' +__version__ = '2021.10.3' + +from collections import namedtuple + +# imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='2021', minor='10', micro='3') diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index 85334a56..c2d0a970 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -19,9 +19,7 @@ "sh_cpl==2021.4.0.post1" ], "PythonVersion": ">=3.9.2", - "PythonPath": { - "linux": "../cpl-env/bin/python3.9" - }, + "PythonPath": {}, "Classifiers": [] }, "BuildSettings": { diff --git a/src/cpl_query/extension/__init__.py b/src/cpl_query/extension/__init__.py index e69de29b..22693b99 100644 --- a/src/cpl_query/extension/__init__.py +++ b/src/cpl_query/extension/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +""" +cpl_query sh-edraft Common Python library Query +~~~~~~~~~~~~~~~~~~~ + +sh-edraft Common Python library Python integrated Queries + +:copyright: (c) 2020 - 2021 sh-edraft.de +:license: MIT, see LICENSE for more details. + +""" + +__title__ = 'cpl_query.extension' +__author__ = 'Sven Heidemann' +__license__ = 'MIT' +__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' +__version__ = '2021.10.3' + +from collections import namedtuple + +# imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='2021', minor='10', micro='3') From 0f85d4b9bce9019abe2897b646243c1ad512b33e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 09:15:19 +0200 Subject: [PATCH 13/49] Refactoring & added all query --- src/cpl_query/_extension/iterable.py | 4 ++++ src/cpl_query/_query/all_query.py | 9 +++++++++ src/cpl_query/_query/where_query.py | 5 ----- src/cpl_query/extension/iterable_abc.py | 3 +++ src/cpl_query/tests/query_test.py | 12 ++++++++++++ 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 src/cpl_query/_query/all_query.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 690a8cd3..2db2c507 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -2,6 +2,7 @@ from typing import Optional, Callable from cpl_query._extension.ordered_iterable import OrderedIterable from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC +from .._query.all_query import all_query from .._query.any_query import any_query from .._query.first_query import first_or_default_query, first_query from .._query.for_each_query import for_each_query @@ -19,6 +20,9 @@ class Iterable(IterableABC): def any(self, func: Callable) -> bool: return any_query(self, func) + def all(self, func: Callable) -> bool: + return all_query(self, func) + def first(self) -> any: return first_query(self) diff --git a/src/cpl_query/_query/all_query.py b/src/cpl_query/_query/all_query.py new file mode 100644 index 00000000..33c9e4c6 --- /dev/null +++ b/src/cpl_query/_query/all_query.py @@ -0,0 +1,9 @@ +from collections import Callable + +from cpl_query._query.where_query import where_query +from cpl_query.extension.iterable_abc import IterableABC + + +def all_query(_list: IterableABC, _func: Callable) -> bool: + result = where_query(_list, _func) + return len(result) == len(_list) diff --git a/src/cpl_query/_query/where_query.py b/src/cpl_query/_query/where_query.py index 3c73b5b2..92593fdd 100644 --- a/src/cpl_query/_query/where_query.py +++ b/src/cpl_query/_query/where_query.py @@ -6,12 +6,7 @@ from cpl_query.extension.iterable_abc import IterableABC def where_query(_list: IterableABC, _func: Callable) -> IterableABC: result = IterableABC() for element in _list: - element_type = type(element).__name__ if _func(element): result.append(element) - # if element_type in _func: - # func = _func.replace(element_type, 'element') - # if eval(func): - # result.append(element) return result diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 63d5d97b..b4ce047d 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -11,6 +11,9 @@ class IterableABC(ABC, list): @abstractmethod def any(self, func: Callable) -> bool: pass + @abstractmethod + def all(self, func: Callable) -> bool: pass + @abstractmethod def first(self) -> any: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 9135c434..5020183f 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -47,6 +47,18 @@ class QueryTest(unittest.TestCase): self.assertTrue(res) self.assertFalse(n_res) + def test_all(self): + results = [] + for user in self._tests: + if user.address.nr == 10: + results.append(user) + + res = self._tests.all(lambda u: u.address is not None) + n_res = self._tests.all(lambda u: u.address.nr == 100) + + self.assertTrue(res) + self.assertFalse(n_res) + def test_first(self): results = [] for user in self._tests: From e0b77287192c3d0f2224d2236928f8327fc18f3e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 09:26:30 +0200 Subject: [PATCH 14/49] Added avg query --- src/cpl_query/_extension/iterable.py | 6 +++++- src/cpl_query/_query/avg_query.py | 22 ++++++++++++++++++++++ src/cpl_query/exceptions.py | 6 ++++++ src/cpl_query/extension/iterable_abc.py | 5 ++++- src/cpl_query/tests/query_test.py | 23 +++++++++++++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/cpl_query/_query/avg_query.py create mode 100644 src/cpl_query/exceptions.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 2db2c507..14f681a8 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -1,9 +1,10 @@ -from typing import Optional, Callable +from typing import Optional, Callable, Union from cpl_query._extension.ordered_iterable import OrderedIterable from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC from .._query.all_query import all_query from .._query.any_query import any_query +from .._query.avg_query import avg_query from .._query.first_query import first_or_default_query, first_query from .._query.for_each_query import for_each_query from .._query.order_by import order_by_query, order_by_descending_query @@ -23,6 +24,9 @@ class Iterable(IterableABC): def all(self, func: Callable) -> bool: return all_query(self, func) + def average(self, t: type, func: Callable) -> Union[int, float, complex]: + return avg_query(self, t, func) + def first(self) -> any: return first_query(self) diff --git a/src/cpl_query/_query/avg_query.py b/src/cpl_query/_query/avg_query.py new file mode 100644 index 00000000..bd884893 --- /dev/null +++ b/src/cpl_query/_query/avg_query.py @@ -0,0 +1,22 @@ +from typing import Callable, Union + +from cpl_query.exceptions import InvalidTypeException, WrongTypeException +from cpl_query.extension.iterable_abc import IterableABC + + +def avg_query(_list: IterableABC, _t: type, _func: Callable) -> Union[int, float, complex]: + average = 0 + count = len(_list) + + if _t != int and _t != float and _t != complex: + raise InvalidTypeException() + + for element in _list: + value = _func(element) + if type(value) != _t: + raise WrongTypeException() + + average += value + + return average / count + diff --git a/src/cpl_query/exceptions.py b/src/cpl_query/exceptions.py new file mode 100644 index 00000000..1bf256e9 --- /dev/null +++ b/src/cpl_query/exceptions.py @@ -0,0 +1,6 @@ +class InvalidTypeException(Exception): + pass + + +class WrongTypeException(Exception): + pass diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index b4ce047d..85aaf734 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -1,5 +1,5 @@ from abc import ABC, abstractmethod -from typing import Optional, Callable +from typing import Optional, Callable, Union class IterableABC(ABC, list): @@ -14,6 +14,9 @@ class IterableABC(ABC, list): @abstractmethod def all(self, func: Callable) -> bool: pass + @abstractmethod + def average(self, t: type, func: Callable) -> Union[int, float, complex]: pass + @abstractmethod def first(self) -> any: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 5020183f..0af4dbaa 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -3,6 +3,7 @@ import unittest from random import randint from cpl.utils import String +from cpl_query.exceptions import InvalidTypeException, WrongTypeException from cpl_query.extension.list import List from cpl_query.tests.models import User, Address @@ -59,6 +60,28 @@ class QueryTest(unittest.TestCase): self.assertTrue(res) self.assertFalse(n_res) + def test_avg(self): + avg = 0 + for user in self._tests: + avg += user.address.nr + + avg = avg / len(self._tests) + res = self._tests.average(int, lambda u: u.address.nr) + + self.assertEqual(res, avg) + + def test_avg_invalid(self): + def _(): + res = self._tests.average(str, lambda u: u.address.nr) + + self.assertRaises(InvalidTypeException, _) + + def test_avg_wrong(self): + def _(): + res = self._tests.average(int, lambda u: u.address.street) + + self.assertRaises(WrongTypeException, _) + def test_first(self): results = [] for user in self._tests: From 5e5d86cf9486362a3928b52b6bef196456848ba4 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 09:41:51 +0200 Subject: [PATCH 15/49] Added better exceptions --- src/cpl_query/_query/all_query.py | 7 +++++++ src/cpl_query/_query/any_query.py | 7 +++++++ src/cpl_query/_query/avg_query.py | 8 +++++++- src/cpl_query/_query/first_query.py | 7 +++++++ src/cpl_query/_query/for_each_query.py | 11 +++++++++-- src/cpl_query/_query/order_by.py | 19 +++++++++++++++++++ src/cpl_query/_query/single_query.py | 7 +++++++ src/cpl_query/_query/where_query.py | 7 +++++++ src/cpl_query/exceptions.py | 17 +++++++++++++++++ src/cpl_query/tests/iterable_test.py | 7 ------- src/cpl_query/tests/query_test.py | 22 ++++++++++++---------- 11 files changed, 99 insertions(+), 20 deletions(-) diff --git a/src/cpl_query/_query/all_query.py b/src/cpl_query/_query/all_query.py index 33c9e4c6..07c40a51 100644 --- a/src/cpl_query/_query/all_query.py +++ b/src/cpl_query/_query/all_query.py @@ -1,9 +1,16 @@ from collections import Callable from cpl_query._query.where_query import where_query +from cpl_query.exceptions import ExceptionArgument, ArgumentNoneException from cpl_query.extension.iterable_abc import IterableABC def all_query(_list: IterableABC, _func: Callable) -> bool: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + result = where_query(_list, _func) return len(result) == len(_list) diff --git a/src/cpl_query/_query/any_query.py b/src/cpl_query/_query/any_query.py index ff85fa98..ede1c0d8 100644 --- a/src/cpl_query/_query/any_query.py +++ b/src/cpl_query/_query/any_query.py @@ -1,9 +1,16 @@ from collections import Callable from cpl_query._query.where_query import where_query +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument from cpl_query.extension.iterable_abc import IterableABC def any_query(_list: IterableABC, _func: Callable) -> bool: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + result = where_query(_list, _func) return len(result) > 0 diff --git a/src/cpl_query/_query/avg_query.py b/src/cpl_query/_query/avg_query.py index bd884893..6d140da8 100644 --- a/src/cpl_query/_query/avg_query.py +++ b/src/cpl_query/_query/avg_query.py @@ -1,6 +1,6 @@ from typing import Callable, Union -from cpl_query.exceptions import InvalidTypeException, WrongTypeException +from cpl_query.exceptions import InvalidTypeException, WrongTypeException, ExceptionArgument, ArgumentNoneException from cpl_query.extension.iterable_abc import IterableABC @@ -8,6 +8,12 @@ def avg_query(_list: IterableABC, _t: type, _func: Callable) -> Union[int, float average = 0 count = len(_list) + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + if _t != int and _t != float and _t != complex: raise InvalidTypeException() diff --git a/src/cpl_query/_query/first_query.py b/src/cpl_query/_query/first_query.py index d0917117..6f3859ae 100644 --- a/src/cpl_query/_query/first_query.py +++ b/src/cpl_query/_query/first_query.py @@ -1,9 +1,13 @@ from typing import Optional +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument from cpl_query.extension.iterable_abc import IterableABC def first_query(_list: IterableABC) -> any: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + if len(_list) == 0: raise Exception('Index out of range') @@ -11,6 +15,9 @@ def first_query(_list: IterableABC) -> any: def first_or_default_query(_list: IterableABC) -> Optional[any]: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + if len(_list) == 0: return None diff --git a/src/cpl_query/_query/for_each_query.py b/src/cpl_query/_query/for_each_query.py index 6681bd0f..62411c4d 100644 --- a/src/cpl_query/_query/for_each_query.py +++ b/src/cpl_query/_query/for_each_query.py @@ -1,8 +1,15 @@ from collections import Callable +from cpl_query.exceptions import ExceptionArgument, ArgumentNoneException from cpl_query.extension.iterable_abc import IterableABC -def for_each_query(_list: IterableABC, func: Callable): +def for_each_query(_list: IterableABC, _func: Callable): + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + for element in _list: - func(element) + _func(element) diff --git a/src/cpl_query/_query/order_by.py b/src/cpl_query/_query/order_by.py index 12cea7b3..2012486c 100644 --- a/src/cpl_query/_query/order_by.py +++ b/src/cpl_query/_query/order_by.py @@ -1,5 +1,6 @@ from collections import Callable +from cpl_query.exceptions import ExceptionArgument, ArgumentNoneException from cpl_query.extension.iterable_abc import IterableABC from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC @@ -12,6 +13,12 @@ def order_by_query(_list: IterableABC, _func: Callable) -> OrderedIterableABC: def order_by_descending_query(_list: IterableABC, _func: Callable) -> OrderedIterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + result = OrderedIterableABC(_func) _list.sort(key=_func, reverse=True) result.extend(_list) @@ -19,10 +26,22 @@ def order_by_descending_query(_list: IterableABC, _func: Callable) -> OrderedIte def then_by_query(_list: OrderedIterableABC, _func: Callable) -> OrderedIterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + _list.sort(key=_func) return _list def then_by_descending_query(_list: OrderedIterableABC, _func: Callable) -> OrderedIterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + _list.sort(key=_func, reverse=True) return _list diff --git a/src/cpl_query/_query/single_query.py b/src/cpl_query/_query/single_query.py index 8ad30cef..7112a2c8 100644 --- a/src/cpl_query/_query/single_query.py +++ b/src/cpl_query/_query/single_query.py @@ -1,9 +1,13 @@ from typing import Optional +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument from cpl_query.extension.iterable_abc import IterableABC def single_query(_list: IterableABC) -> any: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + if len(_list) > 1: raise Exception('Found more than one element') elif len(_list) == 0: @@ -13,6 +17,9 @@ def single_query(_list: IterableABC) -> any: def single_or_default_query(_list: IterableABC) -> Optional[any]: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + if len(_list) > 1: raise Exception('Index out of range') elif len(_list) == 0: diff --git a/src/cpl_query/_query/where_query.py b/src/cpl_query/_query/where_query.py index 92593fdd..94d555fe 100644 --- a/src/cpl_query/_query/where_query.py +++ b/src/cpl_query/_query/where_query.py @@ -1,9 +1,16 @@ from collections import Callable +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument from cpl_query.extension.iterable_abc import IterableABC def where_query(_list: IterableABC, _func: Callable) -> IterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + result = IterableABC() for element in _list: if _func(element): diff --git a/src/cpl_query/exceptions.py b/src/cpl_query/exceptions.py index 1bf256e9..b0a320ea 100644 --- a/src/cpl_query/exceptions.py +++ b/src/cpl_query/exceptions.py @@ -1,3 +1,20 @@ +from enum import Enum + + +# models +class ExceptionArgument(Enum): + list = 'list' + func = 'func' + type = 'type' + + +# exceptions +class ArgumentNoneException(Exception): + + def __init__(self, arg: ExceptionArgument): + Exception.__init__(self, f'Argument {arg} is None') + + class InvalidTypeException(Exception): pass diff --git a/src/cpl_query/tests/iterable_test.py b/src/cpl_query/tests/iterable_test.py index 9b12b28e..a8936a88 100644 --- a/src/cpl_query/tests/iterable_test.py +++ b/src/cpl_query/tests/iterable_test.py @@ -18,11 +18,4 @@ class IterableTest(unittest.TestCase): self._list.append(3) self.assertEqual(self._list, [1, 2, 3]) - self._clear() - - def test_append_wrong_type(self): - self._list.append(1) - self._list.append(2) - self.assertRaises(Exception, lambda v: self._list.append(v), '3') - self._clear() diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 0af4dbaa..d26f2f88 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -3,7 +3,7 @@ import unittest from random import randint from cpl.utils import String -from cpl_query.exceptions import InvalidTypeException, WrongTypeException +from cpl_query.exceptions import InvalidTypeException, WrongTypeException, ArgumentNoneException from cpl_query.extension.list import List from cpl_query.tests.models import User, Address @@ -70,17 +70,14 @@ class QueryTest(unittest.TestCase): self.assertEqual(res, avg) - def test_avg_invalid(self): - def _(): - res = self._tests.average(str, lambda u: u.address.nr) + def invalid(): + e_res = self._tests.average(str, lambda u: u.address.nr) - self.assertRaises(InvalidTypeException, _) + def wrong(): + e_res = self._tests.average(int, lambda u: u.address.street) - def test_avg_wrong(self): - def _(): - res = self._tests.average(int, lambda u: u.address.street) - - self.assertRaises(WrongTypeException, _) + self.assertRaises(InvalidTypeException, invalid) + self.assertRaises(WrongTypeException, wrong) def test_first(self): results = [] @@ -179,3 +176,8 @@ class QueryTest(unittest.TestCase): res = self._tests.where(lambda u: u.address.nr == 5) self.assertEqual(len(results), len(res)) + + def ex(): + e_res = self._tests.where(None) + + self.assertRaises(ArgumentNoneException, ex) From f8bd86692e78a4c45f3db0d765a27bf4f77d4158 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 10:55:23 +0200 Subject: [PATCH 16/49] Added contains query --- src/cpl_query/_extension/iterable.py | 4 ++++ src/cpl_query/_query/contains_query.py | 5 +++++ src/cpl_query/extension/iterable_abc.py | 3 +++ src/cpl_query/tests/query_test.py | 4 ++++ 4 files changed, 16 insertions(+) create mode 100644 src/cpl_query/_query/contains_query.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 14f681a8..28f9bcfc 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -5,6 +5,7 @@ from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC from .._query.all_query import all_query from .._query.any_query import any_query from .._query.avg_query import avg_query +from .._query.contains_query import contains_query from .._query.first_query import first_or_default_query, first_query from .._query.for_each_query import for_each_query from .._query.order_by import order_by_query, order_by_descending_query @@ -27,6 +28,9 @@ class Iterable(IterableABC): def average(self, t: type, func: Callable) -> Union[int, float, complex]: return avg_query(self, t, func) + def contains(self, value: object) -> bool: + return contains_query(self, value) + def first(self) -> any: return first_query(self) diff --git a/src/cpl_query/_query/contains_query.py b/src/cpl_query/_query/contains_query.py new file mode 100644 index 00000000..e235c65d --- /dev/null +++ b/src/cpl_query/_query/contains_query.py @@ -0,0 +1,5 @@ +from cpl_query.extension.iterable_abc import IterableABC + + +def contains_query(_list: IterableABC, value: object) -> bool: + return value in _list diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 85aaf734..ba80b979 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -17,6 +17,9 @@ class IterableABC(ABC, list): @abstractmethod def average(self, t: type, func: Callable) -> Union[int, float, complex]: pass + @abstractmethod + def contains(self, value: object) -> bool: pass + @abstractmethod def first(self) -> any: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index d26f2f88..b836bb6c 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -79,6 +79,10 @@ class QueryTest(unittest.TestCase): self.assertRaises(InvalidTypeException, invalid) self.assertRaises(WrongTypeException, wrong) + def test_contains(self): + self.assertTrue(self._tests.contains(self._t_user)) + self.assertFalse(self._tests.contains(User("Test", None))) + def test_first(self): results = [] for user in self._tests: From 45733b30ef8e3fcc7c814fa53cdd392f7cacf50a Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 10:59:24 +0200 Subject: [PATCH 17/49] Improved error handling --- src/cpl_query/_query/contains_query.py | 11 +++++++++-- src/cpl_query/exceptions.py | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cpl_query/_query/contains_query.py b/src/cpl_query/_query/contains_query.py index e235c65d..47d29dc8 100644 --- a/src/cpl_query/_query/contains_query.py +++ b/src/cpl_query/_query/contains_query.py @@ -1,5 +1,12 @@ +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument from cpl_query.extension.iterable_abc import IterableABC -def contains_query(_list: IterableABC, value: object) -> bool: - return value in _list +def contains_query(_list: IterableABC, _value: object) -> bool: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _value is None: + raise ArgumentNoneException(ExceptionArgument.value) + + return _value in _list diff --git a/src/cpl_query/exceptions.py b/src/cpl_query/exceptions.py index b0a320ea..c9694221 100644 --- a/src/cpl_query/exceptions.py +++ b/src/cpl_query/exceptions.py @@ -6,6 +6,7 @@ class ExceptionArgument(Enum): list = 'list' func = 'func' type = 'type' + value = 'value' # exceptions From c60598b3f61f5a1a76ea01910d76cb07fd0af00d Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:01:43 +0200 Subject: [PATCH 18/49] Added count query --- src/cpl_query/_extension/iterable.py | 4 ++++ src/cpl_query/_query/count_query.py | 15 +++++++++++++++ src/cpl_query/extension/iterable_abc.py | 3 +++ src/cpl_query/tests/query_test.py | 4 ++++ 4 files changed, 26 insertions(+) create mode 100644 src/cpl_query/_query/count_query.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 28f9bcfc..f925851e 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -6,6 +6,7 @@ from .._query.all_query import all_query from .._query.any_query import any_query from .._query.avg_query import avg_query from .._query.contains_query import contains_query +from .._query.count_query import count_query from .._query.first_query import first_or_default_query, first_query from .._query.for_each_query import for_each_query from .._query.order_by import order_by_query, order_by_descending_query @@ -31,6 +32,9 @@ class Iterable(IterableABC): def contains(self, value: object) -> bool: return contains_query(self, value) + def count(self, func: Callable = None) -> int: + return count_query(self, func) + def first(self) -> any: return first_query(self) diff --git a/src/cpl_query/_query/count_query.py b/src/cpl_query/_query/count_query.py new file mode 100644 index 00000000..246feee1 --- /dev/null +++ b/src/cpl_query/_query/count_query.py @@ -0,0 +1,15 @@ +from collections import Callable + +from cpl_query._query.where_query import where_query +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument +from cpl_query.extension.iterable_abc import IterableABC + + +def count_query(_list: IterableABC, _func: Callable = None) -> int: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + return len(_list) + + return len(where_query(_list, _func)) diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index ba80b979..6a85d604 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -20,6 +20,9 @@ class IterableABC(ABC, list): @abstractmethod def contains(self, value: object) -> bool: pass + @abstractmethod + def count(self, func: Callable) -> int: pass + @abstractmethod def first(self) -> any: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index b836bb6c..cb7a42a4 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -83,6 +83,10 @@ class QueryTest(unittest.TestCase): self.assertTrue(self._tests.contains(self._t_user)) self.assertFalse(self._tests.contains(User("Test", None))) + def test_count(self): + self.assertEqual(len(self._tests), self._tests.count()) + self.assertEqual(1, self._tests.count(lambda u: u == self._t_user)) + def test_first(self): results = [] for user in self._tests: From 669133d4919cfc4f16c3187006baa5332728294c Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:20:35 +0200 Subject: [PATCH 19/49] Added distinct query --- src/cpl_query/_extension/iterable.py | 6 ++++++ src/cpl_query/_query/distinct_query.py | 24 ++++++++++++++++++++++++ src/cpl_query/extension/iterable_abc.py | 9 ++++++--- src/cpl_query/tests/query_test.py | 4 ++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 src/cpl_query/_query/distinct_query.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index f925851e..60f1b94d 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -7,6 +7,7 @@ from .._query.any_query import any_query from .._query.avg_query import avg_query from .._query.contains_query import contains_query from .._query.count_query import count_query +from .._query.distinct_query import distinct_query from .._query.first_query import first_or_default_query, first_query from .._query.for_each_query import for_each_query from .._query.order_by import order_by_query, order_by_descending_query @@ -35,6 +36,11 @@ class Iterable(IterableABC): def count(self, func: Callable = None) -> int: return count_query(self, func) + def distinct(self, func: Callable) -> IterableABC: + res = distinct_query(self, func) + res.__class__ = Iterable + return res + def first(self) -> any: return first_query(self) diff --git a/src/cpl_query/_query/distinct_query.py b/src/cpl_query/_query/distinct_query.py new file mode 100644 index 00000000..791ef7c7 --- /dev/null +++ b/src/cpl_query/_query/distinct_query.py @@ -0,0 +1,24 @@ +from collections import Callable + +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument +from cpl_query.extension.iterable_abc import IterableABC + + +def distinct_query(_list: IterableABC, _func: Callable) -> IterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + + result = IterableABC() + known_values = [] + for element in _list: + value = _func(element) + if value in known_values: + continue + + known_values.append(value) + result.append(element) + + return result diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 6a85d604..bd031833 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -23,6 +23,9 @@ class IterableABC(ABC, list): @abstractmethod def count(self, func: Callable) -> int: pass + @abstractmethod + def distinct(self, func: Callable) -> 'IterableABC': pass + @abstractmethod def first(self) -> any: pass @@ -33,13 +36,13 @@ class IterableABC(ABC, list): def for_each(self, func: Callable): pass @abstractmethod - def order_by(self, func: Callable): pass + def order_by(self, func: Callable) -> 'IterableABC': pass @abstractmethod - def order_by_descending(self, func: Callable): pass + def order_by_descending(self, func: Callable) -> 'IterableABC': pass @abstractmethod - def single(self): pass + def single(self) -> any: pass @abstractmethod def single_or_default(self) -> Optional[any]: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index cb7a42a4..9a187f3e 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -87,6 +87,10 @@ class QueryTest(unittest.TestCase): self.assertEqual(len(self._tests), self._tests.count()) self.assertEqual(1, self._tests.count(lambda u: u == self._t_user)) + def test_distinct(self): + res = self._tests.distinct(lambda u: u.address.nr).where(lambda u: u.address.nr == 5) + self.assertEqual(1, len(res)) + def test_first(self): results = [] for user in self._tests: From 6951a19670e315e64a30704752563fc041dd6ad6 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:22:29 +0200 Subject: [PATCH 20/49] Renamed files --- src/cpl_query/_extension/iterable.py | 20 +++++++++---------- src/cpl_query/_query/{all_query.py => all.py} | 2 +- src/cpl_query/_query/{any_query.py => any.py} | 2 +- src/cpl_query/_query/{avg_query.py => avg.py} | 0 .../_query/{contains_query.py => contains.py} | 0 .../_query/{count_query.py => count.py} | 2 +- .../_query/{distinct_query.py => distinct.py} | 0 .../_query/{first_query.py => first.py} | 0 .../_query/{for_each_query.py => for_each.py} | 0 .../_query/{single_query.py => single.py} | 0 .../_query/{where_query.py => where.py} | 0 11 files changed, 13 insertions(+), 13 deletions(-) rename src/cpl_query/_query/{all_query.py => all.py} (89%) rename src/cpl_query/_query/{any_query.py => any.py} (89%) rename src/cpl_query/_query/{avg_query.py => avg.py} (100%) rename src/cpl_query/_query/{contains_query.py => contains.py} (100%) rename src/cpl_query/_query/{count_query.py => count.py} (88%) rename src/cpl_query/_query/{distinct_query.py => distinct.py} (100%) rename src/cpl_query/_query/{first_query.py => first.py} (100%) rename src/cpl_query/_query/{for_each_query.py => for_each.py} (100%) rename src/cpl_query/_query/{single_query.py => single.py} (100%) rename src/cpl_query/_query/{where_query.py => where.py} (100%) diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 60f1b94d..2361fe67 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -2,17 +2,17 @@ from typing import Optional, Callable, Union from cpl_query._extension.ordered_iterable import OrderedIterable from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC -from .._query.all_query import all_query -from .._query.any_query import any_query -from .._query.avg_query import avg_query -from .._query.contains_query import contains_query -from .._query.count_query import count_query -from .._query.distinct_query import distinct_query -from .._query.first_query import first_or_default_query, first_query -from .._query.for_each_query import for_each_query +from .._query.all import all_query +from .._query.any import any_query +from .._query.avg import avg_query +from .._query.contains import contains_query +from .._query.count import count_query +from .._query.distinct import distinct_query +from .._query.first import first_or_default_query, first_query +from .._query.for_each import for_each_query from .._query.order_by import order_by_query, order_by_descending_query -from .._query.single_query import single_query, single_or_default_query -from .._query.where_query import where_query +from .._query.single import single_query, single_or_default_query +from .._query.where import where_query from cpl_query.extension.iterable_abc import IterableABC diff --git a/src/cpl_query/_query/all_query.py b/src/cpl_query/_query/all.py similarity index 89% rename from src/cpl_query/_query/all_query.py rename to src/cpl_query/_query/all.py index 07c40a51..76aa2fb0 100644 --- a/src/cpl_query/_query/all_query.py +++ b/src/cpl_query/_query/all.py @@ -1,6 +1,6 @@ from collections import Callable -from cpl_query._query.where_query import where_query +from cpl_query._query.where import where_query from cpl_query.exceptions import ExceptionArgument, ArgumentNoneException from cpl_query.extension.iterable_abc import IterableABC diff --git a/src/cpl_query/_query/any_query.py b/src/cpl_query/_query/any.py similarity index 89% rename from src/cpl_query/_query/any_query.py rename to src/cpl_query/_query/any.py index ede1c0d8..ab63c154 100644 --- a/src/cpl_query/_query/any_query.py +++ b/src/cpl_query/_query/any.py @@ -1,6 +1,6 @@ from collections import Callable -from cpl_query._query.where_query import where_query +from cpl_query._query.where import where_query from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument from cpl_query.extension.iterable_abc import IterableABC diff --git a/src/cpl_query/_query/avg_query.py b/src/cpl_query/_query/avg.py similarity index 100% rename from src/cpl_query/_query/avg_query.py rename to src/cpl_query/_query/avg.py diff --git a/src/cpl_query/_query/contains_query.py b/src/cpl_query/_query/contains.py similarity index 100% rename from src/cpl_query/_query/contains_query.py rename to src/cpl_query/_query/contains.py diff --git a/src/cpl_query/_query/count_query.py b/src/cpl_query/_query/count.py similarity index 88% rename from src/cpl_query/_query/count_query.py rename to src/cpl_query/_query/count.py index 246feee1..a4a87096 100644 --- a/src/cpl_query/_query/count_query.py +++ b/src/cpl_query/_query/count.py @@ -1,6 +1,6 @@ from collections import Callable -from cpl_query._query.where_query import where_query +from cpl_query._query.where import where_query from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument from cpl_query.extension.iterable_abc import IterableABC diff --git a/src/cpl_query/_query/distinct_query.py b/src/cpl_query/_query/distinct.py similarity index 100% rename from src/cpl_query/_query/distinct_query.py rename to src/cpl_query/_query/distinct.py diff --git a/src/cpl_query/_query/first_query.py b/src/cpl_query/_query/first.py similarity index 100% rename from src/cpl_query/_query/first_query.py rename to src/cpl_query/_query/first.py diff --git a/src/cpl_query/_query/for_each_query.py b/src/cpl_query/_query/for_each.py similarity index 100% rename from src/cpl_query/_query/for_each_query.py rename to src/cpl_query/_query/for_each.py diff --git a/src/cpl_query/_query/single_query.py b/src/cpl_query/_query/single.py similarity index 100% rename from src/cpl_query/_query/single_query.py rename to src/cpl_query/_query/single.py diff --git a/src/cpl_query/_query/where_query.py b/src/cpl_query/_query/where.py similarity index 100% rename from src/cpl_query/_query/where_query.py rename to src/cpl_query/_query/where.py From a3a0a150a8440393e40b1518ee4d8a02aeb7ac5f Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:29:52 +0200 Subject: [PATCH 21/49] Added element at query --- src/cpl_query/_extension/iterable.py | 7 +++++++ src/cpl_query/_query/element_at.py | 25 +++++++++++++++++++++++++ src/cpl_query/exceptions.py | 1 + src/cpl_query/extension/iterable_abc.py | 6 ++++++ src/cpl_query/tests/query_test.py | 9 +++++++++ 5 files changed, 48 insertions(+) create mode 100644 src/cpl_query/_query/element_at.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 2361fe67..cb0f868e 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -8,6 +8,7 @@ from .._query.avg import avg_query from .._query.contains import contains_query from .._query.count import count_query from .._query.distinct import distinct_query +from .._query.element_at import element_at_query, element_at_or_default_query from .._query.first import first_or_default_query, first_query from .._query.for_each import for_each_query from .._query.order_by import order_by_query, order_by_descending_query @@ -41,6 +42,12 @@ class Iterable(IterableABC): res.__class__ = Iterable return res + def element_at(self, index: int) -> any: + return element_at_query(self, index) + + def element_at_or_default(self, index: int) -> Optional[any]: + return element_at_or_default_query(self, index) + def first(self) -> any: return first_query(self) diff --git a/src/cpl_query/_query/element_at.py b/src/cpl_query/_query/element_at.py new file mode 100644 index 00000000..67bd514c --- /dev/null +++ b/src/cpl_query/_query/element_at.py @@ -0,0 +1,25 @@ +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument +from cpl_query.extension.iterable_abc import IterableABC + + +def element_at_query(_list: IterableABC, _index: int) -> any: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _index is None: + raise ArgumentNoneException(ExceptionArgument.index) + + return _list[_index] + + +def element_at_or_default_query(_list: IterableABC, _index: int) -> any: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _index is None: + raise ArgumentNoneException(ExceptionArgument.index) + + try: + return _list[_index] + except IndexError: + return None diff --git a/src/cpl_query/exceptions.py b/src/cpl_query/exceptions.py index c9694221..1b6e550d 100644 --- a/src/cpl_query/exceptions.py +++ b/src/cpl_query/exceptions.py @@ -7,6 +7,7 @@ class ExceptionArgument(Enum): func = 'func' type = 'type' value = 'value' + index = 'index' # exceptions diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index bd031833..28cb188b 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -26,6 +26,12 @@ class IterableABC(ABC, list): @abstractmethod def distinct(self, func: Callable) -> 'IterableABC': pass + @abstractmethod + def element_at(self, index: int) -> any: pass + + @abstractmethod + def element_at_or_default(self, index: int) -> Optional[any]: pass + @abstractmethod def first(self) -> any: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 9a187f3e..2481f60e 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -91,6 +91,15 @@ class QueryTest(unittest.TestCase): res = self._tests.distinct(lambda u: u.address.nr).where(lambda u: u.address.nr == 5) self.assertEqual(1, len(res)) + def test_element_at(self): + index = randint(0, len(self._tests) - 1) + self.assertEqual(self._tests[index], self._tests.element_at(index)) + + def test_element_at_or_default(self): + index = randint(0, len(self._tests) - 1) + self.assertEqual(self._tests[index], self._tests.element_at_or_default(index)) + self.assertIsNone(self._tests.element_at_or_default(len(self._tests))) + def test_first(self): results = [] for user in self._tests: From 82a9e3a23a23f1287116226787edaa44001256e7 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:40:24 +0200 Subject: [PATCH 22/49] Improved index out of range exception --- src/cpl_query/_query/first.py | 4 ++-- src/cpl_query/exceptions.py | 8 +++++++- src/cpl_query/tests/query_test.py | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cpl_query/_query/first.py b/src/cpl_query/_query/first.py index 6f3859ae..0eb98924 100644 --- a/src/cpl_query/_query/first.py +++ b/src/cpl_query/_query/first.py @@ -1,6 +1,6 @@ from typing import Optional -from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, IndexOutOfRangeException from cpl_query.extension.iterable_abc import IterableABC @@ -9,7 +9,7 @@ def first_query(_list: IterableABC) -> any: raise ArgumentNoneException(ExceptionArgument.list) if len(_list) == 0: - raise Exception('Index out of range') + raise IndexOutOfRangeException() return _list[0] diff --git a/src/cpl_query/exceptions.py b/src/cpl_query/exceptions.py index 1b6e550d..7fc33909 100644 --- a/src/cpl_query/exceptions.py +++ b/src/cpl_query/exceptions.py @@ -14,7 +14,13 @@ class ExceptionArgument(Enum): class ArgumentNoneException(Exception): def __init__(self, arg: ExceptionArgument): - Exception.__init__(self, f'Argument {arg} is None') + Exception.__init__(self, f'argument {arg} is None') + + +class IndexOutOfRangeException(Exception): + + def __init__(self): + Exception.__init__(self, f'List index out of range') class InvalidTypeException(Exception): diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 2481f60e..0f6b3e17 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -100,6 +100,9 @@ class QueryTest(unittest.TestCase): self.assertEqual(self._tests[index], self._tests.element_at_or_default(index)) self.assertIsNone(self._tests.element_at_or_default(len(self._tests))) + test = [1, 2, 3] + t = test[100] + def test_first(self): results = [] for user in self._tests: From e7863a92e002205dffd481b73c4e22e4d63d1bd8 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:43:45 +0200 Subject: [PATCH 23/49] Added last query --- src/cpl_query/_extension/iterable.py | 7 ++++++ src/cpl_query/_query/last.py | 24 +++++++++++++++++++ src/cpl_query/extension/iterable_abc.py | 6 +++++ src/cpl_query/tests/query_test.py | 31 +++++++++++++++++++++---- 4 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/cpl_query/_query/last.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index cb0f868e..091eae1a 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -11,6 +11,7 @@ from .._query.distinct import distinct_query from .._query.element_at import element_at_query, element_at_or_default_query from .._query.first import first_or_default_query, first_query from .._query.for_each import for_each_query +from .._query.last import last_query, last_or_default_query from .._query.order_by import order_by_query, order_by_descending_query from .._query.single import single_query, single_or_default_query from .._query.where import where_query @@ -48,6 +49,12 @@ class Iterable(IterableABC): def element_at_or_default(self, index: int) -> Optional[any]: return element_at_or_default_query(self, index) + def last(self) -> any: + return last_query(self) + + def last_or_default(self) -> Optional[any]: + return last_or_default_query(self) + def first(self) -> any: return first_query(self) diff --git a/src/cpl_query/_query/last.py b/src/cpl_query/_query/last.py new file mode 100644 index 00000000..20ff901a --- /dev/null +++ b/src/cpl_query/_query/last.py @@ -0,0 +1,24 @@ +from typing import Optional + +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, IndexOutOfRangeException +from cpl_query.extension.iterable_abc import IterableABC + + +def last_query(_list: IterableABC) -> any: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if len(_list) == 0: + raise IndexOutOfRangeException() + + return _list[len(_list) - 1] + + +def last_or_default_query(_list: IterableABC) -> Optional[any]: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if len(_list) == 0: + return None + + return _list[len(_list) - 1] diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 28cb188b..c9d0105b 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -32,6 +32,12 @@ class IterableABC(ABC, list): @abstractmethod def element_at_or_default(self, index: int) -> Optional[any]: pass + @abstractmethod + def last(self) -> any: pass + + @abstractmethod + def last_or_default(self) -> any: pass + @abstractmethod def first(self) -> any: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 0f6b3e17..64f5f23c 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -100,8 +100,31 @@ class QueryTest(unittest.TestCase): self.assertEqual(self._tests[index], self._tests.element_at_or_default(index)) self.assertIsNone(self._tests.element_at_or_default(len(self._tests))) - test = [1, 2, 3] - t = test[100] + def test_last(self): + results = [] + for user in self._tests: + if user.address.nr == 10: + results.append(user) + + res = self._tests.where(lambda u: u.address.nr == 10) + s_res = self._tests.where(lambda u: u.address.nr == 10).last() + + self.assertEqual(len(res), len(results)) + self.assertEqual(res[len(res) - 1], s_res) + + def test_last_or_default(self): + results = [] + for user in self._tests: + if user.address.nr == 10: + results.append(user) + + res = self._tests.where(lambda u: u.address.nr == 10) + s_res = self._tests.where(lambda u: u.address.nr == 10).last_or_default() + sn_res = self._tests.where(lambda u: u.address.nr == 11).last_or_default() + + self.assertEqual(len(res), len(results)) + self.assertEqual(res[len(res) - 1], s_res) + self.assertIsNone(sn_res) def test_first(self): results = [] @@ -113,7 +136,7 @@ class QueryTest(unittest.TestCase): s_res = self._tests.where(lambda u: u.address.nr == 10).first() self.assertEqual(len(res), len(results)) - self.assertIsNotNone(s_res) + self.assertEqual(res[0], s_res) def test_first_or_default(self): results = [] @@ -126,7 +149,7 @@ class QueryTest(unittest.TestCase): sn_res = self._tests.where(lambda u: u.address.nr == 11).first_or_default() self.assertEqual(len(res), len(results)) - self.assertIsNotNone(s_res) + self.assertEqual(res[0], s_res) self.assertIsNone(sn_res) def test_for_each(self): From c115afd7368351dc562657c0c7d6d4be5fdffd91 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:47:13 +0200 Subject: [PATCH 24/49] Moved last queries --- src/cpl_query/_extension/iterable.py | 3 +-- src/cpl_query/_query/first.py | 24 ------------------- .../_query/{last.py => first_last.py} | 20 ++++++++++++++++ 3 files changed, 21 insertions(+), 26 deletions(-) delete mode 100644 src/cpl_query/_query/first.py rename src/cpl_query/_query/{last.py => first_last.py} (59%) diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 091eae1a..45180a9c 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -9,9 +9,8 @@ from .._query.contains import contains_query from .._query.count import count_query from .._query.distinct import distinct_query from .._query.element_at import element_at_query, element_at_or_default_query -from .._query.first import first_or_default_query, first_query +from .._query.first_last import first_or_default_query, first_query, last_or_default_query, last_query from .._query.for_each import for_each_query -from .._query.last import last_query, last_or_default_query from .._query.order_by import order_by_query, order_by_descending_query from .._query.single import single_query, single_or_default_query from .._query.where import where_query diff --git a/src/cpl_query/_query/first.py b/src/cpl_query/_query/first.py deleted file mode 100644 index 0eb98924..00000000 --- a/src/cpl_query/_query/first.py +++ /dev/null @@ -1,24 +0,0 @@ -from typing import Optional - -from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, IndexOutOfRangeException -from cpl_query.extension.iterable_abc import IterableABC - - -def first_query(_list: IterableABC) -> any: - if _list is None: - raise ArgumentNoneException(ExceptionArgument.list) - - if len(_list) == 0: - raise IndexOutOfRangeException() - - return _list[0] - - -def first_or_default_query(_list: IterableABC) -> Optional[any]: - if _list is None: - raise ArgumentNoneException(ExceptionArgument.list) - - if len(_list) == 0: - return None - - return _list[0] diff --git a/src/cpl_query/_query/last.py b/src/cpl_query/_query/first_last.py similarity index 59% rename from src/cpl_query/_query/last.py rename to src/cpl_query/_query/first_last.py index 20ff901a..9008300a 100644 --- a/src/cpl_query/_query/last.py +++ b/src/cpl_query/_query/first_last.py @@ -4,6 +4,26 @@ from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, Index from cpl_query.extension.iterable_abc import IterableABC +def first_query(_list: IterableABC) -> any: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if len(_list) == 0: + raise IndexOutOfRangeException() + + return _list[0] + + +def first_or_default_query(_list: IterableABC) -> Optional[any]: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if len(_list) == 0: + return None + + return _list[0] + + def last_query(_list: IterableABC) -> any: if _list is None: raise ArgumentNoneException(ExceptionArgument.list) From d4b5c32a2112bb248720706d2295008bd2d68585 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 11:57:42 +0200 Subject: [PATCH 25/49] Added min and max queries --- src/cpl_query/_extension/iterable.py | 7 ++++ src/cpl_query/_query/max_min.py | 48 +++++++++++++++++++++++++ src/cpl_query/extension/iterable_abc.py | 5 ++- src/cpl_query/tests/query_test.py | 10 +++++- 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 src/cpl_query/_query/max_min.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 45180a9c..15037603 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -11,6 +11,7 @@ from .._query.distinct import distinct_query from .._query.element_at import element_at_query, element_at_or_default_query from .._query.first_last import first_or_default_query, first_query, last_or_default_query, last_query from .._query.for_each import for_each_query +from .._query.max_min import max_query, min_query from .._query.order_by import order_by_query, order_by_descending_query from .._query.single import single_query, single_or_default_query from .._query.where import where_query @@ -63,6 +64,12 @@ class Iterable(IterableABC): def for_each(self, func: Callable): for_each_query(self, func) + def max(self, t: type, func: Callable) -> Union[int, float, complex]: + return max_query(self, t, func) + + def min(self, t: type, func: Callable) -> Union[int, float, complex]: + return min_query(self, t, func) + def order_by(self, func: Callable) -> OrderedIterableABC: res = order_by_query(self, func) res.__class__ = OrderedIterable diff --git a/src/cpl_query/_query/max_min.py b/src/cpl_query/_query/max_min.py new file mode 100644 index 00000000..82dc01c0 --- /dev/null +++ b/src/cpl_query/_query/max_min.py @@ -0,0 +1,48 @@ +from collections import Callable +from typing import Union + +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, InvalidTypeException +from cpl_query.extension.iterable_abc import IterableABC + + +def max_query(_list: IterableABC, _t: type, _func: Callable) -> Union[int, float, complex]: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + + if _t != int and _t != float and _t != complex: + raise InvalidTypeException() + + max_value = _t() + for element in _list: + value = _func(element) + if value > max_value: + max_value = value + + return max_value + + +def min_query(_list: IterableABC, _t: type, _func: Callable) -> Union[int, float, complex]: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None: + raise ArgumentNoneException(ExceptionArgument.func) + + if _t != int and _t != float and _t != complex: + raise InvalidTypeException() + + min_value = _t() + is_first = True + for element in _list: + value = _func(element) + if is_first: + min_value = value + is_first = False + + if value < min_value: + min_value = value + + return min_value diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index c9d0105b..6a94c8c3 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -45,7 +45,10 @@ class IterableABC(ABC, list): def first_or_default(self) -> any: pass @abstractmethod - def for_each(self, func: Callable): pass + def for_each(self, func: Callable) -> Union[int, float, complex]: pass + + @abstractmethod + def max(self, t: type, func: Callable) -> Union[int, float, complex]: pass @abstractmethod def order_by(self, func: Callable) -> 'IterableABC': pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 64f5f23c..c5522813 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -28,7 +28,7 @@ class QueryTest(unittest.TestCase): String.random_string(string.ascii_letters, 8).lower(), Address( String.random_string(string.ascii_letters, 10).lower(), - randint(0, 10) + randint(1, 10) ) ) @@ -162,6 +162,14 @@ class QueryTest(unittest.TestCase): self.assertEqual(len(users), len(self._tests)) + def test_max(self): + res = self._tests.max(int, lambda u: u.address.nr) + self.assertEqual(self._t_user.address.nr, res) + + def test_min(self): + res = self._tests.min(int, lambda u: u.address.nr) + self.assertEqual(1, res) + def test_order_by(self): res = self._tests.order_by(lambda user: user.address.street) res2 = self._tests.order_by(lambda user: user.address.nr) From daac14e0997faac9d157317f19fc01828ff86f0a Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 12:35:14 +0200 Subject: [PATCH 26/49] Improved avg query --- src/cpl_query/_extension/iterable.py | 8 ++++---- src/cpl_query/_helper.py | 2 ++ src/cpl_query/_query/avg.py | 23 +++++++++++------------ src/cpl_query/extension/iterable_abc.py | 22 ++++++++++++++++++++-- src/cpl_query/extension/list.py | 13 +------------ src/cpl_query/tests/query_test.py | 19 ++++++++++++------- 6 files changed, 50 insertions(+), 37 deletions(-) create mode 100644 src/cpl_query/_helper.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 15037603..d2a9fb4e 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -20,8 +20,8 @@ from cpl_query.extension.iterable_abc import IterableABC class Iterable(IterableABC): - def __init__(self): - IterableABC.__init__(self) + def __init__(self, t: type = None, values: list = None): + IterableABC.__init__(self, t, values) def any(self, func: Callable) -> bool: return any_query(self, func) @@ -29,8 +29,8 @@ class Iterable(IterableABC): def all(self, func: Callable) -> bool: return all_query(self, func) - def average(self, t: type, func: Callable) -> Union[int, float, complex]: - return avg_query(self, t, func) + def average(self, func: Callable = None) -> Union[int, float, complex]: + return avg_query(self, func) def contains(self, value: object) -> bool: return contains_query(self, value) diff --git a/src/cpl_query/_helper.py b/src/cpl_query/_helper.py new file mode 100644 index 00000000..6f92e585 --- /dev/null +++ b/src/cpl_query/_helper.py @@ -0,0 +1,2 @@ +def is_number(t: type) -> bool: + return issubclass(t, int) or issubclass(t, float) or issubclass(t, complex) diff --git a/src/cpl_query/_query/avg.py b/src/cpl_query/_query/avg.py index 6d140da8..cf8d354a 100644 --- a/src/cpl_query/_query/avg.py +++ b/src/cpl_query/_query/avg.py @@ -1,28 +1,27 @@ from typing import Callable, Union +from cpl_query._helper import is_number from cpl_query.exceptions import InvalidTypeException, WrongTypeException, ExceptionArgument, ArgumentNoneException from cpl_query.extension.iterable_abc import IterableABC -def avg_query(_list: IterableABC, _t: type, _func: Callable) -> Union[int, float, complex]: - average = 0 - count = len(_list) - +def avg_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex]: if _list is None: raise ArgumentNoneException(ExceptionArgument.list) - if _func is None: - raise ArgumentNoneException(ExceptionArgument.func) - - if _t != int and _t != float and _t != complex: - raise InvalidTypeException() + average = 0 + count = len(_list) for element in _list: - value = _func(element) - if type(value) != _t: + if _func is not None: + value = _func(element) + + else: + value = element + + if _list.type is not None and type(element) != _list.type or not is_number(type(value)): raise WrongTypeException() average += value return average / count - diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 6a94c8c3..76a61f72 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -5,17 +5,35 @@ from typing import Optional, Callable, Union class IterableABC(ABC, list): @abstractmethod - def __init__(self): + def __init__(self, t: type = None, values: list = None): list.__init__(self) + if t == any: + t = None + self._type = t + + if values is not None: + for value in values: + self.append(value) + + @property + def type(self) -> type: + return self._type + @abstractmethod def any(self, func: Callable) -> bool: pass @abstractmethod def all(self, func: Callable) -> bool: pass + def append(self, __object: object) -> None: + if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type): + raise Exception(f'Unexpected type: {type(__object)}') + + super().append(__object) + @abstractmethod - def average(self, t: type, func: Callable) -> Union[int, float, complex]: pass + def average(self, func: Callable = None) -> Union[int, float, complex]: pass @abstractmethod def contains(self, value: object) -> bool: pass diff --git a/src/cpl_query/extension/list.py b/src/cpl_query/extension/list.py index 94eeeb09..c642f0be 100644 --- a/src/cpl_query/extension/list.py +++ b/src/cpl_query/extension/list.py @@ -4,15 +4,4 @@ from .._extension.iterable import Iterable class List(Iterable): def __init__(self, t: type = None, values: list = None): - Iterable.__init__(self) - - self._type = t - - if values is not None: - self.extend(values) - - def append(self, __object: object) -> None: - if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type): - raise Exception(f'Unexpected type: {type(__object)}') - - super().append(__object) + Iterable.__init__(self, t, values) diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index c5522813..e1d0b417 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -66,19 +66,24 @@ class QueryTest(unittest.TestCase): avg += user.address.nr avg = avg / len(self._tests) - res = self._tests.average(int, lambda u: u.address.nr) + res = self._tests.average(lambda u: u.address.nr) - self.assertEqual(res, avg) - - def invalid(): - e_res = self._tests.average(str, lambda u: u.address.nr) + self.assertEqual(avg, res) def wrong(): - e_res = self._tests.average(int, lambda u: u.address.street) + e_res = self._tests.average(lambda u: u.address.street) - self.assertRaises(InvalidTypeException, invalid) self.assertRaises(WrongTypeException, wrong) + tests = List(int, list(range(0, 100))) + self.assertEqual(sum(tests) / len(tests), tests.average()) + + def wrong2(): + tests2 = List(int, values=list(range(0, 100))) + e_res = tests2.average(lambda u: u.address.nr) + + self.assertRaises(AttributeError, wrong2) + def test_contains(self): self.assertTrue(self._tests.contains(self._t_user)) self.assertFalse(self._tests.contains(User("Test", None))) From a26c6f1bd910850a643e54e2c42dc6885ec74bac Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 12:42:33 +0200 Subject: [PATCH 27/49] Improved avg, max and min queries type handling --- src/cpl_query/_extension/iterable.py | 8 ++--- src/cpl_query/_query/avg.py | 2 +- src/cpl_query/_query/max_min.py | 41 +++++++++++++------------ src/cpl_query/extension/iterable_abc.py | 8 ++++- src/cpl_query/tests/query_test.py | 4 +-- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index d2a9fb4e..abd06a14 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -64,11 +64,11 @@ class Iterable(IterableABC): def for_each(self, func: Callable): for_each_query(self, func) - def max(self, t: type, func: Callable) -> Union[int, float, complex]: - return max_query(self, t, func) + def max(self, func: Callable) -> Union[int, float, complex]: + return max_query(self, func) - def min(self, t: type, func: Callable) -> Union[int, float, complex]: - return min_query(self, t, func) + def min(self, func: Callable) -> Union[int, float, complex]: + return min_query(self, func) def order_by(self, func: Callable) -> OrderedIterableABC: res = order_by_query(self, func) diff --git a/src/cpl_query/_query/avg.py b/src/cpl_query/_query/avg.py index cf8d354a..ff299a3d 100644 --- a/src/cpl_query/_query/avg.py +++ b/src/cpl_query/_query/avg.py @@ -19,7 +19,7 @@ def avg_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex] else: value = element - if _list.type is not None and type(element) != _list.type or not is_number(type(value)): + if _func is None and type(element) != _list.type or not is_number(type(value)): raise WrongTypeException() average += value diff --git a/src/cpl_query/_query/max_min.py b/src/cpl_query/_query/max_min.py index 82dc01c0..a6cae896 100644 --- a/src/cpl_query/_query/max_min.py +++ b/src/cpl_query/_query/max_min.py @@ -1,43 +1,46 @@ from collections import Callable from typing import Union -from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, InvalidTypeException +from cpl_query._helper import is_number +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, InvalidTypeException, WrongTypeException from cpl_query.extension.iterable_abc import IterableABC -def max_query(_list: IterableABC, _t: type, _func: Callable) -> Union[int, float, complex]: +def max_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex]: if _list is None: raise ArgumentNoneException(ExceptionArgument.list) - if _func is None: - raise ArgumentNoneException(ExceptionArgument.func) - - if _t != int and _t != float and _t != complex: - raise InvalidTypeException() - - max_value = _t() + max_value = 0 for element in _list: - value = _func(element) + if _func is not None: + value = _func(element) + else: + value = element + + if _func is None and type(value) != _list.type or not is_number(type(value)): + raise WrongTypeException() + if value > max_value: max_value = value return max_value -def min_query(_list: IterableABC, _t: type, _func: Callable) -> Union[int, float, complex]: +def min_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex]: if _list is None: raise ArgumentNoneException(ExceptionArgument.list) - if _func is None: - raise ArgumentNoneException(ExceptionArgument.func) - - if _t != int and _t != float and _t != complex: - raise InvalidTypeException() - - min_value = _t() + min_value = 0 is_first = True for element in _list: - value = _func(element) + if _func is not None: + value = _func(element) + else: + value = element + + if _func is None and type(value) != _list.type or not is_number(type(value)): + raise WrongTypeException() + if is_first: min_value = value is_first = False diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 76a61f72..e8b8c8a9 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -30,6 +30,9 @@ class IterableABC(ABC, list): if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type): raise Exception(f'Unexpected type: {type(__object)}') + if len(self) == 0 and self._type is None: + self._type = type(__object) + super().append(__object) @abstractmethod @@ -66,7 +69,10 @@ class IterableABC(ABC, list): def for_each(self, func: Callable) -> Union[int, float, complex]: pass @abstractmethod - def max(self, t: type, func: Callable) -> Union[int, float, complex]: pass + def max(self, func: Callable) -> Union[int, float, complex]: pass + + @abstractmethod + def min(self, func: Callable) -> Union[int, float, complex]: pass @abstractmethod def order_by(self, func: Callable) -> 'IterableABC': pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index e1d0b417..f150f56b 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -168,11 +168,11 @@ class QueryTest(unittest.TestCase): self.assertEqual(len(users), len(self._tests)) def test_max(self): - res = self._tests.max(int, lambda u: u.address.nr) + res = self._tests.max(lambda u: u.address.nr) self.assertEqual(self._t_user.address.nr, res) def test_min(self): - res = self._tests.min(int, lambda u: u.address.nr) + res = self._tests.min(lambda u: u.address.nr) self.assertEqual(1, res) def test_order_by(self): From a080119c449e15addcb5dc0c457342cdee874176 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 12:48:22 +0200 Subject: [PATCH 28/49] Improved unittests --- src/cpl_query/_extension/iterable.py | 4 ++-- src/cpl_query/extension/iterable_abc.py | 4 ++-- src/cpl_query/tests/query_test.py | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index abd06a14..44793b87 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -64,10 +64,10 @@ class Iterable(IterableABC): def for_each(self, func: Callable): for_each_query(self, func) - def max(self, func: Callable) -> Union[int, float, complex]: + def max(self, func: Callable = None) -> Union[int, float, complex]: return max_query(self, func) - def min(self, func: Callable) -> Union[int, float, complex]: + def min(self, func: Callable = None) -> Union[int, float, complex]: return min_query(self, func) def order_by(self, func: Callable) -> OrderedIterableABC: diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index e8b8c8a9..d21cb116 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -69,10 +69,10 @@ class IterableABC(ABC, list): def for_each(self, func: Callable) -> Union[int, float, complex]: pass @abstractmethod - def max(self, func: Callable) -> Union[int, float, complex]: pass + def max(self, func: Callable = None) -> Union[int, float, complex]: pass @abstractmethod - def min(self, func: Callable) -> Union[int, float, complex]: pass + def min(self, func: Callable = None) -> Union[int, float, complex]: pass @abstractmethod def order_by(self, func: Callable) -> 'IterableABC': pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index f150f56b..cc850237 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -171,10 +171,26 @@ class QueryTest(unittest.TestCase): res = self._tests.max(lambda u: u.address.nr) self.assertEqual(self._t_user.address.nr, res) + tests = List(values=list(range(0, 100))) + self.assertEqual(99, tests.max()) + + def wrong(): + e_res = List(str, list([str(v) for v in range(0, 100)])).max() + + self.assertRaises(WrongTypeException, wrong) + def test_min(self): res = self._tests.min(lambda u: u.address.nr) self.assertEqual(1, res) + tests = List(values=list(range(0, 100))) + self.assertEqual(0, tests.min()) + + def wrong(): + e_res = List(str, list([str(v) for v in range(0, 100)])).min() + + self.assertRaises(WrongTypeException, wrong) + def test_order_by(self): res = self._tests.order_by(lambda user: user.address.street) res2 = self._tests.order_by(lambda user: user.address.nr) From 62c8b9c68d461380c018e0a1d6349d2c218f447d Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 12:54:49 +0200 Subject: [PATCH 29/49] Added reverse query --- src/cpl_query/_extension/iterable.py | 7 ++++--- src/cpl_query/_query/reverse.py | 15 +++++++++++++++ src/cpl_query/extension/iterable_abc.py | 6 ++++++ src/cpl_query/tests/query_test.py | 7 +++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 src/cpl_query/_query/reverse.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index 44793b87..d480af94 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -13,6 +13,7 @@ from .._query.first_last import first_or_default_query, first_query, last_or_def from .._query.for_each import for_each_query from .._query.max_min import max_query, min_query from .._query.order_by import order_by_query, order_by_descending_query +from .._query.reverse import reverse_query from .._query.single import single_query, single_or_default_query from .._query.where import where_query from cpl_query.extension.iterable_abc import IterableABC @@ -80,6 +81,9 @@ class Iterable(IterableABC): res.__class__ = OrderedIterable return res + def reverse(self) -> IterableABC: + return reverse_query(self) + def single(self) -> any: return single_query(self) @@ -90,6 +94,3 @@ class Iterable(IterableABC): res = where_query(self, func) res.__class__ = Iterable return res - - def to_list(self) -> list: - return list(self) diff --git a/src/cpl_query/_query/reverse.py b/src/cpl_query/_query/reverse.py new file mode 100644 index 00000000..404d7bd1 --- /dev/null +++ b/src/cpl_query/_query/reverse.py @@ -0,0 +1,15 @@ +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument +from cpl_query.extension.iterable_abc import IterableABC + + +def reverse_query(_list: IterableABC) -> IterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + result = IterableABC() + _copied_list = _list.to_list() + _copied_list.reverse() + for element in _copied_list: + result.append(element) + + return result diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index d21cb116..4b8d65f1 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -80,9 +80,15 @@ class IterableABC(ABC, list): @abstractmethod def order_by_descending(self, func: Callable) -> 'IterableABC': pass + @abstractmethod + def reverse(self) -> 'IterableABC': pass + @abstractmethod def single(self) -> any: pass + def to_list(self) -> list: + return list(self) + @abstractmethod def single_or_default(self) -> Optional[any]: pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index cc850237..7426bd5f 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -228,6 +228,13 @@ class QueryTest(unittest.TestCase): self.assertEqual(res, s_res) + def test_reverse(self): + res = self._tests.reverse() + l_res = self._tests.to_list() + l_res.reverse() + + self.assertEqual(l_res, res) + def test_single(self): res = self._tests.where(lambda u: u.address.nr == self._t_user.address.nr) s_res = self._tests.where(lambda u: u.address.nr == self._t_user.address.nr).single() From 2b5831c5fe6b3b2946edd68e08fc567a4e64e4c4 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 13:00:06 +0200 Subject: [PATCH 30/49] Improved numbered queries --- src/cpl_query/_query/avg.py | 6 +++--- src/cpl_query/_query/max_min.py | 12 ++++++------ src/cpl_query/tests/query_test.py | 21 ++++++++++++--------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/cpl_query/_query/avg.py b/src/cpl_query/_query/avg.py index ff299a3d..09fbbcc4 100644 --- a/src/cpl_query/_query/avg.py +++ b/src/cpl_query/_query/avg.py @@ -9,6 +9,9 @@ def avg_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex] if _list is None: raise ArgumentNoneException(ExceptionArgument.list) + if _func is None and not is_number(_list.type): + raise InvalidTypeException() + average = 0 count = len(_list) @@ -19,9 +22,6 @@ def avg_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex] else: value = element - if _func is None and type(element) != _list.type or not is_number(type(value)): - raise WrongTypeException() - average += value return average / count diff --git a/src/cpl_query/_query/max_min.py b/src/cpl_query/_query/max_min.py index a6cae896..d9c2c6a5 100644 --- a/src/cpl_query/_query/max_min.py +++ b/src/cpl_query/_query/max_min.py @@ -10,6 +10,9 @@ def max_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex] if _list is None: raise ArgumentNoneException(ExceptionArgument.list) + if _func is None and not is_number(_list.type): + raise InvalidTypeException() + max_value = 0 for element in _list: if _func is not None: @@ -17,9 +20,6 @@ def max_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex] else: value = element - if _func is None and type(value) != _list.type or not is_number(type(value)): - raise WrongTypeException() - if value > max_value: max_value = value @@ -30,6 +30,9 @@ def min_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex] if _list is None: raise ArgumentNoneException(ExceptionArgument.list) + if _func is None and not is_number(_list.type): + raise InvalidTypeException() + min_value = 0 is_first = True for element in _list: @@ -38,9 +41,6 @@ def min_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex] else: value = element - if _func is None and type(value) != _list.type or not is_number(type(value)): - raise WrongTypeException() - if is_first: min_value = value is_first = False diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 7426bd5f..61cd1de9 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -70,10 +70,11 @@ class QueryTest(unittest.TestCase): self.assertEqual(avg, res) - def wrong(): - e_res = self._tests.average(lambda u: u.address.street) + def invalid(): + tests = List(str, ['hello', 'world']) + e_res = tests.average() - self.assertRaises(WrongTypeException, wrong) + self.assertRaises(InvalidTypeException, invalid) tests = List(int, list(range(0, 100))) self.assertEqual(sum(tests) / len(tests), tests.average()) @@ -174,10 +175,11 @@ class QueryTest(unittest.TestCase): tests = List(values=list(range(0, 100))) self.assertEqual(99, tests.max()) - def wrong(): - e_res = List(str, list([str(v) for v in range(0, 100)])).max() + def invalid(): + tests = List(str, ['hello', 'world']) + e_res = tests.average() - self.assertRaises(WrongTypeException, wrong) + self.assertRaises(InvalidTypeException, invalid) def test_min(self): res = self._tests.min(lambda u: u.address.nr) @@ -186,10 +188,11 @@ class QueryTest(unittest.TestCase): tests = List(values=list(range(0, 100))) self.assertEqual(0, tests.min()) - def wrong(): - e_res = List(str, list([str(v) for v in range(0, 100)])).min() + def invalid(): + tests = List(str, ['hello', 'world']) + e_res = tests.average() - self.assertRaises(WrongTypeException, wrong) + self.assertRaises(InvalidTypeException, invalid) def test_order_by(self): res = self._tests.order_by(lambda user: user.address.street) From 37175b722753bbd60a1a982eadf8281aa3b17f33 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 27 Jul 2021 13:57:42 +0200 Subject: [PATCH 31/49] Added queries sum, skip & take --- src/cpl_query/_extension/iterable.py | 33 +++++++--- src/cpl_query/_extension/ordered_iterable.py | 5 +- src/cpl_query/_query/skip_take.py | 66 ++++++++++++++++++++ src/cpl_query/_query/sum.py | 25 ++++++++ src/cpl_query/extension/iterable_abc.py | 27 ++++++-- src/cpl_query/tests/query_test.py | 46 ++++++++++++++ 6 files changed, 189 insertions(+), 13 deletions(-) create mode 100644 src/cpl_query/_query/skip_take.py create mode 100644 src/cpl_query/_query/sum.py diff --git a/src/cpl_query/_extension/iterable.py b/src/cpl_query/_extension/iterable.py index d480af94..524d5164 100644 --- a/src/cpl_query/_extension/iterable.py +++ b/src/cpl_query/_extension/iterable.py @@ -1,6 +1,5 @@ from typing import Optional, Callable, Union -from cpl_query._extension.ordered_iterable import OrderedIterable from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC from .._query.all import all_query from .._query.any import any_query @@ -15,6 +14,8 @@ from .._query.max_min import max_query, min_query from .._query.order_by import order_by_query, order_by_descending_query from .._query.reverse import reverse_query from .._query.single import single_query, single_or_default_query +from .._query.skip_take import skip_query, skip_last_query, take_query, take_last_query +from .._query.sum import sum_query from .._query.where import where_query from cpl_query.extension.iterable_abc import IterableABC @@ -40,9 +41,7 @@ class Iterable(IterableABC): return count_query(self, func) def distinct(self, func: Callable) -> IterableABC: - res = distinct_query(self, func) - res.__class__ = Iterable - return res + return self.__to_self(distinct_query(self, func)) def element_at(self, index: int) -> any: return element_at_query(self, index) @@ -73,11 +72,13 @@ class Iterable(IterableABC): def order_by(self, func: Callable) -> OrderedIterableABC: res = order_by_query(self, func) + from cpl_query._extension.ordered_iterable import OrderedIterable res.__class__ = OrderedIterable return res def order_by_descending(self, func: Callable) -> OrderedIterableABC: res = order_by_descending_query(self, func) + from cpl_query._extension.ordered_iterable import OrderedIterable res.__class__ = OrderedIterable return res @@ -90,7 +91,25 @@ class Iterable(IterableABC): def single_or_default(self) -> Optional[any]: return single_or_default_query(self) + def skip(self, index: int) -> IterableABC: + return self.__to_self(skip_query(self, index)) + + def skip_last(self, index: int) -> IterableABC: + return self.__to_self(skip_last_query(self, index)) + + def sum(self, func: Callable = None) -> Union[int, float, complex]: + return sum_query(self, func) + + def take(self, index: int) -> IterableABC: + return self.__to_self(take_query(self, index)) + + def take_last(self, index: int) -> IterableABC: + return self.__to_self(take_last_query(self, index)) + def where(self, func: Callable) -> IterableABC: - res = where_query(self, func) - res.__class__ = Iterable - return res + return self.__to_self(where_query(self, func)) + + @staticmethod + def __to_self(obj: IterableABC) -> IterableABC: + obj.__class__ = Iterable + return obj diff --git a/src/cpl_query/_extension/ordered_iterable.py b/src/cpl_query/_extension/ordered_iterable.py index d7c168e9..e711c7f4 100644 --- a/src/cpl_query/_extension/ordered_iterable.py +++ b/src/cpl_query/_extension/ordered_iterable.py @@ -1,13 +1,14 @@ -from abc import ABC from collections import Callable +from .iterable import Iterable from .._query.order_by import then_by_query, then_by_descending_query from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC -class OrderedIterable(OrderedIterableABC, ABC): +class OrderedIterable(Iterable, OrderedIterableABC): def __init__(self): + Iterable.__init__(self) OrderedIterableABC.__init__(self) def then_by(self, _func: Callable) -> OrderedIterableABC: diff --git a/src/cpl_query/_query/skip_take.py b/src/cpl_query/_query/skip_take.py new file mode 100644 index 00000000..ba5972ef --- /dev/null +++ b/src/cpl_query/_query/skip_take.py @@ -0,0 +1,66 @@ +from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, IndexOutOfRangeException +from cpl_query.extension.iterable_abc import IterableABC + + +def skip_query(_list: IterableABC, _index: int) -> IterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _index is None: + raise ArgumentNoneException(ExceptionArgument.index) + + if _index >= len(_list): + raise IndexOutOfRangeException() + + result = IterableABC() + result.extend(_list[_index:]) + return result + + +def skip_last_query(_list: IterableABC, _index: int) -> IterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _index is None: + raise ArgumentNoneException(ExceptionArgument.index) + + index = len(_list) - _index + + if index >= len(_list) or index < 0: + raise IndexOutOfRangeException() + + result = IterableABC() + result.extend(_list[:index]) + return result + + +def take_query(_list: IterableABC, _index: int) -> IterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _index is None: + raise ArgumentNoneException(ExceptionArgument.index) + + if _index >= len(_list): + raise IndexOutOfRangeException() + + result = IterableABC() + result.extend(_list[:_index]) + return result + + +def take_last_query(_list: IterableABC, _index: int) -> IterableABC: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _index is None: + raise ArgumentNoneException(ExceptionArgument.index) + + index = len(_list) - _index + + if index >= len(_list) or index < 0: + raise IndexOutOfRangeException() + + result = IterableABC() + result.extend(_list[index:]) + return result diff --git a/src/cpl_query/_query/sum.py b/src/cpl_query/_query/sum.py new file mode 100644 index 00000000..f8829dad --- /dev/null +++ b/src/cpl_query/_query/sum.py @@ -0,0 +1,25 @@ +from collections import Callable +from typing import Union + +from cpl_query._helper import is_number +from cpl_query.exceptions import ExceptionArgument, ArgumentNoneException, InvalidTypeException +from cpl_query.extension.iterable_abc import IterableABC + + +def sum_query(_list: IterableABC, _func: Callable) -> Union[int, float, complex]: + if _list is None: + raise ArgumentNoneException(ExceptionArgument.list) + + if _func is None and not is_number(_list.type): + raise InvalidTypeException() + + result = 0 + for element in _list: + if _func is not None: + value = _func(element) + else: + value = element + + result += value + + return result diff --git a/src/cpl_query/extension/iterable_abc.py b/src/cpl_query/extension/iterable_abc.py index 4b8d65f1..673f6167 100644 --- a/src/cpl_query/extension/iterable_abc.py +++ b/src/cpl_query/extension/iterable_abc.py @@ -1,5 +1,5 @@ from abc import ABC, abstractmethod -from typing import Optional, Callable, Union +from typing import Optional, Callable, Union, Iterable class IterableABC(ABC, list): @@ -53,6 +53,10 @@ class IterableABC(ABC, list): @abstractmethod def element_at_or_default(self, index: int) -> Optional[any]: pass + def extend(self, __iterable: Iterable) -> None: + for value in __iterable: + self.append(value) + @abstractmethod def last(self) -> any: pass @@ -86,11 +90,26 @@ class IterableABC(ABC, list): @abstractmethod def single(self) -> any: pass - def to_list(self) -> list: - return list(self) - @abstractmethod def single_or_default(self) -> Optional[any]: pass + @abstractmethod + def skip(self, index: int) -> 'IterableABC': pass + + @abstractmethod + def skip_last(self, index: int) -> 'IterableABC': pass + + @abstractmethod + def sum(self, func: Callable = None) -> Union[int, float, complex]: pass + + @abstractmethod + def take(self, index: int) -> 'IterableABC': pass + + @abstractmethod + def take_last(self, index: int) -> 'IterableABC': pass + + def to_list(self) -> list: + return list(self) + @abstractmethod def where(self, func: Callable) -> 'IterableABC': pass diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 61cd1de9..aee2cf2b 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -204,6 +204,8 @@ class QueryTest(unittest.TestCase): s_res.sort(key=lambda user: user.address.nr) self.assertEqual(res2, s_res) + self.assertEqual(self._t_user, res.where(lambda u: u.address.nr == self._t_user.address.nr).single()) + def test_order_by_descending(self): res = self._tests.order_by_descending(lambda user: user.address.street) res2 = self._tests.order_by_descending(lambda user: user.address.nr) @@ -254,6 +256,50 @@ class QueryTest(unittest.TestCase): self.assertEqual(self._t_user, s_res) self.assertIsNone(sn_res) + def test_skip(self): + skipped = self._tests.skip(5) + + self.assertEqual(len(self._tests) - 5, len(skipped)) + self.assertEqual(self._tests[5:], skipped) + + def test_skip_last(self): + skipped = self._tests.skip_last(5) + + self.assertEqual(len(self._tests) - 5, len(skipped)) + self.assertEqual(self._tests[:-5], skipped) + self.assertEqual(self._tests[:-5][len(self._tests[:-5]) - 1], skipped.last()) + + def test_sum(self): + res = self._tests.sum(lambda u: u.address.nr) + + s_res = 0 + for user in self._tests: + s_res += user.address.nr + + self.assertEqual(s_res, res) + + tests = List(values=list(range(0, 100))) + self.assertEqual(0, tests.min()) + + def invalid(): + tests2 = List(str, ['hello', 'world']) + e_res = tests2.average() + + self.assertRaises(InvalidTypeException, invalid) + + def test_take(self): + skipped = self._tests.take(5) + + self.assertEqual(5, len(skipped)) + self.assertEqual(self._tests[:5], skipped) + + def test_take_last(self): + skipped = self._tests.take_last(5) + + self.assertEqual(5, len(skipped)) + self.assertEqual(self._tests[-5:], skipped) + self.assertEqual(self._tests[len(self._tests) - 1], skipped.last()) + def test_where(self): results = [] for user in self._tests: From b9499108d81272774ba8b8a984a0996e08bd02e3 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 2 Aug 2021 14:03:51 +0200 Subject: [PATCH 32/49] Build cpl_query --- src/cpl_query/__init__.py | 2 +- src/cpl_query/_extension/__init__.py | 2 +- src/cpl_query/_query/__init__.py | 2 +- src/cpl_query/cpl_query.json | 2 +- src/cpl_query/extension/__init__.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cpl_query/__init__.py b/src/cpl_query/__init__.py index 4c2a8ace..2d8f31b2 100644 --- a/src/cpl_query/__init__.py +++ b/src/cpl_query/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -cpl_query sh-edraft Common Python library Query +sh_cpl_query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries diff --git a/src/cpl_query/_extension/__init__.py b/src/cpl_query/_extension/__init__.py index be7ebebb..8afe588d 100644 --- a/src/cpl_query/_extension/__init__.py +++ b/src/cpl_query/_extension/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -cpl_query sh-edraft Common Python library Query +sh_cpl_query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries diff --git a/src/cpl_query/_query/__init__.py b/src/cpl_query/_query/__init__.py index d9873974..508ccbc1 100644 --- a/src/cpl_query/_query/__init__.py +++ b/src/cpl_query/_query/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -cpl_query sh-edraft Common Python library Query +sh_cpl_query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index c2d0a970..906af43b 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -1,6 +1,6 @@ { "ProjectSettings": { - "Name": "cpl_query", + "Name": "sh_cpl_query", "Version": { "Major": "2021", "Minor": "10", diff --git a/src/cpl_query/extension/__init__.py b/src/cpl_query/extension/__init__.py index 22693b99..8f1999c8 100644 --- a/src/cpl_query/extension/__init__.py +++ b/src/cpl_query/extension/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -cpl_query sh-edraft Common Python library Query +sh_cpl_query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries From ffaa5c4a2bfdf56513ea3d867f0621e29191df4f Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 2 Aug 2021 14:09:42 +0200 Subject: [PATCH 33/49] Refactoring --- src/cpl_query/tests/query_test.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index aee2cf2b..9efe8310 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -3,7 +3,7 @@ import unittest from random import randint from cpl.utils import String -from cpl_query.exceptions import InvalidTypeException, WrongTypeException, ArgumentNoneException +from cpl_query.exceptions import InvalidTypeException, ArgumentNoneException from cpl_query.extension.list import List from cpl_query.tests.models import User, Address @@ -160,8 +160,7 @@ class QueryTest(unittest.TestCase): def test_for_each(self): users = [] - self._tests.for_each( - lambda user: ( + self._tests.for_each(lambda user: ( users.append(user) ) ) From 6867eb0e65cd9bf5d3e9c786ee3c097f278e7cde Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 2 Aug 2021 14:14:50 +0200 Subject: [PATCH 34/49] Improved scripts --- scripts/build.sh | 12 ++++++++---- scripts/publish.sh | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index bccdac52..78e1e24c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,10 +2,14 @@ # activate venv source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate -# CLI -cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/ -cpl build - # CPL cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl +cpl build + +# CLI +cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_cli +cpl build + +# CPL Query +cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_query cpl build \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 341a279c..428a540f 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -2,10 +2,14 @@ # activate venv source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate -# CLI -cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/ -cpl publish - # CPL cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl -cpl publish \ No newline at end of file +cpl publish + +# CLI +cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_cli +cpl publish + +# CPL Query +cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_query +cpl \ No newline at end of file From e09a4402b3a449e4ed7c0df336dea0390bb7b670 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 2 Aug 2021 14:36:00 +0200 Subject: [PATCH 35/49] Published sh_cpl-query to version 2021.10.0rc1 --- notices/pip.txt | 15 +++++++++++++++ src/cpl_query/__init__.py | 6 +++--- src/cpl_query/_extension/__init__.py | 6 +++--- src/cpl_query/_query/__init__.py | 6 +++--- src/cpl_query/cpl_query.json | 10 +++++----- src/cpl_query/extension/__init__.py | 6 +++--- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/notices/pip.txt b/notices/pip.txt index fddb0076..6e6e9ab7 100644 --- a/notices/pip.txt +++ b/notices/pip.txt @@ -7,6 +7,10 @@ upload: twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/* twine upload -r pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/* + query: + twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/* + twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/* + exp: cpl: twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl/publish/setup/* @@ -16,6 +20,10 @@ upload: twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/* twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/* + query: + twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-query/publish/setup/* + twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-query/publish/setup/* + dev: cpl: twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl/publish/setup/* @@ -25,15 +33,22 @@ upload: twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/* twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/* + query: + twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/* + twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-query/publish/setup/* + install: prod: pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl-cli + pip install --extra-index-url https://pip.sh-edraft.de/ sh_cpl-query exp: pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl-cli + pip install --extra-index-url https://pip-exp.sh-edraft.de/ sh_cpl-query dev: pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl-cli + pip install --extra-index-url https://pip-dev.sh-edraft.de/ sh_cpl-query diff --git a/src/cpl_query/__init__.py b/src/cpl_query/__init__.py index 2d8f31b2..c4bb6465 100644 --- a/src/cpl_query/__init__.py +++ b/src/cpl_query/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl_query sh-edraft Common Python library Query +sh_cpl-query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries @@ -15,11 +15,11 @@ __title__ = 'cpl_query' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.3' +__version__ = '2021.10.0rc1' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='3') +version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') diff --git a/src/cpl_query/_extension/__init__.py b/src/cpl_query/_extension/__init__.py index 8afe588d..20b5dd05 100644 --- a/src/cpl_query/_extension/__init__.py +++ b/src/cpl_query/_extension/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl_query sh-edraft Common Python library Query +sh_cpl-query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries @@ -15,11 +15,11 @@ __title__ = 'cpl_query._extension' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.3' +__version__ = '2021.10.0rc1' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='3') +version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') diff --git a/src/cpl_query/_query/__init__.py b/src/cpl_query/_query/__init__.py index 508ccbc1..4eb1e489 100644 --- a/src/cpl_query/_query/__init__.py +++ b/src/cpl_query/_query/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl_query sh-edraft Common Python library Query +sh_cpl-query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries @@ -15,11 +15,11 @@ __title__ = 'cpl_query._query' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.3' +__version__ = '2021.10.0rc1' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='3') +version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index 906af43b..042aa616 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -1,10 +1,10 @@ { "ProjectSettings": { - "Name": "sh_cpl_query", + "Name": "sh_cpl-query", "Version": { "Major": "2021", "Minor": "10", - "Micro": "3" + "Micro": "0.rc1" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", @@ -26,9 +26,9 @@ "ProjectType": "library", "SourcePath": "", "OutputPath": "../../dist", - "Main": "cpl_query.main", - "EntryPoint": "cpl_query", - "IncludePackageData": false, + "Main": "", + "EntryPoint": "", + "IncludePackageData": true, "Included": [], "Excluded": [ "*/__pycache__", diff --git a/src/cpl_query/extension/__init__.py b/src/cpl_query/extension/__init__.py index 8f1999c8..21af0cd0 100644 --- a/src/cpl_query/extension/__init__.py +++ b/src/cpl_query/extension/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl_query sh-edraft Common Python library Query +sh_cpl-query sh-edraft Common Python library Query ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library Python integrated Queries @@ -15,11 +15,11 @@ __title__ = 'cpl_query.extension' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.3' +__version__ = '2021.10.0rc1' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='3') +version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') From c68224b31ab5bba6a1264ed9decefb0a063916e5 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 2 Aug 2021 14:48:46 +0200 Subject: [PATCH 36/49] Improved deps of cpl_query --- src/cpl_query/cpl_query.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index 042aa616..02ace14b 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -16,7 +16,7 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "sh_cpl==2021.4.0.post1" + "sh_cpl>=2021.4.0.post1" ], "PythonVersion": ">=3.9.2", "PythonPath": {}, From 63a67be0ee9b86ac9fad64ff79a55d5399d1accc Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 5 Aug 2021 13:27:08 +0200 Subject: [PATCH 37/49] Improved new command --- src/cpl_cli/command/new_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpl_cli/command/new_service.py b/src/cpl_cli/command/new_service.py index 8c19b346..ef1dec22 100644 --- a/src/cpl_cli/command/new_service.py +++ b/src/cpl_cli/command/new_service.py @@ -96,7 +96,7 @@ class NewService(CommandABC): ProjectSettingsNameEnum.license_name.value: '', ProjectSettingsNameEnum.license_description.value: '', ProjectSettingsNameEnum.dependencies.value: [ - f'sh_cpl=={version.parse(cpl.__version__)}' + f'sh_cpl>={version.parse(cpl.__version__)}' ], ProjectSettingsNameEnum.python_version.value: f'>={sys.version.split(" ")[0]}', ProjectSettingsNameEnum.python_path.value: { From 091c89df2c13f6645a8556222b69e5f5d7995393 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 5 Aug 2021 13:37:40 +0200 Subject: [PATCH 38/49] Changed version of CLI --- src/cpl_cli/__init__.py | 4 ++-- src/cpl_cli/_templates/__init__.py | 4 ++-- src/cpl_cli/_templates/build/__init__.py | 4 ++-- src/cpl_cli/_templates/generate/__init__.py | 4 ++-- src/cpl_cli/_templates/new/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/publish/__init__.py | 4 ++-- src/cpl_cli/command/__init__.py | 4 ++-- src/cpl_cli/configuration/__init__.py | 4 ++-- src/cpl_cli/cpl_cli.json | 2 +- src/cpl_cli/live_server/__init__.py | 4 ++-- src/cpl_cli/publish/__init__.py | 4 ++-- src/cpl_cli/source_creator/__init__.py | 4 ++-- 20 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/cpl_cli/__init__.py b/src/cpl_cli/__init__.py index 7af49608..64912d77 100644 --- a/src/cpl_cli/__init__.py +++ b/src/cpl_cli/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple @@ -29,4 +29,4 @@ from .main import main from .startup import Startup VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/__init__.py b/src/cpl_cli/_templates/__init__.py index b3432fda..2fe01cc2 100644 --- a/src/cpl_cli/_templates/__init__.py +++ b/src/cpl_cli/_templates/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/build/__init__.py b/src/cpl_cli/_templates/build/__init__.py index 2f641018..54b539ca 100644 --- a/src/cpl_cli/_templates/build/__init__.py +++ b/src/cpl_cli/_templates/build/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.build' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/generate/__init__.py b/src/cpl_cli/_templates/generate/__init__.py index a625e275..fca1363f 100644 --- a/src/cpl_cli/_templates/generate/__init__.py +++ b/src/cpl_cli/_templates/generate/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.generate' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/__init__.py b/src/cpl_cli/_templates/new/__init__.py index ded8c8ed..3d53f013 100644 --- a/src/cpl_cli/_templates/new/__init__.py +++ b/src/cpl_cli/_templates/new/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/console/__init__.py b/src/cpl_cli/_templates/new/console/__init__.py index 2ed4ea3c..f876b366 100644 --- a/src/cpl_cli/_templates/new/console/__init__.py +++ b/src/cpl_cli/_templates/new/console/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/console/source/__init__.py b/src/cpl_cli/_templates/new/console/source/__init__.py index a567a195..f868829b 100644 --- a/src/cpl_cli/_templates/new/console/source/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/console/source/name/__init__.py b/src/cpl_cli/_templates/new/console/source/name/__init__.py index 8200673b..11d99c4a 100644 --- a/src/cpl_cli/_templates/new/console/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/console/source/tests/__init__.py b/src/cpl_cli/_templates/new/console/source/tests/__init__.py index 551c83cb..eca63d58 100644 --- a/src/cpl_cli/_templates/new/console/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/library/__init__.py b/src/cpl_cli/_templates/new/library/__init__.py index 2c3ea082..d287ab7a 100644 --- a/src/cpl_cli/_templates/new/library/__init__.py +++ b/src/cpl_cli/_templates/new/library/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/library/source/__init__.py b/src/cpl_cli/_templates/new/library/source/__init__.py index da92f04f..88deb1dd 100644 --- a/src/cpl_cli/_templates/new/library/source/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/library/source/name/__init__.py b/src/cpl_cli/_templates/new/library/source/name/__init__.py index f6edde16..8443389e 100644 --- a/src/cpl_cli/_templates/new/library/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/new/library/source/tests/__init__.py b/src/cpl_cli/_templates/new/library/source/tests/__init__.py index 509ba102..fd5bb865 100644 --- a/src/cpl_cli/_templates/new/library/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/_templates/publish/__init__.py b/src/cpl_cli/_templates/publish/__init__.py index ef3ffab3..bb935dac 100644 --- a/src/cpl_cli/_templates/publish/__init__.py +++ b/src/cpl_cli/_templates/publish/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/command/__init__.py b/src/cpl_cli/command/__init__.py index ca2ad5c7..0a470088 100644 --- a/src/cpl_cli/command/__init__.py +++ b/src/cpl_cli/command/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple @@ -28,4 +28,4 @@ from .publish_service import PublishService from .version_service import VersionService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/configuration/__init__.py b/src/cpl_cli/configuration/__init__.py index 856d8c5d..2b3e605b 100644 --- a/src/cpl_cli/configuration/__init__.py +++ b/src/cpl_cli/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple @@ -30,4 +30,4 @@ from .workspace_settings import WorkspaceSettings from .workspace_settings_name_enum import WorkspaceSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/cpl_cli.json b/src/cpl_cli/cpl_cli.json index ace3e1c0..46146adf 100644 --- a/src/cpl_cli/cpl_cli.json +++ b/src/cpl_cli/cpl_cli.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "2" + "Micro": "5" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_cli/live_server/__init__.py b/src/cpl_cli/live_server/__init__.py index c414dac3..8fc495c2 100644 --- a/src/cpl_cli/live_server/__init__.py +++ b/src/cpl_cli/live_server/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/publish/__init__.py b/src/cpl_cli/publish/__init__.py index b62f9083..9cffddd8 100644 --- a/src/cpl_cli/publish/__init__.py +++ b/src/cpl_cli/publish/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple @@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC from .publisher_service import PublisherService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') diff --git a/src/cpl_cli/source_creator/__init__.py b/src/cpl_cli/source_creator/__init__.py index 4c8d75f1..9375819d 100644 --- a/src/cpl_cli/source_creator/__init__.py +++ b/src/cpl_cli/source_creator/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.source_creator' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.2' +__version__ = '2021.10.5' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='2') +version_info = VersionInfo(major='2021', minor='10', micro='5') From c12ff4f9e36b7d186a61b9c6f3abfe8d9ecd4edc Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 5 Aug 2021 14:02:00 +0200 Subject: [PATCH 39/49] Added logic to migrate attributes from workspace and project settings --- src/cpl_cli/configuration/build_settings.py | 6 +++++- src/cpl_cli/configuration/project_settings.py | 6 +++++- src/cpl_cli/configuration/workspace_settings.py | 6 +++++- src/tests/custom/general/src/general/general.json | 5 +++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/cpl_cli/configuration/build_settings.py b/src/cpl_cli/configuration/build_settings.py index 167db345..37e3662a 100644 --- a/src/cpl_cli/configuration/build_settings.py +++ b/src/cpl_cli/configuration/build_settings.py @@ -76,7 +76,11 @@ class BuildSettings(ConfigurationModelABC): self._included = settings[BuildSettingsNameEnum.included.value] self._excluded = settings[BuildSettingsNameEnum.excluded.value] self._package_data = settings[BuildSettingsNameEnum.package_data.value] - self._project_references = settings[BuildSettingsNameEnum.project_references.value] + + if BuildSettingsNameEnum.project_references.value in settings: + self._project_references = settings[BuildSettingsNameEnum.project_references.value] + else: + self._project_references = [] if sys.platform == 'win32': self._source_path = str(self._source_path).replace('/', '\\') diff --git a/src/cpl_cli/configuration/project_settings.py b/src/cpl_cli/configuration/project_settings.py index d9e8413b..3f8f0fcc 100644 --- a/src/cpl_cli/configuration/project_settings.py +++ b/src/cpl_cli/configuration/project_settings.py @@ -127,7 +127,11 @@ class ProjectSettings(ConfigurationModelABC): self._python_executable = path - self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value] + if ProjectSettingsNameEnum.classifiers.value: + self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value] + else: + self._classifiers = [] + except Exception as e: Console.set_foreground_color(ForegroundColorEnum.red) Console.write_line( diff --git a/src/cpl_cli/configuration/workspace_settings.py b/src/cpl_cli/configuration/workspace_settings.py index 2b358218..4d51736a 100644 --- a/src/cpl_cli/configuration/workspace_settings.py +++ b/src/cpl_cli/configuration/workspace_settings.py @@ -31,7 +31,11 @@ class WorkspaceSettings(ConfigurationModelABC): try: self._default_project = settings[WorkspaceSettingsNameEnum.default_project.value] self._projects = settings[WorkspaceSettingsNameEnum.projects.value] - self._scripts = settings[WorkspaceSettingsNameEnum.scripts.value] + + if WorkspaceSettingsNameEnum.scripts.value in settings: + self._scripts = settings[WorkspaceSettingsNameEnum.scripts.value] + else: + self._scripts = {} except Exception as e: Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings') Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}') diff --git a/src/tests/custom/general/src/general/general.json b/src/tests/custom/general/src/general/general.json index 8c2aee2a..6bed03dd 100644 --- a/src/tests/custom/general/src/general/general.json +++ b/src/tests/custom/general/src/general/general.json @@ -16,7 +16,7 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "sh_cpl==2021.4.dev1" + "sh_cpl==2021.4.0.post2" ], "PythonVersion": ">=3.8", "PythonPath": { @@ -40,6 +40,7 @@ "*/logs", "*/tests" ], - "PackageData": {} + "PackageData": {}, + "ProjectReferences": [] } } \ No newline at end of file From 11241d8f993d41584127c4588c0286eed6ec00bd Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 5 Aug 2021 14:17:38 +0200 Subject: [PATCH 40/49] Renamed project --- cpl-workspace.json | 2 +- scripts/build.sh | 2 +- scripts/create_docs.sh | 2 +- scripts/publish.sh | 2 +- src/{cpl => cpl_core}/__init__.py | 8 ++++---- src/{cpl => cpl_core}/application/__init__.py | 8 ++++---- src/{cpl => cpl_core}/application/application_abc.py | 0 src/{cpl => cpl_core}/application/application_builder.py | 0 .../application/application_builder_abc.py | 0 src/{cpl => cpl_core}/application/startup_abc.py | 0 src/{cpl => cpl_core}/configuration/__init__.py | 8 ++++---- src/{cpl => cpl_core}/configuration/configuration.py | 0 src/{cpl => cpl_core}/configuration/configuration_abc.py | 0 .../configuration/configuration_model_abc.py | 0 .../configuration/configuration_variable_name_enum.py | 0 src/{cpl => cpl_core}/configuration/console_argument.py | 0 src/{cpl => cpl_core}/console/__init__.py | 8 ++++---- src/{cpl => cpl_core}/console/background_color_enum.py | 0 src/{cpl => cpl_core}/console/console.py | 0 src/{cpl => cpl_core}/console/console_call.py | 0 src/{cpl => cpl_core}/console/foreground_color_enum.py | 0 src/{cpl => cpl_core}/console/spinner_thread.py | 0 src/{cpl/cpl.json => cpl_core/cpl_core.json} | 6 +++--- src/{cpl => cpl_core}/database/__init__.py | 8 ++++---- src/{cpl => cpl_core}/database/connection/__init__.py | 8 ++++---- .../database/connection/database_connection.py | 0 .../database/connection/database_connection_abc.py | 0 src/{cpl => cpl_core}/database/context/__init__.py | 8 ++++---- .../database/context/database_context.py | 0 .../database/context/database_context_abc.py | 0 src/{cpl => cpl_core}/database/database_model.py | 0 src/{cpl => cpl_core}/database/database_settings.py | 0 .../database/database_settings_name_enum.py | 0 src/{cpl => cpl_core}/dependency_injection/__init__.py | 8 ++++---- .../dependency_injection/service_collection.py | 0 .../dependency_injection/service_collection_abc.py | 0 .../dependency_injection/service_descriptor.py | 0 .../dependency_injection/service_lifetime_enum.py | 0 .../dependency_injection/service_provider.py | 0 .../dependency_injection/service_provider_abc.py | 0 src/{cpl => cpl_core}/environment/__init__.py | 8 ++++---- .../environment/application_environment.py | 0 .../environment/application_environment_abc.py | 0 .../environment/environment_name_enum.py | 0 src/{cpl => cpl_core}/logging/__init__.py | 8 ++++---- src/{cpl => cpl_core}/logging/logger_abc.py | 0 src/{cpl => cpl_core}/logging/logger_service.py | 0 src/{cpl => cpl_core}/logging/logging_level_enum.py | 0 src/{cpl => cpl_core}/logging/logging_settings.py | 0 .../logging/logging_settings_name_enum.py | 0 src/{cpl => cpl_core}/mailing/__init__.py | 8 ++++---- src/{cpl => cpl_core}/mailing/email.py | 0 src/{cpl => cpl_core}/mailing/email_client_abc.py | 0 src/{cpl => cpl_core}/mailing/email_client_service.py | 0 src/{cpl => cpl_core}/mailing/email_client_settings.py | 0 .../mailing/email_client_settings_name_enum.py | 0 src/{cpl => cpl_core}/time/__init__.py | 8 ++++---- src/{cpl => cpl_core}/time/time_format_settings.py | 0 .../time/time_format_settings_names_enum.py | 0 src/{cpl => cpl_core}/utils/__init__.py | 8 ++++---- src/{cpl => cpl_core}/utils/credential_manager.py | 0 src/{cpl => cpl_core}/utils/pip.py | 0 src/{cpl => cpl_core}/utils/string.py | 0 63 files changed, 59 insertions(+), 59 deletions(-) rename src/{cpl => cpl_core}/__init__.py (71%) rename src/{cpl => cpl_core}/application/__init__.py (77%) rename src/{cpl => cpl_core}/application/application_abc.py (100%) rename src/{cpl => cpl_core}/application/application_builder.py (100%) rename src/{cpl => cpl_core}/application/application_builder_abc.py (100%) rename src/{cpl => cpl_core}/application/startup_abc.py (100%) rename src/{cpl => cpl_core}/configuration/__init__.py (79%) rename src/{cpl => cpl_core}/configuration/configuration.py (100%) rename src/{cpl => cpl_core}/configuration/configuration_abc.py (100%) rename src/{cpl => cpl_core}/configuration/configuration_model_abc.py (100%) rename src/{cpl => cpl_core}/configuration/configuration_variable_name_enum.py (100%) rename src/{cpl => cpl_core}/configuration/console_argument.py (100%) rename src/{cpl => cpl_core}/console/__init__.py (78%) rename src/{cpl => cpl_core}/console/background_color_enum.py (100%) rename src/{cpl => cpl_core}/console/console.py (100%) rename src/{cpl => cpl_core}/console/console_call.py (100%) rename src/{cpl => cpl_core}/console/foreground_color_enum.py (100%) rename src/{cpl => cpl_core}/console/spinner_thread.py (100%) rename src/{cpl/cpl.json => cpl_core/cpl_core.json} (94%) rename src/{cpl => cpl_core}/database/__init__.py (76%) rename src/{cpl => cpl_core}/database/connection/__init__.py (73%) rename src/{cpl => cpl_core}/database/connection/database_connection.py (100%) rename src/{cpl => cpl_core}/database/connection/database_connection_abc.py (100%) rename src/{cpl => cpl_core}/database/context/__init__.py (73%) rename src/{cpl => cpl_core}/database/context/database_context.py (100%) rename src/{cpl => cpl_core}/database/context/database_context_abc.py (100%) rename src/{cpl => cpl_core}/database/database_model.py (100%) rename src/{cpl => cpl_core}/database/database_settings.py (100%) rename src/{cpl => cpl_core}/database/database_settings_name_enum.py (100%) rename src/{cpl => cpl_core}/dependency_injection/__init__.py (79%) rename src/{cpl => cpl_core}/dependency_injection/service_collection.py (100%) rename src/{cpl => cpl_core}/dependency_injection/service_collection_abc.py (100%) rename src/{cpl => cpl_core}/dependency_injection/service_descriptor.py (100%) rename src/{cpl => cpl_core}/dependency_injection/service_lifetime_enum.py (100%) rename src/{cpl => cpl_core}/dependency_injection/service_provider.py (100%) rename src/{cpl => cpl_core}/dependency_injection/service_provider_abc.py (100%) rename src/{cpl => cpl_core}/environment/__init__.py (77%) rename src/{cpl => cpl_core}/environment/application_environment.py (100%) rename src/{cpl => cpl_core}/environment/application_environment_abc.py (100%) rename src/{cpl => cpl_core}/environment/environment_name_enum.py (100%) rename src/{cpl => cpl_core}/logging/__init__.py (78%) rename src/{cpl => cpl_core}/logging/logger_abc.py (100%) rename src/{cpl => cpl_core}/logging/logger_service.py (100%) rename src/{cpl => cpl_core}/logging/logging_level_enum.py (100%) rename src/{cpl => cpl_core}/logging/logging_settings.py (100%) rename src/{cpl => cpl_core}/logging/logging_settings_name_enum.py (100%) rename src/{cpl => cpl_core}/mailing/__init__.py (79%) rename src/{cpl => cpl_core}/mailing/email.py (100%) rename src/{cpl => cpl_core}/mailing/email_client_abc.py (100%) rename src/{cpl => cpl_core}/mailing/email_client_service.py (100%) rename src/{cpl => cpl_core}/mailing/email_client_settings.py (100%) rename src/{cpl => cpl_core}/mailing/email_client_settings_name_enum.py (100%) rename src/{cpl => cpl_core}/time/__init__.py (76%) rename src/{cpl => cpl_core}/time/time_format_settings.py (100%) rename src/{cpl => cpl_core}/time/time_format_settings_names_enum.py (100%) rename src/{cpl => cpl_core}/utils/__init__.py (75%) rename src/{cpl => cpl_core}/utils/credential_manager.py (100%) rename src/{cpl => cpl_core}/utils/pip.py (100%) rename src/{cpl => cpl_core}/utils/string.py (100%) diff --git a/cpl-workspace.json b/cpl-workspace.json index a8752234..b7e6637a 100644 --- a/cpl-workspace.json +++ b/cpl-workspace.json @@ -2,7 +2,7 @@ "WorkspaceSettings": { "DefaultProject": "cpl_cli", "Projects": { - "cpl": "src/cpl/cpl.json", + "cpl_core": "src/cpl_core/cpl_core.json", "cpl_cli": "src/cpl_cli/cpl_cli.json", "cpl_query": "src/cpl_query/cpl_query.json" }, diff --git a/scripts/build.sh b/scripts/build.sh index 78e1e24c..5599dad4 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -3,7 +3,7 @@ source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate # CPL -cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl +cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_core cpl build # CLI diff --git a/scripts/create_docs.sh b/scripts/create_docs.sh index e59faeab..ea3d0d8f 100755 --- a/scripts/create_docs.sh +++ b/scripts/create_docs.sh @@ -1,6 +1,6 @@ #!/bin/bash cd ../docs/ -sphinx-apidoc -o source/ ../src/cpl +sphinx-apidoc -o source/ ../src/cpl_core make clean make html; \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 428a540f..b1309515 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -3,7 +3,7 @@ source /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/cpl-env/bin/activate # CPL -cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl +cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_core cpl publish # CLI diff --git a/src/cpl/__init__.py b/src/cpl_core/__init__.py similarity index 71% rename from src/cpl/__init__.py rename to src/cpl_core/__init__.py index 5f00f458..ddc0f8c3 100644 --- a/src/cpl/__init__.py +++ b/src/cpl_core/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,15 +11,15 @@ sh-edraft Common Python library """ -__title__ = 'cpl' +__title__ = 'cpl_core' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/application/__init__.py b/src/cpl_core/application/__init__.py similarity index 77% rename from src/cpl/application/__init__.py rename to src/cpl_core/application/__init__.py index ad9e6f8e..13b0cd96 100644 --- a/src/cpl/application/__init__.py +++ b/src/cpl_core/application/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.application' +__title__ = 'cpl_core.application' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -26,4 +26,4 @@ from .application_builder_abc import ApplicationBuilderABC from .startup_abc import StartupABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/application/application_abc.py b/src/cpl_core/application/application_abc.py similarity index 100% rename from src/cpl/application/application_abc.py rename to src/cpl_core/application/application_abc.py diff --git a/src/cpl/application/application_builder.py b/src/cpl_core/application/application_builder.py similarity index 100% rename from src/cpl/application/application_builder.py rename to src/cpl_core/application/application_builder.py diff --git a/src/cpl/application/application_builder_abc.py b/src/cpl_core/application/application_builder_abc.py similarity index 100% rename from src/cpl/application/application_builder_abc.py rename to src/cpl_core/application/application_builder_abc.py diff --git a/src/cpl/application/startup_abc.py b/src/cpl_core/application/startup_abc.py similarity index 100% rename from src/cpl/application/startup_abc.py rename to src/cpl_core/application/startup_abc.py diff --git a/src/cpl/configuration/__init__.py b/src/cpl_core/configuration/__init__.py similarity index 79% rename from src/cpl/configuration/__init__.py rename to src/cpl_core/configuration/__init__.py index 9646702a..97878f36 100644 --- a/src/cpl/configuration/__init__.py +++ b/src/cpl_core/configuration/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.configuration' +__title__ = 'cpl_core.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -27,4 +27,4 @@ from .configuration_variable_name_enum import ConfigurationVariableNameEnum from .console_argument import ConsoleArgument VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/configuration/configuration.py b/src/cpl_core/configuration/configuration.py similarity index 100% rename from src/cpl/configuration/configuration.py rename to src/cpl_core/configuration/configuration.py diff --git a/src/cpl/configuration/configuration_abc.py b/src/cpl_core/configuration/configuration_abc.py similarity index 100% rename from src/cpl/configuration/configuration_abc.py rename to src/cpl_core/configuration/configuration_abc.py diff --git a/src/cpl/configuration/configuration_model_abc.py b/src/cpl_core/configuration/configuration_model_abc.py similarity index 100% rename from src/cpl/configuration/configuration_model_abc.py rename to src/cpl_core/configuration/configuration_model_abc.py diff --git a/src/cpl/configuration/configuration_variable_name_enum.py b/src/cpl_core/configuration/configuration_variable_name_enum.py similarity index 100% rename from src/cpl/configuration/configuration_variable_name_enum.py rename to src/cpl_core/configuration/configuration_variable_name_enum.py diff --git a/src/cpl/configuration/console_argument.py b/src/cpl_core/configuration/console_argument.py similarity index 100% rename from src/cpl/configuration/console_argument.py rename to src/cpl_core/configuration/console_argument.py diff --git a/src/cpl/console/__init__.py b/src/cpl_core/console/__init__.py similarity index 78% rename from src/cpl/console/__init__.py rename to src/cpl_core/console/__init__.py index 86577a82..9cfd5902 100644 --- a/src/cpl/console/__init__.py +++ b/src/cpl_core/console/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.console' +__title__ = 'cpl_core.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum from .spinner_thread import SpinnerThread VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/console/background_color_enum.py b/src/cpl_core/console/background_color_enum.py similarity index 100% rename from src/cpl/console/background_color_enum.py rename to src/cpl_core/console/background_color_enum.py diff --git a/src/cpl/console/console.py b/src/cpl_core/console/console.py similarity index 100% rename from src/cpl/console/console.py rename to src/cpl_core/console/console.py diff --git a/src/cpl/console/console_call.py b/src/cpl_core/console/console_call.py similarity index 100% rename from src/cpl/console/console_call.py rename to src/cpl_core/console/console_call.py diff --git a/src/cpl/console/foreground_color_enum.py b/src/cpl_core/console/foreground_color_enum.py similarity index 100% rename from src/cpl/console/foreground_color_enum.py rename to src/cpl_core/console/foreground_color_enum.py diff --git a/src/cpl/console/spinner_thread.py b/src/cpl_core/console/spinner_thread.py similarity index 100% rename from src/cpl/console/spinner_thread.py rename to src/cpl_core/console/spinner_thread.py diff --git a/src/cpl/cpl.json b/src/cpl_core/cpl_core.json similarity index 94% rename from src/cpl/cpl.json rename to src/cpl_core/cpl_core.json index 62bdf62d..42f8aebb 100644 --- a/src/cpl/cpl.json +++ b/src/cpl_core/cpl_core.json @@ -1,10 +1,10 @@ { "ProjectSettings": { - "Name": "sh_cpl", + "Name": "sh_cpl-core", "Version": { "Major": "2021", - "Minor": "4", - "Micro": "0.post2" + "Minor": "10", + "Micro": "6" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl/database/__init__.py b/src/cpl_core/database/__init__.py similarity index 76% rename from src/cpl/database/__init__.py rename to src/cpl_core/database/__init__.py index da47460c..c518b55a 100644 --- a/src/cpl/database/__init__.py +++ b/src/cpl_core/database/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.database' +__title__ = 'cpl_core.database' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings from .database_settings_name_enum import DatabaseSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/database/connection/__init__.py b/src/cpl_core/database/connection/__init__.py similarity index 73% rename from src/cpl/database/connection/__init__.py rename to src/cpl_core/database/connection/__init__.py index 78da6595..5bcdbc93 100644 --- a/src/cpl/database/connection/__init__.py +++ b/src/cpl_core/database/connection/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.database.connection' +__title__ = 'cpl_core.database.connection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection from .database_connection_abc import DatabaseConnectionABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/database/connection/database_connection.py b/src/cpl_core/database/connection/database_connection.py similarity index 100% rename from src/cpl/database/connection/database_connection.py rename to src/cpl_core/database/connection/database_connection.py diff --git a/src/cpl/database/connection/database_connection_abc.py b/src/cpl_core/database/connection/database_connection_abc.py similarity index 100% rename from src/cpl/database/connection/database_connection_abc.py rename to src/cpl_core/database/connection/database_connection_abc.py diff --git a/src/cpl/database/context/__init__.py b/src/cpl_core/database/context/__init__.py similarity index 73% rename from src/cpl/database/context/__init__.py rename to src/cpl_core/database/context/__init__.py index b593a1b7..721d67e2 100644 --- a/src/cpl/database/context/__init__.py +++ b/src/cpl_core/database/context/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.database.context' +__title__ = 'cpl_core.database.context' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_context import DatabaseContext from .database_context_abc import DatabaseContextABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/database/context/database_context.py b/src/cpl_core/database/context/database_context.py similarity index 100% rename from src/cpl/database/context/database_context.py rename to src/cpl_core/database/context/database_context.py diff --git a/src/cpl/database/context/database_context_abc.py b/src/cpl_core/database/context/database_context_abc.py similarity index 100% rename from src/cpl/database/context/database_context_abc.py rename to src/cpl_core/database/context/database_context_abc.py diff --git a/src/cpl/database/database_model.py b/src/cpl_core/database/database_model.py similarity index 100% rename from src/cpl/database/database_model.py rename to src/cpl_core/database/database_model.py diff --git a/src/cpl/database/database_settings.py b/src/cpl_core/database/database_settings.py similarity index 100% rename from src/cpl/database/database_settings.py rename to src/cpl_core/database/database_settings.py diff --git a/src/cpl/database/database_settings_name_enum.py b/src/cpl_core/database/database_settings_name_enum.py similarity index 100% rename from src/cpl/database/database_settings_name_enum.py rename to src/cpl_core/database/database_settings_name_enum.py diff --git a/src/cpl/dependency_injection/__init__.py b/src/cpl_core/dependency_injection/__init__.py similarity index 79% rename from src/cpl/dependency_injection/__init__.py rename to src/cpl_core/dependency_injection/__init__.py index 02faf19c..68a9e192 100644 --- a/src/cpl/dependency_injection/__init__.py +++ b/src/cpl_core/dependency_injection/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.dependency_injection' +__title__ = 'cpl_core.dependency_injection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -28,4 +28,4 @@ from .service_provider import ServiceProvider from .service_provider_abc import ServiceProviderABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/dependency_injection/service_collection.py b/src/cpl_core/dependency_injection/service_collection.py similarity index 100% rename from src/cpl/dependency_injection/service_collection.py rename to src/cpl_core/dependency_injection/service_collection.py diff --git a/src/cpl/dependency_injection/service_collection_abc.py b/src/cpl_core/dependency_injection/service_collection_abc.py similarity index 100% rename from src/cpl/dependency_injection/service_collection_abc.py rename to src/cpl_core/dependency_injection/service_collection_abc.py diff --git a/src/cpl/dependency_injection/service_descriptor.py b/src/cpl_core/dependency_injection/service_descriptor.py similarity index 100% rename from src/cpl/dependency_injection/service_descriptor.py rename to src/cpl_core/dependency_injection/service_descriptor.py diff --git a/src/cpl/dependency_injection/service_lifetime_enum.py b/src/cpl_core/dependency_injection/service_lifetime_enum.py similarity index 100% rename from src/cpl/dependency_injection/service_lifetime_enum.py rename to src/cpl_core/dependency_injection/service_lifetime_enum.py diff --git a/src/cpl/dependency_injection/service_provider.py b/src/cpl_core/dependency_injection/service_provider.py similarity index 100% rename from src/cpl/dependency_injection/service_provider.py rename to src/cpl_core/dependency_injection/service_provider.py diff --git a/src/cpl/dependency_injection/service_provider_abc.py b/src/cpl_core/dependency_injection/service_provider_abc.py similarity index 100% rename from src/cpl/dependency_injection/service_provider_abc.py rename to src/cpl_core/dependency_injection/service_provider_abc.py diff --git a/src/cpl/environment/__init__.py b/src/cpl_core/environment/__init__.py similarity index 77% rename from src/cpl/environment/__init__.py rename to src/cpl_core/environment/__init__.py index 1be12aa5..6518878b 100644 --- a/src/cpl/environment/__init__.py +++ b/src/cpl_core/environment/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.environment' +__title__ = 'cpl_core.environment' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -25,4 +25,4 @@ from .environment_name_enum import EnvironmentNameEnum from .application_environment import ApplicationEnvironment VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/environment/application_environment.py b/src/cpl_core/environment/application_environment.py similarity index 100% rename from src/cpl/environment/application_environment.py rename to src/cpl_core/environment/application_environment.py diff --git a/src/cpl/environment/application_environment_abc.py b/src/cpl_core/environment/application_environment_abc.py similarity index 100% rename from src/cpl/environment/application_environment_abc.py rename to src/cpl_core/environment/application_environment_abc.py diff --git a/src/cpl/environment/environment_name_enum.py b/src/cpl_core/environment/environment_name_enum.py similarity index 100% rename from src/cpl/environment/environment_name_enum.py rename to src/cpl_core/environment/environment_name_enum.py diff --git a/src/cpl/logging/__init__.py b/src/cpl_core/logging/__init__.py similarity index 78% rename from src/cpl/logging/__init__.py rename to src/cpl_core/logging/__init__.py index 4a6ac554..9a930d78 100644 --- a/src/cpl/logging/__init__.py +++ b/src/cpl_core/logging/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.logging' +__title__ = 'cpl_core.logging' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -27,4 +27,4 @@ from .logging_settings import LoggingSettings from .logging_settings_name_enum import LoggingSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/logging/logger_abc.py b/src/cpl_core/logging/logger_abc.py similarity index 100% rename from src/cpl/logging/logger_abc.py rename to src/cpl_core/logging/logger_abc.py diff --git a/src/cpl/logging/logger_service.py b/src/cpl_core/logging/logger_service.py similarity index 100% rename from src/cpl/logging/logger_service.py rename to src/cpl_core/logging/logger_service.py diff --git a/src/cpl/logging/logging_level_enum.py b/src/cpl_core/logging/logging_level_enum.py similarity index 100% rename from src/cpl/logging/logging_level_enum.py rename to src/cpl_core/logging/logging_level_enum.py diff --git a/src/cpl/logging/logging_settings.py b/src/cpl_core/logging/logging_settings.py similarity index 100% rename from src/cpl/logging/logging_settings.py rename to src/cpl_core/logging/logging_settings.py diff --git a/src/cpl/logging/logging_settings_name_enum.py b/src/cpl_core/logging/logging_settings_name_enum.py similarity index 100% rename from src/cpl/logging/logging_settings_name_enum.py rename to src/cpl_core/logging/logging_settings_name_enum.py diff --git a/src/cpl/mailing/__init__.py b/src/cpl_core/mailing/__init__.py similarity index 79% rename from src/cpl/mailing/__init__.py rename to src/cpl_core/mailing/__init__.py index 3e945b74..8ea20cfa 100644 --- a/src/cpl/mailing/__init__.py +++ b/src/cpl_core/mailing/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.mailing' +__title__ = 'cpl_core.mailing' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -27,4 +27,4 @@ from .email_client_settings import EMailClientSettings from .email_client_settings_name_enum import EMailClientSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/mailing/email.py b/src/cpl_core/mailing/email.py similarity index 100% rename from src/cpl/mailing/email.py rename to src/cpl_core/mailing/email.py diff --git a/src/cpl/mailing/email_client_abc.py b/src/cpl_core/mailing/email_client_abc.py similarity index 100% rename from src/cpl/mailing/email_client_abc.py rename to src/cpl_core/mailing/email_client_abc.py diff --git a/src/cpl/mailing/email_client_service.py b/src/cpl_core/mailing/email_client_service.py similarity index 100% rename from src/cpl/mailing/email_client_service.py rename to src/cpl_core/mailing/email_client_service.py diff --git a/src/cpl/mailing/email_client_settings.py b/src/cpl_core/mailing/email_client_settings.py similarity index 100% rename from src/cpl/mailing/email_client_settings.py rename to src/cpl_core/mailing/email_client_settings.py diff --git a/src/cpl/mailing/email_client_settings_name_enum.py b/src/cpl_core/mailing/email_client_settings_name_enum.py similarity index 100% rename from src/cpl/mailing/email_client_settings_name_enum.py rename to src/cpl_core/mailing/email_client_settings_name_enum.py diff --git a/src/cpl/time/__init__.py b/src/cpl_core/time/__init__.py similarity index 76% rename from src/cpl/time/__init__.py rename to src/cpl_core/time/__init__.py index 644d91c8..8ba3b612 100644 --- a/src/cpl/time/__init__.py +++ b/src/cpl_core/time/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.time' +__title__ = 'cpl_core.time' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -24,4 +24,4 @@ from .time_format_settings import TimeFormatSettings from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/time/time_format_settings.py b/src/cpl_core/time/time_format_settings.py similarity index 100% rename from src/cpl/time/time_format_settings.py rename to src/cpl_core/time/time_format_settings.py diff --git a/src/cpl/time/time_format_settings_names_enum.py b/src/cpl_core/time/time_format_settings_names_enum.py similarity index 100% rename from src/cpl/time/time_format_settings_names_enum.py rename to src/cpl_core/time/time_format_settings_names_enum.py diff --git a/src/cpl/utils/__init__.py b/src/cpl_core/utils/__init__.py similarity index 75% rename from src/cpl/utils/__init__.py rename to src/cpl_core/utils/__init__.py index 85dc95fd..14e1d114 100644 --- a/src/cpl/utils/__init__.py +++ b/src/cpl_core/utils/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -sh_cpl sh-edraft Common Python library +sh_cpl-core sh-edraft Common Python library ~~~~~~~~~~~~~~~~~~~ sh-edraft Common Python library @@ -11,11 +11,11 @@ sh-edraft Common Python library """ -__title__ = 'cpl.utils' +__title__ = 'cpl_core.utils' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.4.0.post2' +__version__ = '2021.10.6' from collections import namedtuple @@ -25,4 +25,4 @@ from .string import String from .pip import Pip VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='4', micro='0.post2') +version_info = VersionInfo(major='2021', minor='10', micro='6') diff --git a/src/cpl/utils/credential_manager.py b/src/cpl_core/utils/credential_manager.py similarity index 100% rename from src/cpl/utils/credential_manager.py rename to src/cpl_core/utils/credential_manager.py diff --git a/src/cpl/utils/pip.py b/src/cpl_core/utils/pip.py similarity index 100% rename from src/cpl/utils/pip.py rename to src/cpl_core/utils/pip.py diff --git a/src/cpl/utils/string.py b/src/cpl_core/utils/string.py similarity index 100% rename from src/cpl/utils/string.py rename to src/cpl_core/utils/string.py From cac80657df22fbaaa8b62246b3af10b3bd7d1131 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 5 Aug 2021 14:21:42 +0200 Subject: [PATCH 41/49] Renamed cpl to cpl_core --- docs/build/html/_sources/quickstart.md.txt | 4 ++-- docs/source/quickstart.md | 4 ++-- .../_templates/generate/abc_template.py | 2 +- .../_templates/generate/class_template.py | 2 +- .../generate/configmodel_template.py | 6 ++--- .../_templates/generate/enum_template.py | 2 +- .../_templates/generate/init_template.py | 2 +- .../_templates/generate/service_template.py | 2 +- .../_templates/generate/thread_template.py | 2 +- .../new/console/source/name/application.py | 8 +++---- .../new/console/source/name/main.py | 14 ++++++------ .../new/console/source/name/startup.py | 6 ++--- .../new/library/source/name/application.py | 8 +++---- .../new/library/source/name/main.py | 12 +++++----- .../new/library/source/name/startup.py | 6 ++--- src/cpl_cli/cli.py | 10 ++++----- src/cpl_cli/cli_settings.py | 4 ++-- src/cpl_cli/command/add_service.py | 6 ++--- src/cpl_cli/command/custom_script_service.py | 4 ++-- src/cpl_cli/command/generate_service.py | 8 +++---- src/cpl_cli/command/help_service.py | 6 ++--- src/cpl_cli/command/install_service.py | 10 ++++----- src/cpl_cli/command/new_service.py | 12 +++++----- src/cpl_cli/command/remove_service.py | 8 +++---- src/cpl_cli/command/uninstall_service.py | 10 ++++----- src/cpl_cli/command/update_service.py | 10 ++++----- src/cpl_cli/command/version_service.py | 8 +++---- src/cpl_cli/command_handler_service.py | 8 +++---- src/cpl_cli/configuration/build_settings.py | 6 ++--- src/cpl_cli/configuration/project_settings.py | 6 ++--- src/cpl_cli/configuration/version_settings.py | 2 +- .../configuration/workspace_settings.py | 4 ++-- src/cpl_cli/error.py | 4 ++-- .../live_server/live_server_service.py | 4 ++-- src/cpl_cli/live_server/live_server_thread.py | 6 ++--- src/cpl_cli/main.py | 2 +- src/cpl_cli/publish/publisher_service.py | 8 +++---- src/cpl_cli/source_creator/console_builder.py | 6 ++--- src/cpl_cli/source_creator/library_builder.py | 6 ++--- src/cpl_cli/startup.py | 10 ++++----- src/cpl_core/application/application_abc.py | 8 +++---- .../application/application_builder.py | 10 ++++----- .../application/application_builder_abc.py | 4 ++-- src/cpl_core/application/startup_abc.py | 4 ++-- src/cpl_core/configuration/configuration.py | 18 +++++++-------- .../configuration/configuration_abc.py | 6 ++--- src/cpl_core/console/console.py | 8 +++---- src/cpl_core/console/spinner_thread.py | 4 ++-- .../connection/database_connection.py | 8 +++---- .../database/context/database_context.py | 14 ++++++------ src/cpl_core/database/database_settings.py | 8 +++---- .../service_collection.py | 22 +++++++++---------- .../service_collection_abc.py | 6 ++--- .../service_descriptor.py | 2 +- .../dependency_injection/service_provider.py | 14 ++++++------ .../environment/application_environment.py | 4 ++-- src/cpl_core/logging/logger_service.py | 14 ++++++------ src/cpl_core/logging/logging_settings.py | 10 ++++----- src/cpl_core/mailing/email_client_abc.py | 2 +- src/cpl_core/mailing/email_client_service.py | 12 +++++----- src/cpl_core/mailing/email_client_settings.py | 6 ++--- src/cpl_core/time/time_format_settings.py | 8 +++---- src/cpl_query/tests/query_test.py | 2 +- src/tests/custom/console/main.py | 2 +- src/tests/custom/database/src/application.py | 10 ++++----- src/tests/custom/database/src/main.py | 2 +- .../custom/database/src/model/city_model.py | 2 +- .../custom/database/src/model/db_context.py | 4 ++-- .../custom/database/src/model/user_model.py | 2 +- .../custom/database/src/model/user_repo.py | 2 +- src/tests/custom/database/src/startup.py | 10 ++++----- .../custom/general/src/general/application.py | 14 ++++++------ src/tests/custom/general/src/general/main.py | 2 +- .../custom/general/src/general/startup.py | 16 +++++++------- .../general/src/general/test_service.py | 4 ++-- .../generated/simple-app/src/application.py | 8 +++---- src/tests/generated/simple-app/src/main.py | 2 +- .../simple-app/src/simple_app/application.py | 8 +++---- .../simple-app/src/simple_app/main.py | 2 +- .../generated/simple-console/src/main.py | 2 +- .../simple-console/src/simple_console/main.py | 2 +- src/tests/generated/simple-di/src/main.py | 6 ++--- .../generated/simple-di/src/simple_di/main.py | 6 ++--- .../src/simple_startup_app/application.py | 8 +++---- .../src/simple_startup_app/main.py | 2 +- .../src/simple_startup_app/startup.py | 6 ++--- .../generated/startup-app/src/application.py | 8 +++---- src/tests/generated/startup-app/src/main.py | 2 +- .../generated/startup-app/src/startup.py | 6 ++--- 89 files changed, 290 insertions(+), 290 deletions(-) diff --git a/docs/build/html/_sources/quickstart.md.txt b/docs/build/html/_sources/quickstart.md.txt index 0b75384e..42a88449 100644 --- a/docs/build/html/_sources/quickstart.md.txt +++ b/docs/build/html/_sources/quickstart.md.txt @@ -83,7 +83,7 @@ To create the sample project to the following: 3. Add ```Console.select``` as follows: ```py - from cpl.console import Console + from cpl_core.console import Console def main(): @@ -156,7 +156,7 @@ To create the sample project to the following: import random import string - from cpl.console import Console + from cpl_core.console import Console def generate_password(letters: str, length: int) -> str: diff --git a/docs/source/quickstart.md b/docs/source/quickstart.md index 0b75384e..42a88449 100644 --- a/docs/source/quickstart.md +++ b/docs/source/quickstart.md @@ -83,7 +83,7 @@ To create the sample project to the following: 3. Add ```Console.select``` as follows: ```py - from cpl.console import Console + from cpl_core.console import Console def main(): @@ -156,7 +156,7 @@ To create the sample project to the following: import random import string - from cpl.console import Console + from cpl_core.console import Console def generate_password(letters: str, length: int) -> str: diff --git a/src/cpl_cli/_templates/generate/abc_template.py b/src/cpl_cli/_templates/generate/abc_template.py index b624c3b4..4e6d645d 100644 --- a/src/cpl_cli/_templates/generate/abc_template.py +++ b/src/cpl_cli/_templates/generate/abc_template.py @@ -1,7 +1,7 @@ import textwrap from string import Template -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC diff --git a/src/cpl_cli/_templates/generate/class_template.py b/src/cpl_cli/_templates/generate/class_template.py index f923ce19..6d01d659 100644 --- a/src/cpl_cli/_templates/generate/class_template.py +++ b/src/cpl_cli/_templates/generate/class_template.py @@ -1,7 +1,7 @@ import textwrap from string import Template -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC diff --git a/src/cpl_cli/_templates/generate/configmodel_template.py b/src/cpl_cli/_templates/generate/configmodel_template.py index 482cec8f..b695d044 100644 --- a/src/cpl_cli/_templates/generate/configmodel_template.py +++ b/src/cpl_cli/_templates/generate/configmodel_template.py @@ -1,7 +1,7 @@ import textwrap from string import Template -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC @@ -16,8 +16,8 @@ class ConfigModelTemplate(TemplateFileABC): self._value = textwrap.dedent("""\ import traceback - from cpl.configuration.configuration_model_abc import ConfigurationModelABC - from cpl.console import Console + from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC + from cpl_core.console import Console class $Name(ConfigurationModelABC): diff --git a/src/cpl_cli/_templates/generate/enum_template.py b/src/cpl_cli/_templates/generate/enum_template.py index 2acbf588..9b0689cb 100644 --- a/src/cpl_cli/_templates/generate/enum_template.py +++ b/src/cpl_cli/_templates/generate/enum_template.py @@ -1,7 +1,7 @@ import textwrap from string import Template -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC diff --git a/src/cpl_cli/_templates/generate/init_template.py b/src/cpl_cli/_templates/generate/init_template.py index 39cf238a..316d9fa2 100644 --- a/src/cpl_cli/_templates/generate/init_template.py +++ b/src/cpl_cli/_templates/generate/init_template.py @@ -1,7 +1,7 @@ import textwrap from string import Template -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC diff --git a/src/cpl_cli/_templates/generate/service_template.py b/src/cpl_cli/_templates/generate/service_template.py index 02fefa87..0e762685 100644 --- a/src/cpl_cli/_templates/generate/service_template.py +++ b/src/cpl_cli/_templates/generate/service_template.py @@ -1,7 +1,7 @@ import textwrap from string import Template -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC diff --git a/src/cpl_cli/_templates/generate/thread_template.py b/src/cpl_cli/_templates/generate/thread_template.py index f6876e20..c8bd641e 100644 --- a/src/cpl_cli/_templates/generate/thread_template.py +++ b/src/cpl_cli/_templates/generate/thread_template.py @@ -1,7 +1,7 @@ import textwrap from string import Template -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC diff --git a/src/cpl_cli/_templates/new/console/source/name/application.py b/src/cpl_cli/_templates/new/console/source/name/application.py index 934f0522..8230d308 100644 --- a/src/cpl_cli/_templates/new/console/source/name/application.py +++ b/src/cpl_cli/_templates/new/console/source/name/application.py @@ -11,10 +11,10 @@ class ApplicationTemplate(TemplateFileABC): self._name = 'application.py' self._path = path self._value = textwrap.dedent("""\ - from cpl.application import ApplicationABC - from cpl.configuration import ConfigurationABC - from cpl.console import Console - from cpl.dependency_injection import ServiceProviderABC + from cpl_core.application import ApplicationABC + from cpl_core.configuration import ConfigurationABC + from cpl_core.console import Console + from cpl_core.dependency_injection import ServiceProviderABC class Application(ApplicationABC): diff --git a/src/cpl_cli/_templates/new/console/source/name/main.py b/src/cpl_cli/_templates/new/console/source/name/main.py index 861258a1..76734058 100644 --- a/src/cpl_cli/_templates/new/console/source/name/main.py +++ b/src/cpl_cli/_templates/new/console/source/name/main.py @@ -1,6 +1,6 @@ import textwrap -from cpl.utils.string import String +from cpl_core.utils.string import String from cpl_cli._templates.template_file_abc import TemplateFileABC @@ -16,7 +16,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): import_pkg = f'{name}.' self._value = textwrap.dedent(f"""\ - from cpl.application import ApplicationBuilder + from cpl_core.application import ApplicationBuilder from {import_pkg}application import Application from {import_pkg}startup import Startup @@ -57,7 +57,7 @@ class MainWithApplicationBaseTemplate(TemplateFileABC): import_pkg = f'{name}.' self._value = textwrap.dedent(f"""\ - from cpl.application import ApplicationBuilder + from cpl_core.application import ApplicationBuilder from {import_pkg}application import Application @@ -96,7 +96,7 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC): import_pkg = f'{name}.' self._value = textwrap.dedent("""\ - from cpl.console import Console + from cpl_core.console import Console def main(): @@ -132,9 +132,9 @@ class MainWithDependencyInjection(TemplateFileABC): import_pkg = f'{name}.' self._value = textwrap.dedent("""\ - from cpl.configuration import Configuration, ConfigurationABC - from cpl.console import Console - from cpl.dependency_injection import ServiceCollection, ServiceProviderABC + from cpl_core.configuration import Configuration, ConfigurationABC + from cpl_core.console import Console + from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC def configure_configuration() -> ConfigurationABC: diff --git a/src/cpl_cli/_templates/new/console/source/name/startup.py b/src/cpl_cli/_templates/new/console/source/name/startup.py index 6e68b355..9511ac40 100644 --- a/src/cpl_cli/_templates/new/console/source/name/startup.py +++ b/src/cpl_cli/_templates/new/console/source/name/startup.py @@ -11,9 +11,9 @@ class StartupTemplate(TemplateFileABC): self._name = 'startup.py' self._path = path self._value = textwrap.dedent("""\ - from cpl.application import StartupABC - from cpl.configuration import ConfigurationABC - from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC + from cpl_core.application import StartupABC + from cpl_core.configuration import ConfigurationABC + from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC class Startup(StartupABC): diff --git a/src/cpl_cli/_templates/new/library/source/name/application.py b/src/cpl_cli/_templates/new/library/source/name/application.py index 934f0522..8230d308 100644 --- a/src/cpl_cli/_templates/new/library/source/name/application.py +++ b/src/cpl_cli/_templates/new/library/source/name/application.py @@ -11,10 +11,10 @@ class ApplicationTemplate(TemplateFileABC): self._name = 'application.py' self._path = path self._value = textwrap.dedent("""\ - from cpl.application import ApplicationABC - from cpl.configuration import ConfigurationABC - from cpl.console import Console - from cpl.dependency_injection import ServiceProviderABC + from cpl_core.application import ApplicationABC + from cpl_core.configuration import ConfigurationABC + from cpl_core.console import Console + from cpl_core.dependency_injection import ServiceProviderABC class Application(ApplicationABC): diff --git a/src/cpl_cli/_templates/new/library/source/name/main.py b/src/cpl_cli/_templates/new/library/source/name/main.py index 5d43bf3a..a486428b 100644 --- a/src/cpl_cli/_templates/new/library/source/name/main.py +++ b/src/cpl_cli/_templates/new/library/source/name/main.py @@ -16,7 +16,7 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC): import_pkg = '' self._value = textwrap.dedent(f"""\ - from cpl.application import ApplicationBuilder + from cpl_core.application import ApplicationBuilder from {import_pkg}application import Application from {import_pkg}startup import Startup @@ -58,7 +58,7 @@ class MainWithApplicationBaseTemplate(TemplateFileABC): import_pkg = '' self._value = textwrap.dedent(f"""\ - from cpl.application import ApplicationBuilder + from cpl_core.application import ApplicationBuilder from {import_pkg}application import Application @@ -94,7 +94,7 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC): self._path = path self._value = textwrap.dedent("""\ - from cpl.console import Console + from cpl_core.console import Console def main(): @@ -127,9 +127,9 @@ class MainWithDependencyInjection(TemplateFileABC): self._path = path self._value = textwrap.dedent("""\ - from cpl.configuration import Configuration, ConfigurationABC - from cpl.console import Console - from cpl.dependency_injection import ServiceCollection, ServiceProviderABC + from cpl_core.configuration import Configuration, ConfigurationABC + from cpl_core.console import Console + from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC def configure_configuration() -> ConfigurationABC: diff --git a/src/cpl_cli/_templates/new/library/source/name/startup.py b/src/cpl_cli/_templates/new/library/source/name/startup.py index 6e68b355..9511ac40 100644 --- a/src/cpl_cli/_templates/new/library/source/name/startup.py +++ b/src/cpl_cli/_templates/new/library/source/name/startup.py @@ -11,9 +11,9 @@ class StartupTemplate(TemplateFileABC): self._name = 'startup.py' self._path = path self._value = textwrap.dedent("""\ - from cpl.application import StartupABC - from cpl.configuration import ConfigurationABC - from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC + from cpl_core.application import StartupABC + from cpl_core.configuration import ConfigurationABC + from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC class Startup(StartupABC): diff --git a/src/cpl_cli/cli.py b/src/cpl_cli/cli.py index 0ffc20c3..278ff989 100644 --- a/src/cpl_cli/cli.py +++ b/src/cpl_cli/cli.py @@ -1,11 +1,11 @@ import os from typing import Optional -from cpl.application.application_abc import ApplicationABC -from cpl.configuration.console_argument import ConsoleArgument -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.dependency_injection import ServiceProviderABC +from cpl_core.application.application_abc import ApplicationABC +from cpl_core.configuration.console_argument import ConsoleArgument +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.dependency_injection import ServiceProviderABC from cpl_cli.command.add_service import AddService from cpl_cli.command.build_service import BuildService from cpl_cli.command.custom_script_service import CustomScriptService diff --git a/src/cpl_cli/cli_settings.py b/src/cpl_cli/cli_settings.py index 2adb1228..3c38a181 100644 --- a/src/cpl_cli/cli_settings.py +++ b/src/cpl_cli/cli_settings.py @@ -1,8 +1,8 @@ import traceback from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console.console import Console +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console.console import Console from cpl_cli.cli_settings_name_enum import CLISettingsNameEnum diff --git a/src/cpl_cli/command/add_service.py b/src/cpl_cli/command/add_service.py index 30d2dd17..c4bd21f9 100644 --- a/src/cpl_cli/command/add_service.py +++ b/src/cpl_cli/command/add_service.py @@ -3,9 +3,9 @@ import os import textwrap from typing import Optional -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum from cpl_cli.command_abc import CommandABC from cpl_cli.configuration.build_settings import BuildSettings from cpl_cli.configuration.project_settings import ProjectSettings diff --git a/src/cpl_cli/command/custom_script_service.py b/src/cpl_cli/command/custom_script_service.py index c03f6368..87e1a7f9 100644 --- a/src/cpl_cli/command/custom_script_service.py +++ b/src/cpl_cli/command/custom_script_service.py @@ -2,8 +2,8 @@ import os import subprocess import sys -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console from cpl_cli.command_abc import CommandABC from cpl_cli.configuration.workspace_settings import WorkspaceSettings diff --git a/src/cpl_cli/command/generate_service.py b/src/cpl_cli/command/generate_service.py index 9ad04172..cc5e6583 100644 --- a/src/cpl_cli/command/generate_service.py +++ b/src/cpl_cli/command/generate_service.py @@ -2,10 +2,10 @@ import os import textwrap from collections import Callable -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.console.console import Console -from cpl.utils.string import String +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.console import Console +from cpl_core.utils.string import String from cpl_cli.command_abc import CommandABC from cpl_cli._templates.generate.init_template import InitTemplate from cpl_cli._templates.generate.abc_template import ABCTemplate diff --git a/src/cpl_cli/command/help_service.py b/src/cpl_cli/command/help_service.py index 50e98921..0d857ed8 100644 --- a/src/cpl_cli/command/help_service.py +++ b/src/cpl_cli/command/help_service.py @@ -1,9 +1,9 @@ import textwrap from typing import Optional -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC from cpl_cli.command_handler_service import CommandHandler from cpl_cli.command_abc import CommandABC diff --git a/src/cpl_cli/command/install_service.py b/src/cpl_cli/command/install_service.py index 7f733e2f..61d2e989 100644 --- a/src/cpl_cli/command/install_service.py +++ b/src/cpl_cli/command/install_service.py @@ -5,11 +5,11 @@ import textwrap from packaging import version -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC -from cpl.utils.pip import Pip +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.utils.pip import Pip from cpl_cli.cli_settings import CLISettings from cpl_cli.command_abc import CommandABC from cpl_cli.configuration.build_settings import BuildSettings diff --git a/src/cpl_cli/command/new_service.py b/src/cpl_cli/command/new_service.py index ef1dec22..ccc4acbb 100644 --- a/src/cpl_cli/command/new_service.py +++ b/src/cpl_cli/command/new_service.py @@ -5,12 +5,12 @@ from typing import Optional from packaging import version -import cpl +import cpl_core -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.console.console import Console -from cpl.utils.string import String +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.console import Console +from cpl_core.utils.string import String from cpl_cli.command_abc import CommandABC from cpl_cli.configuration.build_settings import BuildSettings from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum @@ -96,7 +96,7 @@ class NewService(CommandABC): ProjectSettingsNameEnum.license_name.value: '', ProjectSettingsNameEnum.license_description.value: '', ProjectSettingsNameEnum.dependencies.value: [ - f'sh_cpl>={version.parse(cpl.__version__)}' + f'sh_cpl>={version.parse(cpl_core.__version__)}' ], ProjectSettingsNameEnum.python_version.value: f'>={sys.version.split(" ")[0]}', ProjectSettingsNameEnum.python_path.value: { diff --git a/src/cpl_cli/command/remove_service.py b/src/cpl_cli/command/remove_service.py index d826d907..701a43fe 100644 --- a/src/cpl_cli/command/remove_service.py +++ b/src/cpl_cli/command/remove_service.py @@ -3,10 +3,10 @@ import shutil import json import textwrap -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC from cpl_cli.command_abc import CommandABC from cpl_cli.configuration import WorkspaceSettings, WorkspaceSettingsNameEnum diff --git a/src/cpl_cli/command/uninstall_service.py b/src/cpl_cli/command/uninstall_service.py index 4c9944c6..d9d1b0e7 100644 --- a/src/cpl_cli/command/uninstall_service.py +++ b/src/cpl_cli/command/uninstall_service.py @@ -3,11 +3,11 @@ import os import subprocess import textwrap -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC -from cpl.utils.pip import Pip +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.utils.pip import Pip from cpl_cli.command_abc import CommandABC from cpl_cli.configuration.build_settings import BuildSettings from cpl_cli.configuration.project_settings import ProjectSettings diff --git a/src/cpl_cli/command/update_service.py b/src/cpl_cli/command/update_service.py index 5cfb52de..412956e5 100644 --- a/src/cpl_cli/command/update_service.py +++ b/src/cpl_cli/command/update_service.py @@ -3,11 +3,11 @@ import os import subprocess import textwrap -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC -from cpl.utils.pip import Pip +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.utils.pip import Pip from cpl_cli.cli_settings import CLISettings from cpl_cli.command_abc import CommandABC from cpl_cli.configuration import BuildSettings diff --git a/src/cpl_cli/command/version_service.py b/src/cpl_cli/command/version_service.py index 5afadbd2..f49ac540 100644 --- a/src/cpl_cli/command/version_service.py +++ b/src/cpl_cli/command/version_service.py @@ -4,10 +4,10 @@ import platform import pkg_resources import textwrap -import cpl import cpl_cli -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum +import cpl_core +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum from cpl_cli.command_abc import CommandABC @@ -46,7 +46,7 @@ class VersionService(CommandABC): Console.write_line('\nCPL packages:') packages = [] - for importer, modname, is_pkg in pkgutil.iter_modules(cpl.__path__): + for importer, modname, is_pkg in pkgutil.iter_modules(cpl_core.__path__): module = importer.find_module(modname).load_module(modname) if '__version__' in dir(module): packages.append([f'{modname}', module.__version__]) diff --git a/src/cpl_cli/command_handler_service.py b/src/cpl_cli/command_handler_service.py index 128e796c..e1d86879 100644 --- a/src/cpl_cli/command_handler_service.py +++ b/src/cpl_cli/command_handler_service.py @@ -2,10 +2,10 @@ import os from abc import ABC from typing import Optional -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC -from cpl.utils.string import String +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.utils.string import String from cpl_cli.command.custom_script_service import CustomScriptService from cpl_cli.configuration.workspace_settings import WorkspaceSettings from cpl_cli.error import Error diff --git a/src/cpl_cli/configuration/build_settings.py b/src/cpl_cli/configuration/build_settings.py index 37e3662a..1909469a 100644 --- a/src/cpl_cli/configuration/build_settings.py +++ b/src/cpl_cli/configuration/build_settings.py @@ -2,9 +2,9 @@ import sys import traceback from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum from cpl_cli.configuration.build_settings_name_enum import BuildSettingsNameEnum from cpl_cli.configuration.project_type_enum import ProjectTypeEnum diff --git a/src/cpl_cli/configuration/project_settings.py b/src/cpl_cli/configuration/project_settings.py index 3f8f0fcc..c73bde40 100644 --- a/src/cpl_cli/configuration/project_settings.py +++ b/src/cpl_cli/configuration/project_settings.py @@ -3,9 +3,9 @@ import sys import traceback from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum from cpl_cli.configuration.version_settings import VersionSettings from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsNameEnum from cpl_cli.error import Error diff --git a/src/cpl_cli/configuration/version_settings.py b/src/cpl_cli/configuration/version_settings.py index 86fac84c..ef1af9b6 100644 --- a/src/cpl_cli/configuration/version_settings.py +++ b/src/cpl_cli/configuration/version_settings.py @@ -1,6 +1,6 @@ from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum diff --git a/src/cpl_cli/configuration/workspace_settings.py b/src/cpl_cli/configuration/workspace_settings.py index 4d51736a..a0b12b8f 100644 --- a/src/cpl_cli/configuration/workspace_settings.py +++ b/src/cpl_cli/configuration/workspace_settings.py @@ -1,8 +1,8 @@ import traceback from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console import Console +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console import Console from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum diff --git a/src/cpl_cli/error.py b/src/cpl_cli/error.py index e4bd7225..e2509903 100644 --- a/src/cpl_cli/error.py +++ b/src/cpl_cli/error.py @@ -1,5 +1,5 @@ -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.console import Console class Error: diff --git a/src/cpl_cli/live_server/live_server_service.py b/src/cpl_cli/live_server/live_server_service.py index d837f4e3..7b411dfb 100644 --- a/src/cpl_cli/live_server/live_server_service.py +++ b/src/cpl_cli/live_server/live_server_service.py @@ -6,8 +6,8 @@ import psutil as psutil from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer -from cpl.console.console import Console -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.console.console import Console +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC from cpl_cli.configuration.build_settings import BuildSettings from cpl_cli.configuration.project_settings import ProjectSettings from cpl_cli.live_server.live_server_thread import LiveServerThread diff --git a/src/cpl_cli/live_server/live_server_thread.py b/src/cpl_cli/live_server/live_server_thread.py index 69af050b..ed91165d 100644 --- a/src/cpl_cli/live_server/live_server_thread.py +++ b/src/cpl_cli/live_server/live_server_thread.py @@ -4,9 +4,9 @@ import sys import threading from datetime import datetime -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC from cpl_cli.configuration import BuildSettings diff --git a/src/cpl_cli/main.py b/src/cpl_cli/main.py index 71024452..b96f89b6 100644 --- a/src/cpl_cli/main.py +++ b/src/cpl_cli/main.py @@ -1,4 +1,4 @@ -from cpl.application.application_builder import ApplicationBuilder +from cpl_core.application.application_builder import ApplicationBuilder from cpl_cli.cli import CLI from cpl_cli.startup import Startup diff --git a/src/cpl_cli/publish/publisher_service.py b/src/cpl_cli/publish/publisher_service.py index 79b46af6..e8bd46ef 100644 --- a/src/cpl_cli/publish/publisher_service.py +++ b/src/cpl_cli/publish/publisher_service.py @@ -7,10 +7,10 @@ import setuptools from packaging import version from setuptools import sandbox -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.console.console import Console -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.console import Console +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC from cpl_cli.configuration.build_settings import BuildSettings from cpl_cli.configuration.project_settings import ProjectSettings from cpl_cli.publish.publisher_abc import PublisherABC diff --git a/src/cpl_cli/source_creator/console_builder.py b/src/cpl_cli/source_creator/console_builder.py index a48d0d0b..e6ee287e 100644 --- a/src/cpl_cli/source_creator/console_builder.py +++ b/src/cpl_cli/source_creator/console_builder.py @@ -2,9 +2,9 @@ import json import os from typing import Optional -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.console.console import Console -from cpl.utils.string import String +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.console import Console +from cpl_core.utils.string import String from cpl_cli.configuration.workspace_settings import WorkspaceSettings from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum from cpl_cli.source_creator.template_builder import TemplateBuilder diff --git a/src/cpl_cli/source_creator/library_builder.py b/src/cpl_cli/source_creator/library_builder.py index 78f18908..80e83bb1 100644 --- a/src/cpl_cli/source_creator/library_builder.py +++ b/src/cpl_cli/source_creator/library_builder.py @@ -2,9 +2,9 @@ import json import os from typing import Optional -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.console.console import Console -from cpl.utils.string import String +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.console import Console +from cpl_core.utils.string import String from cpl_cli.configuration.workspace_settings import WorkspaceSettings from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettingsNameEnum from cpl_cli.source_creator.template_builder import TemplateBuilder diff --git a/src/cpl_cli/startup.py b/src/cpl_cli/startup.py index 56a70e04..07ff0fa9 100644 --- a/src/cpl_cli/startup.py +++ b/src/cpl_cli/startup.py @@ -1,11 +1,11 @@ import os from typing import Optional -from cpl.application.startup_abc import StartupABC -from cpl.configuration.console_argument import ConsoleArgument -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.dependency_injection.service_collection_abc import ServiceCollectionABC -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.application.startup_abc import StartupABC +from cpl_core.configuration.console_argument import ConsoleArgument +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC from cpl_cli.command.add_service import AddService from cpl_cli.command.build_service import BuildService from cpl_cli.command.custom_script_service import CustomScriptService diff --git a/src/cpl_core/application/application_abc.py b/src/cpl_core/application/application_abc.py index b7b303bd..e3215594 100644 --- a/src/cpl_core/application/application_abc.py +++ b/src/cpl_core/application/application_abc.py @@ -1,10 +1,10 @@ from abc import ABC, abstractmethod from typing import Optional -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC -from cpl.environment import ApplicationEnvironmentABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.environment import ApplicationEnvironmentABC class ApplicationABC(ABC): diff --git a/src/cpl_core/application/application_builder.py b/src/cpl_core/application/application_builder.py index e16b2573..417b1256 100644 --- a/src/cpl_core/application/application_builder.py +++ b/src/cpl_core/application/application_builder.py @@ -1,10 +1,10 @@ from typing import Type, Optional -from cpl.application.application_abc import ApplicationABC -from cpl.application.application_builder_abc import ApplicationBuilderABC -from cpl.application.startup_abc import StartupABC -from cpl.configuration.configuration import Configuration -from cpl.dependency_injection.service_collection import ServiceCollection +from cpl_core.application.application_abc import ApplicationABC +from cpl_core.application.application_builder_abc import ApplicationBuilderABC +from cpl_core.application.startup_abc import StartupABC +from cpl_core.configuration.configuration import Configuration +from cpl_core.dependency_injection.service_collection import ServiceCollection class ApplicationBuilder(ApplicationBuilderABC): diff --git a/src/cpl_core/application/application_builder_abc.py b/src/cpl_core/application/application_builder_abc.py index 13c0e2d3..44c68fd7 100644 --- a/src/cpl_core/application/application_builder_abc.py +++ b/src/cpl_core/application/application_builder_abc.py @@ -1,8 +1,8 @@ from abc import ABC, abstractmethod from typing import Type -from cpl.application.application_abc import ApplicationABC -from cpl.application.startup_abc import StartupABC +from cpl_core.application.application_abc import ApplicationABC +from cpl_core.application.startup_abc import StartupABC class ApplicationBuilderABC(ABC): diff --git a/src/cpl_core/application/startup_abc.py b/src/cpl_core/application/startup_abc.py index b550854d..fd48b644 100644 --- a/src/cpl_core/application/startup_abc.py +++ b/src/cpl_core/application/startup_abc.py @@ -1,7 +1,7 @@ from abc import ABC, abstractmethod -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC class StartupABC(ABC): diff --git a/src/cpl_core/configuration/configuration.py b/src/cpl_core/configuration/configuration.py index 68e671a6..605c6bcc 100644 --- a/src/cpl_core/configuration/configuration.py +++ b/src/cpl_core/configuration/configuration.py @@ -4,15 +4,15 @@ import sys from collections import Callable from typing import Union, Type, Optional -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.configuration.configuration_variable_name_enum import ConfigurationVariableNameEnum -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.application_environment_abc import ApplicationEnvironmentABC -from cpl.environment.environment_name_enum import EnvironmentNameEnum +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.configuration.configuration_variable_name_enum import ConfigurationVariableNameEnum +from cpl_core.configuration.console_argument import ConsoleArgument +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.environment.application_environment import ApplicationEnvironment +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.environment.environment_name_enum import EnvironmentNameEnum class Configuration(ConfigurationABC): diff --git a/src/cpl_core/configuration/configuration_abc.py b/src/cpl_core/configuration/configuration_abc.py index 61498d70..9bade832 100644 --- a/src/cpl_core/configuration/configuration_abc.py +++ b/src/cpl_core/configuration/configuration_abc.py @@ -2,9 +2,9 @@ from abc import abstractmethod, ABC from collections import Callable from typing import Type, Union, Optional -from cpl.configuration.console_argument import ConsoleArgument -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.configuration.console_argument import ConsoleArgument +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC class ConfigurationABC(ABC): diff --git a/src/cpl_core/console/console.py b/src/cpl_core/console/console.py index 66140873..aff76a8b 100644 --- a/src/cpl_core/console/console.py +++ b/src/cpl_core/console/console.py @@ -11,10 +11,10 @@ from pynput.keyboard import Key from tabulate import tabulate from termcolor import colored -from cpl.console.background_color_enum import BackgroundColorEnum -from cpl.console.console_call import ConsoleCall -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.console.spinner_thread import SpinnerThread +from cpl_core.console.background_color_enum import BackgroundColorEnum +from cpl_core.console.console_call import ConsoleCall +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.spinner_thread import SpinnerThread class Console: diff --git a/src/cpl_core/console/spinner_thread.py b/src/cpl_core/console/spinner_thread.py index e20b431a..43afcb25 100644 --- a/src/cpl_core/console/spinner_thread.py +++ b/src/cpl_core/console/spinner_thread.py @@ -5,8 +5,8 @@ import time from termcolor import colored -from cpl.console.background_color_enum import BackgroundColorEnum -from cpl.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.console.background_color_enum import BackgroundColorEnum +from cpl_core.console.foreground_color_enum import ForegroundColorEnum class SpinnerThread(threading.Thread): diff --git a/src/cpl_core/database/connection/database_connection.py b/src/cpl_core/database/connection/database_connection.py index 551ce238..d889d240 100644 --- a/src/cpl_core/database/connection/database_connection.py +++ b/src/cpl_core/database/connection/database_connection.py @@ -3,10 +3,10 @@ from typing import Optional from sqlalchemy import engine, create_engine from sqlalchemy.orm import Session, sessionmaker -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.database.connection.database_connection_abc import DatabaseConnectionABC -from cpl.database.database_settings import DatabaseSettings +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.database.connection.database_connection_abc import DatabaseConnectionABC +from cpl_core.database.database_settings import DatabaseSettings class DatabaseConnection(DatabaseConnectionABC): diff --git a/src/cpl_core/database/context/database_context.py b/src/cpl_core/database/context/database_context.py index e331c9e5..922c07e7 100644 --- a/src/cpl_core/database/context/database_context.py +++ b/src/cpl_core/database/context/database_context.py @@ -1,13 +1,13 @@ from sqlalchemy import engine, Table from sqlalchemy.orm import Session -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.database.connection.database_connection import DatabaseConnection -from cpl.database.connection.database_connection_abc import DatabaseConnectionABC -from cpl.database.context.database_context_abc import DatabaseContextABC -from cpl.database.database_settings import DatabaseSettings -from cpl.database.database_model import DatabaseModel +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.database.connection.database_connection import DatabaseConnection +from cpl_core.database.connection.database_connection_abc import DatabaseConnectionABC +from cpl_core.database.context.database_context_abc import DatabaseContextABC +from cpl_core.database.database_settings import DatabaseSettings +from cpl_core.database.database_model import DatabaseModel class DatabaseContext(DatabaseContextABC): diff --git a/src/cpl_core/database/database_settings.py b/src/cpl_core/database/database_settings.py index 08f04b3f..8a561ded 100644 --- a/src/cpl_core/database/database_settings.py +++ b/src/cpl_core/database/database_settings.py @@ -1,10 +1,10 @@ import traceback from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.database.database_settings_name_enum import DatabaseSettingsNameEnum +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.database.database_settings_name_enum import DatabaseSettingsNameEnum class DatabaseSettings(ConfigurationModelABC): diff --git a/src/cpl_core/dependency_injection/service_collection.py b/src/cpl_core/dependency_injection/service_collection.py index 5b96e1ff..d5837f4b 100644 --- a/src/cpl_core/dependency_injection/service_collection.py +++ b/src/cpl_core/dependency_injection/service_collection.py @@ -1,16 +1,16 @@ from typing import Union, Type, Callable, Optional -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.database.database_settings import DatabaseSettings -from cpl.database.context.database_context_abc import DatabaseContextABC -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC -from cpl.dependency_injection.service_collection_abc import ServiceCollectionABC -from cpl.dependency_injection.service_descriptor import ServiceDescriptor -from cpl.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum -from cpl.dependency_injection.service_provider import ServiceProvider -from cpl.logging.logger_service import Logger -from cpl.logging.logger_abc import LoggerABC -from cpl.utils.credential_manager import CredentialManager +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.database.database_settings import DatabaseSettings +from cpl_core.database.context.database_context_abc import DatabaseContextABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC +from cpl_core.dependency_injection.service_descriptor import ServiceDescriptor +from cpl_core.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum +from cpl_core.dependency_injection.service_provider import ServiceProvider +from cpl_core.logging.logger_service import Logger +from cpl_core.logging.logger_abc import LoggerABC +from cpl_core.utils.credential_manager import CredentialManager class ServiceCollection(ServiceCollectionABC): diff --git a/src/cpl_core/dependency_injection/service_collection_abc.py b/src/cpl_core/dependency_injection/service_collection_abc.py index 4d119b29..5f05217e 100644 --- a/src/cpl_core/dependency_injection/service_collection_abc.py +++ b/src/cpl_core/dependency_injection/service_collection_abc.py @@ -2,9 +2,9 @@ from abc import abstractmethod, ABC from collections import Callable from typing import Type -from cpl.database.database_settings import DatabaseSettings -from cpl.database.context.database_context_abc import DatabaseContextABC -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.database.database_settings import DatabaseSettings +from cpl_core.database.context.database_context_abc import DatabaseContextABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC class ServiceCollectionABC(ABC): diff --git a/src/cpl_core/dependency_injection/service_descriptor.py b/src/cpl_core/dependency_injection/service_descriptor.py index a0c70e98..01eea5ce 100644 --- a/src/cpl_core/dependency_injection/service_descriptor.py +++ b/src/cpl_core/dependency_injection/service_descriptor.py @@ -1,6 +1,6 @@ from typing import Union, Optional -from cpl.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum +from cpl_core.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum class ServiceDescriptor: diff --git a/src/cpl_core/dependency_injection/service_provider.py b/src/cpl_core/dependency_injection/service_provider.py index c8c333b2..62769b9e 100644 --- a/src/cpl_core/dependency_injection/service_provider.py +++ b/src/cpl_core/dependency_injection/service_provider.py @@ -2,13 +2,13 @@ from collections import Callable from inspect import signature, Parameter from typing import Optional -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.database.context.database_context_abc import DatabaseContextABC -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC -from cpl.dependency_injection.service_descriptor import ServiceDescriptor -from cpl.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.database.context.database_context_abc import DatabaseContextABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.dependency_injection.service_descriptor import ServiceDescriptor +from cpl_core.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC class ServiceProvider(ServiceProviderABC): diff --git a/src/cpl_core/environment/application_environment.py b/src/cpl_core/environment/application_environment.py index 8acf1637..1c783fbe 100644 --- a/src/cpl_core/environment/application_environment.py +++ b/src/cpl_core/environment/application_environment.py @@ -3,8 +3,8 @@ from datetime import datetime from socket import gethostname from typing import Optional -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC -from cpl.environment.environment_name_enum import EnvironmentNameEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.environment.environment_name_enum import EnvironmentNameEnum class ApplicationEnvironment(ApplicationEnvironmentABC): diff --git a/src/cpl_core/logging/logger_service.py b/src/cpl_core/logging/logger_service.py index e4f13e38..6c8d352a 100644 --- a/src/cpl_core/logging/logger_service.py +++ b/src/cpl_core/logging/logger_service.py @@ -3,13 +3,13 @@ import os import traceback from string import Template -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.environment.application_environment_abc import ApplicationEnvironmentABC -from cpl.logging.logger_abc import LoggerABC -from cpl.logging.logging_level_enum import LoggingLevelEnum -from cpl.logging.logging_settings import LoggingSettings -from cpl.time.time_format_settings import TimeFormatSettings +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.logging.logger_abc import LoggerABC +from cpl_core.logging.logging_level_enum import LoggingLevelEnum +from cpl_core.logging.logging_settings import LoggingSettings +from cpl_core.time.time_format_settings import TimeFormatSettings class Logger(LoggerABC): diff --git a/src/cpl_core/logging/logging_settings.py b/src/cpl_core/logging/logging_settings.py index 6b7128e1..a9554657 100644 --- a/src/cpl_core/logging/logging_settings.py +++ b/src/cpl_core/logging/logging_settings.py @@ -1,11 +1,11 @@ import traceback from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.logging.logging_level_enum import LoggingLevelEnum -from cpl.logging.logging_settings_name_enum import LoggingSettingsNameEnum +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.logging.logging_level_enum import LoggingLevelEnum +from cpl_core.logging.logging_settings_name_enum import LoggingSettingsNameEnum class LoggingSettings(ConfigurationModelABC): diff --git a/src/cpl_core/mailing/email_client_abc.py b/src/cpl_core/mailing/email_client_abc.py index dfc80424..9d60e35b 100644 --- a/src/cpl_core/mailing/email_client_abc.py +++ b/src/cpl_core/mailing/email_client_abc.py @@ -1,6 +1,6 @@ from abc import abstractmethod, ABC -from cpl.mailing.email import EMail +from cpl_core.mailing.email import EMail class EMailClientABC(ABC): diff --git a/src/cpl_core/mailing/email_client_service.py b/src/cpl_core/mailing/email_client_service.py index f169fa11..4d45248e 100644 --- a/src/cpl_core/mailing/email_client_service.py +++ b/src/cpl_core/mailing/email_client_service.py @@ -2,12 +2,12 @@ import ssl from smtplib import SMTP from typing import Optional -from cpl.environment.application_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 -from cpl.mailing.email_client_settings import EMailClientSettings -from cpl.utils.credential_manager import CredentialManager +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.logging.logger_abc import LoggerABC +from cpl_core.mailing.email import EMail +from cpl_core.mailing.email_client_abc import EMailClientABC +from cpl_core.mailing.email_client_settings import EMailClientSettings +from cpl_core.utils.credential_manager import CredentialManager class EMailClient(EMailClientABC): diff --git a/src/cpl_core/mailing/email_client_settings.py b/src/cpl_core/mailing/email_client_settings.py index 31b7f151..9d695e47 100644 --- a/src/cpl_core/mailing/email_client_settings.py +++ b/src/cpl_core/mailing/email_client_settings.py @@ -1,8 +1,8 @@ import traceback -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console.console import Console -from cpl.mailing.email_client_settings_name_enum import EMailClientSettingsNameEnum +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console.console import Console +from cpl_core.mailing.email_client_settings_name_enum import EMailClientSettingsNameEnum class EMailClientSettings(ConfigurationModelABC): diff --git a/src/cpl_core/time/time_format_settings.py b/src/cpl_core/time/time_format_settings.py index f5d0827e..885e8d0b 100644 --- a/src/cpl_core/time/time_format_settings.py +++ b/src/cpl_core/time/time_format_settings.py @@ -1,10 +1,10 @@ import traceback from typing import Optional -from cpl.configuration.configuration_model_abc import ConfigurationModelABC -from cpl.console.console import Console -from cpl.console.foreground_color_enum import ForegroundColorEnum -from cpl.time.time_format_settings_names_enum import TimeFormatSettingsNamesEnum +from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC +from cpl_core.console.console import Console +from cpl_core.console.foreground_color_enum import ForegroundColorEnum +from cpl_core.time.time_format_settings_names_enum import TimeFormatSettingsNamesEnum class TimeFormatSettings(ConfigurationModelABC): diff --git a/src/cpl_query/tests/query_test.py b/src/cpl_query/tests/query_test.py index 9efe8310..9f1e48e2 100644 --- a/src/cpl_query/tests/query_test.py +++ b/src/cpl_query/tests/query_test.py @@ -2,7 +2,7 @@ import string import unittest from random import randint -from cpl.utils import String +from cpl_core.utils import String from cpl_query.exceptions import InvalidTypeException, ArgumentNoneException from cpl_query.extension.list import List from cpl_query.tests.models import User, Address diff --git a/src/tests/custom/console/main.py b/src/tests/custom/console/main.py index 6dfe9a9c..d61cd44c 100644 --- a/src/tests/custom/console/main.py +++ b/src/tests/custom/console/main.py @@ -1,5 +1,5 @@ import time -from cpl.console import Console, ForegroundColorEnum +from cpl_core.console import Console, ForegroundColorEnum def test_spinner(): diff --git a/src/tests/custom/database/src/application.py b/src/tests/custom/database/src/application.py index 4ac5352c..80639750 100644 --- a/src/tests/custom/database/src/application.py +++ b/src/tests/custom/database/src/application.py @@ -1,10 +1,10 @@ from typing import Optional -from cpl.application import ApplicationABC -from cpl.configuration import ConfigurationABC -from cpl.console import Console -from cpl.dependency_injection import ServiceProviderABC -from cpl.logging import LoggerABC +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceProviderABC +from cpl_core.logging import LoggerABC from model.user_repo_abc import UserRepoABC from model.user_repo import UserRepo diff --git a/src/tests/custom/database/src/main.py b/src/tests/custom/database/src/main.py index 6e678925..4272c911 100644 --- a/src/tests/custom/database/src/main.py +++ b/src/tests/custom/database/src/main.py @@ -1,4 +1,4 @@ -from cpl.application import ApplicationBuilder +from cpl_core.application import ApplicationBuilder from application import Application from startup import Startup diff --git a/src/tests/custom/database/src/model/city_model.py b/src/tests/custom/database/src/model/city_model.py index 98523169..aba2cf6f 100644 --- a/src/tests/custom/database/src/model/city_model.py +++ b/src/tests/custom/database/src/model/city_model.py @@ -1,6 +1,6 @@ from sqlalchemy import Column, Integer, String -from cpl.database import DatabaseModel +from cpl_core.database import DatabaseModel class CityModel(DatabaseModel): diff --git a/src/tests/custom/database/src/model/db_context.py b/src/tests/custom/database/src/model/db_context.py index 160ed8b4..d3600643 100644 --- a/src/tests/custom/database/src/model/db_context.py +++ b/src/tests/custom/database/src/model/db_context.py @@ -1,5 +1,5 @@ -from cpl.database import DatabaseSettings -from cpl.database.context import DatabaseContext +from cpl_core.database import DatabaseSettings +from cpl_core.database.context import DatabaseContext class DBContext(DatabaseContext): diff --git a/src/tests/custom/database/src/model/user_model.py b/src/tests/custom/database/src/model/user_model.py index bce0ed69..344612e3 100644 --- a/src/tests/custom/database/src/model/user_model.py +++ b/src/tests/custom/database/src/model/user_model.py @@ -1,7 +1,7 @@ from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.orm import relationship -from cpl.database import DatabaseModel +from cpl_core.database import DatabaseModel from .city_model import CityModel diff --git a/src/tests/custom/database/src/model/user_repo.py b/src/tests/custom/database/src/model/user_repo.py index 111605b3..cdd65b22 100644 --- a/src/tests/custom/database/src/model/user_repo.py +++ b/src/tests/custom/database/src/model/user_repo.py @@ -1,4 +1,4 @@ -from cpl.database.context import DatabaseContextABC +from cpl_core.database.context import DatabaseContextABC from .city_model import CityModel from .user_model import UserModel from .user_repo_abc import UserRepoABC diff --git a/src/tests/custom/database/src/startup.py b/src/tests/custom/database/src/startup.py index 27417a3b..9f954fe5 100644 --- a/src/tests/custom/database/src/startup.py +++ b/src/tests/custom/database/src/startup.py @@ -1,8 +1,8 @@ -from cpl.application import StartupABC -from cpl.configuration import ConfigurationABC -from cpl.database import DatabaseSettings -from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC -from cpl.logging import LoggerABC, Logger +from cpl_core.application import StartupABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.database import DatabaseSettings +from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC +from cpl_core.logging import LoggerABC, Logger from model.db_context import DBContext from model.user_repo import UserRepo from model.user_repo_abc import UserRepoABC diff --git a/src/tests/custom/general/src/general/application.py b/src/tests/custom/general/src/general/application.py index 96bcb086..a42536af 100644 --- a/src/tests/custom/general/src/general/application.py +++ b/src/tests/custom/general/src/general/application.py @@ -1,13 +1,13 @@ import time from typing import Optional -from cpl.application.application_abc import ApplicationABC -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.console.console import Console -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC -from cpl.logging.logger_abc import LoggerABC -from cpl.mailing.email import EMail -from cpl.mailing.email_client_abc import EMailClientABC +from cpl_core.application.application_abc import ApplicationABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.console.console import Console +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.logging.logger_abc import LoggerABC +from cpl_core.mailing.email import EMail +from cpl_core.mailing.email_client_abc import EMailClientABC from test_service import TestService diff --git a/src/tests/custom/general/src/general/main.py b/src/tests/custom/general/src/general/main.py index a2e8cbd0..f6515f12 100644 --- a/src/tests/custom/general/src/general/main.py +++ b/src/tests/custom/general/src/general/main.py @@ -1,4 +1,4 @@ -from cpl.application.application_builder import ApplicationBuilder +from cpl_core.application.application_builder import ApplicationBuilder from application import Application from startup import Startup diff --git a/src/tests/custom/general/src/general/startup.py b/src/tests/custom/general/src/general/startup.py index 102ae67b..3314b852 100644 --- a/src/tests/custom/general/src/general/startup.py +++ b/src/tests/custom/general/src/general/startup.py @@ -1,11 +1,11 @@ -from cpl.application.startup_abc import StartupABC -from cpl.configuration.configuration_abc import ConfigurationABC -from cpl.dependency_injection.service_collection_abc import ServiceCollectionABC -from cpl.dependency_injection.service_provider_abc import ServiceProviderABC -from cpl.logging.logger_service import Logger -from cpl.logging.logger_abc import LoggerABC -from cpl.mailing.email_client_service import EMailClient -from cpl.mailing.email_client_abc import EMailClientABC +from cpl_core.application.startup_abc import StartupABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC +from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.logging.logger_service import Logger +from cpl_core.logging.logger_abc import LoggerABC +from cpl_core.mailing.email_client_service import EMailClient +from cpl_core.mailing.email_client_abc import EMailClientABC from test_service import TestService diff --git a/src/tests/custom/general/src/general/test_service.py b/src/tests/custom/general/src/general/test_service.py index 376707c1..94600a42 100644 --- a/src/tests/custom/general/src/general/test_service.py +++ b/src/tests/custom/general/src/general/test_service.py @@ -1,7 +1,7 @@ from abc import ABC -from cpl.console.console import Console -from cpl.dependency_injection import ServiceProviderABC +from cpl_core.console.console import Console +from cpl_core.dependency_injection import ServiceProviderABC class TestService(ABC): diff --git a/src/tests/generated/simple-app/src/application.py b/src/tests/generated/simple-app/src/application.py index 0a98353b..34a68c80 100644 --- a/src/tests/generated/simple-app/src/application.py +++ b/src/tests/generated/simple-app/src/application.py @@ -1,7 +1,7 @@ -from cpl.application import ApplicationABC -from cpl.configuration import ConfigurationABC -from cpl.console import Console -from cpl.dependency_injection import ServiceProviderABC +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceProviderABC class Application(ApplicationABC): diff --git a/src/tests/generated/simple-app/src/main.py b/src/tests/generated/simple-app/src/main.py index 3d3e7eba..8ebd74ef 100644 --- a/src/tests/generated/simple-app/src/main.py +++ b/src/tests/generated/simple-app/src/main.py @@ -1,4 +1,4 @@ -from cpl.application import ApplicationBuilder +from cpl_core.application import ApplicationBuilder from application import Application diff --git a/src/tests/generated/simple-app/src/simple_app/application.py b/src/tests/generated/simple-app/src/simple_app/application.py index 0a98353b..34a68c80 100644 --- a/src/tests/generated/simple-app/src/simple_app/application.py +++ b/src/tests/generated/simple-app/src/simple_app/application.py @@ -1,7 +1,7 @@ -from cpl.application import ApplicationABC -from cpl.configuration import ConfigurationABC -from cpl.console import Console -from cpl.dependency_injection import ServiceProviderABC +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceProviderABC class Application(ApplicationABC): diff --git a/src/tests/generated/simple-app/src/simple_app/main.py b/src/tests/generated/simple-app/src/simple_app/main.py index c5d29314..a7c8142e 100644 --- a/src/tests/generated/simple-app/src/simple_app/main.py +++ b/src/tests/generated/simple-app/src/simple_app/main.py @@ -1,4 +1,4 @@ -from cpl.application import ApplicationBuilder +from cpl_core.application import ApplicationBuilder from simple_app.application import Application diff --git a/src/tests/generated/simple-console/src/main.py b/src/tests/generated/simple-console/src/main.py index 42e34771..db8266cc 100644 --- a/src/tests/generated/simple-console/src/main.py +++ b/src/tests/generated/simple-console/src/main.py @@ -1,4 +1,4 @@ -from cpl.console import Console +from cpl_core.console import Console def main(): diff --git a/src/tests/generated/simple-console/src/simple_console/main.py b/src/tests/generated/simple-console/src/simple_console/main.py index 42e34771..db8266cc 100644 --- a/src/tests/generated/simple-console/src/simple_console/main.py +++ b/src/tests/generated/simple-console/src/simple_console/main.py @@ -1,4 +1,4 @@ -from cpl.console import Console +from cpl_core.console import Console def main(): diff --git a/src/tests/generated/simple-di/src/main.py b/src/tests/generated/simple-di/src/main.py index a6bd96ec..f716961c 100644 --- a/src/tests/generated/simple-di/src/main.py +++ b/src/tests/generated/simple-di/src/main.py @@ -1,6 +1,6 @@ -from cpl.configuration import Configuration, ConfigurationABC -from cpl.console import Console -from cpl.dependency_injection import ServiceCollection, ServiceProviderABC +from cpl_core.configuration import Configuration, ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC def configure_configuration() -> ConfigurationABC: diff --git a/src/tests/generated/simple-di/src/simple_di/main.py b/src/tests/generated/simple-di/src/simple_di/main.py index a6bd96ec..f716961c 100644 --- a/src/tests/generated/simple-di/src/simple_di/main.py +++ b/src/tests/generated/simple-di/src/simple_di/main.py @@ -1,6 +1,6 @@ -from cpl.configuration import Configuration, ConfigurationABC -from cpl.console import Console -from cpl.dependency_injection import ServiceCollection, ServiceProviderABC +from cpl_core.configuration import Configuration, ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceCollection, ServiceProviderABC def configure_configuration() -> ConfigurationABC: diff --git a/src/tests/generated/simple-startup-app/src/simple_startup_app/application.py b/src/tests/generated/simple-startup-app/src/simple_startup_app/application.py index 0a98353b..34a68c80 100644 --- a/src/tests/generated/simple-startup-app/src/simple_startup_app/application.py +++ b/src/tests/generated/simple-startup-app/src/simple_startup_app/application.py @@ -1,7 +1,7 @@ -from cpl.application import ApplicationABC -from cpl.configuration import ConfigurationABC -from cpl.console import Console -from cpl.dependency_injection import ServiceProviderABC +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceProviderABC class Application(ApplicationABC): diff --git a/src/tests/generated/simple-startup-app/src/simple_startup_app/main.py b/src/tests/generated/simple-startup-app/src/simple_startup_app/main.py index 4bbb4aed..78bd9bb1 100644 --- a/src/tests/generated/simple-startup-app/src/simple_startup_app/main.py +++ b/src/tests/generated/simple-startup-app/src/simple_startup_app/main.py @@ -1,4 +1,4 @@ -from cpl.application import ApplicationBuilder +from cpl_core.application import ApplicationBuilder from simple_startup_app.application import Application from simple_startup_app.startup import Startup diff --git a/src/tests/generated/simple-startup-app/src/simple_startup_app/startup.py b/src/tests/generated/simple-startup-app/src/simple_startup_app/startup.py index 8988cf31..c29f3e6b 100644 --- a/src/tests/generated/simple-startup-app/src/simple_startup_app/startup.py +++ b/src/tests/generated/simple-startup-app/src/simple_startup_app/startup.py @@ -1,6 +1,6 @@ -from cpl.application import StartupABC -from cpl.configuration import ConfigurationABC -from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC +from cpl_core.application import StartupABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC class Startup(StartupABC): diff --git a/src/tests/generated/startup-app/src/application.py b/src/tests/generated/startup-app/src/application.py index 0a98353b..34a68c80 100644 --- a/src/tests/generated/startup-app/src/application.py +++ b/src/tests/generated/startup-app/src/application.py @@ -1,7 +1,7 @@ -from cpl.application import ApplicationABC -from cpl.configuration import ConfigurationABC -from cpl.console import Console -from cpl.dependency_injection import ServiceProviderABC +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceProviderABC class Application(ApplicationABC): diff --git a/src/tests/generated/startup-app/src/main.py b/src/tests/generated/startup-app/src/main.py index 6e678925..4272c911 100644 --- a/src/tests/generated/startup-app/src/main.py +++ b/src/tests/generated/startup-app/src/main.py @@ -1,4 +1,4 @@ -from cpl.application import ApplicationBuilder +from cpl_core.application import ApplicationBuilder from application import Application from startup import Startup diff --git a/src/tests/generated/startup-app/src/startup.py b/src/tests/generated/startup-app/src/startup.py index 07f5dece..acf50c86 100644 --- a/src/tests/generated/startup-app/src/startup.py +++ b/src/tests/generated/startup-app/src/startup.py @@ -1,6 +1,6 @@ -from cpl.application import StartupABC -from cpl.configuration import ConfigurationABC -from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC +from cpl_core.application import StartupABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC class Startup(StartupABC): From 1c6794dc400a5332714640c738dfc7b75712abad Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 7 Aug 2021 11:21:30 +0200 Subject: [PATCH 42/49] Renamed cpl to cpl_core & added config and services as arguments to startup --- src/cpl_core/application/application_abc.py | 8 ++--- .../application/application_builder.py | 10 +++---- .../application/application_builder_abc.py | 6 ++-- src/cpl_core/application/startup_abc.py | 15 +++++++--- src/cpl_core/configuration/configuration.py | 2 +- .../configuration/configuration_abc.py | 10 +++---- .../configuration/console_argument.py | 2 +- src/cpl_core/console/console.py | 24 +++++++-------- src/cpl_core/console/spinner_thread.py | 4 +-- .../connection/database_connection.py | 2 +- .../connection/database_connection_abc.py | 2 +- .../database/context/database_context.py | 2 +- .../database/context/database_context_abc.py | 2 +- .../service_collection_abc.py | 8 ++--- .../service_descriptor.py | 2 +- .../dependency_injection/service_provider.py | 6 ++-- .../service_provider_abc.py | 2 +- .../environment/application_environment.py | 2 +- .../application_environment_abc.py | 2 +- src/cpl_core/logging/logger_abc.py | 2 +- src/cpl_core/logging/logger_service.py | 8 ++--- src/cpl_core/mailing/email_client_abc.py | 4 +-- src/cpl_core/mailing/email_client_service.py | 6 ++-- .../custom/general/src/general/startup.py | 30 +++++++++---------- 24 files changed, 83 insertions(+), 78 deletions(-) diff --git a/src/cpl_core/application/application_abc.py b/src/cpl_core/application/application_abc.py index e3215594..3c64d944 100644 --- a/src/cpl_core/application/application_abc.py +++ b/src/cpl_core/application/application_abc.py @@ -12,9 +12,9 @@ class ApplicationABC(ABC): Parameters ---------- - config: :class:`cpl.configuration.configuration_abc.ConfigurationABC` + config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC` Contains object loaded from appsettings - services: :class:`cpl.dependency_injection.service_provider_abc.ServiceProviderABC` + services: :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC` Contains instances of prepared objects """ @@ -39,7 +39,7 @@ class ApplicationABC(ABC): def configure(self): r"""Configure the application - Called by :class:`cpl.application.application_abc.ApplicationABC.run` + Called by :class:`cpl_core.application.application_abc.ApplicationABC.run` """ pass @@ -47,6 +47,6 @@ class ApplicationABC(ABC): def main(self): r"""Custom entry point - Called by :class:`cpl.application.application_abc.ApplicationABC.run` + Called by :class:`cpl_core.application.application_abc.ApplicationABC.run` """ pass diff --git a/src/cpl_core/application/application_builder.py b/src/cpl_core/application/application_builder.py index 417b1256..ee3f52a6 100644 --- a/src/cpl_core/application/application_builder.py +++ b/src/cpl_core/application/application_builder.py @@ -8,11 +8,11 @@ from cpl_core.dependency_injection.service_collection import ServiceCollection class ApplicationBuilder(ApplicationBuilderABC): - r"""This is class is used to build a object of :class:`cpl.application.application_abc.ApplicationABC` + r"""This is class is used to build a object of :class:`cpl_core.application.application_abc.ApplicationABC` Parameter --------- - app: Type[:class:`cpl.application.application_abc.ApplicationABC`] + app: Type[:class:`cpl_core.application.application_abc.ApplicationABC`] Application to build """ @@ -26,11 +26,11 @@ class ApplicationBuilder(ApplicationBuilderABC): self._services = ServiceCollection(self._configuration) def use_startup(self, startup: Type[StartupABC]): - self._startup = startup(self._configuration, self._services) + self._startup = startup() def build(self) -> ApplicationABC: if self._startup is not None: - self._startup.configure_configuration() - self._startup.configure_services() + self._startup.configure_configuration(self._configuration, self._environment) + self._startup.configure_services(self._services, self._environment) return self._app(self._configuration, self._services.build_service_provider()) diff --git a/src/cpl_core/application/application_builder_abc.py b/src/cpl_core/application/application_builder_abc.py index 44c68fd7..dff8e6f8 100644 --- a/src/cpl_core/application/application_builder_abc.py +++ b/src/cpl_core/application/application_builder_abc.py @@ -6,7 +6,7 @@ from cpl_core.application.startup_abc import StartupABC class ApplicationBuilderABC(ABC): - r"""ABC for the :class:`cpl.application.application_builder.ApplicationBuilder`""" + r"""ABC for the :class:`cpl_core.application.application_builder.ApplicationBuilder`""" @abstractmethod def __init__(self, *args): @@ -18,7 +18,7 @@ class ApplicationBuilderABC(ABC): Parameter --------- - startup: Type[:class:`cpl.application.startup_abc.StartupABC`] + startup: Type[:class:`cpl_core.application.startup_abc.StartupABC`] Startup class to use """ pass @@ -29,6 +29,6 @@ class ApplicationBuilderABC(ABC): Returns ------- - Object of :class:`cpl.application.application_abc.ApplicationABC` + Object of :class:`cpl_core.application.application_abc.ApplicationABC` """ pass diff --git a/src/cpl_core/application/startup_abc.py b/src/cpl_core/application/startup_abc.py index fd48b644..0ace7711 100644 --- a/src/cpl_core/application/startup_abc.py +++ b/src/cpl_core/application/startup_abc.py @@ -1,7 +1,9 @@ from abc import ABC, abstractmethod from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC class StartupABC(ABC): @@ -12,21 +14,26 @@ class StartupABC(ABC): pass @abstractmethod - def configure_configuration(self) -> ConfigurationABC: + def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC) -> ConfigurationABC: r"""Creates configuration of application + Parameter + --------- + config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC` + env: :class:`cpl_core.environment.application_environment_abc` + Returns ------- - Object of :class:`cpl.configuration.configuration_abc.ConfigurationABC` + Object of :class:`cpl_core.configuration.configuration_abc.ConfigurationABC` """ pass @abstractmethod - def configure_services(self) -> ServiceProviderABC: + def configure_services(self, service: ServiceCollectionABC, env: ApplicationEnvironmentABC) -> ServiceProviderABC: r"""Creates service provider Returns ------- - Object of :class:`cpl.dependency_injection.service_provider_abc.ServiceProviderABC` + Object of :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC` """ pass diff --git a/src/cpl_core/configuration/configuration.py b/src/cpl_core/configuration/configuration.py index 605c6bcc..a1fa351e 100644 --- a/src/cpl_core/configuration/configuration.py +++ b/src/cpl_core/configuration/configuration.py @@ -122,7 +122,7 @@ class Configuration(ConfigurationABC): --------- argument: :class:`str` Command as string - argument_type: :class:`cpl.configuration.console_argument.ConsoleArgument` + argument_type: :class:`cpl_core.configuration.console_argument.ConsoleArgument` Command type as ConsoleArgument next_arguments: list[:class:`str`] Following arguments of argument diff --git a/src/cpl_core/configuration/configuration_abc.py b/src/cpl_core/configuration/configuration_abc.py index 9bade832..3d332f65 100644 --- a/src/cpl_core/configuration/configuration_abc.py +++ b/src/cpl_core/configuration/configuration_abc.py @@ -11,7 +11,7 @@ class ConfigurationABC(ABC): @abstractmethod def __init__(self): - r"""ABC for the :class:`cpl.configuration.configuration.Configuration`""" + r"""ABC for the :class:`cpl_core.configuration.configuration.Configuration`""" pass @property @@ -47,7 +47,7 @@ class ConfigurationABC(ABC): Parameter --------- - argument: :class:`cpl.configuration.console_argument.ConsoleArgument` + argument: :class:`cpl_core.configuration.console_argument.ConsoleArgument` Specifies the console argument """ pass @@ -88,7 +88,7 @@ class ConfigurationABC(ABC): --------- key_type: Union[:class:`str`, :class:`type`] Type of the value - value: Union[:class:`str`, :class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`] + value: Union[:class:`str`, :class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`] Object of the value """ pass @@ -99,11 +99,11 @@ class ConfigurationABC(ABC): Parameter --------- - search_type: Union[:class:`str`, Type[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]] + search_type: Union[:class:`str`, Type[:class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]] Type to search for Returns ------- - Object of Union[:class:`str`, Callable[:class:`cpl.configuration.configuration_model_abc.ConfigurationModelABC`]] + Object of Union[:class:`str`, Callable[:class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]] """ pass diff --git a/src/cpl_core/configuration/console_argument.py b/src/cpl_core/configuration/console_argument.py index 807f74ae..6407aa5f 100644 --- a/src/cpl_core/configuration/console_argument.py +++ b/src/cpl_core/configuration/console_argument.py @@ -17,7 +17,7 @@ class ConsoleArgument: aliases: list[:class:`str`] value_token: :class:`str` is_value_token_optional: :class:`bool` - console_arguments: List[:class:`cpl.configuration.console_argument.ConsoleArgument`] + console_arguments: List[:class:`cpl_core.configuration.console_argument.ConsoleArgument`] """ self._token = token self._name = name diff --git a/src/cpl_core/console/console.py b/src/cpl_core/console/console.py index aff76a8b..52ae7f41 100644 --- a/src/cpl_core/console/console.py +++ b/src/cpl_core/console/console.py @@ -64,7 +64,7 @@ class Console: Parameter --------- - color: Union[:class:`cpl.console.background_color_enum.BackgroundColorEnum`, :class:`str`] + color: Union[:class:`cpl_core.console.background_color_enum.BackgroundColorEnum`, :class:`str`] Background color of the console """ if type(color) is str: @@ -78,7 +78,7 @@ class Console: Parameter --------- - color: Union[:class:`cpl.console.background_color_enum.BackgroundColorEnum`, :class:`str`] + color: Union[:class:`cpl_core.console.background_color_enum.BackgroundColorEnum`, :class:`str`] Foreground color of the console """ if type(color) is str: @@ -365,17 +365,17 @@ class Console: Message or header of the selection options: List[:class:`str`] Selectable options - header_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`] + header_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`] Foreground color of the header - header_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`] + header_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`] Background color of the header - option_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`] + option_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`] Foreground color of the options - option_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`] + option_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`] Background color of the options - cursor_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`] + cursor_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`] Foreground color of the cursor - cursor_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`] + cursor_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`] Background color of the cursor Returns @@ -423,13 +423,13 @@ class Console: Function to call args: :class:`list` Arguments of the function - text_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`] + text_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`] Foreground color of the text - spinner_foreground_color: Union[:class:`str`, :class:`cpl.console.foreground_color_enum.ForegroundColorEnum`] + spinner_foreground_color: Union[:class:`str`, :class:`cpl_core.console.foreground_color_enum.ForegroundColorEnum`] Foreground color of the spinner - text_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`] + text_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`] Background color of the text - spinner_background_color: Union[:class:`str`, :class:`cpl.console.background_color_enum.BackgroundColorEnum`] + spinner_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`] Background color of the spinner kwargs: :class:`dict` Keyword arguments of the call diff --git a/src/cpl_core/console/spinner_thread.py b/src/cpl_core/console/spinner_thread.py index 43afcb25..681ba234 100644 --- a/src/cpl_core/console/spinner_thread.py +++ b/src/cpl_core/console/spinner_thread.py @@ -16,9 +16,9 @@ class SpinnerThread(threading.Thread): --------- msg_len: :class:`int` Length of the message - foreground_color: :class:`cpl.console.foreground_color.ForegroundColorEnum` + foreground_color: :class:`cpl_core.console.foreground_color.ForegroundColorEnum` Foreground color of the spinner - background_color: :class:`cpl.console.background_color.BackgroundColorEnum` + background_color: :class:`cpl_core.console.background_color.BackgroundColorEnum` Background color of the spinner """ diff --git a/src/cpl_core/database/connection/database_connection.py b/src/cpl_core/database/connection/database_connection.py index d889d240..6f73363c 100644 --- a/src/cpl_core/database/connection/database_connection.py +++ b/src/cpl_core/database/connection/database_connection.py @@ -14,7 +14,7 @@ class DatabaseConnection(DatabaseConnectionABC): Parameter --------- - database_settings: :class:`cpl.database.database_settings.DatabaseSettings` + database_settings: :class:`cpl_core.database.database_settings.DatabaseSettings` """ def __init__(self, database_settings: DatabaseSettings): diff --git a/src/cpl_core/database/connection/database_connection_abc.py b/src/cpl_core/database/connection/database_connection_abc.py index 637c1da7..976147e1 100644 --- a/src/cpl_core/database/connection/database_connection_abc.py +++ b/src/cpl_core/database/connection/database_connection_abc.py @@ -5,7 +5,7 @@ from sqlalchemy.orm import Session class DatabaseConnectionABC(ABC): - r"""ABC for the :class:`cpl.database.connection.database_connection.DatabaseConnection`""" + r"""ABC for the :class:`cpl_core.database.connection.database_connection.DatabaseConnection`""" @abstractmethod def __init__(self): pass diff --git a/src/cpl_core/database/context/database_context.py b/src/cpl_core/database/context/database_context.py index 922c07e7..f706cfc9 100644 --- a/src/cpl_core/database/context/database_context.py +++ b/src/cpl_core/database/context/database_context.py @@ -15,7 +15,7 @@ class DatabaseContext(DatabaseContextABC): Parameter --------- - database_settings: :class:`cpl.database.database_settings.DatabaseSettings` + database_settings: :class:`cpl_core.database.database_settings.DatabaseSettings` """ def __init__(self, database_settings: DatabaseSettings): diff --git a/src/cpl_core/database/context/database_context_abc.py b/src/cpl_core/database/context/database_context_abc.py index 0587560c..09903d86 100644 --- a/src/cpl_core/database/context/database_context_abc.py +++ b/src/cpl_core/database/context/database_context_abc.py @@ -5,7 +5,7 @@ from sqlalchemy.orm import Session class DatabaseContextABC(ABC): - r"""ABC for the :class:`cpl.database.context.database_context.DatabaseContext`""" + r"""ABC for the :class:`cpl_core.database.context.database_context.DatabaseContext`""" @abstractmethod def __init__(self, *args): diff --git a/src/cpl_core/dependency_injection/service_collection_abc.py b/src/cpl_core/dependency_injection/service_collection_abc.py index 5f05217e..e597ec40 100644 --- a/src/cpl_core/dependency_injection/service_collection_abc.py +++ b/src/cpl_core/dependency_injection/service_collection_abc.py @@ -8,7 +8,7 @@ from cpl_core.dependency_injection.service_provider_abc import ServiceProviderAB class ServiceCollectionABC(ABC): - r"""ABC for the class :class:`cpl.dependency_injection.service_collection.ServiceCollection`""" + r"""ABC for the class :class:`cpl_core.dependency_injection.service_collection.ServiceCollection`""" @abstractmethod def __init__(self): @@ -20,9 +20,9 @@ class ServiceCollectionABC(ABC): Parameter --------- - db_context: Type[:class:`cpl.database.context.database_context_abc.DatabaseContextABC`] + db_context: Type[:class:`cpl_core.database.context.database_context_abc.DatabaseContextABC`] Database context - db_settings: :class:`cpl.database.database_settings.DatabaseSettings` + db_settings: :class:`cpl_core.database.database_settings.DatabaseSettings` Database settings """ pass @@ -77,6 +77,6 @@ class ServiceCollectionABC(ABC): Returns ------- - Object of type :class:`cpl.dependency_injection.service_provider_abc.ServiceProviderABC` + Object of type :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC` """ pass diff --git a/src/cpl_core/dependency_injection/service_descriptor.py b/src/cpl_core/dependency_injection/service_descriptor.py index 01eea5ce..2188ffd0 100644 --- a/src/cpl_core/dependency_injection/service_descriptor.py +++ b/src/cpl_core/dependency_injection/service_descriptor.py @@ -10,7 +10,7 @@ class ServiceDescriptor: --------- implementation: Union[:class:`type`, Optional[:class:`object`]] Object or type of service - lifetime: :class:`cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum` + lifetime: :class:`cpl_core.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum` Lifetime of the service """ diff --git a/src/cpl_core/dependency_injection/service_provider.py b/src/cpl_core/dependency_injection/service_provider.py index 62769b9e..6357716d 100644 --- a/src/cpl_core/dependency_injection/service_provider.py +++ b/src/cpl_core/dependency_injection/service_provider.py @@ -16,11 +16,11 @@ class ServiceProvider(ServiceProviderABC): Parameter --------- - service_descriptors: list[:class:`cpl.dependency_injection.service_descriptor.ServiceDescriptor`] + service_descriptors: list[:class:`cpl_core.dependency_injection.service_descriptor.ServiceDescriptor`] Descriptor of the service - config: :class:`cpl.configuration.configuration_abc.ConfigurationABC` + config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC` CPL Configuration - db_context: Optional[:class:`cpl.database.context.database_context_abc.DatabaseContextABC`] + db_context: Optional[:class:`cpl_core.database.context.database_context_abc.DatabaseContextABC`] Database representation """ diff --git a/src/cpl_core/dependency_injection/service_provider_abc.py b/src/cpl_core/dependency_injection/service_provider_abc.py index 570035ad..507deb21 100644 --- a/src/cpl_core/dependency_injection/service_provider_abc.py +++ b/src/cpl_core/dependency_injection/service_provider_abc.py @@ -4,7 +4,7 @@ from typing import Type, Optional class ServiceProviderABC(ABC): - r"""ABC for the class :class:`cpl.dependency_injection.service_provider.ServiceProvider`""" + r"""ABC for the class :class:`cpl_core.dependency_injection.service_provider.ServiceProvider`""" @abstractmethod def __init__(self): diff --git a/src/cpl_core/environment/application_environment.py b/src/cpl_core/environment/application_environment.py index 1c783fbe..73f82571 100644 --- a/src/cpl_core/environment/application_environment.py +++ b/src/cpl_core/environment/application_environment.py @@ -12,7 +12,7 @@ class ApplicationEnvironment(ApplicationEnvironmentABC): Parameter --------- - name: :class:`cpl.environment.environment_name_enum.EnvironmentNameEnum` + name: :class:`cpl_core.environment.environment_name_enum.EnvironmentNameEnum` """ def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production): diff --git a/src/cpl_core/environment/application_environment_abc.py b/src/cpl_core/environment/application_environment_abc.py index 7d0b82c7..f5b9bd43 100644 --- a/src/cpl_core/environment/application_environment_abc.py +++ b/src/cpl_core/environment/application_environment_abc.py @@ -3,7 +3,7 @@ from datetime import datetime class ApplicationEnvironmentABC(ABC): - r"""ABC of the class :class:`cpl.environment.application_environment.ApplicationEnvironment`""" + r"""ABC of the class :class:`cpl_core.environment.application_environment.ApplicationEnvironment`""" @abstractmethod def __init__(self): diff --git a/src/cpl_core/logging/logger_abc.py b/src/cpl_core/logging/logger_abc.py index a6bfa72f..60a878c9 100644 --- a/src/cpl_core/logging/logger_abc.py +++ b/src/cpl_core/logging/logger_abc.py @@ -2,7 +2,7 @@ from abc import abstractmethod, ABC class LoggerABC(ABC): - r"""ABC for :class:`cpl.logging.logger_service.Logger`""" + r"""ABC for :class:`cpl_core.logging.logger_service.Logger`""" @abstractmethod def __init__(self): diff --git a/src/cpl_core/logging/logger_service.py b/src/cpl_core/logging/logger_service.py index 6c8d352a..c7622364 100644 --- a/src/cpl_core/logging/logger_service.py +++ b/src/cpl_core/logging/logger_service.py @@ -17,11 +17,11 @@ class Logger(LoggerABC): Parameter --------- - logging_settings: :class:`cpl.logging.logging_settings.LoggingSettings` + logging_settings: :class:`cpl_core.logging.logging_settings.LoggingSettings` Settings for the logger - time_format: :class:`cpl.time.time_format_settings.TimeFormatSettings` + time_format: :class:`cpl_core.time.time_format_settings.TimeFormatSettings` Time format settings - env: :class:`cpl.environment.application_environment_abc.ApplicationEnvironmentABC` + env: :class:`cpl_core.environment.application_environment_abc.ApplicationEnvironmentABC` Environment of the application """ @@ -116,7 +116,7 @@ class Logger(LoggerABC): --------- name: :class:`str` Name of the message - level: :class:`cpl.logging.logging_level_enum.LoggingLevelEnum` + level: :class:`cpl_core.logging.logging_level_enum.LoggingLevelEnum` Logging level message: :class:`str` Log message diff --git a/src/cpl_core/mailing/email_client_abc.py b/src/cpl_core/mailing/email_client_abc.py index 9d60e35b..ae103e60 100644 --- a/src/cpl_core/mailing/email_client_abc.py +++ b/src/cpl_core/mailing/email_client_abc.py @@ -4,7 +4,7 @@ from cpl_core.mailing.email import EMail class EMailClientABC(ABC): - """ABC of :class:`cpl.mailing.email_client_service.EMailClient`""" + """ABC of :class:`cpl_core.mailing.email_client_service.EMailClient`""" @abstractmethod def __init__(self): @@ -21,7 +21,7 @@ class EMailClientABC(ABC): Parameter --------- - email: :class:`cpl.mailing.email.EMail` + email: :class:`cpl_core.mailing.email.EMail` Object of the E-Mail to send """ pass diff --git a/src/cpl_core/mailing/email_client_service.py b/src/cpl_core/mailing/email_client_service.py index 4d45248e..2a811e1b 100644 --- a/src/cpl_core/mailing/email_client_service.py +++ b/src/cpl_core/mailing/email_client_service.py @@ -15,11 +15,11 @@ class EMailClient(EMailClientABC): Parameter --------- - environment: :class:`cpl.environment.application_environment_abc.ApplicationEnvironmentABC` + environment: :class:`cpl_core.environment.application_environment_abc.ApplicationEnvironmentABC` Environment of the application - logger: :class:`cpl.logging.logger_abc.LoggerABC` + logger: :class:`cpl_core.logging.logger_abc.LoggerABC` The logger to use - mail_settings: :class:`cpl.mailing.email_client_settings.EMailClientSettings` + mail_settings: :class:`cpl_core.mailing.email_client_settings.EMailClientSettings` Settings for mailing """ diff --git a/src/tests/custom/general/src/general/startup.py b/src/tests/custom/general/src/general/startup.py index 3314b852..3882d130 100644 --- a/src/tests/custom/general/src/general/startup.py +++ b/src/tests/custom/general/src/general/startup.py @@ -2,6 +2,7 @@ from cpl_core.application.startup_abc import StartupABC from cpl_core.configuration.configuration_abc import ConfigurationABC from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.environment import ApplicationEnvironmentABC from cpl_core.logging.logger_service import Logger from cpl_core.logging.logger_abc import LoggerABC from cpl_core.mailing.email_client_service import EMailClient @@ -11,24 +12,21 @@ from test_service import TestService class Startup(StartupABC): - def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC): + def __init__(self): StartupABC.__init__(self) - self._configuration = config - self._services = services + def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC) -> ConfigurationABC: + config.add_environment_variables('PYTHON_') + config.add_environment_variables('CPL_') + config.add_json_file(f'appsettings.json') + config.add_json_file(f'appsettings.{config.environment.environment_name}.json') + config.add_json_file(f'appsettings.{config.environment.host_name}.json', optional=True) - def configure_configuration(self) -> ConfigurationABC: - self._configuration.add_environment_variables('PYTHON_') - self._configuration.add_environment_variables('CPL_') - self._configuration.add_json_file(f'appsettings.json') - self._configuration.add_json_file(f'appsettings.{self._configuration.environment.environment_name}.json') - self._configuration.add_json_file(f'appsettings.{self._configuration.environment.host_name}.json', optional=True) + return config - return self._configuration + def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC) -> ServiceProviderABC: + services.add_singleton(LoggerABC, Logger) + services.add_singleton(EMailClientABC, EMailClient) + services.add_singleton(TestService) - def configure_services(self) -> ServiceProviderABC: - self._services.add_singleton(LoggerABC, Logger) - self._services.add_singleton(EMailClientABC, EMailClient) - self._services.add_singleton(TestService) - - return self._services.build_service_provider() + return services.build_service_provider() From 2809a9cd821a3962fce7ffcc570703105bba0f65 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 7 Aug 2021 11:24:17 +0200 Subject: [PATCH 43/49] Improved imports --- src/tests/custom/general/src/general/startup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/custom/general/src/general/startup.py b/src/tests/custom/general/src/general/startup.py index 3882d130..34337e03 100644 --- a/src/tests/custom/general/src/general/startup.py +++ b/src/tests/custom/general/src/general/startup.py @@ -2,7 +2,7 @@ from cpl_core.application.startup_abc import StartupABC from cpl_core.configuration.configuration_abc import ConfigurationABC from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC -from cpl_core.environment import ApplicationEnvironmentABC +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC from cpl_core.logging.logger_service import Logger from cpl_core.logging.logger_abc import LoggerABC from cpl_core.mailing.email_client_service import EMailClient From 05a9bdbf4a631e8e3c5251378b200d1f978c8070 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 7 Aug 2021 11:29:00 +0200 Subject: [PATCH 44/49] Improved docstrings --- src/cpl_core/application/startup_abc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cpl_core/application/startup_abc.py b/src/cpl_core/application/startup_abc.py index 0ace7711..1d1af6d6 100644 --- a/src/cpl_core/application/startup_abc.py +++ b/src/cpl_core/application/startup_abc.py @@ -32,6 +32,11 @@ class StartupABC(ABC): def configure_services(self, service: ServiceCollectionABC, env: ApplicationEnvironmentABC) -> ServiceProviderABC: r"""Creates service provider + Parameter + --------- + services: :class:`cpl_core.dependency_injection.service_collection_abc` + env: :class:`cpl_core.environment.application_environment_abc` + Returns ------- Object of :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC` From 3903f853683b3f35425e28ee8dce830f4122c6f2 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 2 Oct 2021 10:57:54 +0200 Subject: [PATCH 45/49] Added logic to handle extensions before running the app --- .../application/application_builder.py | 20 +++++++++++++++++-- .../application/application_extension_abc.py | 13 ++++++++++++ .../custom/general/src/general/application.py | 3 ++- src/tests/custom/general/src/general/main.py | 2 ++ .../general/src/general/test_extension.py | 13 ++++++++++++ 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 src/cpl_core/application/application_extension_abc.py create mode 100644 src/tests/custom/general/src/general/test_extension.py diff --git a/src/cpl_core/application/application_builder.py b/src/cpl_core/application/application_builder.py index ee3f52a6..27ccb762 100644 --- a/src/cpl_core/application/application_builder.py +++ b/src/cpl_core/application/application_builder.py @@ -1,9 +1,12 @@ -from typing import Type, Optional +import types +from typing import Type, Optional, Callable from cpl_core.application.application_abc import ApplicationABC from cpl_core.application.application_builder_abc import ApplicationBuilderABC +from cpl_core.application.application_extension_abc import ApplicationExtensionABC from cpl_core.application.startup_abc import StartupABC from cpl_core.configuration.configuration import Configuration +from cpl_core.console import Console from cpl_core.dependency_injection.service_collection import ServiceCollection @@ -25,12 +28,25 @@ class ApplicationBuilder(ApplicationBuilderABC): self._environment = self._configuration.environment self._services = ServiceCollection(self._configuration) + self._extensions: list[Callable] = [] + def use_startup(self, startup: Type[StartupABC]): self._startup = startup() + def use_extension(self, extension: Type[ApplicationExtensionABC]): + if extension not in self._extensions: + self._extensions.append(extension) + def build(self) -> ApplicationABC: if self._startup is not None: self._startup.configure_configuration(self._configuration, self._environment) self._startup.configure_services(self._services, self._environment) - return self._app(self._configuration, self._services.build_service_provider()) + config = self._configuration + services = self._services.build_service_provider() + + for ex in self._extensions: + extension = ex() + extension.run(config, services) + + return self._app(config, services) diff --git a/src/cpl_core/application/application_extension_abc.py b/src/cpl_core/application/application_extension_abc.py new file mode 100644 index 00000000..0a6dfc20 --- /dev/null +++ b/src/cpl_core/application/application_extension_abc.py @@ -0,0 +1,13 @@ +from abc import ABC, abstractmethod + +from cpl_core.configuration import ConfigurationABC +from cpl_core.dependency_injection import ServiceProviderABC + + +class ApplicationExtensionABC(ABC): + + @abstractmethod + def __init__(self): pass + + @abstractmethod + def run(self, config: ConfigurationABC, services: ServiceProviderABC): pass diff --git a/src/tests/custom/general/src/general/application.py b/src/tests/custom/general/src/general/application.py index a42536af..9e2d4ef0 100644 --- a/src/tests/custom/general/src/general/application.py +++ b/src/tests/custom/general/src/general/application.py @@ -37,7 +37,8 @@ class Application(ApplicationABC): self._mailer = self._services.get_service(EMailClientABC) def main(self): - self._logger.header(f'{self._configuration.environment.application_name}:') + if self._configuration.environment.application_name != '': + self._logger.header(f'{self._configuration.environment.application_name}:') self._logger.debug(__name__, f'Host: {self._configuration.environment.host_name}') self._logger.debug(__name__, f'Environment: {self._configuration.environment.environment_name}') self._logger.debug(__name__, f'Customer: {self._configuration.environment.customer}') diff --git a/src/tests/custom/general/src/general/main.py b/src/tests/custom/general/src/general/main.py index f6515f12..339c0723 100644 --- a/src/tests/custom/general/src/general/main.py +++ b/src/tests/custom/general/src/general/main.py @@ -1,11 +1,13 @@ from cpl_core.application.application_builder import ApplicationBuilder from application import Application +from general.test_extension import TestExtension from startup import Startup def main(): app_builder = ApplicationBuilder(Application) app_builder.use_startup(Startup) + app_builder.use_extension(TestExtension) app_builder.build().run() diff --git a/src/tests/custom/general/src/general/test_extension.py b/src/tests/custom/general/src/general/test_extension.py new file mode 100644 index 00000000..b314c665 --- /dev/null +++ b/src/tests/custom/general/src/general/test_extension.py @@ -0,0 +1,13 @@ +from cpl_core.application.application_extension_abc import ApplicationExtensionABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceProviderABC + + +class TestExtension(ApplicationExtensionABC): + + def __init__(self): + ApplicationExtensionABC.__init__(self) + + def run(self, config: ConfigurationABC, services: ServiceProviderABC): + Console.write_line('Hello World from App Extension') From f8ebb4f1d7a07ded267036e5e3c5bea4a027399c Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 3 Oct 2021 11:02:08 +0200 Subject: [PATCH 46/49] Improved imports in test app --- src/tests/custom/general/src/general/application.py | 9 ++++----- src/tests/custom/general/src/general/main.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tests/custom/general/src/general/application.py b/src/tests/custom/general/src/general/application.py index 9e2d4ef0..c3113fb8 100644 --- a/src/tests/custom/general/src/general/application.py +++ b/src/tests/custom/general/src/general/application.py @@ -1,13 +1,12 @@ import time from typing import Optional -from cpl_core.application.application_abc import ApplicationABC -from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC from cpl_core.console.console import Console -from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC +from cpl_core.dependency_injection import ServiceProviderABC from cpl_core.logging.logger_abc import LoggerABC -from cpl_core.mailing.email import EMail -from cpl_core.mailing.email_client_abc import EMailClientABC +from cpl_core.mailing import EMailClientABC, EMail from test_service import TestService diff --git a/src/tests/custom/general/src/general/main.py b/src/tests/custom/general/src/general/main.py index 339c0723..2835d115 100644 --- a/src/tests/custom/general/src/general/main.py +++ b/src/tests/custom/general/src/general/main.py @@ -1,5 +1,5 @@ -from cpl_core.application.application_builder import ApplicationBuilder from application import Application +from cpl_core.application import ApplicationBuilder from general.test_extension import TestExtension from startup import Startup From a8011267d9ff277efe0dbbbe4df9131b2be81865 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 3 Oct 2021 11:23:17 +0200 Subject: [PATCH 47/49] Improved version command --- src/cpl_cli/command/version_service.py | 9 ++- src/cpl_cli/startup.py | 95 ++++++++++++-------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/cpl_cli/command/version_service.py b/src/cpl_cli/command/version_service.py index f49ac540..5f8050ef 100644 --- a/src/cpl_cli/command/version_service.py +++ b/src/cpl_cli/command/version_service.py @@ -45,9 +45,14 @@ class VersionService(CommandABC): Console.write_line(f'OS: {platform.system()} {platform.processor()}') Console.write_line('\nCPL packages:') + cpl_packages = [ + 'cpl_core', + 'cpl_cli', + 'cpl_query' + ] packages = [] - for importer, modname, is_pkg in pkgutil.iter_modules(cpl_core.__path__): - module = importer.find_module(modname).load_module(modname) + for modname in cpl_packages: + module = pkgutil.find_loader(modname).load_module(modname) if '__version__' in dir(module): packages.append([f'{modname}', module.__version__]) diff --git a/src/cpl_cli/startup.py b/src/cpl_cli/startup.py index 07ff0fa9..1148b66a 100644 --- a/src/cpl_cli/startup.py +++ b/src/cpl_cli/startup.py @@ -25,30 +25,25 @@ from cpl_cli.error import Error from cpl_cli.live_server.live_server_service import LiveServerService from cpl_cli.publish.publisher_service import PublisherService from cpl_cli.publish.publisher_abc import PublisherABC +from cpl_core.environment import ApplicationEnvironment class Startup(StartupABC): - def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC): + def __init__(self): StartupABC.__init__(self) - self._configuration = config - self._env = self._configuration.environment - self._services = services + def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: + environment.set_runtime_directory(os.path.dirname(__file__)) + configuration.argument_error_function = Error.error - self._env.set_runtime_directory(os.path.dirname(__file__)) + configuration.add_environment_variables('PYTHON_') + configuration.add_environment_variables('CPL_') + configuration.add_json_file('appsettings.json', path=environment.runtime_directory, optional=False, output=False) - def configure_configuration(self) -> ConfigurationABC: - self._configuration.argument_error_function = Error.error - - self._configuration.add_environment_variables('PYTHON_') - self._configuration.add_environment_variables('CPL_') - self._configuration.add_json_file('appsettings.json', path=self._env.runtime_directory, - optional=False, output=False) - - self._configuration.add_console_argument(ConsoleArgument('', 'add', ['a', 'a'], ' ')) - self._configuration.add_console_argument(ConsoleArgument('', 'build', ['b', 'B'], '')) - self._configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', console_arguments=[ + configuration.add_console_argument(ConsoleArgument('', 'add', ['a', 'a'], ' ')) + configuration.add_console_argument(ConsoleArgument('', 'build', ['b', 'B'], '')) + configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', console_arguments=[ ConsoleArgument('', 'abc', ['a', 'A'], ' '), ConsoleArgument('', 'class', ['c', 'C'], ' '), ConsoleArgument('', 'enum', ['e', 'E'], ' '), @@ -56,54 +51,54 @@ class Startup(StartupABC): ConsoleArgument('', 'settings', ['st', 'ST'], ' '), ConsoleArgument('', 'thread', ['t', 't'], ' ') ])) - self._configuration.add_console_argument( + configuration.add_console_argument( ConsoleArgument('', 'help', ['h', 'H'], ' ', is_value_token_optional=True) ) - self._configuration.add_console_argument( + configuration.add_console_argument( ConsoleArgument('', 'install', ['i', 'I'], ' ', is_value_token_optional=True) ) - self._configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', console_arguments=[ + configuration.add_console_argument(ConsoleArgument('', 'new', ['n', 'N'], '', console_arguments=[ ConsoleArgument('', 'console', ['c', 'C'], ' '), ConsoleArgument('', 'library', ['l', 'L'], ' ') ])) - self._configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], '')) - self._configuration.add_console_argument(ConsoleArgument('', 'remove', ['r', 'R'], ' ')) - self._configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], '')) - self._configuration.add_console_argument(ConsoleArgument('', 'uninstall', ['ui', 'UI'], ' ')) - self._configuration.add_console_argument(ConsoleArgument('', 'update', ['u', 'U'], '')) - self._configuration.add_console_argument(ConsoleArgument('', 'version', ['v', 'V'], '')) + configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], '')) + configuration.add_console_argument(ConsoleArgument('', 'remove', ['r', 'R'], ' ')) + configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], '')) + configuration.add_console_argument(ConsoleArgument('', 'uninstall', ['ui', 'UI'], ' ')) + configuration.add_console_argument(ConsoleArgument('', 'update', ['u', 'U'], '')) + configuration.add_console_argument(ConsoleArgument('', 'version', ['v', 'V'], '')) - self._configuration.add_console_argument(ConsoleArgument('', '--help', ['-h', '-H'], '')) + configuration.add_console_argument(ConsoleArgument('', '--help', ['-h', '-H'], '')) - if os.path.isfile(os.path.join(self._env.working_directory, 'cpl-workspace.json')): - self._configuration.add_json_file('cpl-workspace.json', optional=True, output=False) - workspace: Optional[WorkspaceSettings] = self._configuration.get_configuration(WorkspaceSettings) + if os.path.isfile(os.path.join(environment.working_directory, 'cpl-workspace.json')): + configuration.add_json_file('cpl-workspace.json', optional=True, output=False) + workspace: Optional[WorkspaceSettings] = configuration.get_configuration(WorkspaceSettings) for script in workspace.scripts: - self._configuration.add_console_argument( + configuration.add_console_argument( ConsoleArgument('', script, [], ' ', is_value_token_optional=True)) - self._configuration.add_console_arguments(error=False) + configuration.add_console_arguments(error=False) - return self._configuration + return configuration - def configure_services(self) -> ServiceProviderABC: - self._services.add_singleton(CommandHandler) + def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC: + services.add_singleton(CommandHandler) - self._services.add_transient(PublisherABC, PublisherService) - self._services.add_transient(LiveServerService) + services.add_transient(PublisherABC, PublisherService) + services.add_transient(LiveServerService) - self._services.add_transient(AddService) - self._services.add_transient(BuildService) - self._services.add_transient(CustomScriptService) - self._services.add_transient(GenerateService) - self._services.add_transient(HelpService) - self._services.add_transient(InstallService) - self._services.add_transient(NewService) - self._services.add_transient(PublishService) - self._services.add_transient(RemoveService) - self._services.add_transient(StartService) - self._services.add_transient(UninstallService) - self._services.add_transient(UpdateService) - self._services.add_transient(VersionService) + services.add_transient(AddService) + services.add_transient(BuildService) + services.add_transient(CustomScriptService) + services.add_transient(GenerateService) + services.add_transient(HelpService) + services.add_transient(InstallService) + services.add_transient(NewService) + services.add_transient(PublishService) + services.add_transient(RemoveService) + services.add_transient(StartService) + services.add_transient(UninstallService) + services.add_transient(UpdateService) + services.add_transient(VersionService) - return self._services.build_service_provider() + return services.build_service_provider() From 8460c0fa33a2a5177f996ae9f3ec4e521d09a05f Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 4 Oct 2021 09:23:08 +0200 Subject: [PATCH 48/49] Published 2021.10 --- scripts/publish.sh | 2 +- src/cpl_cli/__init__.py | 4 ++-- src/cpl_cli/_templates/__init__.py | 4 ++-- src/cpl_cli/_templates/build/__init__.py | 4 ++-- src/cpl_cli/_templates/generate/__init__.py | 4 ++-- src/cpl_cli/_templates/new/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/console/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/name/__init__.py | 4 ++-- src/cpl_cli/_templates/new/library/source/tests/__init__.py | 4 ++-- src/cpl_cli/_templates/publish/__init__.py | 4 ++-- src/cpl_cli/command/__init__.py | 4 ++-- src/cpl_cli/configuration/__init__.py | 4 ++-- src/cpl_cli/cpl_cli.json | 4 ++-- src/cpl_cli/live_server/__init__.py | 4 ++-- src/cpl_cli/publish/__init__.py | 4 ++-- src/cpl_cli/source_creator/__init__.py | 4 ++-- src/cpl_core/__init__.py | 4 ++-- src/cpl_core/application/__init__.py | 4 ++-- src/cpl_core/configuration/__init__.py | 4 ++-- src/cpl_core/console/__init__.py | 4 ++-- src/cpl_core/cpl_core.json | 2 +- src/cpl_core/database/__init__.py | 4 ++-- src/cpl_core/database/connection/__init__.py | 4 ++-- src/cpl_core/database/context/__init__.py | 4 ++-- src/cpl_core/dependency_injection/__init__.py | 4 ++-- src/cpl_core/environment/__init__.py | 4 ++-- src/cpl_core/logging/__init__.py | 4 ++-- src/cpl_core/mailing/__init__.py | 4 ++-- src/cpl_core/time/__init__.py | 4 ++-- src/cpl_core/utils/__init__.py | 4 ++-- src/cpl_query/__init__.py | 4 ++-- src/cpl_query/_extension/__init__.py | 4 ++-- src/cpl_query/_query/__init__.py | 4 ++-- src/cpl_query/cpl_query.json | 4 ++-- src/cpl_query/extension/__init__.py | 4 ++-- 40 files changed, 78 insertions(+), 78 deletions(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index b1309515..eabbcb9c 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -12,4 +12,4 @@ cpl publish # CPL Query cd /home/sven/Nextcloud_Sven/Schreibtisch/git_sh-edraft_de/sh_cpl/src/cpl_query -cpl \ No newline at end of file +cpl publish \ No newline at end of file diff --git a/src/cpl_cli/__init__.py b/src/cpl_cli/__init__.py index 64912d77..9a87a9a0 100644 --- a/src/cpl_cli/__init__.py +++ b/src/cpl_cli/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple @@ -29,4 +29,4 @@ from .main import main from .startup import Startup VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/__init__.py b/src/cpl_cli/_templates/__init__.py index 2fe01cc2..71239dbd 100644 --- a/src/cpl_cli/_templates/__init__.py +++ b/src/cpl_cli/_templates/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/build/__init__.py b/src/cpl_cli/_templates/build/__init__.py index 54b539ca..575f88ff 100644 --- a/src/cpl_cli/_templates/build/__init__.py +++ b/src/cpl_cli/_templates/build/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.build' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/generate/__init__.py b/src/cpl_cli/_templates/generate/__init__.py index fca1363f..7aeb9dd9 100644 --- a/src/cpl_cli/_templates/generate/__init__.py +++ b/src/cpl_cli/_templates/generate/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.generate' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/__init__.py b/src/cpl_cli/_templates/new/__init__.py index 3d53f013..1a17d660 100644 --- a/src/cpl_cli/_templates/new/__init__.py +++ b/src/cpl_cli/_templates/new/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/console/__init__.py b/src/cpl_cli/_templates/new/console/__init__.py index f876b366..ca907bec 100644 --- a/src/cpl_cli/_templates/new/console/__init__.py +++ b/src/cpl_cli/_templates/new/console/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/console/source/__init__.py b/src/cpl_cli/_templates/new/console/source/__init__.py index f868829b..5160ae60 100644 --- a/src/cpl_cli/_templates/new/console/source/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/console/source/name/__init__.py b/src/cpl_cli/_templates/new/console/source/name/__init__.py index 11d99c4a..87cf1328 100644 --- a/src/cpl_cli/_templates/new/console/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/console/source/tests/__init__.py b/src/cpl_cli/_templates/new/console/source/tests/__init__.py index eca63d58..e80108b0 100644 --- a/src/cpl_cli/_templates/new/console/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.console.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/library/__init__.py b/src/cpl_cli/_templates/new/library/__init__.py index d287ab7a..b1396478 100644 --- a/src/cpl_cli/_templates/new/library/__init__.py +++ b/src/cpl_cli/_templates/new/library/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/library/source/__init__.py b/src/cpl_cli/_templates/new/library/source/__init__.py index 88deb1dd..340b1326 100644 --- a/src/cpl_cli/_templates/new/library/source/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/library/source/name/__init__.py b/src/cpl_cli/_templates/new/library/source/name/__init__.py index 8443389e..6251a919 100644 --- a/src/cpl_cli/_templates/new/library/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/name/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/new/library/source/tests/__init__.py b/src/cpl_cli/_templates/new/library/source/tests/__init__.py index fd5bb865..b8acaa44 100644 --- a/src/cpl_cli/_templates/new/library/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/tests/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.new.library.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/_templates/publish/__init__.py b/src/cpl_cli/_templates/publish/__init__.py index bb935dac..665dc41c 100644 --- a/src/cpl_cli/_templates/publish/__init__.py +++ b/src/cpl_cli/_templates/publish/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli._templates.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/command/__init__.py b/src/cpl_cli/command/__init__.py index 0a470088..e393ed72 100644 --- a/src/cpl_cli/command/__init__.py +++ b/src/cpl_cli/command/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple @@ -28,4 +28,4 @@ from .publish_service import PublishService from .version_service import VersionService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/configuration/__init__.py b/src/cpl_cli/configuration/__init__.py index 2b3e605b..fbe11276 100644 --- a/src/cpl_cli/configuration/__init__.py +++ b/src/cpl_cli/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple @@ -30,4 +30,4 @@ from .workspace_settings import WorkspaceSettings from .workspace_settings_name_enum import WorkspaceSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/cpl_cli.json b/src/cpl_cli/cpl_cli.json index 46146adf..b515b7a6 100644 --- a/src/cpl_cli/cpl_cli.json +++ b/src/cpl_cli/cpl_cli.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "5" + "Micro": "0" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", @@ -16,7 +16,7 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "sh_cpl>=2021.4.0.post1" + "sh_cpl-core>=2021.10.0" ], "PythonVersion": ">=3.8", "PythonPath": {}, diff --git a/src/cpl_cli/live_server/__init__.py b/src/cpl_cli/live_server/__init__.py index 8fc495c2..dd1d9f42 100644 --- a/src/cpl_cli/live_server/__init__.py +++ b/src/cpl_cli/live_server/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/publish/__init__.py b/src/cpl_cli/publish/__init__.py index 9cffddd8..aebfb538 100644 --- a/src/cpl_cli/publish/__init__.py +++ b/src/cpl_cli/publish/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple @@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC from .publisher_service import PublisherService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_cli/source_creator/__init__.py b/src/cpl_cli/source_creator/__init__.py index 9375819d..33b21c46 100644 --- a/src/cpl_cli/source_creator/__init__.py +++ b/src/cpl_cli/source_creator/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_cli.source_creator' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.5' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='5') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/__init__.py b/src/cpl_core/__init__.py index ddc0f8c3..0c3d2958 100644 --- a/src/cpl_core/__init__.py +++ b/src/cpl_core/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_core' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/application/__init__.py b/src/cpl_core/application/__init__.py index 13b0cd96..24af4c32 100644 --- a/src/cpl_core/application/__init__.py +++ b/src/cpl_core/application/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.application' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -26,4 +26,4 @@ from .application_builder_abc import ApplicationBuilderABC from .startup_abc import StartupABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/configuration/__init__.py b/src/cpl_core/configuration/__init__.py index 97878f36..922312e4 100644 --- a/src/cpl_core/configuration/__init__.py +++ b/src/cpl_core/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -27,4 +27,4 @@ from .configuration_variable_name_enum import ConfigurationVariableNameEnum from .console_argument import ConsoleArgument VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/console/__init__.py b/src/cpl_core/console/__init__.py index 9cfd5902..b6a2e2da 100644 --- a/src/cpl_core/console/__init__.py +++ b/src/cpl_core/console/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum from .spinner_thread import SpinnerThread VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/cpl_core.json b/src/cpl_core/cpl_core.json index 42f8aebb..e82e2f4b 100644 --- a/src/cpl_core/cpl_core.json +++ b/src/cpl_core/cpl_core.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "6" + "Micro": "0" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_core/database/__init__.py b/src/cpl_core/database/__init__.py index c518b55a..01f60194 100644 --- a/src/cpl_core/database/__init__.py +++ b/src/cpl_core/database/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings from .database_settings_name_enum import DatabaseSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/database/connection/__init__.py b/src/cpl_core/database/connection/__init__.py index 5bcdbc93..235bfcf7 100644 --- a/src/cpl_core/database/connection/__init__.py +++ b/src/cpl_core/database/connection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.connection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection from .database_connection_abc import DatabaseConnectionABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/database/context/__init__.py b/src/cpl_core/database/context/__init__.py index 721d67e2..bebbf13d 100644 --- a/src/cpl_core/database/context/__init__.py +++ b/src/cpl_core/database/context/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.context' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -24,4 +24,4 @@ from .database_context import DatabaseContext from .database_context_abc import DatabaseContextABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/dependency_injection/__init__.py b/src/cpl_core/dependency_injection/__init__.py index 68a9e192..5824b419 100644 --- a/src/cpl_core/dependency_injection/__init__.py +++ b/src/cpl_core/dependency_injection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.dependency_injection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -28,4 +28,4 @@ from .service_provider import ServiceProvider from .service_provider_abc import ServiceProviderABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/environment/__init__.py b/src/cpl_core/environment/__init__.py index 6518878b..3f47418b 100644 --- a/src/cpl_core/environment/__init__.py +++ b/src/cpl_core/environment/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.environment' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -25,4 +25,4 @@ from .environment_name_enum import EnvironmentNameEnum from .application_environment import ApplicationEnvironment VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/logging/__init__.py b/src/cpl_core/logging/__init__.py index 9a930d78..77004711 100644 --- a/src/cpl_core/logging/__init__.py +++ b/src/cpl_core/logging/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.logging' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -27,4 +27,4 @@ from .logging_settings import LoggingSettings from .logging_settings_name_enum import LoggingSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/mailing/__init__.py b/src/cpl_core/mailing/__init__.py index 8ea20cfa..1f0e7f7d 100644 --- a/src/cpl_core/mailing/__init__.py +++ b/src/cpl_core/mailing/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.mailing' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -27,4 +27,4 @@ from .email_client_settings import EMailClientSettings from .email_client_settings_name_enum import EMailClientSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/time/__init__.py b/src/cpl_core/time/__init__.py index 8ba3b612..a16b20a3 100644 --- a/src/cpl_core/time/__init__.py +++ b/src/cpl_core/time/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.time' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -24,4 +24,4 @@ from .time_format_settings import TimeFormatSettings from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_core/utils/__init__.py b/src/cpl_core/utils/__init__.py index 14e1d114..637f1897 100644 --- a/src/cpl_core/utils/__init__.py +++ b/src/cpl_core/utils/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.utils' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.6' +__version__ = '2021.10.0' from collections import namedtuple @@ -25,4 +25,4 @@ from .string import String from .pip import Pip VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='6') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_query/__init__.py b/src/cpl_query/__init__.py index c4bb6465..c4bb7802 100644 --- a/src/cpl_query/__init__.py +++ b/src/cpl_query/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_query' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0rc1' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_query/_extension/__init__.py b/src/cpl_query/_extension/__init__.py index 20b5dd05..a663c76b 100644 --- a/src/cpl_query/_extension/__init__.py +++ b/src/cpl_query/_extension/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_query._extension' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0rc1' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_query/_query/__init__.py b/src/cpl_query/_query/__init__.py index 4eb1e489..fb6e0e79 100644 --- a/src/cpl_query/_query/__init__.py +++ b/src/cpl_query/_query/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_query._query' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0rc1' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') +version_info = VersionInfo(major='2021', minor='10', micro='0') diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index 02ace14b..7ab1335c 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -4,7 +4,7 @@ "Version": { "Major": "2021", "Minor": "10", - "Micro": "0.rc1" + "Micro": "0" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", @@ -16,7 +16,7 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "sh_cpl>=2021.4.0.post1" + "sh_cpl-core>=2021.10.0" ], "PythonVersion": ">=3.9.2", "PythonPath": {}, diff --git a/src/cpl_query/extension/__init__.py b/src/cpl_query/extension/__init__.py index 21af0cd0..5a8ab001 100644 --- a/src/cpl_query/extension/__init__.py +++ b/src/cpl_query/extension/__init__.py @@ -15,11 +15,11 @@ __title__ = 'cpl_query.extension' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' -__version__ = '2021.10.0rc1' +__version__ = '2021.10.0' from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2021', minor='10', micro='0.rc1') +version_info = VersionInfo(major='2021', minor='10', micro='0') From fb2872422e4160abcf699d2d8d347be51c9c835d Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 4 Oct 2021 09:30:27 +0200 Subject: [PATCH 49/49] Added upload script --- notices/pip.txt | 12 ++++++------ scripts/upload.sh | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 scripts/upload.sh diff --git a/notices/pip.txt b/notices/pip.txt index 6e6e9ab7..ac9f0c59 100644 --- a/notices/pip.txt +++ b/notices/pip.txt @@ -1,8 +1,8 @@ upload: prod: cpl: - twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl/publish/setup/* - twine upload -r pip.sh-edraft.de dist/sh_cpl/publish/setup/* + twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl-core/publish/setup/* + twine upload -r pip.sh-edraft.de dist/sh_cpl-core/publish/setup/* cli: twine upload --repository-url https://pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/* twine upload -r pip.sh-edraft.de dist/sh_cpl-cli/publish/setup/* @@ -13,8 +13,8 @@ upload: exp: cpl: - twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl/publish/setup/* - twine upload -r pip-exp.sh-edraft.de dist/sh_cpl/publish/setup/* + twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-core/publish/setup/* + twine upload -r pip-exp.sh-edraft.de dist/sh_cpl-core/publish/setup/* cli: twine upload --repository-url https://pip-exp.sh-edraft.de dist/sh_cpl-cli/publish/setup/* @@ -26,8 +26,8 @@ upload: dev: cpl: - twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl/publish/setup/* - twine upload -r pip-dev.sh-edraft.de dist/sh_cpl/publish/setup/* + twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-core/publish/setup/* + twine upload -r pip-dev.sh-edraft.de dist/sh_cpl-core/publish/setup/* cli: twine upload --repository-url https://pip-dev.sh-edraft.de dist/sh_cpl-cli/publish/setup/* diff --git a/scripts/upload.sh b/scripts/upload.sh new file mode 100644 index 00000000..9c27227f --- /dev/null +++ b/scripts/upload.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ $1 == "-prod" ]; then + twine upload -r pip.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/* + twine upload -r pip.sh-edraft.de ../dist/sh_cpl-core/publish/setup/* + twine upload -r pip.sh-edraft.de ../dist/sh_cpl-query/publish/setup/* +elif [ $1 == "-prod" ]; then + twine upload -r pip-exp.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/* + twine upload -r pip-exp.sh-edraft.de ../dist/sh_cpl-core/publish/setup/* + twine upload -r pip-.sh-edraft.de ../dist/sh_cpl-query/publish/setup/* + +else + twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-cli/publish/setup/* + twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-core/publish/setup/* + twine upload -r pip-dev.sh-edraft.de ../dist/sh_cpl-query/publish/setup/* +fi