Merge pull request '2022.7 - cpl-translation' (#90) from 2022.7 into master

Reviewed-on: #90
Closes #89
Closes #63
Closes #62
This commit is contained in:
Sven Heidemann 2022-07-10 18:10:30 +02:00
commit c0ae0c8389
86 changed files with 780 additions and 125 deletions

View File

@ -5,13 +5,15 @@
"cpl-core": "src/cpl_core/cpl-core.json", "cpl-core": "src/cpl_core/cpl-core.json",
"cpl-cli": "src/cpl_cli/cpl-cli.json", "cpl-cli": "src/cpl_cli/cpl-cli.json",
"cpl-query": "src/cpl_query/cpl-query.json", "cpl-query": "src/cpl_query/cpl-query.json",
"cpl-translation": "src/cpl_translation/cpl-translation.json",
"set-version": "tools/set_version/set-version.json", "set-version": "tools/set_version/set-version.json",
"set-pip-urls": "tools/set_pip_urls/set-pip-urls.json", "set-pip-urls": "tools/set_pip_urls/set-pip-urls.json",
"unittests": "unittests/unittests/unittests.json", "unittests": "unittests/unittests/unittests.json",
"unittests_cli": "unittests/unittests_cli/unittests_cli.json", "unittests_cli": "unittests/unittests_cli/unittests_cli.json",
"unittests_core": "unittests/unittests_core/unittests_core.json", "unittests_core": "unittests/unittests_core/unittests_core.json",
"unittests_query": "unittests/unittests_query/unittests_query.json", "unittests_query": "unittests/unittests_query/unittests_query.json",
"unittests_shared": "unittests/unittests_shared/unittests_shared.json" "unittests_shared": "unittests/unittests_shared/unittests_shared.json",
"unittests_translation": "unittests/unittests_translation/unittests_translation.json"
}, },
"Scripts": { "Scripts": {
"hello-world": "echo 'Hello World'", "hello-world": "echo 'Hello World'",
@ -24,72 +26,96 @@
"docs-build": "echo 'Build Documentation'; cd docs/; sphinx-apidoc -o source/ ../src/cpl_core; sphinx-apidoc -o source/ ../src/cpl_query; make clean; make html; rm source/cpl_query.tests.rst;", "docs-build": "echo 'Build Documentation'; cd docs/; sphinx-apidoc -o source/ ../src/cpl_core; sphinx-apidoc -o source/ ../src/cpl_query; make clean; make html; rm source/cpl_query.tests.rst;",
"db": "cpl docs-build", "db": "cpl docs-build",
"docs-open": "xdg-open $PWD/docs/build/html/index.html &", "docs-open": "xdg-open $PWD/docs/build/html/index.html &",
"do": "cpl docs-open", "do": "cpl docs-open",
"test": "cpl run unittests", "test": "cpl run unittests",
"pre-build-all": "cpl sv $ARGS; cpl spu $ARGS;", "pre-build-all": "cpl sv $ARGS; cpl spu $ARGS;",
"build-all": "cpl build-cli; cpl build-core; cpl build-query; cpl build-set-pip-urls; cpl build-set-version", "build-all": "cpl build-cli; cpl build-core; cpl build-query; cpl build-translation; cpl build-set-pip-urls; cpl build-set-version",
"ba": "cpl build-all $ARGS", "ba": "cpl build-all $ARGS",
"build-cli": "echo 'Build cpl-cli'; cd ./src/cpl_cli; cpl build; cd ../../;", "build-cli": "echo 'Build cpl-cli'; cd ./src/cpl_cli; cpl build; cd ../../;",
"build-core": "echo 'Build cpl-core'; cd ./src/cpl_core; cpl build; cd ../../;", "build-core": "echo 'Build cpl-core'; cd ./src/cpl_core; cpl build; cd ../../;",
"build-query": "echo 'Build cpl-query'; cd ./src/cpl_query; cpl build; cd ../../;", "build-query": "echo 'Build cpl-query'; cd ./src/cpl_query; cpl build; cd ../../;",
"build-translation": "echo 'Build cpl-translation'; cd ./src/cpl_translation; cpl build; cd ../../;",
"build-set-pip-urls": "echo 'Build set-pip-urls'; cd ./tools/set_pip_urls; cpl build; cd ../../;", "build-set-pip-urls": "echo 'Build set-pip-urls'; cd ./tools/set_pip_urls; cpl build; cd ../../;",
"build-set-version": "echo 'Build set-version'; cd ./tools/set_version; cpl build; cd ../../;", "build-set-version": "echo 'Build set-version'; cd ./tools/set_version; cpl build; cd ../../;",
"pre-publish-all": "cpl sv $ARGS; cpl spu $ARGS;", "pre-publish-all": "cpl sv $ARGS; cpl spu $ARGS;",
"publish-all": "cpl publish-cli; cpl publish-core; cpl publish-query;", "publish-all": "cpl publish-cli; cpl publish-core; cpl publish-query; cpl publish-translation;",
"pa": "cpl build-all $ARGS", "pa": "cpl build-all $ARGS",
"publish-cli": "echo 'Publish cpl-cli'; cd ./src/cpl_cli; cpl publish; cd ../../;", "publish-cli": "echo 'Publish cpl-cli'; cd ./src/cpl_cli; cpl publish; cd ../../;",
"publish-core": "echo 'Publish cpl-core'; cd ./src/cpl_core; cpl publish; cd ../../;", "publish-core": "echo 'Publish cpl-core'; cd ./src/cpl_core; cpl publish; cd ../../;",
"publish-query": "echo 'Publish cpl_query'; cd ./src/cpl_query; cpl publish; cd ../../;", "publish-query": "echo 'Publish cpl-query'; cd ./src/cpl_query; cpl publish; cd ../../;",
"publish-translation": "echo 'Publish cpl-translation'; cd ./src/cpl_translation; cpl publish; cd ../../;",
"upload-prod-cli": "echo 'PROD Upload cpl-cli'; cpl upl-prod-cli;", "upload-prod-cli": "echo 'PROD Upload cpl-cli'; cpl upl-prod-cli;",
"upl-prod-cli": "twine upload -r pip.sh-edraft.de dist/cpl-cli/publish/setup/*", "upl-prod-cli": "twine upload -r pip.sh-edraft.de dist/cpl-cli/publish/setup/*",
"upload-prod-core": "echo 'PROD Upload cpl-core'; cpl upl-prod-core;", "upload-prod-core": "echo 'PROD Upload cpl-core'; cpl upl-prod-core;",
"upl-prod-core": "twine upload -r pip.sh-edraft.de dist/cpl-core/publish/setup/*", "upl-prod-core": "twine upload -r pip.sh-edraft.de dist/cpl-core/publish/setup/*",
"upload-prod-query": "echo 'PROD Upload cpl_query'; cpl upl-prod-query;",
"upload-prod-query": "echo 'PROD Upload cpl-query'; cpl upl-prod-query;",
"upl-prod-query": "twine upload -r pip.sh-edraft.de dist/cpl-query/publish/setup/*", "upl-prod-query": "twine upload -r pip.sh-edraft.de dist/cpl-query/publish/setup/*",
"upload-prod-translation": "echo 'PROD Upload cpl-translation'; cpl upl-prod-translation;",
"upl-prod-translation": "twine upload -r pip.sh-edraft.de dist/cpl-translation/publish/setup/*",
"upload-exp-cli": "echo 'EXP Upload cpl-cli'; cpl upl-exp-cli;", "upload-exp-cli": "echo 'EXP Upload cpl-cli'; cpl upl-exp-cli;",
"upl-exp-cli": "twine upload -r pip-exp.sh-edraft.de dist/cpl-cli/publish/setup/*", "upl-exp-cli": "twine upload -r pip-exp.sh-edraft.de dist/cpl-cli/publish/setup/*",
"upload-exp-core": "echo 'EXP Upload cpl-core'; cpl upl-exp-core;", "upload-exp-core": "echo 'EXP Upload cpl-core'; cpl upl-exp-core;",
"upl-exp-core": "twine upload -r pip-exp.sh-edraft.de dist/cpl-core/publish/setup/*", "upl-exp-core": "twine upload -r pip-exp.sh-edraft.de dist/cpl-core/publish/setup/*",
"upload-exp-query": "echo 'EXP Upload cpl_query'; cpl upl-exp-query;",
"upload-exp-query": "echo 'EXP Upload cpl-query'; cpl upl-exp-query;",
"upl-exp-query": "twine upload -r pip-exp.sh-edraft.de dist/cpl-query/publish/setup/*", "upl-exp-query": "twine upload -r pip-exp.sh-edraft.de dist/cpl-query/publish/setup/*",
"upload-exp-translation": "echo 'EXP Upload cpl-translation'; cpl upl-exp-translation;",
"upl-exp-translation": "twine upload -r pip-exp.sh-edraft.de dist/cpl-translation/publish/setup/*",
"upload-dev-cli": "echo 'DEV Upload cpl-cli'; cpl upl-dev-cli;", "upload-dev-cli": "echo 'DEV Upload cpl-cli'; cpl upl-dev-cli;",
"upl-dev-cli": "twine upload -r pip-dev.sh-edraft.de dist/cpl-cli/publish/setup/*", "upl-dev-cli": "twine upload -r pip-dev.sh-edraft.de dist/cpl-cli/publish/setup/*",
"upload-dev-core": "echo 'DEV Upload cpl-core'; cpl upl-dev-core;", "upload-dev-core": "echo 'DEV Upload cpl-core'; cpl upl-dev-core;",
"upl-dev-core": "twine upload -r pip-dev.sh-edraft.de dist/cpl-core/publish/setup/*", "upl-dev-core": "twine upload -r pip-dev.sh-edraft.de dist/cpl-core/publish/setup/*",
"upload-dev-query": "echo 'DEV Upload cpl_query'; cpl upl-dev-query;",
"upload-dev-query": "echo 'DEV Upload cpl-query'; cpl upl-dev-query;",
"upl-dev-query": "twine upload -r pip-dev.sh-edraft.de dist/cpl-query/publish/setup/*", "upl-dev-query": "twine upload -r pip-dev.sh-edraft.de dist/cpl-query/publish/setup/*",
"upload-dev-translation": "echo 'DEV Upload cpl-translation'; cpl upl-dev-translation;",
"upl-dev-translation": "twine upload -r pip-dev.sh-edraft.de dist/cpl-translation/publish/setup/*",
"pre-deploy-prod": "cpl sv $ARGS; cpl spu --environment=production;", "pre-deploy-prod": "cpl sv $ARGS; cpl spu --environment=production;",
"deploy-prod": "cpl deploy-prod-cli; cpl deploy-prod-core; cpl deploy-prod-query;", "deploy-prod": "cpl deploy-prod-cli; cpl deploy-prod-core; cpl deploy-prod-query; cpl deploy-prod-translation;",
"dp": "cpl deploy-prod $ARGS", "dp": "cpl deploy-prod $ARGS",
"deploy-prod-cli": "cpl publish-cli; cpl upload-prod-cli", "deploy-prod-cli": "cpl publish-cli; cpl upload-prod-cli",
"deploy-prod-core": "cpl publish-core; cpl upload-prod-core", "deploy-prod-core": "cpl publish-core; cpl upload-prod-core",
"deploy-prod-query": "cpl publish-query; cpl upload-prod-query", "deploy-prod-query": "cpl publish-query; cpl upload-prod-query",
"deploy-prod-translation": "cpl publish-translation; cpl upload-prod-translation",
"pre-deploy-exp": "cpl sv $ARGS; cpl spu --environment=staging;", "pre-deploy-exp": "cpl sv $ARGS; cpl spu --environment=staging;",
"deploy-exp": "cpl deploy-exp-cli; cpl deploy-exp-core; cpl deploy-exp-query;", "deploy-exp": "cpl deploy-exp-cli; cpl deploy-exp-core; cpl deploy-exp-query; cpl deploy-exp-translation;",
"de": "cpl deploy-exp $ARGS", "de": "cpl deploy-exp $ARGS",
"deploy-exp-cli": "cpl publish-cli; cpl upload-exp-cli", "deploy-exp-cli": "cpl publish-cli; cpl upload-exp-cli",
"deploy-exp-core": "cpl publish-core; cpl upload-exp-core", "deploy-exp-core": "cpl publish-core; cpl upload-exp-core",
"deploy-exp-query": "cpl publish-query; cpl upload-exp-query", "deploy-exp-query": "cpl publish-query; cpl upload-exp-query",
"deploy-exp-translation": "cpl publish-translation; cpl upload-exp-translation",
"pre-deploy-dev": "cpl sv $ARGS; cpl spu --environment=development;", "pre-deploy-dev": "cpl sv $ARGS; cpl spu --environment=development;",
"deploy-dev": "cpl deploy-dev-cli; cpl deploy-dev-core; cpl deploy-dev-query;", "deploy-dev": "cpl deploy-dev-cli; cpl deploy-dev-core; cpl deploy-dev-query; cpl deploy-dev-translation;",
"dd": "cpl deploy-dev $ARGS", "dd": "cpl deploy-dev $ARGS",
"deploy-dev-cli": "cpl publish-cli; cpl upload-dev-cli", "deploy-dev-cli": "cpl publish-cli; cpl upload-dev-cli",
"deploy-dev-core": "cpl publish-core; cpl upload-dev-core", "deploy-dev-core": "cpl publish-core; cpl upload-dev-core",
"deploy-dev-query": "cpl publish-query; cpl upload-dev-query", "deploy-dev-query": "cpl publish-query; cpl upload-dev-query",
"deploy-dev-translation": "cpl publish-query; cpl upload-dev-translation",
"dev-install": "cpl di-core; cpl di-cli; cpl di-query;", "dev-install": "cpl di-core; cpl di-cli; cpl di-query; cpl di-translation;",
"di": "cpl dev-install", "di": "cpl dev-install",
"di-core": "pip install cpl-core --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de", "di-core": "pip install cpl-core --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"di-cli": "pip install cpl-cli --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de", "di-cli": "pip install cpl-cli --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"di-query": "pip install cpl-query --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de" "di-query": "pip install cpl-query --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de",
"di-translation": "pip install cpl-translation --pre --upgrade --extra-index-url https://pip-dev.sh-edraft.de"
} }
} }
} }

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_cli'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .cli import CLI from .cli import CLI
from .command_abc import CommandABC from .command_abc import CommandABC
@ -27,4 +28,4 @@ from .main import main
from .startup import Startup from .startup import Startup
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.build'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -27,6 +27,7 @@ class InitTemplate:
from collections import namedtuple from collections import namedtuple
$Imports $Imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.generate'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.console'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.console.source'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.console.source.name'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.console.source.tests'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.library'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.library.source'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.library.source.name'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.library.source.tests'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.unittest'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.unittest.source'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.new.unittest.source.name'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli._templates.publish'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_cli.command'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .build_service import BuildService from .build_service import BuildService
from .generate_service import GenerateService from .generate_service import GenerateService
@ -28,4 +29,4 @@ from .publish_service import PublishService
from .version_service import VersionService from .version_service import VersionService
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -68,6 +68,7 @@ class NewService(CommandABC):
Types: Types:
console console
library library
unittest
""") """)
@staticmethod @staticmethod
@ -82,6 +83,7 @@ class NewService(CommandABC):
schematics = [ schematics = [
'console (c|C) <name>', 'console (c|C) <name>',
'library (l|L) <name>', 'library (l|L) <name>',
'unittest (ut|UT) <name>',
] ]
Console.write_line('Available Schematics:') Console.write_line('Available Schematics:')
for name in schematics: for name in schematics:

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_cli.configuration'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .build_settings import BuildSettings from .build_settings import BuildSettings
from .build_settings_name_enum import BuildSettingsNameEnum from .build_settings_name_enum import BuildSettingsNameEnum
@ -30,4 +31,4 @@ from .workspace_settings import WorkspaceSettings
from .workspace_settings_name_enum import WorkspaceSettingsNameEnum from .workspace_settings_name_enum import WorkspaceSettingsNameEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -3,7 +3,7 @@
"Name": "cpl-cli", "Name": "cpl-cli",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "7",
"Micro": "0" "Micro": "0"
}, },
"Author": "Sven Heidemann", "Author": "Sven Heidemann",
@ -16,7 +16,7 @@
"LicenseName": "MIT", "LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.", "LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0" "cpl-core>=2022.7.0"
], ],
"DevDependencies": [], "DevDependencies": [],
"PythonVersion": ">=3.10", "PythonVersion": ">=3.10",

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli.live_server'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,13 +15,14 @@ __title__ = 'cpl_cli.publish'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .publisher_abc import PublisherABC from .publisher_abc import PublisherABC
from .publisher_service import PublisherService from .publisher_service import PublisherService
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -227,11 +227,19 @@ class PublisherService(PublisherABC):
imports = '# imports:' imports = '# imports:'
else: else:
is_started = False is_started = False
build_ignore = False
for line in module_file_lines: for line in module_file_lines:
if line.__contains__('# imports'): if line.__contains__('# imports'):
is_started = True is_started = True
if ((line.__contains__('from') or line.__contains__('import')) and is_started) or line.startswith('__cli_startup_extension__'): if line.__contains__('# build-ignore'):
build_ignore = True
if line.__contains__('# build-ignore-end') and is_started:
module_py_lines.append('# build-ignore-end'.replace('\n', ''))
build_ignore = False
if ((line.__contains__('from') or line.__contains__('import')) and is_started) or line.startswith('__cli_startup_extension__') or build_ignore:
module_py_lines.append(line.replace('\n', '')) module_py_lines.append(line.replace('\n', ''))
if len(module_py_lines) > 0: if len(module_py_lines) > 0:

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli.source_creator'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_cli.validators'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_core'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_core.application'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .application_abc import ApplicationABC from .application_abc import ApplicationABC
from .application_builder import ApplicationBuilder from .application_builder import ApplicationBuilder
@ -28,4 +29,4 @@ from .startup_abc import StartupABC
from .startup_extension_abc import StartupExtensionABC from .startup_extension_abc import StartupExtensionABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_core.configuration'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .argument_abc import ArgumentABC from .argument_abc import ArgumentABC
from .argument_builder import ArgumentBuilder from .argument_builder import ArgumentBuilder
@ -34,4 +35,4 @@ from .validator_abc import ValidatorABC
from .variable_argument import VariableArgument from .variable_argument import VariableArgument
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_core.console'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .background_color_enum import BackgroundColorEnum from .background_color_enum import BackgroundColorEnum
from .console import Console from .console import Console
@ -27,4 +28,4 @@ from .foreground_color_enum import ForegroundColorEnum
from .spinner_thread import SpinnerThread from .spinner_thread import SpinnerThread
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -3,7 +3,7 @@
"Name": "cpl-core", "Name": "cpl-core",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "7",
"Micro": "0" "Micro": "0"
}, },
"Author": "Sven Heidemann", "Author": "Sven Heidemann",

View File

@ -15,14 +15,15 @@ __title__ = 'cpl_core.database'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .database_settings_name_enum import DatabaseSettingsNameEnum from .database_settings_name_enum import DatabaseSettingsNameEnum
from .database_settings import DatabaseSettings from .database_settings import DatabaseSettings
from .table_abc import TableABC from .table_abc import TableABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,13 +15,14 @@ __title__ = 'cpl_core.database.connection'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .database_connection import DatabaseConnection from .database_connection import DatabaseConnection
from .database_connection_abc import DatabaseConnectionABC from .database_connection_abc import DatabaseConnectionABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,13 +15,14 @@ __title__ = 'cpl_core.database.context'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .database_context import DatabaseContext from .database_context import DatabaseContext
from .database_context_abc import DatabaseContextABC from .database_context_abc import DatabaseContextABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_core.dependency_injection'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .scope import Scope from .scope import Scope
from .scope_abc import ScopeABC from .scope_abc import ScopeABC
@ -30,4 +31,4 @@ from .service_provider import ServiceProvider
from .service_provider_abc import ServiceProviderABC from .service_provider_abc import ServiceProviderABC
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -1,7 +1,6 @@
from typing import Union, Type, Callable, Optional from typing import Union, Type, Callable, Optional
from cpl_core.configuration.configuration_abc import ConfigurationABC from cpl_core.configuration.configuration_abc import ConfigurationABC
from cpl_core.console import Console
from cpl_core.database.context.database_context_abc import DatabaseContextABC from cpl_core.database.context.database_context_abc import DatabaseContextABC
from cpl_core.database.database_settings import DatabaseSettings from cpl_core.database.database_settings import DatabaseSettings
from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC

View File

@ -35,6 +35,11 @@ class ServiceCollectionABC(ABC):
r"""Adds the CPL internal pipes as transient""" r"""Adds the CPL internal pipes as transient"""
pass pass
def add_translation(self):
r"""Adds the CPL translation"""
raise NotImplementedError('You should install and use the cpl-translation package')
pass
@abstractmethod @abstractmethod
def add_transient(self, service_type: Type, service: Callable = None) -> 'ServiceCollectionABC': def add_transient(self, service_type: Type, service: Callable = None) -> 'ServiceCollectionABC':
r"""Adds a service with transient lifetime r"""Adds a service with transient lifetime

View File

@ -15,14 +15,15 @@ __title__ = 'cpl_core.environment'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .application_environment_abc import ApplicationEnvironmentABC from .application_environment_abc import ApplicationEnvironmentABC
from .environment_name_enum import EnvironmentNameEnum from .environment_name_enum import EnvironmentNameEnum
from .application_environment import ApplicationEnvironment from .application_environment import ApplicationEnvironment
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_core.logging'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .logger_service import Logger from .logger_service import Logger
from .logger_abc import LoggerABC from .logger_abc import LoggerABC
@ -27,4 +28,4 @@ from .logging_settings import LoggingSettings
from .logging_settings_name_enum import LoggingSettingsNameEnum from .logging_settings_name_enum import LoggingSettingsNameEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_core.mailing'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .email import EMail from .email import EMail
from .email_client_service import EMailClient from .email_client_service import EMailClient
@ -27,4 +28,4 @@ from .email_client_settings import EMailClientSettings
from .email_client_settings_name_enum import EMailClientSettingsNameEnum from .email_client_settings_name_enum import EMailClientSettingsNameEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_core.pipes'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .bool_pipe import BoolPipe from .bool_pipe import BoolPipe
from .first_char_to_lower_pipe import FirstCharToLowerPipe from .first_char_to_lower_pipe import FirstCharToLowerPipe
@ -29,4 +30,4 @@ from .to_camel_case_pipe import ToCamelCasePipe
from .to_snake_case_pipe import ToSnakeCasePipe from .to_snake_case_pipe import ToSnakeCasePipe
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,13 +15,14 @@ __title__ = 'cpl_core.time'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .time_format_settings import TimeFormatSettings from .time_format_settings import TimeFormatSettings
from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,14 +15,15 @@ __title__ = 'cpl_core.utils'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .credential_manager import CredentialManager from .credential_manager import CredentialManager
from .string import String from .string import String
from .pip import Pip from .pip import Pip
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_query'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -15,11 +15,12 @@ __title__ = 'cpl_query._query'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -3,7 +3,7 @@
"Name": "cpl-query", "Name": "cpl-query",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "7",
"Micro": "0" "Micro": "0"
}, },
"Author": "Sven Heidemann", "Author": "Sven Heidemann",

View File

@ -15,10 +15,11 @@ __title__ = 'cpl_query.extension'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de' __copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
__version__ = '2022.6.0' __version__ = '2022.7.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .iterable_abc import IterableABC from .iterable_abc import IterableABC
from .iterable import Iterable from .iterable import Iterable
@ -27,4 +28,4 @@ from .ordered_iterable_abc import OrderedIterableABC
from .ordered_iterable import OrderedIterable from .ordered_iterable import OrderedIterable
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='6', micro='0') version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
"""
cpl-translation sh-edraft Common Python library Translation
~~~~~~~~~~~~~~~~~~~
sh-edraft Common Python library Python Translation
:copyright: (c) 2022 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'cpl_translation'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '2022.7.0'
from collections import namedtuple
# imports:
from .translate_pipe import TranslatePipe
from .translation_service import TranslationService
from .translation_service_abc import TranslationServiceABC
from .translation_settings import TranslationSettings
# build-ignore
def add_translation(self):
from cpl_core.console import Console
from cpl_core.pipes import PipeABC
from cpl_translation.translate_pipe import TranslatePipe
from cpl_translation.translation_service import TranslationService
from cpl_translation.translation_service_abc import TranslationServiceABC
try:
self.add_singleton(TranslationServiceABC, TranslationService)
self.add_transient(PipeABC, TranslatePipe)
except ImportError as e:
Console.error('cpl-translation is not installed', str(e))
def init():
from cpl_core.dependency_injection import ServiceCollection
ServiceCollection.add_translation = add_translation
init()
# build-ignore-end
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='2022', minor='7', micro='0')

View File

@ -0,0 +1,46 @@
{
"ProjectSettings": {
"Name": "cpl-translation",
"Version": {
"Major": "2022",
"Minor": "7",
"Micro": "0"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "sh-edraft Common Python library Translation",
"LongDescription": "sh-edraft Common Python library Python Translation",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": "../../venv/bin/python"
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "library",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "cpl_translation.main",
"EntryPoint": "cpl-translation",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}

View File

@ -0,0 +1,16 @@
from cpl_core.console import Console
from cpl_core.pipes.pipe_abc import PipeABC
from cpl_translation.translation_service_abc import TranslationServiceABC
class TranslatePipe(PipeABC):
def __init__(self, translation: TranslationServiceABC):
self._translation = translation
def transform(self, value: any, *args):
try:
return self._translation.translate(value)
except KeyError as e:
Console.error(f'Translation {value} not found')
return ''

View File

@ -0,0 +1,59 @@
import json
import os.path
from functools import reduce
from cpl_translation.translation_service_abc import TranslationServiceABC
from cpl_translation.translation_settings import TranslationSettings
class TranslationService(TranslationServiceABC):
def __init__(self):
self._translation = {}
self._language = ''
self._default_language = ''
TranslationServiceABC.__init__(self)
def set_default_lang(self, lang: str):
if lang not in self._translation:
raise KeyError()
self._default_language = lang
self.set_lang(lang)
def set_lang(self, lang: str):
if lang not in self._translation:
raise KeyError()
self._language = lang
def load(self, lang: str):
if not os.path.exists(f'translation/{lang}.json'):
raise FileNotFoundError()
file_dict = {}
with open(f'translation/{lang}.json', 'r') as file:
file_dict = json.load(file)
file.close()
self._translation[lang] = file_dict
def load_by_settings(self, settings: TranslationSettings):
if settings is None:
raise Exception(f'{TranslationSettings.__name__} not loaded')
self._language = settings.default_language
self._default_language = settings.default_language
for lang in settings.languages:
self.load(lang)
def translate(self, key: str) -> str:
value = reduce(lambda d, key: d.get(key) if isinstance(d, dict) else None, key.split("."), self._translation[self._language])
if value is None:
raise KeyError(f'Translation {key} not found')
return value

View File

@ -0,0 +1,22 @@
from abc import ABC, abstractmethod
class TranslationServiceABC(ABC):
@abstractmethod
def __init__(self): pass
@abstractmethod
def set_default_lang(self, lang: str): pass
@abstractmethod
def set_lang(self, lang: str): pass
@abstractmethod
def load(self, lang: str): pass
@abstractmethod
def load_by_settings(self): pass
@abstractmethod
def translate(self, key: str) -> str: pass

View File

@ -0,0 +1,29 @@
import traceback
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
from cpl_core.console import Console
class TranslationSettings(ConfigurationModelABC):
def __init__(self):
ConfigurationModelABC.__init__(self)
self._languages = []
self._default_lang = ''
@property
def languages(self) -> list[str]:
return self._languages
@property
def default_language(self) -> str:
return self._default_lang
def from_dict(self, settings: dict):
try:
self._languages = settings['Languages']
self._default_lang = settings['DefaultLanguage']
except Exception as e:
Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')

View File

View File

View File

@ -0,0 +1,9 @@
{
"WorkspaceSettings": {
"DefaultProject": "translation",
"Projects": {
"translation": "src/translation/translation.json"
},
"Scripts": {}
}
}

View File

@ -0,0 +1 @@
# imports:

View File

@ -0,0 +1 @@
# imports:

View File

@ -0,0 +1,29 @@
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_translation.translate_pipe import TranslatePipe
from cpl_translation.translation_service_abc import TranslationServiceABC
from cpl_translation.translation_settings import TranslationSettings
class Application(ApplicationABC):
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
self._translate: TranslatePipe = services.get_service(TranslatePipe)
self._translation: TranslationServiceABC = services.get_service(TranslationServiceABC)
self._translation_settings: TranslationSettings = config.get_configuration(TranslationSettings)
self._translation.load_by_settings(config.get_configuration(TranslationSettings))
self._translation.set_default_lang('de')
def configure(self):
pass
def main(self):
Console.write_line(self._translate.transform('main.text.hello_world'))
self._translation.set_lang('en')
Console.write_line(self._translate.transform('main.text.hello_world'))
Console.write_line(self._translate.transform('main.text.hello'))

View File

@ -0,0 +1,23 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "ERROR",
"FileLogLevel": "WARN"
},
"Translation": {
"Languages":[
"de",
"en"
],
"DefaultLanguage": "en"
}
}

View File

@ -0,0 +1,14 @@
from cpl_core.application import ApplicationBuilder
from translation.application import Application
from translation.startup import Startup
def main():
app_builder = ApplicationBuilder(Application)
app_builder.use_startup(Startup)
app_builder.build().run()
if __name__ == '__main__':
main()

View File

@ -0,0 +1,18 @@
from cpl_core.application import StartupABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
from cpl_core.environment import ApplicationEnvironment
class Startup(StartupABC):
def __init__(self):
StartupABC.__init__(self)
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
configuration.add_json_file('appsettings.json')
return configuration
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
services.add_translation()
return services.build_service_provider()

View File

@ -0,0 +1,46 @@
{
"ProjectSettings": {
"Name": "translation",
"Version": {
"Major": "0",
"Minor": "0",
"Micro": "0"
},
"Author": "",
"AuthorEmail": "",
"Description": "",
"LongDescription": "",
"URL": "",
"CopyrightDate": "",
"CopyrightName": "",
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"cpl-core>=2022.6.0"
],
"DevDependencies": [
"cpl-cli>=2022.6.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "console",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "translation.main",
"EntryPoint": "translation",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}

View File

@ -0,0 +1,7 @@
{
"main": {
"text": {
"hello_world": "Hallo Welt"
}
}
}

View File

@ -0,0 +1,7 @@
{
"main": {
"text": {
"hello_world": "Hello World"
}
}
}

View File

@ -19,6 +19,7 @@ __version__ = '2022.6.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')

View File

@ -16,11 +16,12 @@
"LicenseName": "MIT", "LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.", "LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0.rc1" "cpl-core>=2022.7.0"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": {}, "PythonPath": {},
"Classifiers": [] "Classifiers": [],
"DevDependencies": []
}, },
"BuildSettings": { "BuildSettings": {
"ProjectType": "console", "ProjectType": "console",

View File

@ -19,6 +19,7 @@ __version__ = '2022.6.0'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro') VersionInfo = namedtuple('VersionInfo', 'major minor micro')

View File

@ -82,7 +82,8 @@ class Application(ApplicationABC):
continue continue
Console.write_line(f'Set dependencies {self._version_pipe.transform(version)} for {project}') Console.write_line(f'Set dependencies {self._version_pipe.transform(version)} for {project}')
self._version_setter.set_dependencies(self._workspace.projects[project], version, skipped=skipped) self._version_setter.set_dependencies(self._workspace.projects[project], version, 'Dependencies', skipped=skipped)
self._version_setter.set_dependencies(self._workspace.projects[project], version, 'DevDependencies', skipped=skipped)
if not project.startswith('cpl') and not project.startswith('unittest'): if not project.startswith('cpl') and not project.startswith('unittest'):
Console.write_line(f'Skipping {project}') Console.write_line(f'Skipping {project}')
continue continue

View File

@ -16,12 +16,13 @@
"LicenseName": "MIT", "LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.", "LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0.rc1", "cpl-core>=2022.7.0",
"gitpython==3.1.27" "gitpython==3.1.27"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": {}, "PythonPath": {},
"Classifiers": [] "Classifiers": [],
"DevDependencies": []
}, },
"BuildSettings": { "BuildSettings": {
"ProjectType": "console", "ProjectType": "console",

View File

@ -33,9 +33,12 @@ class VersionSetterService:
project_json['ProjectSettings']['Version'] = version project_json['ProjectSettings']['Version'] = version
self._write_file(file, project_json) self._write_file(file, project_json)
def set_dependencies(self, file: str, version: dict, skipped=None): def set_dependencies(self, file: str, version: dict, key: str, skipped=None):
project_json = self._read_file(file) project_json = self._read_file(file)
dependencies = project_json['ProjectSettings']['Dependencies'] if key not in project_json['ProjectSettings']:
project_json['ProjectSettings'][key] = []
dependencies = project_json['ProjectSettings'][key]
new_deps = [] new_deps = []
for dependency in dependencies: for dependency in dependencies:
if not dependency.startswith('cpl-'): if not dependency.startswith('cpl-'):
@ -52,5 +55,5 @@ class VersionSetterService:
continue continue
new_deps.append(dependency.replace(dep_version, f'{version["Major"]}.{version["Minor"]}.{version["Micro"]}')) new_deps.append(dependency.replace(dep_version, f'{version["Major"]}.{version["Minor"]}.{version["Micro"]}'))
project_json['ProjectSettings']['Dependencies'] = new_deps project_json['ProjectSettings'][key] = new_deps
self._write_file(file, project_json) self._write_file(file, project_json)

View File

@ -5,6 +5,7 @@ from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC from cpl_core.dependency_injection import ServiceProviderABC
from unittests_cli.cli_test_suite import CLITestSuite from unittests_cli.cli_test_suite import CLITestSuite
from unittests_query.query_test_suite import QueryTestSuite from unittests_query.query_test_suite import QueryTestSuite
from unittests_translation.translation_test_suite import TranslationTestSuite
class Application(ApplicationABC): class Application(ApplicationABC):
@ -19,3 +20,4 @@ class Application(ApplicationABC):
runner = unittest.TextTestRunner() runner = unittest.TextTestRunner()
runner.run(CLITestSuite()) runner.run(CLITestSuite())
runner.run(QueryTestSuite()) runner.run(QueryTestSuite())
runner.run(TranslationTestSuite())

View File

@ -3,8 +3,8 @@
"Name": "unittests", "Name": "unittests",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "7",
"Micro": "0.rc1" "Micro": "0"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,13 +16,14 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0.rc1" "cpl-core>=2022.8.1.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {
"linux": "" "linux": ""
}, },
"Classifiers": [] "Classifiers": [],
"DevDependencies": []
}, },
"BuildSettings": { "BuildSettings": {
"ProjectType": "unittest", "ProjectType": "unittest",

View File

@ -1,4 +1,5 @@
import os import os
PLAYGROUND_PATH = os.path.abspath(os.path.join(os.getcwd(), '../test_cli_playground')) PLAYGROUND_PATH = os.path.abspath(os.path.join(os.getcwd(), '../test_cli_playground'))
TRANSLATION_PATH = os.path.abspath(os.path.join(os.getcwd(), '../unittests_translation'))
CLI_PATH = os.path.abspath(os.path.join(os.getcwd(), '../../src/cpl_cli/main.py')) CLI_PATH = os.path.abspath(os.path.join(os.getcwd(), '../../src/cpl_cli/main.py'))

View File

@ -3,8 +3,8 @@
"Name": "unittest_cli", "Name": "unittest_cli",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "7",
"Micro": "0.rc1" "Micro": "0"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,14 +16,15 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0.rc1", "cpl-core>=2022.8.1.dev7",
"cpl-cli>=2022.6.0.rc1" "cpl-cli>=2022.7.0"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {
"linux": "" "linux": ""
}, },
"Classifiers": [] "Classifiers": [],
"DevDependencies": []
}, },
"BuildSettings": { "BuildSettings": {
"ProjectType": "library", "ProjectType": "library",

View File

@ -3,8 +3,8 @@
"Name": "unittest_core", "Name": "unittest_core",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "8",
"Micro": "0.rc1" "Micro": "1.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,7 +16,7 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0.rc1" "cpl-core>=2022.8.1.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {

View File

@ -3,8 +3,8 @@
"Name": "unittest_query", "Name": "unittest_query",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "8",
"Micro": "0.rc1" "Micro": "1.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,8 +16,8 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0.rc1", "cpl-core>=2022.8.1.dev7",
"cpl-query>=2022.6.0.rc1" "cpl-query>=2022.8.1.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {

View File

@ -3,8 +3,8 @@
"Name": "unittest_shared", "Name": "unittest_shared",
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "8",
"Micro": "0.rc1" "Micro": "1.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,7 +16,7 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.0.rc1" "cpl-core>=2022.8.1.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {

View File

@ -0,0 +1 @@
# imports:

View File

@ -0,0 +1,7 @@
{
"main": {
"text": {
"hello_world": "Hallo Welt"
}
}
}

View File

@ -0,0 +1,7 @@
{
"main": {
"text": {
"hello_world": "Hello World"
}
}
}

View File

@ -0,0 +1,67 @@
import os
import unittest
from typing import Optional
from cpl_translation import TranslationService, TranslatePipe, TranslationSettings
from unittests_cli.constants import TRANSLATION_PATH
class TranslationTestCase(unittest.TestCase):
def __init__(self, methodName: str):
unittest.TestCase.__init__(self, methodName)
self._translation: Optional[TranslationService] = None
self._translate: Optional[TranslatePipe] = None
def setUp(self):
os.chdir(os.path.abspath(TRANSLATION_PATH))
self._translation = TranslationService()
settings = TranslationSettings()
settings.from_dict({
"Languages": [
"de",
"en"
],
"DefaultLanguage": "en"
})
self._translation.load_by_settings(settings)
self._translation.set_default_lang('de')
self._translate = TranslatePipe(self._translation)
def cleanUp(self):
pass
def test_service(self):
self.assertEqual('Hallo Welt', self._translation.translate('main.text.hello_world'))
self._translation.set_lang('en')
self.assertEqual('Hello World', self._translation.translate('main.text.hello_world'))
with self.assertRaises(KeyError) as ctx:
self._translation.translate('main.text.hallo_welt')
self.assertTrue(type(ctx.exception) == KeyError)
self.assertIn('Translation main.text.hallo_welt not found', str(ctx.exception))
with self.assertRaises(FileNotFoundError) as ctx:
self._translation.load('DE')
self.assertTrue(type(ctx.exception) == FileNotFoundError)
with self.assertRaises(KeyError) as ctx:
self._translation.set_lang('DE')
self.assertTrue(type(ctx.exception) == KeyError)
with self.assertRaises(KeyError) as ctx:
self._translation.set_default_lang('DE')
self.assertTrue(type(ctx.exception) == KeyError)
def test_pipe(self):
self.assertEqual('Hallo Welt', self._translate.transform('main.text.hello_world'))
self._translation.set_lang('en')
self.assertEqual('Hello World', self._translate.transform('main.text.hello_world'))
with self.assertRaises(KeyError) as ctx:
self._translation.translate('main.text.hallo_welt')
self.assertTrue(type(ctx.exception) == KeyError)
self.assertIn('Translation main.text.hallo_welt not found', str(ctx.exception))

View File

@ -0,0 +1,51 @@
import os
import shutil
import traceback
import unittest
from typing import Optional
from unittest import TestResult
from unittests_cli.constants import PLAYGROUND_PATH
from unittests_translation.translation_test_case import TranslationTestCase
class TranslationTestSuite(unittest.TestSuite):
def __init__(self):
unittest.TestSuite.__init__(self)
loader = unittest.TestLoader()
self._result: Optional[TestResult] = None
self._is_online = True
active_tests = [
TranslationTestCase
]
for test in active_tests:
self.addTests(loader.loadTestsFromTestCase(test))
def _setup(self):
try:
if os.path.exists(PLAYGROUND_PATH):
shutil.rmtree(os.path.abspath(os.path.join(PLAYGROUND_PATH)))
os.makedirs(PLAYGROUND_PATH)
os.chdir(PLAYGROUND_PATH)
except Exception as e:
print(f'Setup of {__name__} failed: {traceback.format_exc()}')
def _cleanup(self):
try:
if self._result is not None and (len(self._result.errors) > 0 or len(self._result.failures) > 0):
return
if os.path.exists(PLAYGROUND_PATH):
shutil.rmtree(os.path.abspath(os.path.join(PLAYGROUND_PATH)))
except Exception as e:
print(f'Cleanup of {__name__} failed: {traceback.format_exc()}')
def run(self, *args):
self._setup()
self._result = super().run(*args)
self._cleanup()

View File

@ -0,0 +1,47 @@
{
"ProjectSettings": {
"Name": "unittests_translation",
"Version": {
"Major": "2022",
"Minor": "7",
"Micro": "0"
},
"Author": "",
"AuthorEmail": "",
"Description": "",
"LongDescription": "",
"URL": "",
"CopyrightDate": "",
"CopyrightName": "",
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"cpl-core>=2022.7.0",
"cpl-translation>=2022.7.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "unittest",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "unittests_translation.main",
"EntryPoint": "unittests_translation",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}