diff --git a/cpl-workspace.json b/cpl-workspace.json index 3c5d5f67..e00ea987 100644 --- a/cpl-workspace.json +++ b/cpl-workspace.json @@ -1,6 +1,6 @@ { "WorkspaceSettings": { - "DefaultProject": "cpl-cli", + "DefaultProject": "cpl-core", "Projects": { "cpl-cli": "src/cpl_cli/cpl-cli.json", "cpl-core": "src/cpl_core/cpl-core.json", @@ -19,13 +19,15 @@ "Scripts": { "hello-world": "echo 'Hello World'", + "format": "echo 'Formatting:'; black ./", + "sv": "cpl set-version", "set-version": "cpl run set-version --dev $ARGS; echo '';", "spu": "cpl set-pip-urls", "set-pip-urls": "cpl run set-pip-urls --dev $ARGS; echo '';", - "docs-build": "echo 'Build Documentation'; cpl db-core; cpl db-discord; cpl db-query; cpl db-translation; cd docs/; make clean; make html; # rm source/cpl_query.tests.rst;", + "docs-build": "cpl format; echo 'Build Documentation'; cpl db-core; cpl db-discord; cpl db-query; cpl db-translation; cd docs/; make clean; make html;", "db-core": "cd docs/; sphinx-apidoc -o source/ ../src/cpl_core; cd ../", "db-discord": "cd docs/; sphinx-apidoc -o source/ ../src/cpl_discord; cd ../", "db-query": "cd docs/; sphinx-apidoc -o source/ ../src/cpl_query; cd ../", diff --git a/docs/build/doctrees/cli.overview.doctree b/docs/build/doctrees/cli.overview.doctree deleted file mode 100644 index 219aa2b4..00000000 Binary files a/docs/build/doctrees/cli.overview.doctree and /dev/null differ diff --git a/docs/build/doctrees/cli.add.doctree b/docs/build/doctrees/cpl_cli.add.doctree similarity index 91% rename from docs/build/doctrees/cli.add.doctree rename to docs/build/doctrees/cpl_cli.add.doctree index 9e15f0d4..97991a88 100644 Binary files a/docs/build/doctrees/cli.add.doctree and b/docs/build/doctrees/cpl_cli.add.doctree differ diff --git a/docs/build/doctrees/cli.build.doctree b/docs/build/doctrees/cpl_cli.build.doctree similarity index 85% rename from docs/build/doctrees/cli.build.doctree rename to docs/build/doctrees/cpl_cli.build.doctree index c8c89959..22e6ce70 100644 Binary files a/docs/build/doctrees/cli.build.doctree and b/docs/build/doctrees/cpl_cli.build.doctree differ diff --git a/docs/build/doctrees/cpl_cli.doctree b/docs/build/doctrees/cpl_cli.doctree index 46b5c415..8ea9293a 100644 Binary files a/docs/build/doctrees/cpl_cli.doctree and b/docs/build/doctrees/cpl_cli.doctree differ diff --git a/docs/build/doctrees/cli.generate.doctree b/docs/build/doctrees/cpl_cli.generate.doctree similarity index 95% rename from docs/build/doctrees/cli.generate.doctree rename to docs/build/doctrees/cpl_cli.generate.doctree index f088d0e2..ff4ab1fa 100644 Binary files a/docs/build/doctrees/cli.generate.doctree and b/docs/build/doctrees/cpl_cli.generate.doctree differ diff --git a/docs/build/doctrees/cli.help.doctree b/docs/build/doctrees/cpl_cli.help.doctree similarity index 87% rename from docs/build/doctrees/cli.help.doctree rename to docs/build/doctrees/cpl_cli.help.doctree index 8d4ba844..42e7ac40 100644 Binary files a/docs/build/doctrees/cli.help.doctree and b/docs/build/doctrees/cpl_cli.help.doctree differ diff --git a/docs/build/doctrees/cli.install.doctree b/docs/build/doctrees/cpl_cli.install.doctree similarity index 90% rename from docs/build/doctrees/cli.install.doctree rename to docs/build/doctrees/cpl_cli.install.doctree index b92b9153..58c5fabb 100644 Binary files a/docs/build/doctrees/cli.install.doctree and b/docs/build/doctrees/cpl_cli.install.doctree differ diff --git a/docs/build/doctrees/cli.new.doctree b/docs/build/doctrees/cpl_cli.new.doctree similarity index 94% rename from docs/build/doctrees/cli.new.doctree rename to docs/build/doctrees/cpl_cli.new.doctree index 3dcb9191..9f65fa70 100644 Binary files a/docs/build/doctrees/cli.new.doctree and b/docs/build/doctrees/cpl_cli.new.doctree differ diff --git a/docs/build/doctrees/cpl_cli.overview.doctree b/docs/build/doctrees/cpl_cli.overview.doctree new file mode 100644 index 00000000..370fcf10 Binary files /dev/null and b/docs/build/doctrees/cpl_cli.overview.doctree differ diff --git a/docs/build/doctrees/cli.publish.doctree b/docs/build/doctrees/cpl_cli.publish.doctree similarity index 87% rename from docs/build/doctrees/cli.publish.doctree rename to docs/build/doctrees/cpl_cli.publish.doctree index d78cbc7a..89343906 100644 Binary files a/docs/build/doctrees/cli.publish.doctree and b/docs/build/doctrees/cpl_cli.publish.doctree differ diff --git a/docs/build/doctrees/cli.remove.doctree b/docs/build/doctrees/cpl_cli.remove.doctree similarity index 89% rename from docs/build/doctrees/cli.remove.doctree rename to docs/build/doctrees/cpl_cli.remove.doctree index 8287aa7a..2a8f81a1 100644 Binary files a/docs/build/doctrees/cli.remove.doctree and b/docs/build/doctrees/cpl_cli.remove.doctree differ diff --git a/docs/build/doctrees/cli.run.doctree b/docs/build/doctrees/cpl_cli.run.doctree similarity index 94% rename from docs/build/doctrees/cli.run.doctree rename to docs/build/doctrees/cpl_cli.run.doctree index c1463960..36091d23 100644 Binary files a/docs/build/doctrees/cli.run.doctree and b/docs/build/doctrees/cpl_cli.run.doctree differ diff --git a/docs/build/doctrees/cli.start.doctree b/docs/build/doctrees/cpl_cli.start.doctree similarity index 92% rename from docs/build/doctrees/cli.start.doctree rename to docs/build/doctrees/cpl_cli.start.doctree index 1bde7025..b79235b4 100644 Binary files a/docs/build/doctrees/cli.start.doctree and b/docs/build/doctrees/cpl_cli.start.doctree differ diff --git a/docs/build/doctrees/cli.uninstall.doctree b/docs/build/doctrees/cpl_cli.uninstall.doctree similarity index 90% rename from docs/build/doctrees/cli.uninstall.doctree rename to docs/build/doctrees/cpl_cli.uninstall.doctree index 074b870e..efecefb7 100644 Binary files a/docs/build/doctrees/cli.uninstall.doctree and b/docs/build/doctrees/cpl_cli.uninstall.doctree differ diff --git a/docs/build/doctrees/cli.update.doctree b/docs/build/doctrees/cpl_cli.update.doctree similarity index 92% rename from docs/build/doctrees/cli.update.doctree rename to docs/build/doctrees/cpl_cli.update.doctree index bbb915dc..b9940e83 100644 Binary files a/docs/build/doctrees/cli.update.doctree and b/docs/build/doctrees/cpl_cli.update.doctree differ diff --git a/docs/build/doctrees/cli.version.doctree b/docs/build/doctrees/cpl_cli.version.doctree similarity index 88% rename from docs/build/doctrees/cli.version.doctree rename to docs/build/doctrees/cpl_cli.version.doctree index 1eb8970a..72d23301 100644 Binary files a/docs/build/doctrees/cli.version.doctree and b/docs/build/doctrees/cpl_cli.version.doctree differ diff --git a/docs/build/doctrees/cpl_core.application.doctree b/docs/build/doctrees/cpl_core.application.doctree index bdf49dba..4f15e383 100644 Binary files a/docs/build/doctrees/cpl_core.application.doctree and b/docs/build/doctrees/cpl_core.application.doctree differ diff --git a/docs/build/doctrees/cpl_core.configuration.doctree b/docs/build/doctrees/cpl_core.configuration.doctree index d725a0f3..78be136c 100644 Binary files a/docs/build/doctrees/cpl_core.configuration.doctree and b/docs/build/doctrees/cpl_core.configuration.doctree differ diff --git a/docs/build/doctrees/cpl_core.console.doctree b/docs/build/doctrees/cpl_core.console.doctree index ec0de895..33aa42c8 100644 Binary files a/docs/build/doctrees/cpl_core.console.doctree and b/docs/build/doctrees/cpl_core.console.doctree differ diff --git a/docs/build/doctrees/cpl_core.database.connection.doctree b/docs/build/doctrees/cpl_core.database.connection.doctree index 20177fc3..28f21565 100644 Binary files a/docs/build/doctrees/cpl_core.database.connection.doctree and b/docs/build/doctrees/cpl_core.database.connection.doctree differ diff --git a/docs/build/doctrees/cpl_core.database.context.doctree b/docs/build/doctrees/cpl_core.database.context.doctree index d682166a..fce538d0 100644 Binary files a/docs/build/doctrees/cpl_core.database.context.doctree and b/docs/build/doctrees/cpl_core.database.context.doctree differ diff --git a/docs/build/doctrees/cpl_core.database.doctree b/docs/build/doctrees/cpl_core.database.doctree index 208ae505..ed9cfcc0 100644 Binary files a/docs/build/doctrees/cpl_core.database.doctree and b/docs/build/doctrees/cpl_core.database.doctree differ diff --git a/docs/build/doctrees/cpl_core.dependency_injection.doctree b/docs/build/doctrees/cpl_core.dependency_injection.doctree index c4d70486..f764f3d3 100644 Binary files a/docs/build/doctrees/cpl_core.dependency_injection.doctree and b/docs/build/doctrees/cpl_core.dependency_injection.doctree differ diff --git a/docs/build/doctrees/cpl_core.doctree b/docs/build/doctrees/cpl_core.doctree index 39eb74a8..8440d5e7 100644 Binary files a/docs/build/doctrees/cpl_core.doctree and b/docs/build/doctrees/cpl_core.doctree differ diff --git a/docs/build/doctrees/cpl_core.environment.doctree b/docs/build/doctrees/cpl_core.environment.doctree index 28869772..0904b8b0 100644 Binary files a/docs/build/doctrees/cpl_core.environment.doctree and b/docs/build/doctrees/cpl_core.environment.doctree differ diff --git a/docs/build/doctrees/cpl_core.logging.doctree b/docs/build/doctrees/cpl_core.logging.doctree index 28781205..eea196ea 100644 Binary files a/docs/build/doctrees/cpl_core.logging.doctree and b/docs/build/doctrees/cpl_core.logging.doctree differ diff --git a/docs/build/doctrees/cpl_core.mailing.doctree b/docs/build/doctrees/cpl_core.mailing.doctree index 72718582..670cf3f2 100644 Binary files a/docs/build/doctrees/cpl_core.mailing.doctree and b/docs/build/doctrees/cpl_core.mailing.doctree differ diff --git a/docs/build/doctrees/cpl_core.pipes.doctree b/docs/build/doctrees/cpl_core.pipes.doctree index c19a94da..9db3a564 100644 Binary files a/docs/build/doctrees/cpl_core.pipes.doctree and b/docs/build/doctrees/cpl_core.pipes.doctree differ diff --git a/docs/build/doctrees/cpl_core.time.doctree b/docs/build/doctrees/cpl_core.time.doctree index 75121de8..4cca8172 100644 Binary files a/docs/build/doctrees/cpl_core.time.doctree and b/docs/build/doctrees/cpl_core.time.doctree differ diff --git a/docs/build/doctrees/cpl_core.utils.doctree b/docs/build/doctrees/cpl_core.utils.doctree index e9a6e4af..7c567f4d 100644 Binary files a/docs/build/doctrees/cpl_core.utils.doctree and b/docs/build/doctrees/cpl_core.utils.doctree differ diff --git a/docs/build/doctrees/cpl_discord.application.doctree b/docs/build/doctrees/cpl_discord.application.doctree index 64d0f8cc..c839d9d3 100644 Binary files a/docs/build/doctrees/cpl_discord.application.doctree and b/docs/build/doctrees/cpl_discord.application.doctree differ diff --git a/docs/build/doctrees/cpl_discord.command.doctree b/docs/build/doctrees/cpl_discord.command.doctree index d0fe4f61..cf792dc7 100644 Binary files a/docs/build/doctrees/cpl_discord.command.doctree and b/docs/build/doctrees/cpl_discord.command.doctree differ diff --git a/docs/build/doctrees/cpl_discord.configuration.doctree b/docs/build/doctrees/cpl_discord.configuration.doctree index 0e397e29..0909eb30 100644 Binary files a/docs/build/doctrees/cpl_discord.configuration.doctree and b/docs/build/doctrees/cpl_discord.configuration.doctree differ diff --git a/docs/build/doctrees/cpl_discord.container.doctree b/docs/build/doctrees/cpl_discord.container.doctree index a3f5ee12..40bcda72 100644 Binary files a/docs/build/doctrees/cpl_discord.container.doctree and b/docs/build/doctrees/cpl_discord.container.doctree differ diff --git a/docs/build/doctrees/cpl_discord.doctree b/docs/build/doctrees/cpl_discord.doctree index a373b278..186d38f1 100644 Binary files a/docs/build/doctrees/cpl_discord.doctree and b/docs/build/doctrees/cpl_discord.doctree differ diff --git a/docs/build/doctrees/cpl_discord.events.doctree b/docs/build/doctrees/cpl_discord.events.doctree index a0615548..a1d4c896 100644 Binary files a/docs/build/doctrees/cpl_discord.events.doctree and b/docs/build/doctrees/cpl_discord.events.doctree differ diff --git a/docs/build/doctrees/cpl_discord.helper.doctree b/docs/build/doctrees/cpl_discord.helper.doctree index e661717e..b62443a9 100644 Binary files a/docs/build/doctrees/cpl_discord.helper.doctree and b/docs/build/doctrees/cpl_discord.helper.doctree differ diff --git a/docs/build/doctrees/cpl_discord.service.doctree b/docs/build/doctrees/cpl_discord.service.doctree index 8e13fbf2..e6a2dfff 100644 Binary files a/docs/build/doctrees/cpl_discord.service.doctree and b/docs/build/doctrees/cpl_discord.service.doctree differ diff --git a/docs/build/doctrees/cpl_query.base.doctree b/docs/build/doctrees/cpl_query.base.doctree index 2d7ab57a..d4027221 100644 Binary files a/docs/build/doctrees/cpl_query.base.doctree and b/docs/build/doctrees/cpl_query.base.doctree differ diff --git a/docs/build/doctrees/cpl_query.doctree b/docs/build/doctrees/cpl_query.doctree index 3f98dae1..00f7a9a1 100644 Binary files a/docs/build/doctrees/cpl_query.doctree and b/docs/build/doctrees/cpl_query.doctree differ diff --git a/docs/build/doctrees/cpl_query.enumerable.doctree b/docs/build/doctrees/cpl_query.enumerable.doctree index 4af22b0d..9cf715f8 100644 Binary files a/docs/build/doctrees/cpl_query.enumerable.doctree and b/docs/build/doctrees/cpl_query.enumerable.doctree differ diff --git a/docs/build/doctrees/cpl_query.extension.doctree b/docs/build/doctrees/cpl_query.extension.doctree index 6e010bdc..44449644 100644 Binary files a/docs/build/doctrees/cpl_query.extension.doctree and b/docs/build/doctrees/cpl_query.extension.doctree differ diff --git a/docs/build/doctrees/cpl_query.iterable.doctree b/docs/build/doctrees/cpl_query.iterable.doctree index 56087112..dfb9aeb6 100644 Binary files a/docs/build/doctrees/cpl_query.iterable.doctree and b/docs/build/doctrees/cpl_query.iterable.doctree differ diff --git a/docs/build/doctrees/cpl_translation.doctree b/docs/build/doctrees/cpl_translation.doctree index c70dfd3f..dd408802 100644 Binary files a/docs/build/doctrees/cpl_translation.doctree and b/docs/build/doctrees/cpl_translation.doctree differ diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index 1130483c..ae0229c9 100644 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/doctrees/introduction.doctree b/docs/build/doctrees/introduction.doctree index 409c498b..4a611cdc 100644 Binary files a/docs/build/doctrees/introduction.doctree and b/docs/build/doctrees/introduction.doctree differ diff --git a/docs/build/doctrees/modules.doctree b/docs/build/doctrees/modules.doctree index ceb86bd7..7c7692f4 100644 Binary files a/docs/build/doctrees/modules.doctree and b/docs/build/doctrees/modules.doctree differ diff --git a/docs/build/doctrees/setup.doctree b/docs/build/doctrees/setup.doctree index 68420c76..876ecf92 100644 Binary files a/docs/build/doctrees/setup.doctree and b/docs/build/doctrees/setup.doctree differ diff --git a/docs/build/html/_sources/cli.add.md.txt b/docs/build/html/_sources/cpl_cli.add.md.txt similarity index 99% rename from docs/build/html/_sources/cli.add.md.txt rename to docs/build/html/_sources/cpl_cli.add.md.txt index 46b3c5b0..119359fa 100644 --- a/docs/build/html/_sources/cli.add.md.txt +++ b/docs/build/html/_sources/cpl_cli.add.md.txt @@ -29,4 +29,4 @@ If you call the command in a CPL workspace, you can use the project names. Other | Argument | Description | |------------------|:------------------------------------------:| -| ```--simulate``` | Specifies whether the command is simulated | +| ```--simulate``` | Specifies whether the command is simulated | \ No newline at end of file diff --git a/docs/build/html/_sources/cli.build.md.txt b/docs/build/html/_sources/cpl_cli.build.md.txt similarity index 100% rename from docs/build/html/_sources/cli.build.md.txt rename to docs/build/html/_sources/cpl_cli.build.md.txt diff --git a/docs/build/html/_sources/cli.generate.md.txt b/docs/build/html/_sources/cpl_cli.generate.md.txt similarity index 100% rename from docs/build/html/_sources/cli.generate.md.txt rename to docs/build/html/_sources/cpl_cli.generate.md.txt diff --git a/docs/build/html/_sources/cli.help.md.txt b/docs/build/html/_sources/cpl_cli.help.md.txt similarity index 100% rename from docs/build/html/_sources/cli.help.md.txt rename to docs/build/html/_sources/cpl_cli.help.md.txt diff --git a/docs/build/html/_sources/cli.install.md.txt b/docs/build/html/_sources/cpl_cli.install.md.txt similarity index 100% rename from docs/build/html/_sources/cli.install.md.txt rename to docs/build/html/_sources/cpl_cli.install.md.txt diff --git a/docs/build/html/_sources/cli.new.md.txt b/docs/build/html/_sources/cpl_cli.new.md.txt similarity index 100% rename from docs/build/html/_sources/cli.new.md.txt rename to docs/build/html/_sources/cpl_cli.new.md.txt diff --git a/docs/build/html/_sources/cli.overview.md.txt b/docs/build/html/_sources/cpl_cli.overview.md.txt similarity index 51% rename from docs/build/html/_sources/cli.overview.md.txt rename to docs/build/html/_sources/cpl_cli.overview.md.txt index 5cd12eca..1116b4ba 100644 --- a/docs/build/html/_sources/cli.overview.md.txt +++ b/docs/build/html/_sources/cpl_cli.overview.md.txt @@ -39,15 +39,15 @@ The cpl generate command takes as an argument the artifact to be generated. In | Command | Alias | Description | | ----------------------------- |:-------------:|:----------------:| -| [add](cli.add) | a or a | Adds a project reference to given project. -| [build](cli.build) | b or B | Prepares files for publish into an output directory named dist/ at the given output path. Must be executed from within a workspace directory. -| [generate](cli.generate) | g or G | Generate a new file. -| [help](cli.help) | h or H | Lists available command and their short descriptions. -| [install](cli.install) | i or I | With argument installs packages to project, without argument installs project dependencies. -| [new](cli.new) | n or N | Creates new CPL project. -| [publish](cli.publish) | p or P | Prepares files for publish into an output directory named dist/ at the given output path and executes ```setup.py```. Must be executed from within a library workspace directory. -| [remove](cli.remove) | r or R | Removes a project from workspace. -| [start](cli.start) | s or S | Starts CPL project, restarting on file changes. -| [uninstall](cli.uninstall) | ui or UI | Uninstalls packages from project. -| [update](cli.update) | u or U | Update CPL and project dependencies. -| [version](cli.version) | v or V | Outputs CPL CLI version. +| [add](cpl_cli.add) | a or a | Adds a project reference to given project. +| [build](cpl_cli.build) | b or B | Prepares files for publish into an output directory named dist/ at the given output path. Must be executed from within a workspace directory. +| [generate](cpl_cli.generate) | g or G | Generate a new file. +| [help](cpl_cli.help) | h or H | Lists available command and their short descriptions. +| [install](cpl_cli.install) | i or I | With argument installs packages to project, without argument installs project dependencies. +| [new](cpl_cli.new) | n or N | Creates new CPL project. +| [publish](cpl_cli.publish) | p or P | Prepares files for publish into an output directory named dist/ at the given output path and executes ```setup.py```. Must be executed from within a library workspace directory. +| [remove](cpl_cli.remove) | r or R | Removes a project from workspace. +| [start](cpl_cli.start) | s or S | Starts CPL project, restarting on file changes. +| [uninstall](cpl_cli.uninstall) | ui or UI | Uninstalls packages from project. +| [update](cpl_cli.update) | u or U | Update CPL and project dependencies. +| [version](cpl_cli.version) | v or V | Outputs CPL CLI version. diff --git a/docs/build/html/_sources/cli.publish.md.txt b/docs/build/html/_sources/cpl_cli.publish.md.txt similarity index 100% rename from docs/build/html/_sources/cli.publish.md.txt rename to docs/build/html/_sources/cpl_cli.publish.md.txt diff --git a/docs/build/html/_sources/cli.remove.md.txt b/docs/build/html/_sources/cpl_cli.remove.md.txt similarity index 100% rename from docs/build/html/_sources/cli.remove.md.txt rename to docs/build/html/_sources/cpl_cli.remove.md.txt diff --git a/docs/build/html/_sources/cpl_cli.rst.txt b/docs/build/html/_sources/cpl_cli.rst.txt index cec12291..e0ca1832 100644 --- a/docs/build/html/_sources/cpl_cli.rst.txt +++ b/docs/build/html/_sources/cpl_cli.rst.txt @@ -4,16 +4,17 @@ CLI reference .. toctree:: :maxdepth: 4 - cli.overview - cli.add - cli.build - cli.generate - cli.help - cli.install - cli.new - cli.publish - cli.remove - cli.start - cli.uninstall - cli.update - cli.version \ No newline at end of file + cpl_cli.overview + cpl_cli.add + cpl_cli.build + cpl_cli.generate + cpl_cli.help + cpl_cli.install + cpl_cli.new + cpl_cli.publish + cpl_cli.remove + cpl_cli.run + cpl_cli.start + cpl_cli.uninstall + cpl_cli.update + cpl_cli.version \ No newline at end of file diff --git a/docs/build/html/_sources/cli.run.md.txt b/docs/build/html/_sources/cpl_cli.run.md.txt similarity index 100% rename from docs/build/html/_sources/cli.run.md.txt rename to docs/build/html/_sources/cpl_cli.run.md.txt diff --git a/docs/build/html/_sources/cli.start.md.txt b/docs/build/html/_sources/cpl_cli.start.md.txt similarity index 100% rename from docs/build/html/_sources/cli.start.md.txt rename to docs/build/html/_sources/cpl_cli.start.md.txt diff --git a/docs/build/html/_sources/cli.uninstall.md.txt b/docs/build/html/_sources/cpl_cli.uninstall.md.txt similarity index 100% rename from docs/build/html/_sources/cli.uninstall.md.txt rename to docs/build/html/_sources/cpl_cli.uninstall.md.txt diff --git a/docs/build/html/_sources/cli.update.md.txt b/docs/build/html/_sources/cpl_cli.update.md.txt similarity index 100% rename from docs/build/html/_sources/cli.update.md.txt rename to docs/build/html/_sources/cpl_cli.update.md.txt diff --git a/docs/build/html/_sources/cli.version.md.txt b/docs/build/html/_sources/cpl_cli.version.md.txt similarity index 100% rename from docs/build/html/_sources/cli.version.md.txt rename to docs/build/html/_sources/cpl_cli.version.md.txt diff --git a/docs/build/html/_sources/cpl_core.application.rst.txt b/docs/build/html/_sources/cpl_core.application.rst.txt index 140534a8..bcdcbc20 100644 --- a/docs/build/html/_sources/cpl_core.application.rst.txt +++ b/docs/build/html/_sources/cpl_core.application.rst.txt @@ -1,34 +1,61 @@ -cpl_core.application -======================= +cpl\_core.application package +============================= -cpl_core.application.application\_abc ---------------------------------------- +Submodules +---------- + +cpl\_core.application.application\_abc module +--------------------------------------------- .. automodule:: cpl_core.application.application_abc :members: :undoc-members: :show-inheritance: -cpl_core.application.application\_builder -------------------------------------------- +cpl\_core.application.application\_builder module +------------------------------------------------- .. automodule:: cpl_core.application.application_builder :members: :undoc-members: :show-inheritance: -cpl_core.application.application\_builder\_abc ------------------------------------------------- +cpl\_core.application.application\_builder\_abc module +------------------------------------------------------ .. automodule:: cpl_core.application.application_builder_abc :members: :undoc-members: :show-inheritance: -cpl_core.application.startup\_abc ------------------------------------ +cpl\_core.application.application\_extension\_abc module +-------------------------------------------------------- + +.. automodule:: cpl_core.application.application_extension_abc + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.application.startup\_abc module +----------------------------------------- .. automodule:: cpl_core.application.startup_abc :members: :undoc-members: :show-inheritance: + +cpl\_core.application.startup\_extension\_abc module +---------------------------------------------------- + +.. automodule:: cpl_core.application.startup_extension_abc + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.application + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.configuration.rst.txt b/docs/build/html/_sources/cpl_core.configuration.rst.txt index 6b2c210e..708c4ea6 100644 --- a/docs/build/html/_sources/cpl_core.configuration.rst.txt +++ b/docs/build/html/_sources/cpl_core.configuration.rst.txt @@ -1,42 +1,109 @@ -cpl_core.configuration -========================= +cpl\_core.configuration package +=============================== -cpl_core.configuration.configuration --------------------------------------- +Submodules +---------- + +cpl\_core.configuration.argument\_abc module +-------------------------------------------- + +.. automodule:: cpl_core.configuration.argument_abc + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.configuration.argument\_builder module +------------------------------------------------ + +.. automodule:: cpl_core.configuration.argument_builder + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.configuration.argument\_executable\_abc module +-------------------------------------------------------- + +.. automodule:: cpl_core.configuration.argument_executable_abc + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.configuration.argument\_type\_enum module +--------------------------------------------------- + +.. automodule:: cpl_core.configuration.argument_type_enum + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.configuration.configuration module +-------------------------------------------- .. automodule:: cpl_core.configuration.configuration :members: :undoc-members: :show-inheritance: -cpl_core.configuration.configuration\_abc -------------------------------------------- +cpl\_core.configuration.configuration\_abc module +------------------------------------------------- .. automodule:: cpl_core.configuration.configuration_abc :members: :undoc-members: :show-inheritance: -cpl_core.configuration.configuration\_model\_abc --------------------------------------------------- +cpl\_core.configuration.configuration\_model\_abc module +-------------------------------------------------------- .. automodule:: cpl_core.configuration.configuration_model_abc :members: :undoc-members: :show-inheritance: -cpl_core.configuration.configuration\_variable\_name\_enum ------------------------------------------------------------- +cpl\_core.configuration.configuration\_variable\_name\_enum module +------------------------------------------------------------------ .. automodule:: cpl_core.configuration.configuration_variable_name_enum :members: :undoc-members: :show-inheritance: -cpl_core.configuration.console\_argument ------------------------------------------- +cpl\_core.configuration.executable\_argument module +--------------------------------------------------- -.. automodule:: cpl_core.configuration.console_argument +.. automodule:: cpl_core.configuration.executable_argument + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.configuration.flag\_argument module +--------------------------------------------- + +.. automodule:: cpl_core.configuration.flag_argument + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.configuration.validator\_abc module +--------------------------------------------- + +.. automodule:: cpl_core.configuration.validator_abc + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.configuration.variable\_argument module +------------------------------------------------- + +.. automodule:: cpl_core.configuration.variable_argument + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.configuration :members: :undoc-members: :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.console.rst.txt b/docs/build/html/_sources/cpl_core.console.rst.txt index 21ce79e3..b14cc8c8 100644 --- a/docs/build/html/_sources/cpl_core.console.rst.txt +++ b/docs/build/html/_sources/cpl_core.console.rst.txt @@ -1,42 +1,53 @@ -cpl_core.console -=================== +cpl\_core.console package +========================= -cpl_core.console.background\_color\_enum ------------------------------------------- +Submodules +---------- + +cpl\_core.console.background\_color\_enum module +------------------------------------------------ .. automodule:: cpl_core.console.background_color_enum :members: :undoc-members: :show-inheritance: -cpl_core.console.console --------------------------- +cpl\_core.console.console module +-------------------------------- .. automodule:: cpl_core.console.console :members: :undoc-members: :show-inheritance: -cpl_core.console.console\_call --------------------------------- +cpl\_core.console.console\_call module +-------------------------------------- .. automodule:: cpl_core.console.console_call :members: :undoc-members: :show-inheritance: -cpl_core.console.foreground\_color\_enum ------------------------------------------- +cpl\_core.console.foreground\_color\_enum module +------------------------------------------------ .. automodule:: cpl_core.console.foreground_color_enum :members: :undoc-members: :show-inheritance: -cpl_core.console.spinner\_thread ----------------------------------- +cpl\_core.console.spinner\_thread module +---------------------------------------- .. automodule:: cpl_core.console.spinner_thread :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.console + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.database.connection.rst.txt b/docs/build/html/_sources/cpl_core.database.connection.rst.txt index e7324f18..86ec3966 100644 --- a/docs/build/html/_sources/cpl_core.database.connection.rst.txt +++ b/docs/build/html/_sources/cpl_core.database.connection.rst.txt @@ -1,18 +1,29 @@ -cpl_core.database.connection -=============================== +cpl\_core.database.connection package +===================================== -cpl_core.database.connection.database\_connection ---------------------------------------------------- +Submodules +---------- + +cpl\_core.database.connection.database\_connection module +--------------------------------------------------------- .. automodule:: cpl_core.database.connection.database_connection :members: :undoc-members: :show-inheritance: -cpl_core.database.connection.database\_connection\_abc --------------------------------------------------------- +cpl\_core.database.connection.database\_connection\_abc module +-------------------------------------------------------------- .. automodule:: cpl_core.database.connection.database_connection_abc :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.database.connection + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.database.context.rst.txt b/docs/build/html/_sources/cpl_core.database.context.rst.txt index ec368871..a17353d7 100644 --- a/docs/build/html/_sources/cpl_core.database.context.rst.txt +++ b/docs/build/html/_sources/cpl_core.database.context.rst.txt @@ -1,18 +1,29 @@ -cpl_core.database.context -============================ +cpl\_core.database.context package +================================== -cpl_core.database.context.database\_context ---------------------------------------------- +Submodules +---------- + +cpl\_core.database.context.database\_context module +--------------------------------------------------- .. automodule:: cpl_core.database.context.database_context :members: :undoc-members: :show-inheritance: -cpl_core.database.context.database\_context\_abc --------------------------------------------------- +cpl\_core.database.context.database\_context\_abc module +-------------------------------------------------------- .. automodule:: cpl_core.database.context.database_context_abc :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.database.context + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.database.rst.txt b/docs/build/html/_sources/cpl_core.database.rst.txt index cdcb0ce8..c5fbcffb 100644 --- a/docs/build/html/_sources/cpl_core.database.rst.txt +++ b/docs/build/html/_sources/cpl_core.database.rst.txt @@ -1,5 +1,8 @@ -cpl_core.database -==================== +cpl\_core.database package +========================== + +Subpackages +----------- .. toctree:: :maxdepth: 4 @@ -7,28 +10,37 @@ cpl_core.database cpl_core.database.connection cpl_core.database.context +Submodules +---------- - -cpl_core.database.database\_model ------------------------------------ - -.. automodule:: cpl_core.database.database_model - :members: - :undoc-members: - :show-inheritance: - -cpl_core.database.database\_settings --------------------------------------- +cpl\_core.database.database\_settings module +-------------------------------------------- .. automodule:: cpl_core.database.database_settings :members: :undoc-members: :show-inheritance: -cpl_core.database.database\_settings\_name\_enum --------------------------------------------------- +cpl\_core.database.database\_settings\_name\_enum module +-------------------------------------------------------- .. automodule:: cpl_core.database.database_settings_name_enum :members: :undoc-members: :show-inheritance: + +cpl\_core.database.table\_abc module +------------------------------------ + +.. automodule:: cpl_core.database.table_abc + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.database + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.dependency_injection.rst.txt b/docs/build/html/_sources/cpl_core.dependency_injection.rst.txt index 4f27f5fc..4e951d6e 100644 --- a/docs/build/html/_sources/cpl_core.dependency_injection.rst.txt +++ b/docs/build/html/_sources/cpl_core.dependency_injection.rst.txt @@ -1,50 +1,85 @@ -cpl_core.dependency\_injection -================================= +cpl\_core.dependency\_injection package +======================================= -cpl_core.dependency\_injection.service\_collection ----------------------------------------------------- +Submodules +---------- + +cpl\_core.dependency\_injection.scope module +-------------------------------------------- + +.. automodule:: cpl_core.dependency_injection.scope + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.dependency\_injection.scope\_abc module +------------------------------------------------- + +.. automodule:: cpl_core.dependency_injection.scope_abc + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.dependency\_injection.scope\_builder module +----------------------------------------------------- + +.. automodule:: cpl_core.dependency_injection.scope_builder + :members: + :undoc-members: + :show-inheritance: + +cpl\_core.dependency\_injection.service\_collection module +---------------------------------------------------------- .. automodule:: cpl_core.dependency_injection.service_collection :members: :undoc-members: :show-inheritance: -cpl_core.dependency\_injection.service\_collection\_abc ---------------------------------------------------------- +cpl\_core.dependency\_injection.service\_collection\_abc module +--------------------------------------------------------------- .. automodule:: cpl_core.dependency_injection.service_collection_abc :members: :undoc-members: :show-inheritance: -cpl_core.dependency\_injection.service\_descriptor ----------------------------------------------------- +cpl\_core.dependency\_injection.service\_descriptor module +---------------------------------------------------------- .. automodule:: cpl_core.dependency_injection.service_descriptor :members: :undoc-members: :show-inheritance: -cpl_core.dependency\_injection.service\_lifetime\_enum --------------------------------------------------------- +cpl\_core.dependency\_injection.service\_lifetime\_enum module +-------------------------------------------------------------- .. automodule:: cpl_core.dependency_injection.service_lifetime_enum :members: :undoc-members: :show-inheritance: -cpl_core.dependency\_injection.service\_provider --------------------------------------------------- +cpl\_core.dependency\_injection.service\_provider module +-------------------------------------------------------- .. automodule:: cpl_core.dependency_injection.service_provider :members: :undoc-members: :show-inheritance: -cpl_core.dependency\_injection.service\_provider\_abc -------------------------------------------------------- +cpl\_core.dependency\_injection.service\_provider\_abc module +------------------------------------------------------------- .. automodule:: cpl_core.dependency_injection.service_provider_abc :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.dependency_injection + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.environment.rst.txt b/docs/build/html/_sources/cpl_core.environment.rst.txt index 04c1b930..84eaedde 100644 --- a/docs/build/html/_sources/cpl_core.environment.rst.txt +++ b/docs/build/html/_sources/cpl_core.environment.rst.txt @@ -1,26 +1,37 @@ -cpl_core.environment -======================= +cpl\_core.environment package +============================= -cpl_core.environment.application\_environment ------------------------------------------------ +Submodules +---------- + +cpl\_core.environment.application\_environment module +----------------------------------------------------- .. automodule:: cpl_core.environment.application_environment :members: :undoc-members: :show-inheritance: -cpl_core.environment.application\_environment\_abc ----------------------------------------------------- +cpl\_core.environment.application\_environment\_abc module +---------------------------------------------------------- .. automodule:: cpl_core.environment.application_environment_abc :members: :undoc-members: :show-inheritance: -cpl_core.environment.environment\_name\_enum ----------------------------------------------- +cpl\_core.environment.environment\_name\_enum module +---------------------------------------------------- .. automodule:: cpl_core.environment.environment_name_enum :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.environment + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.logging.rst.txt b/docs/build/html/_sources/cpl_core.logging.rst.txt index f34f815d..6f36754d 100644 --- a/docs/build/html/_sources/cpl_core.logging.rst.txt +++ b/docs/build/html/_sources/cpl_core.logging.rst.txt @@ -1,42 +1,53 @@ -cpl_core.logging -=================== +cpl\_core.logging package +========================= -cpl_core.logging.logger\_abc ------------------------------- +Submodules +---------- + +cpl\_core.logging.logger\_abc module +------------------------------------ .. automodule:: cpl_core.logging.logger_abc :members: :undoc-members: :show-inheritance: -cpl_core.logging.logger\_service ----------------------------------- +cpl\_core.logging.logger\_service module +---------------------------------------- .. automodule:: cpl_core.logging.logger_service :members: :undoc-members: :show-inheritance: -cpl_core.logging.logging\_level\_enum ---------------------------------------- +cpl\_core.logging.logging\_level\_enum module +--------------------------------------------- .. automodule:: cpl_core.logging.logging_level_enum :members: :undoc-members: :show-inheritance: -cpl_core.logging.logging\_settings ------------------------------------- +cpl\_core.logging.logging\_settings module +------------------------------------------ .. automodule:: cpl_core.logging.logging_settings :members: :undoc-members: :show-inheritance: -cpl_core.logging.logging\_settings\_name\_enum ------------------------------------------------- +cpl\_core.logging.logging\_settings\_name\_enum module +------------------------------------------------------ .. automodule:: cpl_core.logging.logging_settings_name_enum :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.logging + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.mailing.rst.txt b/docs/build/html/_sources/cpl_core.mailing.rst.txt index 8074d736..323e167c 100644 --- a/docs/build/html/_sources/cpl_core.mailing.rst.txt +++ b/docs/build/html/_sources/cpl_core.mailing.rst.txt @@ -1,42 +1,53 @@ -cpl_core.mailing -=================== +cpl\_core.mailing package +========================= -cpl_core.mailing.email ------------------------- +Submodules +---------- + +cpl\_core.mailing.email module +------------------------------ .. automodule:: cpl_core.mailing.email :members: :undoc-members: :show-inheritance: -cpl_core.mailing.email\_client\_abc -------------------------------------- +cpl\_core.mailing.email\_client\_abc module +------------------------------------------- .. automodule:: cpl_core.mailing.email_client_abc :members: :undoc-members: :show-inheritance: -cpl_core.mailing.email\_client\_service ------------------------------------------ +cpl\_core.mailing.email\_client\_service module +----------------------------------------------- .. automodule:: cpl_core.mailing.email_client_service :members: :undoc-members: :show-inheritance: -cpl_core.mailing.email\_client\_settings ------------------------------------------- +cpl\_core.mailing.email\_client\_settings module +------------------------------------------------ .. automodule:: cpl_core.mailing.email_client_settings :members: :undoc-members: :show-inheritance: -cpl_core.mailing.email\_client\_settings\_name\_enum ------------------------------------------------------- +cpl\_core.mailing.email\_client\_settings\_name\_enum module +------------------------------------------------------------ .. automodule:: cpl_core.mailing.email_client_settings_name_enum :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.mailing + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.pipes.rst.txt b/docs/build/html/_sources/cpl_core.pipes.rst.txt index 0a8bba4d..cc061b15 100644 --- a/docs/build/html/_sources/cpl_core.pipes.rst.txt +++ b/docs/build/html/_sources/cpl_core.pipes.rst.txt @@ -1,9 +1,10 @@ -cpl\_core.pipes +cpl\_core.pipes package ======================= +Submodules +---------- - -cpl\_core.pipes.bool\_pipe +cpl\_core.pipes.bool\_pipe module --------------------------------- .. automodule:: cpl_core.pipes.bool_pipe @@ -11,7 +12,7 @@ cpl\_core.pipes.bool\_pipe :undoc-members: :show-inheritance: -cpl\_core.pipes.first\_char\_to\_lower\_pipe +cpl\_core.pipes.first\_char\_to\_lower\_pipe module --------------------------------------------------- .. automodule:: cpl_core.pipes.first_char_to_lower_pipe @@ -19,7 +20,7 @@ cpl\_core.pipes.first\_char\_to\_lower\_pipe :undoc-members: :show-inheritance: -cpl\_core.pipes.first\_to\_upper\_pipe +cpl\_core.pipes.first\_to\_upper\_pipe module --------------------------------------------- .. automodule:: cpl_core.pipes.first_to_upper_pipe @@ -27,7 +28,7 @@ cpl\_core.pipes.first\_to\_upper\_pipe :undoc-members: :show-inheritance: -cpl\_core.pipes.ip\_address\_pipe +cpl\_core.pipes.ip\_address\_pipe module ---------------------------------------- .. automodule:: cpl_core.pipes.ip_address_pipe @@ -35,7 +36,7 @@ cpl\_core.pipes.ip\_address\_pipe :undoc-members: :show-inheritance: -cpl\_core.pipes.pipe\_abc +cpl\_core.pipes.pipe\_abc module -------------------------------- .. automodule:: cpl_core.pipes.pipe_abc @@ -43,7 +44,7 @@ cpl\_core.pipes.pipe\_abc :undoc-members: :show-inheritance: -cpl\_core.pipes.to\_camel\_case\_pipe +cpl\_core.pipes.to\_camel\_case\_pipe module -------------------------------------------- .. automodule:: cpl_core.pipes.to_camel_case_pipe @@ -51,7 +52,7 @@ cpl\_core.pipes.to\_camel\_case\_pipe :undoc-members: :show-inheritance: -cpl\_core.pipes.to\_snake\_case\_pipe +cpl\_core.pipes.to\_snake\_case\_pipe module -------------------------------------------- .. automodule:: cpl_core.pipes.to_snake_case_pipe @@ -59,10 +60,18 @@ cpl\_core.pipes.to\_snake\_case\_pipe :undoc-members: :show-inheritance: -cpl\_core.pipes.version\_pipe +cpl\_core.pipes.version\_pipe module ------------------------------------ .. automodule:: cpl_core.pipes.version_pipe :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.pipes + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.rst.txt b/docs/build/html/_sources/cpl_core.rst.txt index e1e9b11a..f238136a 100644 --- a/docs/build/html/_sources/cpl_core.rst.txt +++ b/docs/build/html/_sources/cpl_core.rst.txt @@ -1,5 +1,5 @@ API reference -=========== +============= .. toctree:: :maxdepth: 4 @@ -15,3 +15,4 @@ API reference cpl_core.pipes cpl_core.time cpl_core.utils + diff --git a/docs/build/html/_sources/cpl_core.time.rst.txt b/docs/build/html/_sources/cpl_core.time.rst.txt index 7bbec704..4ecce6ec 100644 --- a/docs/build/html/_sources/cpl_core.time.rst.txt +++ b/docs/build/html/_sources/cpl_core.time.rst.txt @@ -1,18 +1,29 @@ -cpl_core.time -================ +cpl\_core.time package +====================== -cpl_core.time.time\_format\_settings --------------------------------------- +Submodules +---------- + +cpl\_core.time.time\_format\_settings module +-------------------------------------------- .. automodule:: cpl_core.time.time_format_settings :members: :undoc-members: :show-inheritance: -cpl_core.time.time\_format\_settings\_names\_enum ---------------------------------------------------- +cpl\_core.time.time\_format\_settings\_names\_enum module +--------------------------------------------------------- .. automodule:: cpl_core.time.time_format_settings_names_enum :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.time + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_core.utils.rst.txt b/docs/build/html/_sources/cpl_core.utils.rst.txt index 846071cb..6318a1de 100644 --- a/docs/build/html/_sources/cpl_core.utils.rst.txt +++ b/docs/build/html/_sources/cpl_core.utils.rst.txt @@ -1,26 +1,37 @@ -cpl_core.utils -================= +cpl\_core.utils package +======================= -cpl_core.utils.credential\_manager ------------------------------------- +Submodules +---------- + +cpl\_core.utils.credential\_manager module +------------------------------------------ .. automodule:: cpl_core.utils.credential_manager :members: :undoc-members: :show-inheritance: -cpl_core.utils.pip --------------------- +cpl\_core.utils.pip module +-------------------------- .. automodule:: cpl_core.utils.pip :members: :undoc-members: :show-inheritance: -cpl_core.utils.string ------------------------ +cpl\_core.utils.string module +----------------------------- .. automodule:: cpl_core.utils.string :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_core.utils + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.application.rst.txt b/docs/build/html/_sources/cpl_discord.application.rst.txt index ef077d22..3ce2c948 100644 --- a/docs/build/html/_sources/cpl_discord.application.rst.txt +++ b/docs/build/html/_sources/cpl_discord.application.rst.txt @@ -1,12 +1,21 @@ -cpl\_discord.application +cpl\_discord.application package ================================ +Submodules +---------- - -cpl\_discord.application.discord\_bot\_application\_abc +cpl\_discord.application.discord\_bot\_application\_abc module -------------------------------------------------------------- .. automodule:: cpl_discord.application.discord_bot_application_abc :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord.application + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.command.rst.txt b/docs/build/html/_sources/cpl_discord.command.rst.txt index 5f495733..ca0bb5a5 100644 --- a/docs/build/html/_sources/cpl_discord.command.rst.txt +++ b/docs/build/html/_sources/cpl_discord.command.rst.txt @@ -1,9 +1,10 @@ -cpl\_discord.command +cpl\_discord.command package ============================ +Submodules +---------- - -cpl\_discord.command.discord\_command\_abc +cpl\_discord.command.discord\_command\_abc module ------------------------------------------------- .. automodule:: cpl_discord.command.discord_command_abc @@ -11,10 +12,18 @@ cpl\_discord.command.discord\_command\_abc :undoc-members: :show-inheritance: -cpl\_discord.command.discord\_commands\_meta +cpl\_discord.command.discord\_commands\_meta module --------------------------------------------------- .. automodule:: cpl_discord.command.discord_commands_meta :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord.command + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.configuration.rst.txt b/docs/build/html/_sources/cpl_discord.configuration.rst.txt index eb855d14..47cda9ed 100644 --- a/docs/build/html/_sources/cpl_discord.configuration.rst.txt +++ b/docs/build/html/_sources/cpl_discord.configuration.rst.txt @@ -1,12 +1,21 @@ -cpl\_discord.configuration +cpl\_discord.configuration package ================================== +Submodules +---------- - -cpl\_discord.configuration.discord\_bot\_settings +cpl\_discord.configuration.discord\_bot\_settings module -------------------------------------------------------- .. automodule:: cpl_discord.configuration.discord_bot_settings :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord.configuration + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.container.rst.txt b/docs/build/html/_sources/cpl_discord.container.rst.txt index a47f50b1..44b70a52 100644 --- a/docs/build/html/_sources/cpl_discord.container.rst.txt +++ b/docs/build/html/_sources/cpl_discord.container.rst.txt @@ -1,9 +1,10 @@ -cpl\_discord.container +cpl\_discord.container package ============================== +Submodules +---------- - -cpl\_discord.container.category\_channel +cpl\_discord.container.category\_channel module ----------------------------------------------- .. automodule:: cpl_discord.container.category_channel @@ -11,7 +12,7 @@ cpl\_discord.container.category\_channel :undoc-members: :show-inheritance: -cpl\_discord.container.container +cpl\_discord.container.container module --------------------------------------- .. automodule:: cpl_discord.container.container @@ -19,7 +20,7 @@ cpl\_discord.container.container :undoc-members: :show-inheritance: -cpl\_discord.container.guild +cpl\_discord.container.guild module ----------------------------------- .. automodule:: cpl_discord.container.guild @@ -27,7 +28,7 @@ cpl\_discord.container.guild :undoc-members: :show-inheritance: -cpl\_discord.container.member +cpl\_discord.container.member module ------------------------------------ .. automodule:: cpl_discord.container.member @@ -35,7 +36,7 @@ cpl\_discord.container.member :undoc-members: :show-inheritance: -cpl\_discord.container.role +cpl\_discord.container.role module ---------------------------------- .. automodule:: cpl_discord.container.role @@ -43,7 +44,7 @@ cpl\_discord.container.role :undoc-members: :show-inheritance: -cpl\_discord.container.text\_channel +cpl\_discord.container.text\_channel module ------------------------------------------- .. automodule:: cpl_discord.container.text_channel @@ -51,7 +52,7 @@ cpl\_discord.container.text\_channel :undoc-members: :show-inheritance: -cpl\_discord.container.thread +cpl\_discord.container.thread module ------------------------------------ .. automodule:: cpl_discord.container.thread @@ -59,10 +60,18 @@ cpl\_discord.container.thread :undoc-members: :show-inheritance: -cpl\_discord.container.voice\_channel +cpl\_discord.container.voice\_channel module -------------------------------------------- .. automodule:: cpl_discord.container.voice_channel :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord.container + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.events.rst.txt b/docs/build/html/_sources/cpl_discord.events.rst.txt index d26aa744..290111c1 100644 --- a/docs/build/html/_sources/cpl_discord.events.rst.txt +++ b/docs/build/html/_sources/cpl_discord.events.rst.txt @@ -1,9 +1,10 @@ -cpl\_discord.events +cpl\_discord.events package =========================== +Submodules +---------- - -cpl\_discord.events.on\_bulk\_message\_delete\_abc +cpl\_discord.events.on\_bulk\_message\_delete\_abc module --------------------------------------------------------- .. automodule:: cpl_discord.events.on_bulk_message_delete_abc @@ -11,7 +12,7 @@ cpl\_discord.events.on\_bulk\_message\_delete\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_command\_abc +cpl\_discord.events.on\_command\_abc module ------------------------------------------- .. automodule:: cpl_discord.events.on_command_abc @@ -19,7 +20,7 @@ cpl\_discord.events.on\_command\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_command\_completion\_abc +cpl\_discord.events.on\_command\_completion\_abc module ------------------------------------------------------- .. automodule:: cpl_discord.events.on_command_completion_abc @@ -27,7 +28,7 @@ cpl\_discord.events.on\_command\_completion\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_command\_error\_abc +cpl\_discord.events.on\_command\_error\_abc module -------------------------------------------------- .. automodule:: cpl_discord.events.on_command_error_abc @@ -35,7 +36,7 @@ cpl\_discord.events.on\_command\_error\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_connect\_abc +cpl\_discord.events.on\_connect\_abc module ------------------------------------------- .. automodule:: cpl_discord.events.on_connect_abc @@ -43,7 +44,7 @@ cpl\_discord.events.on\_connect\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_disconnect\_abc +cpl\_discord.events.on\_disconnect\_abc module ---------------------------------------------- .. automodule:: cpl_discord.events.on_disconnect_abc @@ -51,7 +52,7 @@ cpl\_discord.events.on\_disconnect\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_error\_abc +cpl\_discord.events.on\_error\_abc module ----------------------------------------- .. automodule:: cpl_discord.events.on_error_abc @@ -59,7 +60,7 @@ cpl\_discord.events.on\_error\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_group\_join\_abc +cpl\_discord.events.on\_group\_join\_abc module ----------------------------------------------- .. automodule:: cpl_discord.events.on_group_join_abc @@ -67,7 +68,7 @@ cpl\_discord.events.on\_group\_join\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_group\_remove\_abc +cpl\_discord.events.on\_group\_remove\_abc module ------------------------------------------------- .. automodule:: cpl_discord.events.on_group_remove_abc @@ -75,7 +76,7 @@ cpl\_discord.events.on\_group\_remove\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_available\_abc +cpl\_discord.events.on\_guild\_available\_abc module ---------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_available_abc @@ -83,7 +84,7 @@ cpl\_discord.events.on\_guild\_available\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_channel\_create\_abc +cpl\_discord.events.on\_guild\_channel\_create\_abc module ---------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_channel_create_abc @@ -91,7 +92,7 @@ cpl\_discord.events.on\_guild\_channel\_create\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_channel\_delete\_abc +cpl\_discord.events.on\_guild\_channel\_delete\_abc module ---------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_channel_delete_abc @@ -99,7 +100,7 @@ cpl\_discord.events.on\_guild\_channel\_delete\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_channel\_pins\_update\_abc +cpl\_discord.events.on\_guild\_channel\_pins\_update\_abc module ---------------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_channel_pins_update_abc @@ -107,7 +108,7 @@ cpl\_discord.events.on\_guild\_channel\_pins\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_channel\_update\_abc +cpl\_discord.events.on\_guild\_channel\_update\_abc module ---------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_channel_update_abc @@ -115,7 +116,7 @@ cpl\_discord.events.on\_guild\_channel\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_emojis\_update\_abc +cpl\_discord.events.on\_guild\_emojis\_update\_abc module --------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_emojis_update_abc @@ -123,7 +124,7 @@ cpl\_discord.events.on\_guild\_emojis\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_integrations\_update\_abc +cpl\_discord.events.on\_guild\_integrations\_update\_abc module --------------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_integrations_update_abc @@ -131,7 +132,7 @@ cpl\_discord.events.on\_guild\_integrations\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_join\_abc +cpl\_discord.events.on\_guild\_join\_abc module ----------------------------------------------- .. automodule:: cpl_discord.events.on_guild_join_abc @@ -139,7 +140,7 @@ cpl\_discord.events.on\_guild\_join\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_remove\_abc +cpl\_discord.events.on\_guild\_remove\_abc module ------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_remove_abc @@ -147,7 +148,7 @@ cpl\_discord.events.on\_guild\_remove\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_role\_create\_abc +cpl\_discord.events.on\_guild\_role\_create\_abc module ------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_role_create_abc @@ -155,7 +156,7 @@ cpl\_discord.events.on\_guild\_role\_create\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_role\_delete\_abc +cpl\_discord.events.on\_guild\_role\_delete\_abc module ------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_role_delete_abc @@ -163,7 +164,7 @@ cpl\_discord.events.on\_guild\_role\_delete\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_role\_update\_abc +cpl\_discord.events.on\_guild\_role\_update\_abc module ------------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_role_update_abc @@ -171,7 +172,7 @@ cpl\_discord.events.on\_guild\_role\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_unavailable\_abc +cpl\_discord.events.on\_guild\_unavailable\_abc module ------------------------------------------------------ .. automodule:: cpl_discord.events.on_guild_unavailable_abc @@ -179,7 +180,7 @@ cpl\_discord.events.on\_guild\_unavailable\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_guild\_update\_abc +cpl\_discord.events.on\_guild\_update\_abc module ------------------------------------------------- .. automodule:: cpl_discord.events.on_guild_update_abc @@ -187,7 +188,7 @@ cpl\_discord.events.on\_guild\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_invite\_create\_abc +cpl\_discord.events.on\_invite\_create\_abc module -------------------------------------------------- .. automodule:: cpl_discord.events.on_invite_create_abc @@ -195,7 +196,7 @@ cpl\_discord.events.on\_invite\_create\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_invite\_delete\_abc +cpl\_discord.events.on\_invite\_delete\_abc module -------------------------------------------------- .. automodule:: cpl_discord.events.on_invite_delete_abc @@ -203,7 +204,7 @@ cpl\_discord.events.on\_invite\_delete\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_member\_ban\_abc +cpl\_discord.events.on\_member\_ban\_abc module ----------------------------------------------- .. automodule:: cpl_discord.events.on_member_ban_abc @@ -211,7 +212,7 @@ cpl\_discord.events.on\_member\_ban\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_member\_join\_abc +cpl\_discord.events.on\_member\_join\_abc module ------------------------------------------------ .. automodule:: cpl_discord.events.on_member_join_abc @@ -219,7 +220,7 @@ cpl\_discord.events.on\_member\_join\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_member\_remove\_abc +cpl\_discord.events.on\_member\_remove\_abc module -------------------------------------------------- .. automodule:: cpl_discord.events.on_member_remove_abc @@ -227,7 +228,7 @@ cpl\_discord.events.on\_member\_remove\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_member\_unban\_abc +cpl\_discord.events.on\_member\_unban\_abc module ------------------------------------------------- .. automodule:: cpl_discord.events.on_member_unban_abc @@ -235,7 +236,7 @@ cpl\_discord.events.on\_member\_unban\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_member\_update\_abc +cpl\_discord.events.on\_member\_update\_abc module -------------------------------------------------- .. automodule:: cpl_discord.events.on_member_update_abc @@ -243,7 +244,7 @@ cpl\_discord.events.on\_member\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_message\_abc +cpl\_discord.events.on\_message\_abc module ------------------------------------------- .. automodule:: cpl_discord.events.on_message_abc @@ -251,7 +252,7 @@ cpl\_discord.events.on\_message\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_message\_delete\_abc +cpl\_discord.events.on\_message\_delete\_abc module --------------------------------------------------- .. automodule:: cpl_discord.events.on_message_delete_abc @@ -259,7 +260,7 @@ cpl\_discord.events.on\_message\_delete\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_message\_edit\_abc +cpl\_discord.events.on\_message\_edit\_abc module ------------------------------------------------- .. automodule:: cpl_discord.events.on_message_edit_abc @@ -267,7 +268,7 @@ cpl\_discord.events.on\_message\_edit\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_private\_channel\_create\_abc +cpl\_discord.events.on\_private\_channel\_create\_abc module ------------------------------------------------------------ .. automodule:: cpl_discord.events.on_private_channel_create_abc @@ -275,7 +276,7 @@ cpl\_discord.events.on\_private\_channel\_create\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_private\_channel\_delete\_abc +cpl\_discord.events.on\_private\_channel\_delete\_abc module ------------------------------------------------------------ .. automodule:: cpl_discord.events.on_private_channel_delete_abc @@ -283,7 +284,7 @@ cpl\_discord.events.on\_private\_channel\_delete\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_private\_channel\_pins\_update\_abc +cpl\_discord.events.on\_private\_channel\_pins\_update\_abc module ------------------------------------------------------------------ .. automodule:: cpl_discord.events.on_private_channel_pins_update_abc @@ -291,7 +292,7 @@ cpl\_discord.events.on\_private\_channel\_pins\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_private\_channel\_update\_abc +cpl\_discord.events.on\_private\_channel\_update\_abc module ------------------------------------------------------------ .. automodule:: cpl_discord.events.on_private_channel_update_abc @@ -299,7 +300,7 @@ cpl\_discord.events.on\_private\_channel\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_raw\_reaction\_add\_abc +cpl\_discord.events.on\_raw\_reaction\_add\_abc module ------------------------------------------------------ .. automodule:: cpl_discord.events.on_raw_reaction_add_abc @@ -307,7 +308,7 @@ cpl\_discord.events.on\_raw\_reaction\_add\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_raw\_reaction\_clear\_abc +cpl\_discord.events.on\_raw\_reaction\_clear\_abc module -------------------------------------------------------- .. automodule:: cpl_discord.events.on_raw_reaction_clear_abc @@ -315,7 +316,7 @@ cpl\_discord.events.on\_raw\_reaction\_clear\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_raw\_reaction\_clear\_emoji\_abc +cpl\_discord.events.on\_raw\_reaction\_clear\_emoji\_abc module --------------------------------------------------------------- .. automodule:: cpl_discord.events.on_raw_reaction_clear_emoji_abc @@ -323,7 +324,7 @@ cpl\_discord.events.on\_raw\_reaction\_clear\_emoji\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_raw\_reaction\_remove\_abc +cpl\_discord.events.on\_raw\_reaction\_remove\_abc module --------------------------------------------------------- .. automodule:: cpl_discord.events.on_raw_reaction_remove_abc @@ -331,7 +332,7 @@ cpl\_discord.events.on\_raw\_reaction\_remove\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_reaction\_add\_abc +cpl\_discord.events.on\_reaction\_add\_abc module ------------------------------------------------- .. automodule:: cpl_discord.events.on_reaction_add_abc @@ -339,7 +340,7 @@ cpl\_discord.events.on\_reaction\_add\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_reaction\_clear\_abc +cpl\_discord.events.on\_reaction\_clear\_abc module --------------------------------------------------- .. automodule:: cpl_discord.events.on_reaction_clear_abc @@ -347,7 +348,7 @@ cpl\_discord.events.on\_reaction\_clear\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_reaction\_clear\_emoji\_abc +cpl\_discord.events.on\_reaction\_clear\_emoji\_abc module ---------------------------------------------------------- .. automodule:: cpl_discord.events.on_reaction_clear_emoji_abc @@ -355,7 +356,7 @@ cpl\_discord.events.on\_reaction\_clear\_emoji\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_reaction\_remove\_abc +cpl\_discord.events.on\_reaction\_remove\_abc module ---------------------------------------------------- .. automodule:: cpl_discord.events.on_reaction_remove_abc @@ -363,7 +364,7 @@ cpl\_discord.events.on\_reaction\_remove\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_ready\_abc +cpl\_discord.events.on\_ready\_abc module ----------------------------------------- .. automodule:: cpl_discord.events.on_ready_abc @@ -371,7 +372,7 @@ cpl\_discord.events.on\_ready\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_resume\_abc +cpl\_discord.events.on\_resume\_abc module ------------------------------------------ .. automodule:: cpl_discord.events.on_resume_abc @@ -379,7 +380,7 @@ cpl\_discord.events.on\_resume\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_typing\_abc +cpl\_discord.events.on\_typing\_abc module ------------------------------------------ .. automodule:: cpl_discord.events.on_typing_abc @@ -387,7 +388,7 @@ cpl\_discord.events.on\_typing\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_user\_update\_abc +cpl\_discord.events.on\_user\_update\_abc module ------------------------------------------------ .. automodule:: cpl_discord.events.on_user_update_abc @@ -395,7 +396,7 @@ cpl\_discord.events.on\_user\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_voice\_state\_update\_abc +cpl\_discord.events.on\_voice\_state\_update\_abc module -------------------------------------------------------- .. automodule:: cpl_discord.events.on_voice_state_update_abc @@ -403,10 +404,18 @@ cpl\_discord.events.on\_voice\_state\_update\_abc :undoc-members: :show-inheritance: -cpl\_discord.events.on\_webhooks\_update\_abc +cpl\_discord.events.on\_webhooks\_update\_abc module ---------------------------------------------------- .. automodule:: cpl_discord.events.on_webhooks_update_abc :members: :undoc-members: - :show-inheritance: \ No newline at end of file + :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord.events + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.helper.rst.txt b/docs/build/html/_sources/cpl_discord.helper.rst.txt index 396b4c89..fab914ae 100644 --- a/docs/build/html/_sources/cpl_discord.helper.rst.txt +++ b/docs/build/html/_sources/cpl_discord.helper.rst.txt @@ -1,12 +1,21 @@ -cpl\_discord.helper +cpl\_discord.helper package =========================== +Submodules +---------- - -cpl\_discord.helper.to\_containers\_converter +cpl\_discord.helper.to\_containers\_converter module ---------------------------------------------------- .. automodule:: cpl_discord.helper.to_containers_converter :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord.helper + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.rst.txt b/docs/build/html/_sources/cpl_discord.rst.txt index 5d10fb20..d777438b 100644 --- a/docs/build/html/_sources/cpl_discord.rst.txt +++ b/docs/build/html/_sources/cpl_discord.rst.txt @@ -1,6 +1,9 @@ -Discord reference +cpl\_discord package ==================== +Subpackages +----------- + .. toctree:: :maxdepth: 4 @@ -11,3 +14,22 @@ Discord reference cpl_discord.events cpl_discord.helper cpl_discord.service + +Submodules +---------- + +cpl\_discord.discord\_event\_types\_enum module +----------------------------------------------- + +.. automodule:: cpl_discord.discord_event_types_enum + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_discord.service.rst.txt b/docs/build/html/_sources/cpl_discord.service.rst.txt index a6898292..13527b5b 100644 --- a/docs/build/html/_sources/cpl_discord.service.rst.txt +++ b/docs/build/html/_sources/cpl_discord.service.rst.txt @@ -1,9 +1,10 @@ -cpl\_discord.service +cpl\_discord.service package ============================ +Submodules +---------- - -cpl\_discord.service.command\_error\_handler\_service +cpl\_discord.service.command\_error\_handler\_service module ------------------------------------------------------------ .. automodule:: cpl_discord.service.command_error_handler_service @@ -11,7 +12,7 @@ cpl\_discord.service.command\_error\_handler\_service :undoc-members: :show-inheritance: -cpl\_discord.service.discord\_bot\_service +cpl\_discord.service.discord\_bot\_service module ------------------------------------------------- .. automodule:: cpl_discord.service.discord_bot_service @@ -19,7 +20,7 @@ cpl\_discord.service.discord\_bot\_service :undoc-members: :show-inheritance: -cpl\_discord.service.discord\_bot\_service\_abc +cpl\_discord.service.discord\_bot\_service\_abc module ------------------------------------------------------ .. automodule:: cpl_discord.service.discord_bot_service_abc @@ -27,7 +28,7 @@ cpl\_discord.service.discord\_bot\_service\_abc :undoc-members: :show-inheritance: -cpl\_discord.service.discord\_collection +cpl\_discord.service.discord\_collection module ----------------------------------------------- .. automodule:: cpl_discord.service.discord_collection @@ -35,7 +36,7 @@ cpl\_discord.service.discord\_collection :undoc-members: :show-inheritance: -cpl\_discord.service.discord\_collection\_abc +cpl\_discord.service.discord\_collection\_abc module ---------------------------------------------------- .. automodule:: cpl_discord.service.discord_collection_abc @@ -43,7 +44,7 @@ cpl\_discord.service.discord\_collection\_abc :undoc-members: :show-inheritance: -cpl\_discord.service.discord\_service +cpl\_discord.service.discord\_service module -------------------------------------------- .. automodule:: cpl_discord.service.discord_service @@ -51,10 +52,18 @@ cpl\_discord.service.discord\_service :undoc-members: :show-inheritance: -cpl\_discord.service.discord\_service\_abc +cpl\_discord.service.discord\_service\_abc module ------------------------------------------------- .. automodule:: cpl_discord.service.discord_service_abc :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_discord.service + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_query.base.rst.txt b/docs/build/html/_sources/cpl_query.base.rst.txt index 156985e5..34fc9962 100644 --- a/docs/build/html/_sources/cpl_query.base.rst.txt +++ b/docs/build/html/_sources/cpl_query.base.rst.txt @@ -1,9 +1,10 @@ -cpl\_query.base +cpl\_query.base package ======================= +Submodules +---------- - -cpl\_query.base.default\_lambda +cpl\_query.base.default\_lambda module -------------------------------------- .. automodule:: cpl_query.base.default_lambda @@ -11,7 +12,7 @@ cpl\_query.base.default\_lambda :undoc-members: :show-inheritance: -cpl\_query.base.ordered\_queryable +cpl\_query.base.ordered\_queryable module ----------------------------------------- .. automodule:: cpl_query.base.ordered_queryable @@ -19,7 +20,7 @@ cpl\_query.base.ordered\_queryable :undoc-members: :show-inheritance: -cpl\_query.base.ordered\_queryable\_abc +cpl\_query.base.ordered\_queryable\_abc module ---------------------------------------------- .. automodule:: cpl_query.base.ordered_queryable_abc @@ -27,7 +28,7 @@ cpl\_query.base.ordered\_queryable\_abc :undoc-members: :show-inheritance: -cpl\_query.base.queryable\_abc +cpl\_query.base.queryable\_abc module ------------------------------------- .. automodule:: cpl_query.base.queryable_abc @@ -35,18 +36,18 @@ cpl\_query.base.queryable\_abc :undoc-members: :show-inheritance: -cpl\_query.base.sequence\_abc ------------------------------------- +cpl\_query.base.sequence module +------------------------------- -.. automodule:: cpl_query.base.sequence_abc +.. automodule:: cpl_query.base.sequence :members: :undoc-members: :show-inheritance: -cpl\_query.base.sequence\_values ---------------------------------------- +Module contents +--------------- -.. automodule:: cpl_query.base.sequence_values +.. automodule:: cpl_query.base :members: :undoc-members: :show-inheritance: diff --git a/docs/build/html/_sources/cpl_query.enumerable.rst.txt b/docs/build/html/_sources/cpl_query.enumerable.rst.txt index 37e58add..6c4d6a18 100644 --- a/docs/build/html/_sources/cpl_query.enumerable.rst.txt +++ b/docs/build/html/_sources/cpl_query.enumerable.rst.txt @@ -1,9 +1,10 @@ -cpl\_query.enumerable +cpl\_query.enumerable package ============================= +Submodules +---------- - -cpl\_query.enumerable.enumerable +cpl\_query.enumerable.enumerable module --------------------------------------- .. automodule:: cpl_query.enumerable.enumerable @@ -11,10 +12,18 @@ cpl\_query.enumerable.enumerable :undoc-members: :show-inheritance: -cpl\_query.enumerable.enumerable\_abc +cpl\_query.enumerable.enumerable\_abc module -------------------------------------------- .. automodule:: cpl_query.enumerable.enumerable_abc :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_query.enumerable + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_query.extension.rst.txt b/docs/build/html/_sources/cpl_query.extension.rst.txt index a0bba3e0..4579c6e1 100644 --- a/docs/build/html/_sources/cpl_query.extension.rst.txt +++ b/docs/build/html/_sources/cpl_query.extension.rst.txt @@ -1,12 +1,21 @@ -cpl\_query.extension +cpl\_query.extension package ============================ +Submodules +---------- - -cpl\_query.extension.list +cpl\_query.extension.list module -------------------------------- .. automodule:: cpl_query.extension.list :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_query.extension + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_query.iterable.rst.txt b/docs/build/html/_sources/cpl_query.iterable.rst.txt index 8a7bc919..07ea0c19 100644 --- a/docs/build/html/_sources/cpl_query.iterable.rst.txt +++ b/docs/build/html/_sources/cpl_query.iterable.rst.txt @@ -1,9 +1,10 @@ -cpl\_query.iterable +cpl\_query.iterable package =========================== +Submodules +---------- - -cpl\_query.iterable.iterable +cpl\_query.iterable.iterable module ----------------------------------- .. automodule:: cpl_query.iterable.iterable @@ -11,10 +12,18 @@ cpl\_query.iterable.iterable :undoc-members: :show-inheritance: -cpl\_query.iterable.iterable\_abc +cpl\_query.iterable.iterable\_abc module ---------------------------------------- .. automodule:: cpl_query.iterable.iterable_abc :members: :undoc-members: :show-inheritance: + +Module contents +--------------- + +.. automodule:: cpl_query.iterable + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/cpl_query.rst.txt b/docs/build/html/_sources/cpl_query.rst.txt index 5a362b26..5812cc73 100644 --- a/docs/build/html/_sources/cpl_query.rst.txt +++ b/docs/build/html/_sources/cpl_query.rst.txt @@ -1,10 +1,10 @@ Query reference -=========== +=============== .. toctree:: :maxdepth: 4 - cpl_query.base - cpl_query.enumerable - cpl_query.extension - cpl_query.iterable + cpl_query.base + cpl_query.enumerable + cpl_query.extension + cpl_query.iterable diff --git a/docs/build/html/_sources/introduction.md.txt b/docs/build/html/_sources/introduction.md.txt index fc9721da..33d31430 100644 --- a/docs/build/html/_sources/introduction.md.txt +++ b/docs/build/html/_sources/introduction.md.txt @@ -56,5 +56,5 @@ This CPL docs help you learn, understand and use the package. From your first ap - [Getting started](quickstart) - [Setup](setup) - [API Reference](cpl_core) -- [CLI Reference](cli.overview) +- [CLI Reference](cpl_cli.overview) - [Query Reference](cpl_query) diff --git a/docs/build/html/_sources/modules.rst.txt b/docs/build/html/_sources/modules.rst.txt index 5a411fa4..49bd8182 100644 --- a/docs/build/html/_sources/modules.rst.txt +++ b/docs/build/html/_sources/modules.rst.txt @@ -1,10 +1,9 @@ -cpl -=== +Packages +======== .. toctree:: :maxdepth: 4 - getting_started cpl_cli cpl_core cpl_discord diff --git a/docs/build/html/_sources/setup.md.txt b/docs/build/html/_sources/setup.md.txt index be16fa9b..1a953c69 100644 --- a/docs/build/html/_sources/setup.md.txt +++ b/docs/build/html/_sources/setup.md.txt @@ -104,8 +104,8 @@ Hello World ## What's next -- To learn more about the CPL CLI, see the [CLI Overview](cli.overview) -- Fore more informations about the Pyhton files generated by ```cpl new```, see [New Command](cli.new) +- To learn more about the CPL CLI, see the [CLI Overview](cpl_cli.overview) +- Fore more informations about the Pyhton files generated by ```cpl new```, see [New Command](cpl_cli.new) [pip-url]: https://pip.sh-edraft.de diff --git a/docs/build/html/contributing.html b/docs/build/html/contributing.html index 05c75b17..c74eb795 100644 --- a/docs/build/html/contributing.html +++ b/docs/build/html/contributing.html @@ -59,7 +59,7 @@
Be sure that an issue describes the problem you’re fixing, or documents the design for the feature you’d like to add. Discussing the design upfront helps to ensure that we’re ready to accept your work.
Fork the sh-edraft.de/cpl repo.
In your forked repository, make your changes in a new git branch:
-git checkout -b my-fix-branch master
+git checkout -b my-fix-branch master
@@ -136,13 +136,13 @@
Commit your changes.
-git commit --all
+git commit --all
Note: the optional commit -a
command line option will automatically “add” and “rm” edited files.
Push your branch to the repository:
-git push origin my-fix-branch
+git push origin my-fix-branch
@@ -158,8 +158,8 @@
Make the required updates to the code.
Create a fixup commit and push to your repository (this will update your Pull Request):
-git commit --all --fixup HEAD
-git push
+git commit --all --fixup HEAD
+git push
diff --git a/docs/build/html/cli.add.html b/docs/build/html/cpl_cli.add.html
similarity index 79%
rename from docs/build/html/cli.add.html
rename to docs/build/html/cpl_cli.add.html
index 54bff940..1d45e0f8 100644
--- a/docs/build/html/cli.add.html
+++ b/docs/build/html/cpl_cli.add.html
@@ -19,8 +19,8 @@
-
-
+
+
@@ -43,7 +43,7 @@
- Getting started
- Contributing to CPL
- CLI reference
-- CLI Overview and Command Reference
+- CLI Overview and Command Reference
- cpl add
- Contents
- Description
@@ -51,21 +51,22 @@
- Flags
-- cpl build
-- cpl generate
-- cpl help
-- cpl install
-- cpl new
-- cpl publish
-- cpl remove
-- cpl start
-- cpl uninstall
-- cpl update
-- cpl version
+- cpl build
+- cpl generate
+- cpl help
+- cpl install
+- cpl new
+- cpl publish
+- cpl remove
+- cpl run
+- cpl start
+- cpl uninstall
+- cpl update
+- cpl version
- API reference
-- Discord reference
+- cpl_discord package
- Query reference
- Translation reference
@@ -87,7 +88,7 @@
- CLI reference »
- cpl add
@@ -156,8 +157,8 @@ cpl A <source-project> <target-project>
To create, build, and serve a new, basic CPL project on a development server, go to the parent directory of your new workspace use the following commands:
-cpl new console my-first-project
-cd my-first-project
-cpl start
+cpl new console my-first-project
+cd my-first-project
+cpl start
In the terminal you will the output of the app.
@@ -147,51 +148,51 @@ cpl start
-
+
a or a
Adds a project reference to given project.
-
+
b or B
Prepares files for publish into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
-
+
g or G
Generate a new file.
-
+
h or H
Lists available command and their short descriptions.
-
+
i or I
With argument installs packages to project, without argument installs project dependencies.
-
+
n or N
Creates new CPL project.
-
+
p or P
Prepares files for publish into an output directory named dist/ at the given output path and executes setup.py
. Must be executed from within a library workspace directory.
-
+
r or R
Removes a project from workspace.
-
+
s or S
Starts CPL project, restarting on file changes.
-
+
ui or UI
Uninstalls packages from project.
-
+
u or U
Update CPL and project dependencies.
-
+
v or V
Outputs CPL CLI version.
@@ -205,7 +206,7 @@ cpl start
diff --git a/docs/build/html/cli.publish.html b/docs/build/html/cpl_cli.publish.html
similarity index 76%
rename from docs/build/html/cli.publish.html
rename to docs/build/html/cpl_cli.publish.html
index 51103a03..806e5fb7 100644
--- a/docs/build/html/cli.publish.html
+++ b/docs/build/html/cpl_cli.publish.html
@@ -19,8 +19,8 @@
-
-
+
+
@@ -43,27 +43,28 @@
Getting started
Contributing to CPL
CLI reference
-- CLI Overview and Command Reference
-- cpl add
-- cpl build
-- cpl generate
-- cpl help
-- cpl install
-- cpl new
+- CLI Overview and Command Reference
+- cpl add
+- cpl build
+- cpl generate
+- cpl help
+- cpl install
+- cpl new
- cpl publish
-- cpl remove
-- cpl start
-- cpl uninstall
-- cpl update
-- cpl version
+- cpl remove
+- cpl run
+- cpl start
+- cpl uninstall
+- cpl update
+- cpl version
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
@@ -85,7 +86,7 @@
CLI reference »
cpl publish
- View page source
+ View page source
@@ -123,8 +124,8 @@ The command executes the
diff --git a/docs/build/html/cli.remove.html b/docs/build/html/cpl_cli.remove.html
similarity index 78%
rename from docs/build/html/cli.remove.html
rename to docs/build/html/cpl_cli.remove.html
index 71530a72..fc989382 100644
--- a/docs/build/html/cli.remove.html
+++ b/docs/build/html/cpl_cli.remove.html
@@ -19,8 +19,8 @@
-
-
+
+
@@ -43,14 +43,14 @@
Getting started
Contributing to CPL
CLI reference
-- CLI Overview and Command Reference
-- cpl add
-- cpl build
-- cpl generate
-- cpl help
-- cpl install
-- cpl new
-- cpl publish
+- CLI Overview and Command Reference
+- cpl add
+- cpl build
+- cpl generate
+- cpl help
+- cpl install
+- cpl new
+- cpl publish
- cpl remove
- Contents
- Description
@@ -58,14 +58,15 @@
- Flags
-- cpl start
-- cpl uninstall
-- cpl update
-- cpl version
+- cpl run
+- cpl start
+- cpl uninstall
+- cpl update
+- cpl version
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
@@ -87,7 +88,7 @@
CLI reference »
cpl remove
- View page source
+ View page source
@@ -151,8 +152,8 @@ cpl R <project>
diff --git a/docs/build/html/cli.run.html b/docs/build/html/cpl_cli.run.html
similarity index 67%
rename from docs/build/html/cli.run.html
rename to docs/build/html/cpl_cli.run.html
index ebbfd30c..f4f50c47 100644
--- a/docs/build/html/cli.run.html
+++ b/docs/build/html/cpl_cli.run.html
@@ -18,7 +18,9 @@
-
+
+
+
@@ -36,13 +38,29 @@
-
+
diff --git a/docs/build/html/cli.start.html b/docs/build/html/cpl_cli.start.html
similarity index 72%
rename from docs/build/html/cli.start.html
rename to docs/build/html/cpl_cli.start.html
index 3ace5c51..61789670 100644
--- a/docs/build/html/cli.start.html
+++ b/docs/build/html/cpl_cli.start.html
@@ -19,8 +19,8 @@
-
-
+
+
@@ -43,23 +43,24 @@
Getting started
Contributing to CPL
CLI reference
-- CLI Overview and Command Reference
-- cpl add
-- cpl build
-- cpl generate
-- cpl help
-- cpl install
-- cpl new
-- cpl publish
-- cpl remove
+- CLI Overview and Command Reference
+- cpl add
+- cpl build
+- cpl generate
+- cpl help
+- cpl install
+- cpl new
+- cpl publish
+- cpl remove
+- cpl run
- cpl start
-- cpl uninstall
-- cpl update
-- cpl version
+- cpl uninstall
+- cpl update
+- cpl version
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
@@ -81,7 +82,7 @@
CLI reference »
cpl start
- View page source
+ View page source
@@ -115,8 +116,8 @@ cpl S
diff --git a/docs/build/html/cli.uninstall.html b/docs/build/html/cpl_cli.uninstall.html
similarity index 78%
rename from docs/build/html/cli.uninstall.html
rename to docs/build/html/cpl_cli.uninstall.html
index 8bcb760f..6e1656f3 100644
--- a/docs/build/html/cli.uninstall.html
+++ b/docs/build/html/cpl_cli.uninstall.html
@@ -19,8 +19,8 @@
-
-
+
+
@@ -43,16 +43,17 @@
Getting started
Contributing to CPL
CLI reference
-- CLI Overview and Command Reference
-- cpl add
-- cpl build
-- cpl generate
-- cpl help
-- cpl install
-- cpl new
-- cpl publish
-- cpl remove
-- cpl start
+- CLI Overview and Command Reference
+- cpl add
+- cpl build
+- cpl generate
+- cpl help
+- cpl install
+- cpl new
+- cpl publish
+- cpl remove
+- cpl run
+- cpl start
- cpl uninstall
- Contents
- Description
@@ -60,12 +61,12 @@
- Flags
-- cpl update
-- cpl version
+- cpl update
+- cpl version
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
@@ -87,7 +88,7 @@
CLI reference »
cpl uninstall
- View page source
+ View page source
@@ -156,8 +157,8 @@ cpl UI <package>
diff --git a/docs/build/html/cli.update.html b/docs/build/html/cpl_cli.update.html
similarity index 72%
rename from docs/build/html/cli.update.html
rename to docs/build/html/cpl_cli.update.html
index 0cf1d016..20064016 100644
--- a/docs/build/html/cli.update.html
+++ b/docs/build/html/cpl_cli.update.html
@@ -19,8 +19,8 @@
-
-
+
+
@@ -43,26 +43,27 @@
Getting started
Contributing to CPL
CLI reference
-- CLI Overview and Command Reference
-- cpl add
-- cpl build
-- cpl generate
-- cpl help
-- cpl install
-- cpl new
-- cpl publish
-- cpl remove
-- cpl start
-- cpl uninstall
+- CLI Overview and Command Reference
+- cpl add
+- cpl build
+- cpl generate
+- cpl help
+- cpl install
+- cpl new
+- cpl publish
+- cpl remove
+- cpl run
+- cpl start
+- cpl uninstall
- cpl update
-- cpl version
+- cpl version
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
@@ -84,7 +85,7 @@
CLI reference »
cpl update
- View page source
+ View page source
@@ -119,8 +120,8 @@ cpl U
diff --git a/docs/build/html/cli.version.html b/docs/build/html/cpl_cli.version.html
similarity index 73%
rename from docs/build/html/cli.version.html
rename to docs/build/html/cpl_cli.version.html
index a1bc3ab4..bd4f64d0 100644
--- a/docs/build/html/cli.version.html
+++ b/docs/build/html/cpl_cli.version.html
@@ -20,7 +20,7 @@
-
+
@@ -43,23 +43,24 @@
Getting started
Contributing to CPL
CLI reference
-- CLI Overview and Command Reference
-- cpl add
-- cpl build
-- cpl generate
-- cpl help
-- cpl install
-- cpl new
-- cpl publish
-- cpl remove
-- cpl start
-- cpl uninstall
-- cpl update
+- CLI Overview and Command Reference
+- cpl add
+- cpl build
+- cpl generate
+- cpl help
+- cpl install
+- cpl new
+- cpl publish
+- cpl remove
+- cpl run
+- cpl start
+- cpl uninstall
+- cpl update
- cpl version
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
@@ -81,7 +82,7 @@
CLI reference »
cpl version
- View page source
+ View page source
@@ -101,7 +102,7 @@ cpl V
cpl_core.application — Common Python Library documentation
+ cpl_core.application package — Common Python Library documentation
diff --git a/docs/build/html/tutorials.appsettings.html b/docs/build/html/tutorials.appsettings.html
index b3743d8d..d2fd0703 100644
--- a/docs/build/html/tutorials.appsettings.html
+++ b/docs/build/html/tutorials.appsettings.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.console-arguments.html b/docs/build/html/tutorials.console-arguments.html
index 515c1c3a..f166ba32 100644
--- a/docs/build/html/tutorials.console-arguments.html
+++ b/docs/build/html/tutorials.console-arguments.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.console.html b/docs/build/html/tutorials.console.html
index d72ba844..4307d292 100644
--- a/docs/build/html/tutorials.console.html
+++ b/docs/build/html/tutorials.console.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.create-startup.html b/docs/build/html/tutorials.create-startup.html
index e5ccb0af..f62dbca9 100644
--- a/docs/build/html/tutorials.create-startup.html
+++ b/docs/build/html/tutorials.create-startup.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.extend-application.html b/docs/build/html/tutorials.extend-application.html
index 6c905a44..8d31718b 100644
--- a/docs/build/html/tutorials.extend-application.html
+++ b/docs/build/html/tutorials.extend-application.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.extend-startup.html b/docs/build/html/tutorials.extend-startup.html
index 4fe21474..ab2aec47 100644
--- a/docs/build/html/tutorials.extend-startup.html
+++ b/docs/build/html/tutorials.extend-startup.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.html b/docs/build/html/tutorials.html
index 0f8ed43f..9647379b 100644
--- a/docs/build/html/tutorials.html
+++ b/docs/build/html/tutorials.html
@@ -60,7 +60,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.logging.html b/docs/build/html/tutorials.logging.html
index 1a61b350..4cd75f5c 100644
--- a/docs/build/html/tutorials.logging.html
+++ b/docs/build/html/tutorials.logging.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.mail.html b/docs/build/html/tutorials.mail.html
index d61de75d..cefccd0a 100644
--- a/docs/build/html/tutorials.mail.html
+++ b/docs/build/html/tutorials.mail.html
@@ -63,7 +63,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/build/html/tutorials.templating.html b/docs/build/html/tutorials.templating.html
index 0efc7173..54f974ee 100644
--- a/docs/build/html/tutorials.templating.html
+++ b/docs/build/html/tutorials.templating.html
@@ -66,7 +66,7 @@
Contributing to CPL
CLI reference
API reference
-Discord reference
+cpl_discord package
Query reference
Translation reference
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 00747705..464c691e 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -16,13 +16,13 @@
import os
import sys
-sys.path.insert(0, os.path.abspath('../../src/'))
+sys.path.insert(0, os.path.abspath("../../src/"))
# -- Project information -----------------------------------------------------
-project = 'Common Python Library'
-copyright = '2021 - 2023, Sven Heidemann'
-author = 'Sven Heidemann'
+project = "Common Python Library"
+copyright = "2021 - 2023, Sven Heidemann"
+author = "Sven Heidemann"
# -- General configuration ---------------------------------------------------
@@ -30,39 +30,33 @@ author = 'Sven Heidemann'
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx_rtd_theme',
- 'myst_parser'
+ "sphinx.ext.autodoc",
+ "sphinx_rtd_theme",
+ "myst_parser",
]
source_suffix = {
- '.rst': 'restructuredtext',
- '.txt': 'markdown',
- '.md': 'markdown',
+ ".md": "markdown",
+ ".txt": "markdown",
+ ".rst": "restructuredtext",
}
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
-exclude_patterns = [
- 'cpl_cli/templates/*',
- 'cpl_cli/*',
- 'tests',
- 'cpl_query/tests/*',
- 'tests/*'
-]
+exclude_patterns = ["cpl_cli/templates/*", "cpl_cli/*", "tests", "cpl_query/tests/*", "tests/*"]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
-html_theme = 'sphinx_rtd_theme'
+html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+html_static_path = ["_static"]
diff --git a/docs/source/cli.add.md b/docs/source/cpl_cli.add.md
similarity index 99%
rename from docs/source/cli.add.md
rename to docs/source/cpl_cli.add.md
index 46b3c5b0..119359fa 100644
--- a/docs/source/cli.add.md
+++ b/docs/source/cpl_cli.add.md
@@ -29,4 +29,4 @@ If you call the command in a CPL workspace, you can use the project names. Other
| Argument | Description |
|------------------|:------------------------------------------:|
-| ```--simulate``` | Specifies whether the command is simulated |
+| ```--simulate``` | Specifies whether the command is simulated |
\ No newline at end of file
diff --git a/docs/source/cli.build.md b/docs/source/cpl_cli.build.md
similarity index 100%
rename from docs/source/cli.build.md
rename to docs/source/cpl_cli.build.md
diff --git a/docs/source/cli.generate.md b/docs/source/cpl_cli.generate.md
similarity index 100%
rename from docs/source/cli.generate.md
rename to docs/source/cpl_cli.generate.md
diff --git a/docs/source/cli.help.md b/docs/source/cpl_cli.help.md
similarity index 100%
rename from docs/source/cli.help.md
rename to docs/source/cpl_cli.help.md
diff --git a/docs/source/cli.install.md b/docs/source/cpl_cli.install.md
similarity index 100%
rename from docs/source/cli.install.md
rename to docs/source/cpl_cli.install.md
diff --git a/docs/source/cli.new.md b/docs/source/cpl_cli.new.md
similarity index 100%
rename from docs/source/cli.new.md
rename to docs/source/cpl_cli.new.md
diff --git a/docs/source/cli.overview.md b/docs/source/cpl_cli.overview.md
similarity index 51%
rename from docs/source/cli.overview.md
rename to docs/source/cpl_cli.overview.md
index 5cd12eca..1116b4ba 100644
--- a/docs/source/cli.overview.md
+++ b/docs/source/cpl_cli.overview.md
@@ -39,15 +39,15 @@ The cpl generate command takes as an argument the artifact to be generated. In
| Command | Alias | Description |
| ----------------------------- |:-------------:|:----------------:|
-| [add](cli.add) | a or a | Adds a project reference to given project.
-| [build](cli.build) | b or B | Prepares files for publish into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
-| [generate](cli.generate) | g or G | Generate a new file.
-| [help](cli.help) | h or H | Lists available command and their short descriptions.
-| [install](cli.install) | i or I | With argument installs packages to project, without argument installs project dependencies.
-| [new](cli.new) | n or N | Creates new CPL project.
-| [publish](cli.publish) | p or P | Prepares files for publish into an output directory named dist/ at the given output path and executes ```setup.py```. Must be executed from within a library workspace directory.
-| [remove](cli.remove) | r or R | Removes a project from workspace.
-| [start](cli.start) | s or S | Starts CPL project, restarting on file changes.
-| [uninstall](cli.uninstall) | ui or UI | Uninstalls packages from project.
-| [update](cli.update) | u or U | Update CPL and project dependencies.
-| [version](cli.version) | v or V | Outputs CPL CLI version.
+| [add](cpl_cli.add) | a or a | Adds a project reference to given project.
+| [build](cpl_cli.build) | b or B | Prepares files for publish into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
+| [generate](cpl_cli.generate) | g or G | Generate a new file.
+| [help](cpl_cli.help) | h or H | Lists available command and their short descriptions.
+| [install](cpl_cli.install) | i or I | With argument installs packages to project, without argument installs project dependencies.
+| [new](cpl_cli.new) | n or N | Creates new CPL project.
+| [publish](cpl_cli.publish) | p or P | Prepares files for publish into an output directory named dist/ at the given output path and executes ```setup.py```. Must be executed from within a library workspace directory.
+| [remove](cpl_cli.remove) | r or R | Removes a project from workspace.
+| [start](cpl_cli.start) | s or S | Starts CPL project, restarting on file changes.
+| [uninstall](cpl_cli.uninstall) | ui or UI | Uninstalls packages from project.
+| [update](cpl_cli.update) | u or U | Update CPL and project dependencies.
+| [version](cpl_cli.version) | v or V | Outputs CPL CLI version.
diff --git a/docs/source/cli.publish.md b/docs/source/cpl_cli.publish.md
similarity index 100%
rename from docs/source/cli.publish.md
rename to docs/source/cpl_cli.publish.md
diff --git a/docs/source/cli.remove.md b/docs/source/cpl_cli.remove.md
similarity index 100%
rename from docs/source/cli.remove.md
rename to docs/source/cpl_cli.remove.md
diff --git a/docs/source/cpl_cli.rst b/docs/source/cpl_cli.rst
index cec12291..e0ca1832 100644
--- a/docs/source/cpl_cli.rst
+++ b/docs/source/cpl_cli.rst
@@ -4,16 +4,17 @@ CLI reference
.. toctree::
:maxdepth: 4
- cli.overview
- cli.add
- cli.build
- cli.generate
- cli.help
- cli.install
- cli.new
- cli.publish
- cli.remove
- cli.start
- cli.uninstall
- cli.update
- cli.version
\ No newline at end of file
+ cpl_cli.overview
+ cpl_cli.add
+ cpl_cli.build
+ cpl_cli.generate
+ cpl_cli.help
+ cpl_cli.install
+ cpl_cli.new
+ cpl_cli.publish
+ cpl_cli.remove
+ cpl_cli.run
+ cpl_cli.start
+ cpl_cli.uninstall
+ cpl_cli.update
+ cpl_cli.version
\ No newline at end of file
diff --git a/docs/source/cli.run.md b/docs/source/cpl_cli.run.md
similarity index 100%
rename from docs/source/cli.run.md
rename to docs/source/cpl_cli.run.md
diff --git a/docs/source/cli.start.md b/docs/source/cpl_cli.start.md
similarity index 100%
rename from docs/source/cli.start.md
rename to docs/source/cpl_cli.start.md
diff --git a/docs/source/cli.uninstall.md b/docs/source/cpl_cli.uninstall.md
similarity index 100%
rename from docs/source/cli.uninstall.md
rename to docs/source/cpl_cli.uninstall.md
diff --git a/docs/source/cli.update.md b/docs/source/cpl_cli.update.md
similarity index 100%
rename from docs/source/cli.update.md
rename to docs/source/cpl_cli.update.md
diff --git a/docs/source/cli.version.md b/docs/source/cpl_cli.version.md
similarity index 100%
rename from docs/source/cli.version.md
rename to docs/source/cpl_cli.version.md
diff --git a/docs/source/cpl_core.application.rst b/docs/source/cpl_core.application.rst
index 140534a8..bcdcbc20 100644
--- a/docs/source/cpl_core.application.rst
+++ b/docs/source/cpl_core.application.rst
@@ -1,34 +1,61 @@
-cpl_core.application
-=======================
+cpl\_core.application package
+=============================
-cpl_core.application.application\_abc
----------------------------------------
+Submodules
+----------
+
+cpl\_core.application.application\_abc module
+---------------------------------------------
.. automodule:: cpl_core.application.application_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.application.application\_builder
--------------------------------------------
+cpl\_core.application.application\_builder module
+-------------------------------------------------
.. automodule:: cpl_core.application.application_builder
:members:
:undoc-members:
:show-inheritance:
-cpl_core.application.application\_builder\_abc
-------------------------------------------------
+cpl\_core.application.application\_builder\_abc module
+------------------------------------------------------
.. automodule:: cpl_core.application.application_builder_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.application.startup\_abc
------------------------------------
+cpl\_core.application.application\_extension\_abc module
+--------------------------------------------------------
+
+.. automodule:: cpl_core.application.application_extension_abc
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.application.startup\_abc module
+-----------------------------------------
.. automodule:: cpl_core.application.startup_abc
:members:
:undoc-members:
:show-inheritance:
+
+cpl\_core.application.startup\_extension\_abc module
+----------------------------------------------------
+
+.. automodule:: cpl_core.application.startup_extension_abc
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.application
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.configuration.rst b/docs/source/cpl_core.configuration.rst
index 6b2c210e..708c4ea6 100644
--- a/docs/source/cpl_core.configuration.rst
+++ b/docs/source/cpl_core.configuration.rst
@@ -1,42 +1,109 @@
-cpl_core.configuration
-=========================
+cpl\_core.configuration package
+===============================
-cpl_core.configuration.configuration
---------------------------------------
+Submodules
+----------
+
+cpl\_core.configuration.argument\_abc module
+--------------------------------------------
+
+.. automodule:: cpl_core.configuration.argument_abc
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.configuration.argument\_builder module
+------------------------------------------------
+
+.. automodule:: cpl_core.configuration.argument_builder
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.configuration.argument\_executable\_abc module
+--------------------------------------------------------
+
+.. automodule:: cpl_core.configuration.argument_executable_abc
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.configuration.argument\_type\_enum module
+---------------------------------------------------
+
+.. automodule:: cpl_core.configuration.argument_type_enum
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.configuration.configuration module
+--------------------------------------------
.. automodule:: cpl_core.configuration.configuration
:members:
:undoc-members:
:show-inheritance:
-cpl_core.configuration.configuration\_abc
--------------------------------------------
+cpl\_core.configuration.configuration\_abc module
+-------------------------------------------------
.. automodule:: cpl_core.configuration.configuration_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.configuration.configuration\_model\_abc
---------------------------------------------------
+cpl\_core.configuration.configuration\_model\_abc module
+--------------------------------------------------------
.. automodule:: cpl_core.configuration.configuration_model_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.configuration.configuration\_variable\_name\_enum
-------------------------------------------------------------
+cpl\_core.configuration.configuration\_variable\_name\_enum module
+------------------------------------------------------------------
.. automodule:: cpl_core.configuration.configuration_variable_name_enum
:members:
:undoc-members:
:show-inheritance:
-cpl_core.configuration.console\_argument
-------------------------------------------
+cpl\_core.configuration.executable\_argument module
+---------------------------------------------------
-.. automodule:: cpl_core.configuration.console_argument
+.. automodule:: cpl_core.configuration.executable_argument
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.configuration.flag\_argument module
+---------------------------------------------
+
+.. automodule:: cpl_core.configuration.flag_argument
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.configuration.validator\_abc module
+---------------------------------------------
+
+.. automodule:: cpl_core.configuration.validator_abc
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.configuration.variable\_argument module
+-------------------------------------------------
+
+.. automodule:: cpl_core.configuration.variable_argument
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.configuration
:members:
:undoc-members:
:show-inheritance:
diff --git a/docs/source/cpl_core.console.rst b/docs/source/cpl_core.console.rst
index 21ce79e3..b14cc8c8 100644
--- a/docs/source/cpl_core.console.rst
+++ b/docs/source/cpl_core.console.rst
@@ -1,42 +1,53 @@
-cpl_core.console
-===================
+cpl\_core.console package
+=========================
-cpl_core.console.background\_color\_enum
-------------------------------------------
+Submodules
+----------
+
+cpl\_core.console.background\_color\_enum module
+------------------------------------------------
.. automodule:: cpl_core.console.background_color_enum
:members:
:undoc-members:
:show-inheritance:
-cpl_core.console.console
---------------------------
+cpl\_core.console.console module
+--------------------------------
.. automodule:: cpl_core.console.console
:members:
:undoc-members:
:show-inheritance:
-cpl_core.console.console\_call
---------------------------------
+cpl\_core.console.console\_call module
+--------------------------------------
.. automodule:: cpl_core.console.console_call
:members:
:undoc-members:
:show-inheritance:
-cpl_core.console.foreground\_color\_enum
-------------------------------------------
+cpl\_core.console.foreground\_color\_enum module
+------------------------------------------------
.. automodule:: cpl_core.console.foreground_color_enum
:members:
:undoc-members:
:show-inheritance:
-cpl_core.console.spinner\_thread
-----------------------------------
+cpl\_core.console.spinner\_thread module
+----------------------------------------
.. automodule:: cpl_core.console.spinner_thread
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.console
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.database.connection.rst b/docs/source/cpl_core.database.connection.rst
index e7324f18..86ec3966 100644
--- a/docs/source/cpl_core.database.connection.rst
+++ b/docs/source/cpl_core.database.connection.rst
@@ -1,18 +1,29 @@
-cpl_core.database.connection
-===============================
+cpl\_core.database.connection package
+=====================================
-cpl_core.database.connection.database\_connection
----------------------------------------------------
+Submodules
+----------
+
+cpl\_core.database.connection.database\_connection module
+---------------------------------------------------------
.. automodule:: cpl_core.database.connection.database_connection
:members:
:undoc-members:
:show-inheritance:
-cpl_core.database.connection.database\_connection\_abc
---------------------------------------------------------
+cpl\_core.database.connection.database\_connection\_abc module
+--------------------------------------------------------------
.. automodule:: cpl_core.database.connection.database_connection_abc
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.database.connection
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.database.context.rst b/docs/source/cpl_core.database.context.rst
index ec368871..a17353d7 100644
--- a/docs/source/cpl_core.database.context.rst
+++ b/docs/source/cpl_core.database.context.rst
@@ -1,18 +1,29 @@
-cpl_core.database.context
-============================
+cpl\_core.database.context package
+==================================
-cpl_core.database.context.database\_context
----------------------------------------------
+Submodules
+----------
+
+cpl\_core.database.context.database\_context module
+---------------------------------------------------
.. automodule:: cpl_core.database.context.database_context
:members:
:undoc-members:
:show-inheritance:
-cpl_core.database.context.database\_context\_abc
---------------------------------------------------
+cpl\_core.database.context.database\_context\_abc module
+--------------------------------------------------------
.. automodule:: cpl_core.database.context.database_context_abc
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.database.context
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.database.rst b/docs/source/cpl_core.database.rst
index cdcb0ce8..c5fbcffb 100644
--- a/docs/source/cpl_core.database.rst
+++ b/docs/source/cpl_core.database.rst
@@ -1,5 +1,8 @@
-cpl_core.database
-====================
+cpl\_core.database package
+==========================
+
+Subpackages
+-----------
.. toctree::
:maxdepth: 4
@@ -7,28 +10,37 @@ cpl_core.database
cpl_core.database.connection
cpl_core.database.context
+Submodules
+----------
-
-cpl_core.database.database\_model
------------------------------------
-
-.. automodule:: cpl_core.database.database_model
- :members:
- :undoc-members:
- :show-inheritance:
-
-cpl_core.database.database\_settings
---------------------------------------
+cpl\_core.database.database\_settings module
+--------------------------------------------
.. automodule:: cpl_core.database.database_settings
:members:
:undoc-members:
:show-inheritance:
-cpl_core.database.database\_settings\_name\_enum
---------------------------------------------------
+cpl\_core.database.database\_settings\_name\_enum module
+--------------------------------------------------------
.. automodule:: cpl_core.database.database_settings_name_enum
:members:
:undoc-members:
:show-inheritance:
+
+cpl\_core.database.table\_abc module
+------------------------------------
+
+.. automodule:: cpl_core.database.table_abc
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.database
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.dependency_injection.rst b/docs/source/cpl_core.dependency_injection.rst
index 4f27f5fc..4e951d6e 100644
--- a/docs/source/cpl_core.dependency_injection.rst
+++ b/docs/source/cpl_core.dependency_injection.rst
@@ -1,50 +1,85 @@
-cpl_core.dependency\_injection
-=================================
+cpl\_core.dependency\_injection package
+=======================================
-cpl_core.dependency\_injection.service\_collection
-----------------------------------------------------
+Submodules
+----------
+
+cpl\_core.dependency\_injection.scope module
+--------------------------------------------
+
+.. automodule:: cpl_core.dependency_injection.scope
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.dependency\_injection.scope\_abc module
+-------------------------------------------------
+
+.. automodule:: cpl_core.dependency_injection.scope_abc
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.dependency\_injection.scope\_builder module
+-----------------------------------------------------
+
+.. automodule:: cpl_core.dependency_injection.scope_builder
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+cpl\_core.dependency\_injection.service\_collection module
+----------------------------------------------------------
.. automodule:: cpl_core.dependency_injection.service_collection
:members:
:undoc-members:
:show-inheritance:
-cpl_core.dependency\_injection.service\_collection\_abc
----------------------------------------------------------
+cpl\_core.dependency\_injection.service\_collection\_abc module
+---------------------------------------------------------------
.. automodule:: cpl_core.dependency_injection.service_collection_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.dependency\_injection.service\_descriptor
-----------------------------------------------------
+cpl\_core.dependency\_injection.service\_descriptor module
+----------------------------------------------------------
.. automodule:: cpl_core.dependency_injection.service_descriptor
:members:
:undoc-members:
:show-inheritance:
-cpl_core.dependency\_injection.service\_lifetime\_enum
---------------------------------------------------------
+cpl\_core.dependency\_injection.service\_lifetime\_enum module
+--------------------------------------------------------------
.. automodule:: cpl_core.dependency_injection.service_lifetime_enum
:members:
:undoc-members:
:show-inheritance:
-cpl_core.dependency\_injection.service\_provider
---------------------------------------------------
+cpl\_core.dependency\_injection.service\_provider module
+--------------------------------------------------------
.. automodule:: cpl_core.dependency_injection.service_provider
:members:
:undoc-members:
:show-inheritance:
-cpl_core.dependency\_injection.service\_provider\_abc
--------------------------------------------------------
+cpl\_core.dependency\_injection.service\_provider\_abc module
+-------------------------------------------------------------
.. automodule:: cpl_core.dependency_injection.service_provider_abc
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.dependency_injection
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.environment.rst b/docs/source/cpl_core.environment.rst
index 04c1b930..84eaedde 100644
--- a/docs/source/cpl_core.environment.rst
+++ b/docs/source/cpl_core.environment.rst
@@ -1,26 +1,37 @@
-cpl_core.environment
-=======================
+cpl\_core.environment package
+=============================
-cpl_core.environment.application\_environment
------------------------------------------------
+Submodules
+----------
+
+cpl\_core.environment.application\_environment module
+-----------------------------------------------------
.. automodule:: cpl_core.environment.application_environment
:members:
:undoc-members:
:show-inheritance:
-cpl_core.environment.application\_environment\_abc
-----------------------------------------------------
+cpl\_core.environment.application\_environment\_abc module
+----------------------------------------------------------
.. automodule:: cpl_core.environment.application_environment_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.environment.environment\_name\_enum
-----------------------------------------------
+cpl\_core.environment.environment\_name\_enum module
+----------------------------------------------------
.. automodule:: cpl_core.environment.environment_name_enum
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.environment
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.logging.rst b/docs/source/cpl_core.logging.rst
index f34f815d..6f36754d 100644
--- a/docs/source/cpl_core.logging.rst
+++ b/docs/source/cpl_core.logging.rst
@@ -1,42 +1,53 @@
-cpl_core.logging
-===================
+cpl\_core.logging package
+=========================
-cpl_core.logging.logger\_abc
-------------------------------
+Submodules
+----------
+
+cpl\_core.logging.logger\_abc module
+------------------------------------
.. automodule:: cpl_core.logging.logger_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.logging.logger\_service
-----------------------------------
+cpl\_core.logging.logger\_service module
+----------------------------------------
.. automodule:: cpl_core.logging.logger_service
:members:
:undoc-members:
:show-inheritance:
-cpl_core.logging.logging\_level\_enum
----------------------------------------
+cpl\_core.logging.logging\_level\_enum module
+---------------------------------------------
.. automodule:: cpl_core.logging.logging_level_enum
:members:
:undoc-members:
:show-inheritance:
-cpl_core.logging.logging\_settings
-------------------------------------
+cpl\_core.logging.logging\_settings module
+------------------------------------------
.. automodule:: cpl_core.logging.logging_settings
:members:
:undoc-members:
:show-inheritance:
-cpl_core.logging.logging\_settings\_name\_enum
-------------------------------------------------
+cpl\_core.logging.logging\_settings\_name\_enum module
+------------------------------------------------------
.. automodule:: cpl_core.logging.logging_settings_name_enum
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.logging
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.mailing.rst b/docs/source/cpl_core.mailing.rst
index 8074d736..323e167c 100644
--- a/docs/source/cpl_core.mailing.rst
+++ b/docs/source/cpl_core.mailing.rst
@@ -1,42 +1,53 @@
-cpl_core.mailing
-===================
+cpl\_core.mailing package
+=========================
-cpl_core.mailing.email
-------------------------
+Submodules
+----------
+
+cpl\_core.mailing.email module
+------------------------------
.. automodule:: cpl_core.mailing.email
:members:
:undoc-members:
:show-inheritance:
-cpl_core.mailing.email\_client\_abc
--------------------------------------
+cpl\_core.mailing.email\_client\_abc module
+-------------------------------------------
.. automodule:: cpl_core.mailing.email_client_abc
:members:
:undoc-members:
:show-inheritance:
-cpl_core.mailing.email\_client\_service
------------------------------------------
+cpl\_core.mailing.email\_client\_service module
+-----------------------------------------------
.. automodule:: cpl_core.mailing.email_client_service
:members:
:undoc-members:
:show-inheritance:
-cpl_core.mailing.email\_client\_settings
-------------------------------------------
+cpl\_core.mailing.email\_client\_settings module
+------------------------------------------------
.. automodule:: cpl_core.mailing.email_client_settings
:members:
:undoc-members:
:show-inheritance:
-cpl_core.mailing.email\_client\_settings\_name\_enum
-------------------------------------------------------
+cpl\_core.mailing.email\_client\_settings\_name\_enum module
+------------------------------------------------------------
.. automodule:: cpl_core.mailing.email_client_settings_name_enum
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.mailing
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.pipes.rst b/docs/source/cpl_core.pipes.rst
index 0a8bba4d..cc061b15 100644
--- a/docs/source/cpl_core.pipes.rst
+++ b/docs/source/cpl_core.pipes.rst
@@ -1,9 +1,10 @@
-cpl\_core.pipes
+cpl\_core.pipes package
=======================
+Submodules
+----------
-
-cpl\_core.pipes.bool\_pipe
+cpl\_core.pipes.bool\_pipe module
---------------------------------
.. automodule:: cpl_core.pipes.bool_pipe
@@ -11,7 +12,7 @@ cpl\_core.pipes.bool\_pipe
:undoc-members:
:show-inheritance:
-cpl\_core.pipes.first\_char\_to\_lower\_pipe
+cpl\_core.pipes.first\_char\_to\_lower\_pipe module
---------------------------------------------------
.. automodule:: cpl_core.pipes.first_char_to_lower_pipe
@@ -19,7 +20,7 @@ cpl\_core.pipes.first\_char\_to\_lower\_pipe
:undoc-members:
:show-inheritance:
-cpl\_core.pipes.first\_to\_upper\_pipe
+cpl\_core.pipes.first\_to\_upper\_pipe module
---------------------------------------------
.. automodule:: cpl_core.pipes.first_to_upper_pipe
@@ -27,7 +28,7 @@ cpl\_core.pipes.first\_to\_upper\_pipe
:undoc-members:
:show-inheritance:
-cpl\_core.pipes.ip\_address\_pipe
+cpl\_core.pipes.ip\_address\_pipe module
----------------------------------------
.. automodule:: cpl_core.pipes.ip_address_pipe
@@ -35,7 +36,7 @@ cpl\_core.pipes.ip\_address\_pipe
:undoc-members:
:show-inheritance:
-cpl\_core.pipes.pipe\_abc
+cpl\_core.pipes.pipe\_abc module
--------------------------------
.. automodule:: cpl_core.pipes.pipe_abc
@@ -43,7 +44,7 @@ cpl\_core.pipes.pipe\_abc
:undoc-members:
:show-inheritance:
-cpl\_core.pipes.to\_camel\_case\_pipe
+cpl\_core.pipes.to\_camel\_case\_pipe module
--------------------------------------------
.. automodule:: cpl_core.pipes.to_camel_case_pipe
@@ -51,7 +52,7 @@ cpl\_core.pipes.to\_camel\_case\_pipe
:undoc-members:
:show-inheritance:
-cpl\_core.pipes.to\_snake\_case\_pipe
+cpl\_core.pipes.to\_snake\_case\_pipe module
--------------------------------------------
.. automodule:: cpl_core.pipes.to_snake_case_pipe
@@ -59,10 +60,18 @@ cpl\_core.pipes.to\_snake\_case\_pipe
:undoc-members:
:show-inheritance:
-cpl\_core.pipes.version\_pipe
+cpl\_core.pipes.version\_pipe module
------------------------------------
.. automodule:: cpl_core.pipes.version_pipe
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.pipes
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.rst b/docs/source/cpl_core.rst
index e1e9b11a..f238136a 100644
--- a/docs/source/cpl_core.rst
+++ b/docs/source/cpl_core.rst
@@ -1,5 +1,5 @@
API reference
-===========
+=============
.. toctree::
:maxdepth: 4
@@ -15,3 +15,4 @@ API reference
cpl_core.pipes
cpl_core.time
cpl_core.utils
+
diff --git a/docs/source/cpl_core.time.rst b/docs/source/cpl_core.time.rst
index 7bbec704..4ecce6ec 100644
--- a/docs/source/cpl_core.time.rst
+++ b/docs/source/cpl_core.time.rst
@@ -1,18 +1,29 @@
-cpl_core.time
-================
+cpl\_core.time package
+======================
-cpl_core.time.time\_format\_settings
---------------------------------------
+Submodules
+----------
+
+cpl\_core.time.time\_format\_settings module
+--------------------------------------------
.. automodule:: cpl_core.time.time_format_settings
:members:
:undoc-members:
:show-inheritance:
-cpl_core.time.time\_format\_settings\_names\_enum
----------------------------------------------------
+cpl\_core.time.time\_format\_settings\_names\_enum module
+---------------------------------------------------------
.. automodule:: cpl_core.time.time_format_settings_names_enum
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.time
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_core.utils.rst b/docs/source/cpl_core.utils.rst
index 846071cb..6318a1de 100644
--- a/docs/source/cpl_core.utils.rst
+++ b/docs/source/cpl_core.utils.rst
@@ -1,26 +1,37 @@
-cpl_core.utils
-=================
+cpl\_core.utils package
+=======================
-cpl_core.utils.credential\_manager
-------------------------------------
+Submodules
+----------
+
+cpl\_core.utils.credential\_manager module
+------------------------------------------
.. automodule:: cpl_core.utils.credential_manager
:members:
:undoc-members:
:show-inheritance:
-cpl_core.utils.pip
---------------------
+cpl\_core.utils.pip module
+--------------------------
.. automodule:: cpl_core.utils.pip
:members:
:undoc-members:
:show-inheritance:
-cpl_core.utils.string
------------------------
+cpl\_core.utils.string module
+-----------------------------
.. automodule:: cpl_core.utils.string
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_core.utils
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.application.rst b/docs/source/cpl_discord.application.rst
index ef077d22..3ce2c948 100644
--- a/docs/source/cpl_discord.application.rst
+++ b/docs/source/cpl_discord.application.rst
@@ -1,12 +1,21 @@
-cpl\_discord.application
+cpl\_discord.application package
================================
+Submodules
+----------
-
-cpl\_discord.application.discord\_bot\_application\_abc
+cpl\_discord.application.discord\_bot\_application\_abc module
--------------------------------------------------------------
.. automodule:: cpl_discord.application.discord_bot_application_abc
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord.application
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.command.rst b/docs/source/cpl_discord.command.rst
index 5f495733..ca0bb5a5 100644
--- a/docs/source/cpl_discord.command.rst
+++ b/docs/source/cpl_discord.command.rst
@@ -1,9 +1,10 @@
-cpl\_discord.command
+cpl\_discord.command package
============================
+Submodules
+----------
-
-cpl\_discord.command.discord\_command\_abc
+cpl\_discord.command.discord\_command\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.command.discord_command_abc
@@ -11,10 +12,18 @@ cpl\_discord.command.discord\_command\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.command.discord\_commands\_meta
+cpl\_discord.command.discord\_commands\_meta module
---------------------------------------------------
.. automodule:: cpl_discord.command.discord_commands_meta
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord.command
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.configuration.rst b/docs/source/cpl_discord.configuration.rst
index eb855d14..47cda9ed 100644
--- a/docs/source/cpl_discord.configuration.rst
+++ b/docs/source/cpl_discord.configuration.rst
@@ -1,12 +1,21 @@
-cpl\_discord.configuration
+cpl\_discord.configuration package
==================================
+Submodules
+----------
-
-cpl\_discord.configuration.discord\_bot\_settings
+cpl\_discord.configuration.discord\_bot\_settings module
--------------------------------------------------------
.. automodule:: cpl_discord.configuration.discord_bot_settings
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord.configuration
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.container.rst b/docs/source/cpl_discord.container.rst
index a47f50b1..44b70a52 100644
--- a/docs/source/cpl_discord.container.rst
+++ b/docs/source/cpl_discord.container.rst
@@ -1,9 +1,10 @@
-cpl\_discord.container
+cpl\_discord.container package
==============================
+Submodules
+----------
-
-cpl\_discord.container.category\_channel
+cpl\_discord.container.category\_channel module
-----------------------------------------------
.. automodule:: cpl_discord.container.category_channel
@@ -11,7 +12,7 @@ cpl\_discord.container.category\_channel
:undoc-members:
:show-inheritance:
-cpl\_discord.container.container
+cpl\_discord.container.container module
---------------------------------------
.. automodule:: cpl_discord.container.container
@@ -19,7 +20,7 @@ cpl\_discord.container.container
:undoc-members:
:show-inheritance:
-cpl\_discord.container.guild
+cpl\_discord.container.guild module
-----------------------------------
.. automodule:: cpl_discord.container.guild
@@ -27,7 +28,7 @@ cpl\_discord.container.guild
:undoc-members:
:show-inheritance:
-cpl\_discord.container.member
+cpl\_discord.container.member module
------------------------------------
.. automodule:: cpl_discord.container.member
@@ -35,7 +36,7 @@ cpl\_discord.container.member
:undoc-members:
:show-inheritance:
-cpl\_discord.container.role
+cpl\_discord.container.role module
----------------------------------
.. automodule:: cpl_discord.container.role
@@ -43,7 +44,7 @@ cpl\_discord.container.role
:undoc-members:
:show-inheritance:
-cpl\_discord.container.text\_channel
+cpl\_discord.container.text\_channel module
-------------------------------------------
.. automodule:: cpl_discord.container.text_channel
@@ -51,7 +52,7 @@ cpl\_discord.container.text\_channel
:undoc-members:
:show-inheritance:
-cpl\_discord.container.thread
+cpl\_discord.container.thread module
------------------------------------
.. automodule:: cpl_discord.container.thread
@@ -59,10 +60,18 @@ cpl\_discord.container.thread
:undoc-members:
:show-inheritance:
-cpl\_discord.container.voice\_channel
+cpl\_discord.container.voice\_channel module
--------------------------------------------
.. automodule:: cpl_discord.container.voice_channel
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord.container
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.events.rst b/docs/source/cpl_discord.events.rst
index d26aa744..290111c1 100644
--- a/docs/source/cpl_discord.events.rst
+++ b/docs/source/cpl_discord.events.rst
@@ -1,9 +1,10 @@
-cpl\_discord.events
+cpl\_discord.events package
===========================
+Submodules
+----------
-
-cpl\_discord.events.on\_bulk\_message\_delete\_abc
+cpl\_discord.events.on\_bulk\_message\_delete\_abc module
---------------------------------------------------------
.. automodule:: cpl_discord.events.on_bulk_message_delete_abc
@@ -11,7 +12,7 @@ cpl\_discord.events.on\_bulk\_message\_delete\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_command\_abc
+cpl\_discord.events.on\_command\_abc module
-------------------------------------------
.. automodule:: cpl_discord.events.on_command_abc
@@ -19,7 +20,7 @@ cpl\_discord.events.on\_command\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_command\_completion\_abc
+cpl\_discord.events.on\_command\_completion\_abc module
-------------------------------------------------------
.. automodule:: cpl_discord.events.on_command_completion_abc
@@ -27,7 +28,7 @@ cpl\_discord.events.on\_command\_completion\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_command\_error\_abc
+cpl\_discord.events.on\_command\_error\_abc module
--------------------------------------------------
.. automodule:: cpl_discord.events.on_command_error_abc
@@ -35,7 +36,7 @@ cpl\_discord.events.on\_command\_error\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_connect\_abc
+cpl\_discord.events.on\_connect\_abc module
-------------------------------------------
.. automodule:: cpl_discord.events.on_connect_abc
@@ -43,7 +44,7 @@ cpl\_discord.events.on\_connect\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_disconnect\_abc
+cpl\_discord.events.on\_disconnect\_abc module
----------------------------------------------
.. automodule:: cpl_discord.events.on_disconnect_abc
@@ -51,7 +52,7 @@ cpl\_discord.events.on\_disconnect\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_error\_abc
+cpl\_discord.events.on\_error\_abc module
-----------------------------------------
.. automodule:: cpl_discord.events.on_error_abc
@@ -59,7 +60,7 @@ cpl\_discord.events.on\_error\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_group\_join\_abc
+cpl\_discord.events.on\_group\_join\_abc module
-----------------------------------------------
.. automodule:: cpl_discord.events.on_group_join_abc
@@ -67,7 +68,7 @@ cpl\_discord.events.on\_group\_join\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_group\_remove\_abc
+cpl\_discord.events.on\_group\_remove\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.events.on_group_remove_abc
@@ -75,7 +76,7 @@ cpl\_discord.events.on\_group\_remove\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_available\_abc
+cpl\_discord.events.on\_guild\_available\_abc module
----------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_available_abc
@@ -83,7 +84,7 @@ cpl\_discord.events.on\_guild\_available\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_channel\_create\_abc
+cpl\_discord.events.on\_guild\_channel\_create\_abc module
----------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_channel_create_abc
@@ -91,7 +92,7 @@ cpl\_discord.events.on\_guild\_channel\_create\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_channel\_delete\_abc
+cpl\_discord.events.on\_guild\_channel\_delete\_abc module
----------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_channel_delete_abc
@@ -99,7 +100,7 @@ cpl\_discord.events.on\_guild\_channel\_delete\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_channel\_pins\_update\_abc
+cpl\_discord.events.on\_guild\_channel\_pins\_update\_abc module
----------------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_channel_pins_update_abc
@@ -107,7 +108,7 @@ cpl\_discord.events.on\_guild\_channel\_pins\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_channel\_update\_abc
+cpl\_discord.events.on\_guild\_channel\_update\_abc module
----------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_channel_update_abc
@@ -115,7 +116,7 @@ cpl\_discord.events.on\_guild\_channel\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_emojis\_update\_abc
+cpl\_discord.events.on\_guild\_emojis\_update\_abc module
---------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_emojis_update_abc
@@ -123,7 +124,7 @@ cpl\_discord.events.on\_guild\_emojis\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_integrations\_update\_abc
+cpl\_discord.events.on\_guild\_integrations\_update\_abc module
---------------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_integrations_update_abc
@@ -131,7 +132,7 @@ cpl\_discord.events.on\_guild\_integrations\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_join\_abc
+cpl\_discord.events.on\_guild\_join\_abc module
-----------------------------------------------
.. automodule:: cpl_discord.events.on_guild_join_abc
@@ -139,7 +140,7 @@ cpl\_discord.events.on\_guild\_join\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_remove\_abc
+cpl\_discord.events.on\_guild\_remove\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_remove_abc
@@ -147,7 +148,7 @@ cpl\_discord.events.on\_guild\_remove\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_role\_create\_abc
+cpl\_discord.events.on\_guild\_role\_create\_abc module
-------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_role_create_abc
@@ -155,7 +156,7 @@ cpl\_discord.events.on\_guild\_role\_create\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_role\_delete\_abc
+cpl\_discord.events.on\_guild\_role\_delete\_abc module
-------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_role_delete_abc
@@ -163,7 +164,7 @@ cpl\_discord.events.on\_guild\_role\_delete\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_role\_update\_abc
+cpl\_discord.events.on\_guild\_role\_update\_abc module
-------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_role_update_abc
@@ -171,7 +172,7 @@ cpl\_discord.events.on\_guild\_role\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_unavailable\_abc
+cpl\_discord.events.on\_guild\_unavailable\_abc module
------------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_unavailable_abc
@@ -179,7 +180,7 @@ cpl\_discord.events.on\_guild\_unavailable\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_guild\_update\_abc
+cpl\_discord.events.on\_guild\_update\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.events.on_guild_update_abc
@@ -187,7 +188,7 @@ cpl\_discord.events.on\_guild\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_invite\_create\_abc
+cpl\_discord.events.on\_invite\_create\_abc module
--------------------------------------------------
.. automodule:: cpl_discord.events.on_invite_create_abc
@@ -195,7 +196,7 @@ cpl\_discord.events.on\_invite\_create\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_invite\_delete\_abc
+cpl\_discord.events.on\_invite\_delete\_abc module
--------------------------------------------------
.. automodule:: cpl_discord.events.on_invite_delete_abc
@@ -203,7 +204,7 @@ cpl\_discord.events.on\_invite\_delete\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_member\_ban\_abc
+cpl\_discord.events.on\_member\_ban\_abc module
-----------------------------------------------
.. automodule:: cpl_discord.events.on_member_ban_abc
@@ -211,7 +212,7 @@ cpl\_discord.events.on\_member\_ban\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_member\_join\_abc
+cpl\_discord.events.on\_member\_join\_abc module
------------------------------------------------
.. automodule:: cpl_discord.events.on_member_join_abc
@@ -219,7 +220,7 @@ cpl\_discord.events.on\_member\_join\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_member\_remove\_abc
+cpl\_discord.events.on\_member\_remove\_abc module
--------------------------------------------------
.. automodule:: cpl_discord.events.on_member_remove_abc
@@ -227,7 +228,7 @@ cpl\_discord.events.on\_member\_remove\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_member\_unban\_abc
+cpl\_discord.events.on\_member\_unban\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.events.on_member_unban_abc
@@ -235,7 +236,7 @@ cpl\_discord.events.on\_member\_unban\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_member\_update\_abc
+cpl\_discord.events.on\_member\_update\_abc module
--------------------------------------------------
.. automodule:: cpl_discord.events.on_member_update_abc
@@ -243,7 +244,7 @@ cpl\_discord.events.on\_member\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_message\_abc
+cpl\_discord.events.on\_message\_abc module
-------------------------------------------
.. automodule:: cpl_discord.events.on_message_abc
@@ -251,7 +252,7 @@ cpl\_discord.events.on\_message\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_message\_delete\_abc
+cpl\_discord.events.on\_message\_delete\_abc module
---------------------------------------------------
.. automodule:: cpl_discord.events.on_message_delete_abc
@@ -259,7 +260,7 @@ cpl\_discord.events.on\_message\_delete\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_message\_edit\_abc
+cpl\_discord.events.on\_message\_edit\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.events.on_message_edit_abc
@@ -267,7 +268,7 @@ cpl\_discord.events.on\_message\_edit\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_private\_channel\_create\_abc
+cpl\_discord.events.on\_private\_channel\_create\_abc module
------------------------------------------------------------
.. automodule:: cpl_discord.events.on_private_channel_create_abc
@@ -275,7 +276,7 @@ cpl\_discord.events.on\_private\_channel\_create\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_private\_channel\_delete\_abc
+cpl\_discord.events.on\_private\_channel\_delete\_abc module
------------------------------------------------------------
.. automodule:: cpl_discord.events.on_private_channel_delete_abc
@@ -283,7 +284,7 @@ cpl\_discord.events.on\_private\_channel\_delete\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_private\_channel\_pins\_update\_abc
+cpl\_discord.events.on\_private\_channel\_pins\_update\_abc module
------------------------------------------------------------------
.. automodule:: cpl_discord.events.on_private_channel_pins_update_abc
@@ -291,7 +292,7 @@ cpl\_discord.events.on\_private\_channel\_pins\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_private\_channel\_update\_abc
+cpl\_discord.events.on\_private\_channel\_update\_abc module
------------------------------------------------------------
.. automodule:: cpl_discord.events.on_private_channel_update_abc
@@ -299,7 +300,7 @@ cpl\_discord.events.on\_private\_channel\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_raw\_reaction\_add\_abc
+cpl\_discord.events.on\_raw\_reaction\_add\_abc module
------------------------------------------------------
.. automodule:: cpl_discord.events.on_raw_reaction_add_abc
@@ -307,7 +308,7 @@ cpl\_discord.events.on\_raw\_reaction\_add\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_raw\_reaction\_clear\_abc
+cpl\_discord.events.on\_raw\_reaction\_clear\_abc module
--------------------------------------------------------
.. automodule:: cpl_discord.events.on_raw_reaction_clear_abc
@@ -315,7 +316,7 @@ cpl\_discord.events.on\_raw\_reaction\_clear\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_raw\_reaction\_clear\_emoji\_abc
+cpl\_discord.events.on\_raw\_reaction\_clear\_emoji\_abc module
---------------------------------------------------------------
.. automodule:: cpl_discord.events.on_raw_reaction_clear_emoji_abc
@@ -323,7 +324,7 @@ cpl\_discord.events.on\_raw\_reaction\_clear\_emoji\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_raw\_reaction\_remove\_abc
+cpl\_discord.events.on\_raw\_reaction\_remove\_abc module
---------------------------------------------------------
.. automodule:: cpl_discord.events.on_raw_reaction_remove_abc
@@ -331,7 +332,7 @@ cpl\_discord.events.on\_raw\_reaction\_remove\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_reaction\_add\_abc
+cpl\_discord.events.on\_reaction\_add\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.events.on_reaction_add_abc
@@ -339,7 +340,7 @@ cpl\_discord.events.on\_reaction\_add\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_reaction\_clear\_abc
+cpl\_discord.events.on\_reaction\_clear\_abc module
---------------------------------------------------
.. automodule:: cpl_discord.events.on_reaction_clear_abc
@@ -347,7 +348,7 @@ cpl\_discord.events.on\_reaction\_clear\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_reaction\_clear\_emoji\_abc
+cpl\_discord.events.on\_reaction\_clear\_emoji\_abc module
----------------------------------------------------------
.. automodule:: cpl_discord.events.on_reaction_clear_emoji_abc
@@ -355,7 +356,7 @@ cpl\_discord.events.on\_reaction\_clear\_emoji\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_reaction\_remove\_abc
+cpl\_discord.events.on\_reaction\_remove\_abc module
----------------------------------------------------
.. automodule:: cpl_discord.events.on_reaction_remove_abc
@@ -363,7 +364,7 @@ cpl\_discord.events.on\_reaction\_remove\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_ready\_abc
+cpl\_discord.events.on\_ready\_abc module
-----------------------------------------
.. automodule:: cpl_discord.events.on_ready_abc
@@ -371,7 +372,7 @@ cpl\_discord.events.on\_ready\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_resume\_abc
+cpl\_discord.events.on\_resume\_abc module
------------------------------------------
.. automodule:: cpl_discord.events.on_resume_abc
@@ -379,7 +380,7 @@ cpl\_discord.events.on\_resume\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_typing\_abc
+cpl\_discord.events.on\_typing\_abc module
------------------------------------------
.. automodule:: cpl_discord.events.on_typing_abc
@@ -387,7 +388,7 @@ cpl\_discord.events.on\_typing\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_user\_update\_abc
+cpl\_discord.events.on\_user\_update\_abc module
------------------------------------------------
.. automodule:: cpl_discord.events.on_user_update_abc
@@ -395,7 +396,7 @@ cpl\_discord.events.on\_user\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_voice\_state\_update\_abc
+cpl\_discord.events.on\_voice\_state\_update\_abc module
--------------------------------------------------------
.. automodule:: cpl_discord.events.on_voice_state_update_abc
@@ -403,10 +404,18 @@ cpl\_discord.events.on\_voice\_state\_update\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.events.on\_webhooks\_update\_abc
+cpl\_discord.events.on\_webhooks\_update\_abc module
----------------------------------------------------
.. automodule:: cpl_discord.events.on_webhooks_update_abc
:members:
:undoc-members:
- :show-inheritance:
\ No newline at end of file
+ :show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord.events
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.helper.rst b/docs/source/cpl_discord.helper.rst
index 396b4c89..fab914ae 100644
--- a/docs/source/cpl_discord.helper.rst
+++ b/docs/source/cpl_discord.helper.rst
@@ -1,12 +1,21 @@
-cpl\_discord.helper
+cpl\_discord.helper package
===========================
+Submodules
+----------
-
-cpl\_discord.helper.to\_containers\_converter
+cpl\_discord.helper.to\_containers\_converter module
----------------------------------------------------
.. automodule:: cpl_discord.helper.to_containers_converter
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord.helper
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.rst b/docs/source/cpl_discord.rst
index 5d10fb20..d777438b 100644
--- a/docs/source/cpl_discord.rst
+++ b/docs/source/cpl_discord.rst
@@ -1,6 +1,9 @@
-Discord reference
+cpl\_discord package
====================
+Subpackages
+-----------
+
.. toctree::
:maxdepth: 4
@@ -11,3 +14,22 @@ Discord reference
cpl_discord.events
cpl_discord.helper
cpl_discord.service
+
+Submodules
+----------
+
+cpl\_discord.discord\_event\_types\_enum module
+-----------------------------------------------
+
+.. automodule:: cpl_discord.discord_event_types_enum
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_discord.service.rst b/docs/source/cpl_discord.service.rst
index a6898292..13527b5b 100644
--- a/docs/source/cpl_discord.service.rst
+++ b/docs/source/cpl_discord.service.rst
@@ -1,9 +1,10 @@
-cpl\_discord.service
+cpl\_discord.service package
============================
+Submodules
+----------
-
-cpl\_discord.service.command\_error\_handler\_service
+cpl\_discord.service.command\_error\_handler\_service module
------------------------------------------------------------
.. automodule:: cpl_discord.service.command_error_handler_service
@@ -11,7 +12,7 @@ cpl\_discord.service.command\_error\_handler\_service
:undoc-members:
:show-inheritance:
-cpl\_discord.service.discord\_bot\_service
+cpl\_discord.service.discord\_bot\_service module
-------------------------------------------------
.. automodule:: cpl_discord.service.discord_bot_service
@@ -19,7 +20,7 @@ cpl\_discord.service.discord\_bot\_service
:undoc-members:
:show-inheritance:
-cpl\_discord.service.discord\_bot\_service\_abc
+cpl\_discord.service.discord\_bot\_service\_abc module
------------------------------------------------------
.. automodule:: cpl_discord.service.discord_bot_service_abc
@@ -27,7 +28,7 @@ cpl\_discord.service.discord\_bot\_service\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.service.discord\_collection
+cpl\_discord.service.discord\_collection module
-----------------------------------------------
.. automodule:: cpl_discord.service.discord_collection
@@ -35,7 +36,7 @@ cpl\_discord.service.discord\_collection
:undoc-members:
:show-inheritance:
-cpl\_discord.service.discord\_collection\_abc
+cpl\_discord.service.discord\_collection\_abc module
----------------------------------------------------
.. automodule:: cpl_discord.service.discord_collection_abc
@@ -43,7 +44,7 @@ cpl\_discord.service.discord\_collection\_abc
:undoc-members:
:show-inheritance:
-cpl\_discord.service.discord\_service
+cpl\_discord.service.discord\_service module
--------------------------------------------
.. automodule:: cpl_discord.service.discord_service
@@ -51,10 +52,18 @@ cpl\_discord.service.discord\_service
:undoc-members:
:show-inheritance:
-cpl\_discord.service.discord\_service\_abc
+cpl\_discord.service.discord\_service\_abc module
-------------------------------------------------
.. automodule:: cpl_discord.service.discord_service_abc
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_discord.service
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_query.base.rst b/docs/source/cpl_query.base.rst
index 156985e5..34fc9962 100644
--- a/docs/source/cpl_query.base.rst
+++ b/docs/source/cpl_query.base.rst
@@ -1,9 +1,10 @@
-cpl\_query.base
+cpl\_query.base package
=======================
+Submodules
+----------
-
-cpl\_query.base.default\_lambda
+cpl\_query.base.default\_lambda module
--------------------------------------
.. automodule:: cpl_query.base.default_lambda
@@ -11,7 +12,7 @@ cpl\_query.base.default\_lambda
:undoc-members:
:show-inheritance:
-cpl\_query.base.ordered\_queryable
+cpl\_query.base.ordered\_queryable module
-----------------------------------------
.. automodule:: cpl_query.base.ordered_queryable
@@ -19,7 +20,7 @@ cpl\_query.base.ordered\_queryable
:undoc-members:
:show-inheritance:
-cpl\_query.base.ordered\_queryable\_abc
+cpl\_query.base.ordered\_queryable\_abc module
----------------------------------------------
.. automodule:: cpl_query.base.ordered_queryable_abc
@@ -27,7 +28,7 @@ cpl\_query.base.ordered\_queryable\_abc
:undoc-members:
:show-inheritance:
-cpl\_query.base.queryable\_abc
+cpl\_query.base.queryable\_abc module
-------------------------------------
.. automodule:: cpl_query.base.queryable_abc
@@ -35,18 +36,18 @@ cpl\_query.base.queryable\_abc
:undoc-members:
:show-inheritance:
-cpl\_query.base.sequence\_abc
-------------------------------------
+cpl\_query.base.sequence module
+-------------------------------
-.. automodule:: cpl_query.base.sequence_abc
+.. automodule:: cpl_query.base.sequence
:members:
:undoc-members:
:show-inheritance:
-cpl\_query.base.sequence\_values
----------------------------------------
+Module contents
+---------------
-.. automodule:: cpl_query.base.sequence_values
+.. automodule:: cpl_query.base
:members:
:undoc-members:
:show-inheritance:
diff --git a/docs/source/cpl_query.enumerable.rst b/docs/source/cpl_query.enumerable.rst
index 37e58add..6c4d6a18 100644
--- a/docs/source/cpl_query.enumerable.rst
+++ b/docs/source/cpl_query.enumerable.rst
@@ -1,9 +1,10 @@
-cpl\_query.enumerable
+cpl\_query.enumerable package
=============================
+Submodules
+----------
-
-cpl\_query.enumerable.enumerable
+cpl\_query.enumerable.enumerable module
---------------------------------------
.. automodule:: cpl_query.enumerable.enumerable
@@ -11,10 +12,18 @@ cpl\_query.enumerable.enumerable
:undoc-members:
:show-inheritance:
-cpl\_query.enumerable.enumerable\_abc
+cpl\_query.enumerable.enumerable\_abc module
--------------------------------------------
.. automodule:: cpl_query.enumerable.enumerable_abc
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_query.enumerable
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_query.extension.rst b/docs/source/cpl_query.extension.rst
index a0bba3e0..4579c6e1 100644
--- a/docs/source/cpl_query.extension.rst
+++ b/docs/source/cpl_query.extension.rst
@@ -1,12 +1,21 @@
-cpl\_query.extension
+cpl\_query.extension package
============================
+Submodules
+----------
-
-cpl\_query.extension.list
+cpl\_query.extension.list module
--------------------------------
.. automodule:: cpl_query.extension.list
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_query.extension
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_query.iterable.rst b/docs/source/cpl_query.iterable.rst
index 8a7bc919..07ea0c19 100644
--- a/docs/source/cpl_query.iterable.rst
+++ b/docs/source/cpl_query.iterable.rst
@@ -1,9 +1,10 @@
-cpl\_query.iterable
+cpl\_query.iterable package
===========================
+Submodules
+----------
-
-cpl\_query.iterable.iterable
+cpl\_query.iterable.iterable module
-----------------------------------
.. automodule:: cpl_query.iterable.iterable
@@ -11,10 +12,18 @@ cpl\_query.iterable.iterable
:undoc-members:
:show-inheritance:
-cpl\_query.iterable.iterable\_abc
+cpl\_query.iterable.iterable\_abc module
----------------------------------------
.. automodule:: cpl_query.iterable.iterable_abc
:members:
:undoc-members:
:show-inheritance:
+
+Module contents
+---------------
+
+.. automodule:: cpl_query.iterable
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/cpl_query.rst b/docs/source/cpl_query.rst
index 5a362b26..5812cc73 100644
--- a/docs/source/cpl_query.rst
+++ b/docs/source/cpl_query.rst
@@ -1,10 +1,10 @@
Query reference
-===========
+===============
.. toctree::
:maxdepth: 4
- cpl_query.base
- cpl_query.enumerable
- cpl_query.extension
- cpl_query.iterable
+ cpl_query.base
+ cpl_query.enumerable
+ cpl_query.extension
+ cpl_query.iterable
diff --git a/docs/source/introduction.md b/docs/source/introduction.md
index fc9721da..33d31430 100644
--- a/docs/source/introduction.md
+++ b/docs/source/introduction.md
@@ -56,5 +56,5 @@ This CPL docs help you learn, understand and use the package. From your first ap
- [Getting started](quickstart)
- [Setup](setup)
- [API Reference](cpl_core)
-- [CLI Reference](cli.overview)
+- [CLI Reference](cpl_cli.overview)
- [Query Reference](cpl_query)
diff --git a/docs/source/modules.rst b/docs/source/modules.rst
index 5a411fa4..49bd8182 100644
--- a/docs/source/modules.rst
+++ b/docs/source/modules.rst
@@ -1,10 +1,9 @@
-cpl
-===
+Packages
+========
.. toctree::
:maxdepth: 4
- getting_started
cpl_cli
cpl_core
cpl_discord
diff --git a/docs/source/setup.md b/docs/source/setup.md
index be16fa9b..1a953c69 100644
--- a/docs/source/setup.md
+++ b/docs/source/setup.md
@@ -104,8 +104,8 @@ Hello World
## What's next
-- To learn more about the CPL CLI, see the [CLI Overview](cli.overview)
-- Fore more informations about the Pyhton files generated by ```cpl new```, see [New Command](cli.new)
+- To learn more about the CPL CLI, see the [CLI Overview](cpl_cli.overview)
+- Fore more informations about the Pyhton files generated by ```cpl new```, see [New Command](cpl_cli.new)
[pip-url]: https://pip.sh-edraft.de
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000..e34796ec
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,2 @@
+[tool.black]
+line-length = 120
\ No newline at end of file
diff --git a/src/cpl_cli/.cpl/__init__.py b/src/cpl_cli/.cpl/__init__.py
index fd1901ed..211386b3 100644
--- a/src/cpl_cli/.cpl/__init__.py
+++ b/src/cpl_cli/.cpl/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/.cpl/project_console.py b/src/cpl_cli/.cpl/project_console.py
index 46179e8b..178ca299 100644
--- a/src/cpl_cli/.cpl/project_console.py
+++ b/src/cpl_cli/.cpl/project_console.py
@@ -4,17 +4,16 @@ from cpl_core.utils import String
class Console(ProjectTypeABC):
-
def __init__(
- self,
- base_path: str,
- project_name: str,
- workspace: WorkspaceSettings,
- use_application_api: bool,
- use_startup: bool,
- use_service_providing: bool,
- use_async: bool,
- project_file_data: dict,
+ self,
+ base_path: str,
+ project_name: str,
+ workspace: WorkspaceSettings,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ project_file_data: dict,
):
from project_file import ProjectFile
from project_file_appsettings import ProjectFileAppsettings
@@ -25,23 +24,46 @@ class Console(ProjectTypeABC):
from project_file_license import ProjectFileLicense
from schematic_init import Init
- ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
+ ProjectTypeABC.__init__(
+ self,
+ base_path,
+ project_name,
+ workspace,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ project_file_data,
+ )
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
- self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
+ self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
if workspace is None:
- self.add_template(ProjectFileLicense(''))
- self.add_template(ProjectFileReadme(''))
- self.add_template(Init('', 'init', f'{base_path}tests/'))
+ self.add_template(ProjectFileLicense(""))
+ self.add_template(ProjectFileReadme(""))
+ self.add_template(Init("", "init", f"{base_path}tests/"))
- self.add_template(Init('', 'init', project_path))
+ self.add_template(Init("", "init", project_path))
self.add_template(ProjectFileAppsettings(project_path))
if use_application_api:
- self.add_template(ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
+ self.add_template(
+ ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async)
+ )
if use_startup:
- self.add_template(ProjectFileStartup(project_path, use_application_api, use_startup, use_service_providing, use_async))
+ self.add_template(
+ ProjectFileStartup(project_path, use_application_api, use_startup, use_service_providing, use_async)
+ )
- self.add_template(ProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
+ self.add_template(
+ ProjectFileMain(
+ project_name.split("/")[-1],
+ project_path,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ )
+ )
diff --git a/src/cpl_cli/.cpl/project_file.py b/src/cpl_cli/.cpl/project_file.py
index ecee56ce..0ef75d52 100644
--- a/src/cpl_cli/.cpl/project_file.py
+++ b/src/cpl_cli/.cpl/project_file.py
@@ -4,10 +4,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFile(FileTemplateABC):
-
def __init__(self, name: str, path: str, code: dict):
- FileTemplateABC.__init__(self, '', path, '{}')
- self._name = f'{name}.json'
+ FileTemplateABC.__init__(self, "", path, "{}")
+ self._name = f"{name}.json"
self._code = code
def get_code(self) -> str:
diff --git a/src/cpl_cli/.cpl/project_file_appsettings.py b/src/cpl_cli/.cpl/project_file_appsettings.py
index c1601d8a..cea4eb14 100644
--- a/src/cpl_cli/.cpl/project_file_appsettings.py
+++ b/src/cpl_cli/.cpl/project_file_appsettings.py
@@ -4,13 +4,13 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFileAppsettings(FileTemplateABC):
-
def __init__(self, path: str):
- FileTemplateABC.__init__(self, '', path, '{}')
- self._name = 'appsettings.json'
+ FileTemplateABC.__init__(self, "", path, "{}")
+ self._name = "appsettings.json"
def get_code(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
@@ -25,4 +25,5 @@ class ProjectFileAppsettings(FileTemplateABC):
"FileLogLevel": "WARN"
}
}
- """)
+ """
+ )
diff --git a/src/cpl_cli/.cpl/project_file_code_application.py b/src/cpl_cli/.cpl/project_file_code_application.py
index 59bc447a..d3324dde 100644
--- a/src/cpl_cli/.cpl/project_file_code_application.py
+++ b/src/cpl_cli/.cpl/project_file_code_application.py
@@ -2,15 +2,19 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileApplication(CodeFileTemplateABC):
-
- def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'application', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "application", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
def get_code(self) -> str:
import textwrap
if self._use_async:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
from cpl_core.application import ApplicationABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.console import Console
@@ -27,9 +31,11 @@ class ProjectFileApplication(CodeFileTemplateABC):
async def main(self):
Console.write_line('Hello World')
- """)
+ """
+ )
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
from cpl_core.application import ApplicationABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.console import Console
@@ -46,4 +52,5 @@ class ProjectFileApplication(CodeFileTemplateABC):
def main(self):
Console.write_line('Hello World')
- """)
+ """
+ )
diff --git a/src/cpl_cli/.cpl/project_file_code_main.py b/src/cpl_cli/.cpl/project_file_code_main.py
index 614eb1d2..1c544083 100644
--- a/src/cpl_cli/.cpl/project_file_code_main.py
+++ b/src/cpl_cli/.cpl/project_file_code_main.py
@@ -3,15 +3,25 @@ from cpl_core.utils import String
class ProjectFileMain(CodeFileTemplateABC):
-
- def __init__(self, name: str, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'main', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self,
+ name: str,
+ path: str,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "main", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
import textwrap
- import_pkg = f'{String.convert_to_snake_case(name)}.'
+ import_pkg = f"{String.convert_to_snake_case(name)}."
- self._main_with_application_host_and_startup = textwrap.dedent(f"""\
+ self._main_with_application_host_and_startup = textwrap.dedent(
+ f"""\
{"import asyncio" if self._use_async else ''}
from cpl_core.application import ApplicationBuilder
@@ -29,8 +39,10 @@ class ProjectFileMain(CodeFileTemplateABC):
if __name__ == '__main__':
{"asyncio.run(main())" if self._use_async else "main()"}
- """)
- self._main_with_application_base = textwrap.dedent(f"""\
+ """
+ )
+ self._main_with_application_base = textwrap.dedent(
+ f"""\
{"import asyncio" if self._use_async else ''}
from cpl_core.application import ApplicationBuilder
@@ -46,9 +58,11 @@ class ProjectFileMain(CodeFileTemplateABC):
if __name__ == '__main__':
{"asyncio.run(main())" if self._use_async else "main()"}
- """)
+ """
+ )
- self._main_with_dependency_injection = textwrap.dedent(f"""\
+ self._main_with_dependency_injection = textwrap.dedent(
+ f"""\
{"import asyncio" if self._use_async else ''}
from cpl_core.application import ApplicationBuilder
@@ -72,12 +86,13 @@ class ProjectFileMain(CodeFileTemplateABC):
if __name__ == '__main__':
{"asyncio.run(main())" if self._use_async else "main()"}
- """)
+ """
+ )
def _async(self) -> str:
if self._use_async:
- return 'async '
- return ''
+ return "async "
+ return ""
def get_code(self) -> str:
if self._use_application_api and self._use_startup:
diff --git a/src/cpl_cli/.cpl/project_file_code_startup.py b/src/cpl_cli/.cpl/project_file_code_startup.py
index 51ce07c1..5277d616 100644
--- a/src/cpl_cli/.cpl/project_file_code_startup.py
+++ b/src/cpl_cli/.cpl/project_file_code_startup.py
@@ -2,14 +2,18 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileStartup(CodeFileTemplateABC):
-
- def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'startup', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "startup", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
def get_code(self) -> str:
import textwrap
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
from cpl_core.application import StartupABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
@@ -26,4 +30,5 @@ class ProjectFileStartup(CodeFileTemplateABC):
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
return services.build_service_provider()
- """)
+ """
+ )
diff --git a/src/cpl_cli/.cpl/project_file_code_test_application.py b/src/cpl_cli/.cpl/project_file_code_test_application.py
index 06221cd6..aa1ccbde 100644
--- a/src/cpl_cli/.cpl/project_file_code_test_application.py
+++ b/src/cpl_cli/.cpl/project_file_code_test_application.py
@@ -2,15 +2,19 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileTestApplication(CodeFileTemplateABC):
-
- def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'application', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "application", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
def get_code(self) -> str:
import textwrap
if self._use_async:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
import unittest
from unittest import TestSuite
@@ -32,9 +36,11 @@ class ProjectFileTestApplication(CodeFileTemplateABC):
async def main(self):
runner = unittest.TextTestRunner()
runner.run(self._suite)
- """)
+ """
+ )
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
import unittest
from unittest import TestSuite
@@ -56,4 +62,5 @@ class ProjectFileTestApplication(CodeFileTemplateABC):
def main(self):
runner = unittest.TextTestRunner()
runner.run(self._suite)
- """)
+ """
+ )
diff --git a/src/cpl_cli/.cpl/project_file_code_test_case.py b/src/cpl_cli/.cpl/project_file_code_test_case.py
index 731e9b93..88cf4ce9 100644
--- a/src/cpl_cli/.cpl/project_file_code_test_case.py
+++ b/src/cpl_cli/.cpl/project_file_code_test_case.py
@@ -2,15 +2,19 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class ProjectFileTestCase(CodeFileTemplateABC):
-
- def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'test_case', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "test_case", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
def get_code(self) -> str:
import textwrap
if self._use_async:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
import unittest
@@ -21,9 +25,11 @@ class ProjectFileTestCase(CodeFileTemplateABC):
async def test_equal(self):
self.assertEqual(True, True)
- """)
+ """
+ )
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
import unittest
@@ -34,4 +40,5 @@ class ProjectFileTestCase(CodeFileTemplateABC):
def test_equal(self):
self.assertEqual(True, True)
- """)
+ """
+ )
diff --git a/src/cpl_cli/.cpl/project_file_license.py b/src/cpl_cli/.cpl/project_file_license.py
index 49030517..c145e846 100644
--- a/src/cpl_cli/.cpl/project_file_license.py
+++ b/src/cpl_cli/.cpl/project_file_license.py
@@ -2,10 +2,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFileLicense(FileTemplateABC):
-
def __init__(self, path: str):
- FileTemplateABC.__init__(self, '', path, '')
- self._name = 'LICENSE'
+ FileTemplateABC.__init__(self, "", path, "")
+ self._name = "LICENSE"
def get_code(self) -> str:
return self._code
diff --git a/src/cpl_cli/.cpl/project_file_readme.py b/src/cpl_cli/.cpl/project_file_readme.py
index ff45ab52..f5ef9714 100644
--- a/src/cpl_cli/.cpl/project_file_readme.py
+++ b/src/cpl_cli/.cpl/project_file_readme.py
@@ -2,10 +2,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class ProjectFileReadme(FileTemplateABC):
-
def __init__(self, path: str):
- FileTemplateABC.__init__(self, '', path, '')
- self._name = 'README.md'
+ FileTemplateABC.__init__(self, "", path, "")
+ self._name = "README.md"
def get_code(self) -> str:
return self._code
diff --git a/src/cpl_cli/.cpl/project_library.py b/src/cpl_cli/.cpl/project_library.py
index 7ade19b6..9774bea1 100644
--- a/src/cpl_cli/.cpl/project_library.py
+++ b/src/cpl_cli/.cpl/project_library.py
@@ -6,17 +6,16 @@ from cpl_core.utils import String
class Library(ProjectTypeABC):
-
def __init__(
- self,
- base_path: str,
- project_name: str,
- workspace: WorkspaceSettings,
- use_application_api: bool,
- use_startup: bool,
- use_service_providing: bool,
- use_async: bool,
- project_file_data: dict,
+ self,
+ base_path: str,
+ project_name: str,
+ workspace: WorkspaceSettings,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ project_file_data: dict,
):
from project_file import ProjectFile
from project_file_readme import ProjectFileReadme
@@ -24,14 +23,24 @@ class Library(ProjectTypeABC):
from schematic_init import Init
from schematic_class import Class
- ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
+ ProjectTypeABC.__init__(
+ self,
+ base_path,
+ project_name,
+ workspace,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ project_file_data,
+ )
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
- self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
+ self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
if workspace is None:
- self.add_template(ProjectFileLicense(''))
- self.add_template(ProjectFileReadme(''))
+ self.add_template(ProjectFileLicense(""))
+ self.add_template(ProjectFileReadme(""))
- self.add_template(Init('', 'init', project_path))
- self.add_template(Class('Class1', 'class', project_path))
+ self.add_template(Init("", "init", project_path))
+ self.add_template(Class("Class1", "class", project_path))
diff --git a/src/cpl_cli/.cpl/project_unittest.py b/src/cpl_cli/.cpl/project_unittest.py
index 7b4b4d2b..059e1864 100644
--- a/src/cpl_cli/.cpl/project_unittest.py
+++ b/src/cpl_cli/.cpl/project_unittest.py
@@ -6,17 +6,16 @@ from cpl_core.utils import String
class Unittest(ProjectTypeABC):
-
def __init__(
- self,
- base_path: str,
- project_name: str,
- workspace: WorkspaceSettings,
- use_application_api: bool,
- use_startup: bool,
- use_service_providing: bool,
- use_async: bool,
- project_file_data: dict,
+ self,
+ base_path: str,
+ project_name: str,
+ workspace: WorkspaceSettings,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ project_file_data: dict,
):
from project_file import ProjectFile
from project_file_code_application import ProjectFileApplication
@@ -26,17 +25,40 @@ class Unittest(ProjectTypeABC):
from project_file_license import ProjectFileLicense
from schematic_init import Init
- ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
+ ProjectTypeABC.__init__(
+ self,
+ base_path,
+ project_name,
+ workspace,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ project_file_data,
+ )
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
- self.add_template(ProjectFile(project_name.split('/')[-1], project_path, project_file_data))
+ self.add_template(ProjectFile(project_name.split("/")[-1], project_path, project_file_data))
if workspace is None:
- self.add_template(ProjectFileLicense(''))
- self.add_template(ProjectFileReadme(''))
- self.add_template(Init('', 'init', f'{base_path}tests/'))
+ self.add_template(ProjectFileLicense(""))
+ self.add_template(ProjectFileReadme(""))
+ self.add_template(Init("", "init", f"{base_path}tests/"))
- self.add_template(Init('', 'init', project_path))
- self.add_template(ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
- self.add_template(ProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
- self.add_template(ProjectFileTestCase(project_path, use_application_api, use_startup, use_service_providing, use_async))
+ self.add_template(Init("", "init", project_path))
+ self.add_template(
+ ProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async)
+ )
+ self.add_template(
+ ProjectFileMain(
+ project_name.split("/")[-1],
+ project_path,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ )
+ )
+ self.add_template(
+ ProjectFileTestCase(project_path, use_application_api, use_startup, use_service_providing, use_async)
+ )
diff --git a/src/cpl_cli/.cpl/schematic_abc.py b/src/cpl_cli/.cpl/schematic_abc.py
index eaaab12e..dfcfc251 100644
--- a/src/cpl_cli/.cpl/schematic_abc.py
+++ b/src/cpl_cli/.cpl/schematic_abc.py
@@ -3,11 +3,10 @@ from cpl_core.utils import String
class ABC(GenerateSchematicABC):
-
def __init__(self, name: str, schematic: str, path: str):
GenerateSchematicABC.__init__(self, name, schematic, path)
self._class_name = name
- if name != '':
+ if name != "":
self._class_name = f'{String.first_to_upper(name.replace(schematic, ""))}ABC'
def get_code(self) -> str:
@@ -25,8 +24,4 @@ class ABC(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'abc',
- ['a', 'A']
- )
+ GenerateSchematicABC.register(cls, "abc", ["a", "A"])
diff --git a/src/cpl_cli/.cpl/schematic_application.py b/src/cpl_cli/.cpl/schematic_application.py
index 60761fe6..a3cfe18c 100644
--- a/src/cpl_cli/.cpl/schematic_application.py
+++ b/src/cpl_cli/.cpl/schematic_application.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Application(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -32,8 +31,4 @@ class Application(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'application',
- ['app', 'APP']
- )
+ GenerateSchematicABC.register(cls, "application", ["app", "APP"])
diff --git a/src/cpl_cli/.cpl/schematic_application_extension.py b/src/cpl_cli/.cpl/schematic_application_extension.py
index 82672aee..4cbdb453 100644
--- a/src/cpl_cli/.cpl/schematic_application_extension.py
+++ b/src/cpl_cli/.cpl/schematic_application_extension.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class ApplicationExtension(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -28,8 +27,4 @@ class ApplicationExtension(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'application-extension',
- ['appex', 'APPEX']
- )
+ GenerateSchematicABC.register(cls, "application-extension", ["appex", "APPEX"])
diff --git a/src/cpl_cli/.cpl/schematic_class.py b/src/cpl_cli/.cpl/schematic_class.py
index 617634de..ff6f9148 100644
--- a/src/cpl_cli/.cpl/schematic_class.py
+++ b/src/cpl_cli/.cpl/schematic_class.py
@@ -3,11 +3,10 @@ from cpl_core.utils import String
class Class(GenerateSchematicABC):
-
def __init__(self, name: str, schematic: str, path: str):
GenerateSchematicABC.__init__(self, name, schematic, path)
- self._name = f'{String.convert_to_snake_case(name)}.py'
- self._class_name = f'{String.first_to_upper(name)}'
+ self._name = f"{String.convert_to_snake_case(name)}.py"
+ self._class_name = f"{String.first_to_upper(name)}"
def get_code(self) -> str:
code = """\
@@ -21,8 +20,4 @@ class Class(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'class',
- ['c', 'C']
- )
+ GenerateSchematicABC.register(cls, "class", ["c", "C"])
diff --git a/src/cpl_cli/.cpl/schematic_configmodel.py b/src/cpl_cli/.cpl/schematic_configmodel.py
index e692f1e1..18a01d37 100644
--- a/src/cpl_cli/.cpl/schematic_configmodel.py
+++ b/src/cpl_cli/.cpl/schematic_configmodel.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class ConfigModel(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -39,8 +38,4 @@ class ConfigModel(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'settings',
- ['st', 'ST']
- )
+ GenerateSchematicABC.register(cls, "settings", ["st", "ST"])
diff --git a/src/cpl_cli/.cpl/schematic_enum.py b/src/cpl_cli/.cpl/schematic_enum.py
index 93361f65..81f14c55 100644
--- a/src/cpl_cli/.cpl/schematic_enum.py
+++ b/src/cpl_cli/.cpl/schematic_enum.py
@@ -2,26 +2,24 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Enum(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
def get_code(self) -> str:
import textwrap
- code = textwrap.dedent("""\
+
+ code = textwrap.dedent(
+ """\
from enum import Enum
class $Name(Enum):
atr = 0
- """)
+ """
+ )
return self.build_code_str(code, Name=self._class_name)
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'enum',
- ['e', 'E']
- )
+ GenerateSchematicABC.register(cls, "enum", ["e", "E"])
diff --git a/src/cpl_cli/.cpl/schematic_init.py b/src/cpl_cli/.cpl/schematic_init.py
index f089ac18..2a79af6c 100644
--- a/src/cpl_cli/.cpl/schematic_init.py
+++ b/src/cpl_cli/.cpl/schematic_init.py
@@ -4,10 +4,9 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Init(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
- self._name = f'__init__.py'
+ self._name = f"__init__.py"
def get_code(self) -> str:
code = """\
@@ -18,8 +17,4 @@ class Init(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'init',
- []
- )
+ GenerateSchematicABC.register(cls, "init", [])
diff --git a/src/cpl_cli/.cpl/schematic_pipe.py b/src/cpl_cli/.cpl/schematic_pipe.py
index fe7ab972..8e19bdda 100644
--- a/src/cpl_cli/.cpl/schematic_pipe.py
+++ b/src/cpl_cli/.cpl/schematic_pipe.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Pipe(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -25,8 +24,4 @@ class Pipe(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'pipe',
- ['p', 'P']
- )
+ GenerateSchematicABC.register(cls, "pipe", ["p", "P"])
diff --git a/src/cpl_cli/.cpl/schematic_schematic.py b/src/cpl_cli/.cpl/schematic_schematic.py
index b62d2277..c5f7ddf0 100644
--- a/src/cpl_cli/.cpl/schematic_schematic.py
+++ b/src/cpl_cli/.cpl/schematic_schematic.py
@@ -3,11 +3,10 @@ from cpl_core.utils import String
class Schematic(GenerateSchematicABC):
-
def __init__(self, name: str, path: str, schematic: str):
GenerateSchematicABC.__init__(self, name, path, schematic)
- self._name = f'schematic_{String.convert_to_snake_case(name)}.py'
- self._path = '.cpl/'
+ self._name = f"schematic_{String.convert_to_snake_case(name)}.py"
+ self._path = ".cpl/"
self._class_name = String.convert_to_camel_case(name)
def get_code(self) -> str:
@@ -44,8 +43,4 @@ class Schematic(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'schematic',
- ['scheme', 'SCHEME']
- )
+ GenerateSchematicABC.register(cls, "schematic", ["scheme", "SCHEME"])
diff --git a/src/cpl_cli/.cpl/schematic_service.py b/src/cpl_cli/.cpl/schematic_service.py
index 9651f7de..f78ffb5c 100644
--- a/src/cpl_cli/.cpl/schematic_service.py
+++ b/src/cpl_cli/.cpl/schematic_service.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Service(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -20,8 +19,4 @@ class Service(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'service',
- ['s', 'S']
- )
+ GenerateSchematicABC.register(cls, "service", ["s", "S"])
diff --git a/src/cpl_cli/.cpl/schematic_startup.py b/src/cpl_cli/.cpl/schematic_startup.py
index 4be1b678..47d2ef74 100644
--- a/src/cpl_cli/.cpl/schematic_startup.py
+++ b/src/cpl_cli/.cpl/schematic_startup.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Startup(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -32,8 +31,4 @@ class Startup(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'startup',
- ['stup', 'STUP']
- )
+ GenerateSchematicABC.register(cls, "startup", ["stup", "STUP"])
diff --git a/src/cpl_cli/.cpl/schematic_startup_extension.py b/src/cpl_cli/.cpl/schematic_startup_extension.py
index 60debcf8..3bb74468 100644
--- a/src/cpl_cli/.cpl/schematic_startup_extension.py
+++ b/src/cpl_cli/.cpl/schematic_startup_extension.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class StartupExtension(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -32,8 +31,4 @@ class StartupExtension(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'startup-extension',
- ['stupex', 'STUPEX']
- )
+ GenerateSchematicABC.register(cls, "startup-extension", ["stupex", "STUPEX"])
diff --git a/src/cpl_cli/.cpl/schematic_test_case.py b/src/cpl_cli/.cpl/schematic_test_case.py
index d0f2b4bd..a29144d4 100644
--- a/src/cpl_cli/.cpl/schematic_test_case.py
+++ b/src/cpl_cli/.cpl/schematic_test_case.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class TestCase(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -25,8 +24,4 @@ class TestCase(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'test-case',
- ['tc', 'TC']
- )
+ GenerateSchematicABC.register(cls, "test-case", ["tc", "TC"])
diff --git a/src/cpl_cli/.cpl/schematic_thread.py b/src/cpl_cli/.cpl/schematic_thread.py
index 4bb19e98..914b2615 100644
--- a/src/cpl_cli/.cpl/schematic_thread.py
+++ b/src/cpl_cli/.cpl/schematic_thread.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Thread(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -26,8 +25,4 @@ class Thread(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'thread',
- ['t', 'T']
- )
+ GenerateSchematicABC.register(cls, "thread", ["t", "T"])
diff --git a/src/cpl_cli/.cpl/schematic_validator.py b/src/cpl_cli/.cpl/schematic_validator.py
index a7a17cb1..b99790d2 100644
--- a/src/cpl_cli/.cpl/schematic_validator.py
+++ b/src/cpl_cli/.cpl/schematic_validator.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Validator(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -26,8 +25,4 @@ class Validator(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'validator',
- ['v', 'V']
- )
+ GenerateSchematicABC.register(cls, "validator", ["v", "V"])
diff --git a/src/cpl_cli/__init__.py b/src/cpl_cli/__init__.py
index 88563c33..d6d20caa 100644
--- a/src/cpl_cli/__init__.py
+++ b/src/cpl_cli/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -27,5 +27,5 @@ from .error import Error
from .main import main
from .startup import Startup
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/_templates/__init__.py b/src/cpl_cli/_templates/__init__.py
index 56690313..e90c4518 100644
--- a/src/cpl_cli/_templates/__init__.py
+++ b/src/cpl_cli/_templates/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli._templates'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli._templates"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/_templates/build/__init__.py b/src/cpl_cli/_templates/build/__init__.py
index 8b300e0f..ece37d0b 100644
--- a/src/cpl_cli/_templates/build/__init__.py
+++ b/src/cpl_cli/_templates/build/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli._templates.build'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli._templates.build"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/_templates/build/init_template.py b/src/cpl_cli/_templates/build/init_template.py
index 2e3911bc..0529cb67 100644
--- a/src/cpl_cli/_templates/build/init_template.py
+++ b/src/cpl_cli/_templates/build/init_template.py
@@ -2,10 +2,10 @@ import textwrap
class InitTemplate:
-
@staticmethod
def get_init_py() -> str:
- string = textwrap.dedent("""\
+ string = textwrap.dedent(
+ """\
# -*- coding: utf-8 -*-
\"\"\"
@@ -32,6 +32,7 @@ class InitTemplate:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='$Major', minor='$Minor', micro='$Micro')
- """)
+ """
+ )
return string
diff --git a/src/cpl_cli/_templates/publish/__init__.py b/src/cpl_cli/_templates/publish/__init__.py
index d8dabf44..b5986f99 100644
--- a/src/cpl_cli/_templates/publish/__init__.py
+++ b/src/cpl_cli/_templates/publish/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli._templates.publish'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli._templates.publish"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/_templates/publish/setup_template.py b/src/cpl_cli/_templates/publish/setup_template.py
index abae3251..63049f0c 100644
--- a/src/cpl_cli/_templates/publish/setup_template.py
+++ b/src/cpl_cli/_templates/publish/setup_template.py
@@ -2,10 +2,10 @@ import textwrap
class SetupTemplate:
-
@staticmethod
def get_setup_py() -> str:
- string = textwrap.dedent("""\
+ string = textwrap.dedent(
+ """\
\"\"\"
This file is generated by CPL CLI
\"\"\"
@@ -27,6 +27,7 @@ class SetupTemplate:
entry_points=$EntryPoints,
package_data=$PackageData
)
- """)
+ """
+ )
return string
diff --git a/src/cpl_cli/_templates/template_file_abc.py b/src/cpl_cli/_templates/template_file_abc.py
index bbe2f2e3..a7e0e6e7 100644
--- a/src/cpl_cli/_templates/template_file_abc.py
+++ b/src/cpl_cli/_templates/template_file_abc.py
@@ -2,18 +2,21 @@ from abc import ABC, abstractmethod
class TemplateFileABC(ABC):
-
@abstractmethod
- def __init__(self): pass
+ def __init__(self):
+ pass
@property
@abstractmethod
- def name(self) -> str: pass
+ def name(self) -> str:
+ pass
@property
@abstractmethod
- def path(self) -> str: pass
+ def path(self) -> str:
+ pass
@property
@abstractmethod
- def value(self) -> str: pass
+ def value(self) -> str:
+ pass
diff --git a/src/cpl_cli/abc/__init__.py b/src/cpl_cli/abc/__init__.py
index 7d010963..c889d116 100644
--- a/src/cpl_cli/abc/__init__.py
+++ b/src/cpl_cli/abc/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.abc'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.abc"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/abc/code_file_template_abc.py b/src/cpl_cli/abc/code_file_template_abc.py
index 439d8e4f..abd1fefa 100644
--- a/src/cpl_cli/abc/code_file_template_abc.py
+++ b/src/cpl_cli/abc/code_file_template_abc.py
@@ -5,17 +5,16 @@ from cpl_core.utils import String
class CodeFileTemplateABC(FileTemplateABC):
-
@abstractmethod
def __init__(
- self,
- name: str,
- path: str,
- code: str,
- use_application_api: bool,
- use_startup: bool,
- use_service_providing: bool,
- use_async: bool,
+ self,
+ name: str,
+ path: str,
+ code: str,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
):
FileTemplateABC.__init__(self, name, path, code)
self._use_application_api = use_application_api
diff --git a/src/cpl_cli/abc/file_template_abc.py b/src/cpl_cli/abc/file_template_abc.py
index e86cd436..99425f00 100644
--- a/src/cpl_cli/abc/file_template_abc.py
+++ b/src/cpl_cli/abc/file_template_abc.py
@@ -4,15 +4,14 @@ from cpl_core.utils import String
class FileTemplateABC(ABC):
-
@abstractmethod
def __init__(self, name: str, path: str, code: str):
- self._name = f'{String.convert_to_snake_case(name)}.py'
+ self._name = f"{String.convert_to_snake_case(name)}.py"
self._path = path
self._code = code
def __repr__(self):
- return f'<{type(self).__name__} {self._path}{self._name}>'
+ return f"<{type(self).__name__} {self._path}{self._name}>"
@property
def name(self) -> str:
@@ -21,7 +20,7 @@ class FileTemplateABC(ABC):
@property
def path(self) -> str:
return self._path
-
+
@path.setter
def path(self, value: str):
self._path = value
@@ -31,4 +30,5 @@ class FileTemplateABC(ABC):
return self.get_code()
@abstractmethod
- def get_code(self) -> str: pass
+ def get_code(self) -> str:
+ pass
diff --git a/src/cpl_cli/abc/generate_schematic_abc.py b/src/cpl_cli/abc/generate_schematic_abc.py
index 5a0b958d..7b79f441 100644
--- a/src/cpl_cli/abc/generate_schematic_abc.py
+++ b/src/cpl_cli/abc/generate_schematic_abc.py
@@ -8,19 +8,18 @@ from cpl_core.utils import String
class GenerateSchematicABC(FileTemplateABC):
-
def __init__(self, name: str, schematic: str, path: str):
- FileTemplateABC.__init__(self, name, path, '')
- self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
+ FileTemplateABC.__init__(self, name, path, "")
+ self._name = f"{String.convert_to_snake_case(name)}_{schematic}.py"
if schematic in name.lower():
- self._name = f'{String.convert_to_snake_case(name)}.py'
+ self._name = f"{String.convert_to_snake_case(name)}.py"
self._class_name = name
- if name != '':
- self._class_name = f'{String.first_to_upper(name)}{String.first_to_upper(schematic)}'
+ if name != "":
+ self._class_name = f"{String.first_to_upper(name)}{String.first_to_upper(schematic)}"
if schematic in name.lower():
- self._class_name = f'{String.first_to_upper(name)}'
+ self._class_name = f"{String.first_to_upper(name)}"
@property
def class_name(self) -> str:
diff --git a/src/cpl_cli/abc/project_type_abc.py b/src/cpl_cli/abc/project_type_abc.py
index 68016e49..caf72db5 100644
--- a/src/cpl_cli/abc/project_type_abc.py
+++ b/src/cpl_cli/abc/project_type_abc.py
@@ -6,18 +6,17 @@ from cpl_cli.configuration import WorkspaceSettings
class ProjectTypeABC(ABC):
-
@abstractmethod
def __init__(
- self,
- base_path: str,
- project_name: str,
- workspace: Optional[WorkspaceSettings],
- use_application_api: bool,
- use_startup: bool,
- use_service_providing: bool,
- use_async: bool,
- project_file_data: dict,
+ self,
+ base_path: str,
+ project_name: str,
+ workspace: Optional[WorkspaceSettings],
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ project_file_data: dict,
):
self._templates: list[FileTemplateABC] = []
self._base_path = base_path
diff --git a/src/cpl_cli/cli.py b/src/cpl_cli/cli.py
index d70a777a..8428f4aa 100644
--- a/src/cpl_cli/cli.py
+++ b/src/cpl_cli/cli.py
@@ -9,7 +9,6 @@ from cpl_core.dependency_injection.service_provider_abc import ServiceProviderAB
class CLI(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
"""
CPL CLI
@@ -33,11 +32,11 @@ class CLI(ApplicationABC):
return
if len(self._configuration.additional_arguments) == 0:
- Error.error('Expected command')
+ Error.error("Expected command")
return
- unexpected_arguments = ', '.join(self._configuration.additional_arguments)
- Error.error(f'Unexpected argument(s): {unexpected_arguments}')
+ unexpected_arguments = ", ".join(self._configuration.additional_arguments)
+ Error.error(f"Unexpected argument(s): {unexpected_arguments}")
Console.write_line()
except KeyboardInterrupt:
Console.write_line()
diff --git a/src/cpl_cli/cli_settings.py b/src/cpl_cli/cli_settings.py
index e616b976..c23dfb8d 100644
--- a/src/cpl_cli/cli_settings.py
+++ b/src/cpl_cli/cli_settings.py
@@ -7,7 +7,6 @@ from cpl_cli.cli_settings_name_enum import CLISettingsNameEnum
class CLISettings(ConfigurationModelABC):
-
def __init__(self):
ConfigurationModelABC.__init__(self)
@@ -21,5 +20,5 @@ class CLISettings(ConfigurationModelABC):
try:
self._pip_path = settings[CLISettingsNameEnum.pip_path.value]
except Exception as e:
- Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
+ Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
diff --git a/src/cpl_cli/cli_settings_name_enum.py b/src/cpl_cli/cli_settings_name_enum.py
index f7dc8889..06e024ad 100644
--- a/src/cpl_cli/cli_settings_name_enum.py
+++ b/src/cpl_cli/cli_settings_name_enum.py
@@ -2,5 +2,4 @@ from enum import Enum
class CLISettingsNameEnum(Enum):
-
- pip_path = 'PipPath'
+ pip_path = "PipPath"
diff --git a/src/cpl_cli/command/__init__.py b/src/cpl_cli/command/__init__.py
index 01e0cf59..3d61863a 100644
--- a/src/cpl_cli/command/__init__.py
+++ b/src/cpl_cli/command/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.command'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.command"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -28,5 +28,5 @@ from .new_service import NewService
from .publish_service import PublishService
from .version_service import VersionService
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/command/add_service.py b/src/cpl_cli/command/add_service.py
index e3223d85..655a93fc 100644
--- a/src/cpl_cli/command/add_service.py
+++ b/src/cpl_cli/command/add_service.py
@@ -14,7 +14,6 @@ from cpl_cli.configuration.workspace_settings import WorkspaceSettings
class AddService(CommandABC):
-
def __init__(self, config: ConfigurationABC, workspace: WorkspaceSettings):
"""
Service for CLI command add
@@ -27,23 +26,30 @@ class AddService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Adds a project reference to given project.
Usage: cpl add
Arguments:
source-project: Name of the project to which the reference has to be
target-project: Name of the project to be referenced
- """)
+ """
+ )
def _edit_project_file(self, source: str, project_settings: ProjectSettings, build_settings: BuildSettings):
if self._is_simulation:
return
- with open(source, 'w') as file:
- file.write(json.dumps({
- ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(project_settings),
- BuildSettings.__name__: SettingsHelper.get_build_settings_dict(build_settings)
- }, indent=2))
+ with open(source, "w") as file:
+ file.write(
+ json.dumps(
+ {
+ ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(project_settings),
+ BuildSettings.__name__: SettingsHelper.get_build_settings_dict(build_settings),
+ },
+ indent=2,
+ )
+ )
file.close()
def execute(self, args: list[str]):
@@ -52,17 +58,17 @@ class AddService(CommandABC):
:param args:
:return:
"""
- if 'simulate' in args:
- args.remove('simulate')
- Console.write_line('Running in simulation mode:')
+ if "simulate" in args:
+ args.remove("simulate")
+ Console.write_line("Running in simulation mode:")
self._is_simulation = True
if len(args) == 0:
- Console.error('Expected source and target project')
+ Console.error("Expected source and target project")
return
elif len(args) == 1:
- Console.error('Expected target project')
+ Console.error("Expected target project")
return
elif len(args) > 2:
@@ -103,30 +109,30 @@ class AddService(CommandABC):
is_invalid_source = True
if is_invalid_source:
- Console.error(f'Invalid source: {source}')
+ Console.error(f"Invalid source: {source}")
return
if is_invalid_target or source == target or not os.path.isfile(target):
- Console.error(f'Invalid target: {target}')
+ Console.error(f"Invalid target: {target}")
return
if self._workspace is None:
- target = f'../{target}'
+ target = f"../{target}"
else:
- target = target.replace('src', '..')
+ target = target.replace("src", "..")
if target in build_settings.project_references:
- Console.error(f'Project reference already exists.')
+ Console.error(f"Project reference already exists.")
return
build_settings.project_references.append(target)
Console.spinner(
- f'Editing {source}',
+ f"Editing {source}",
self._edit_project_file,
source,
project_settings,
build_settings,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
diff --git a/src/cpl_cli/command/build_service.py b/src/cpl_cli/command/build_service.py
index a9c764b6..3286732e 100644
--- a/src/cpl_cli/command/build_service.py
+++ b/src/cpl_cli/command/build_service.py
@@ -5,7 +5,6 @@ from cpl_cli.publish.publisher_abc import PublisherABC
class BuildService(CommandABC):
-
def __init__(self, publisher: PublisherABC):
"""
Service for the CLI command build
@@ -17,10 +16,12 @@ class BuildService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Copies an python app into an output directory named build/ at the given output path. Must be executed within a CPL workspace or project directory
Usage: cpl build
- """)
+ """
+ )
def execute(self, args: list[str]):
"""
diff --git a/src/cpl_cli/command/custom_script_service.py b/src/cpl_cli/command/custom_script_service.py
index 3ef8b465..29578713 100644
--- a/src/cpl_cli/command/custom_script_service.py
+++ b/src/cpl_cli/command/custom_script_service.py
@@ -10,7 +10,6 @@ from cpl_cli.configuration.workspace_settings import WorkspaceSettings
class CustomScriptService(CommandABC):
-
def __init__(self, config: ConfigurationABC, env: ApplicationEnvironmentABC, ws: WorkspaceSettings):
"""
Service for CLI scripts
@@ -23,11 +22,11 @@ class CustomScriptService(CommandABC):
@property
def help_message(self) -> str:
- return ''
+ return ""
def execute(self, args: list[str]):
- cmd = self._config.get_configuration('ACTIVE_EXECUTABLE')
- wd = self._config.get_configuration('PATH_WORKSPACE')
+ cmd = self._config.get_configuration("ACTIVE_EXECUTABLE")
+ wd = self._config.get_configuration("PATH_WORKSPACE")
if wd is not None:
self._env.set_working_directory(wd)
@@ -35,16 +34,16 @@ class CustomScriptService(CommandABC):
if script != cmd:
continue
- command = ''
- external_args = self._config.get_configuration('ARGS')
+ command = ""
+ external_args = self._config.get_configuration("ARGS")
if external_args is not None:
command += f'ARGS="{external_args}";'
command += self._workspace.scripts[script]
env_vars = os.environ
- env_vars['CPL_ARGS'] = " ".join(args)
+ env_vars["CPL_ARGS"] = " ".join(args)
try:
- subprocess.run(command, shell=True if os.name == 'posix' else None)
+ subprocess.run(command, shell=True if os.name == "posix" else None)
except Exception as e:
Console.error(str(e))
diff --git a/src/cpl_cli/command/generate_service.py b/src/cpl_cli/command/generate_service.py
index 37946bcb..bdd5c92f 100644
--- a/src/cpl_cli/command/generate_service.py
+++ b/src/cpl_cli/command/generate_service.py
@@ -16,11 +16,10 @@ from cpl_core.utils.string import String
class GenerateService(CommandABC):
-
def __init__(
- self,
- configuration: ConfigurationABC,
- workspace: WorkspaceSettings,
+ self,
+ configuration: ConfigurationABC,
+ workspace: WorkspaceSettings,
):
"""
Service for the CLI command generate
@@ -37,7 +36,7 @@ class GenerateService(CommandABC):
self._schematic_classes = set()
for package_name, version in Dependencies.get_cpl_packages():
- if package_name == 'cpl-cli':
+ if package_name == "cpl-cli":
continue
package = importlib.import_module(String.convert_to_snake_case(package_name))
self._read_custom_schematics_from_path(os.path.dirname(package.__file__))
@@ -46,7 +45,7 @@ class GenerateService(CommandABC):
self._read_custom_schematics_from_path(self._env.runtime_directory)
if len(self._schematic_classes) == 0:
- Console.error(f'No schematics found in template directory: .cpl')
+ Console.error(f"No schematics found in template directory: .cpl")
sys.exit()
known_schematics = []
@@ -60,13 +59,14 @@ class GenerateService(CommandABC):
def help_message(self) -> str:
schematics = []
for schematic in self._schematics:
- aliases = '|'.join(self._schematics[schematic]['Aliases'])
+ aliases = "|".join(self._schematics[schematic]["Aliases"])
schematic_str = schematic
if len(aliases) > 0:
- schematic_str = f'{schematic} ({aliases})'
+ schematic_str = f"{schematic} ({aliases})"
schematics.append(schematic_str)
- help_msg = textwrap.dedent("""\
+ help_msg = textwrap.dedent(
+ """\
Generate a file based on schematic.
Usage: cpl generate
@@ -74,24 +74,25 @@ class GenerateService(CommandABC):
schematic: The schematic to generate.
name: The name of the generated file
- Schematics:""")
+ Schematics:"""
+ )
for schematic in schematics:
- help_msg += f'\n {schematic}'
+ help_msg += f"\n {schematic}"
return help_msg
def _read_custom_schematics_from_path(self, path: str):
- if not os.path.exists(os.path.join(path, '.cpl')):
+ if not os.path.exists(os.path.join(path, ".cpl")):
return
- sys.path.insert(0, os.path.join(path, '.cpl'))
- for r, d, f in os.walk(os.path.join(path, '.cpl')):
+ sys.path.insert(0, os.path.join(path, ".cpl"))
+ for r, d, f in os.walk(os.path.join(path, ".cpl")):
for file in f:
- if not file.startswith('schematic_') or not file.endswith('.py'):
+ if not file.startswith("schematic_") or not file.endswith(".py"):
continue
try:
- exec(open(os.path.join(r, file), 'r').read())
+ exec(open(os.path.join(r, file), "r").read())
self._schematic_classes.update(GenerateSchematicABC.__subclasses__())
except Exception as e:
Console.error(str(e), traceback.format_exc())
@@ -105,30 +106,32 @@ class GenerateService(CommandABC):
:param value:
:return:
"""
- with open(file_path, 'w') as template:
+ with open(file_path, "w") as template:
template.write(value)
template.close()
- def _create_init_files(self, file_path: str, template: GenerateSchematicABC, class_name: str, schematic: str, rel_path: str):
+ def _create_init_files(
+ self, file_path: str, template: GenerateSchematicABC, class_name: str, schematic: str, rel_path: str
+ ):
if not os.path.isdir(os.path.dirname(file_path)):
os.makedirs(os.path.dirname(file_path))
- directory = ''
- for subdir in template.path.split('/'):
+ directory = ""
+ for subdir in template.path.split("/"):
directory = os.path.join(directory, subdir)
- if subdir == 'src':
+ if subdir == "src":
continue
- file = self._schematics['init']['Template'](class_name, 'init', rel_path)
+ file = self._schematics["init"]["Template"](class_name, "init", rel_path)
if os.path.exists(os.path.join(os.path.abspath(directory), file.name)):
continue
Console.spinner(
- f'Creating {os.path.abspath(directory)}/{file.name}',
+ f"Creating {os.path.abspath(directory)}/{file.name}",
self._create_file,
os.path.join(os.path.abspath(directory), file.name),
file.get_code(),
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
def _generate(self, schematic: str, name: str, template: type):
@@ -140,10 +143,10 @@ class GenerateService(CommandABC):
:return:
"""
class_name = name
- rel_path = ''
- if '/' in name:
- parts = name.split('/')
- rel_path = '/'.join(parts[:-1])
+ rel_path = ""
+ if "/" in name:
+ parts = name.split("/")
+ rel_path = "/".join(parts[:-1])
class_name = parts[len(parts) - 1]
if self._workspace is not None and parts[0] in self._workspace.projects:
@@ -155,12 +158,12 @@ class GenerateService(CommandABC):
self._create_init_files(file_path, template, class_name, schematic, rel_path)
if os.path.isfile(file_path):
- Console.error(f'{String.first_to_upper(schematic)} already exists!\n')
+ Console.error(f"{String.first_to_upper(schematic)} already exists!\n")
sys.exit()
- message = f'Creating {self._env.working_directory}/{template.path}/{template.name}'
- if template.path == '':
- message = f'Creating {self._env.working_directory}/{template.name}'
+ message = f"Creating {self._env.working_directory}/{template.path}/{template.name}"
+ if template.path == "":
+ message = f"Creating {self._env.working_directory}/{template.name}"
Console.spinner(
message,
@@ -168,12 +171,12 @@ class GenerateService(CommandABC):
file_path,
template.get_code(),
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
def _get_schematic_by_alias(self, schematic: str) -> str:
for key in self._schematics:
- if schematic in self._schematics[key]['Aliases']:
+ if schematic in self._schematics[key]["Aliases"]:
return key
return schematic
@@ -192,25 +195,29 @@ class GenerateService(CommandABC):
schematic = s
break
- if schematic is None and len(args) >= 1 and (args[0] in self._schematics or self._get_schematic_by_alias(args[0]) != args[0]):
+ if (
+ schematic is None
+ and len(args) >= 1
+ and (args[0] in self._schematics or self._get_schematic_by_alias(args[0]) != args[0])
+ ):
schematic = self._get_schematic_by_alias(args[0])
self._config.add_configuration(schematic, args[1])
value = args[1]
if schematic is None:
- Console.error(f'Schematic not found')
+ Console.error(f"Schematic not found")
Console.write_line(self.help_message)
sys.exit()
name = value
if name is None:
- name = Console.read(f'Name for the {args[0]}: ')
+ name = Console.read(f"Name for the {args[0]}: ")
if schematic in self._schematics:
s = self._schematics[schematic]
self._generate(schematic, name, s["Template"])
else:
- self._help('Usage: cpl generate [options]')
+ self._help("Usage: cpl generate [options]")
Console.write_line()
sys.exit()
diff --git a/src/cpl_cli/command/help_service.py b/src/cpl_cli/command/help_service.py
index d22e0e98..0314aa02 100644
--- a/src/cpl_cli/command/help_service.py
+++ b/src/cpl_cli/command/help_service.py
@@ -8,7 +8,6 @@ from cpl_cli.command_abc import CommandABC
class HelpService(CommandABC):
-
def __init__(self, services: ServiceProviderABC):
"""
Service for CLI command help
@@ -19,10 +18,12 @@ class HelpService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Lists available command and their short descriptions.
Usage: cpl help
- """)
+ """
+ )
def execute(self, args: list[str]):
"""
@@ -34,24 +35,33 @@ class HelpService(CommandABC):
Console.error(f'Unexpected argument(s): {", ".join(args)}')
sys.exit()
- Console.write_line('Available Commands:')
+ Console.write_line("Available Commands:")
commands = [
- ['add (a|a)', 'Adds a project reference to given project.'],
- ['build (b|B)', 'Prepares files for publish into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.'],
- ['generate (g|G)', 'Generate a new file.'],
- ['help (h|H)', 'Lists available command and their short descriptions.'],
- ['install (i|I)', 'With argument installs packages to project, without argument installs project dependencies.'],
- ['new (n|N)', 'Creates new CPL project.'],
- ['publish (p|P)', 'Prepares files for publish into an output directory named dist/ at the given output path and executes setup.py. Must be executed from within a library workspace directory.'],
- ['remove (r|R)', 'Removes a project from workspace.'],
- ['start (s|S)', 'Starts CPL project, restarting on file changes.'],
- ['uninstall (ui|UI)', 'Uninstalls packages from project.'],
- ['update (u|u)', 'Update CPL and project dependencies.'],
- ['version (v|V)', 'Outputs CPL CLI version.']
+ ["add (a|a)", "Adds a project reference to given project."],
+ [
+ "build (b|B)",
+ "Prepares files for publish into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.",
+ ],
+ ["generate (g|G)", "Generate a new file."],
+ ["help (h|H)", "Lists available command and their short descriptions."],
+ [
+ "install (i|I)",
+ "With argument installs packages to project, without argument installs project dependencies.",
+ ],
+ ["new (n|N)", "Creates new CPL project."],
+ [
+ "publish (p|P)",
+ "Prepares files for publish into an output directory named dist/ at the given output path and executes setup.py. Must be executed from within a library workspace directory.",
+ ],
+ ["remove (r|R)", "Removes a project from workspace."],
+ ["start (s|S)", "Starts CPL project, restarting on file changes."],
+ ["uninstall (ui|UI)", "Uninstalls packages from project."],
+ ["update (u|u)", "Update CPL and project dependencies."],
+ ["version (v|V)", "Outputs CPL CLI version."],
]
for name, description in commands:
Console.set_foreground_color(ForegroundColorEnum.blue)
- Console.write(f'\n\t{name} ')
+ Console.write(f"\n\t{name} ")
Console.set_foreground_color(ForegroundColorEnum.default)
- Console.write(f'{description}')
- Console.write_line('\nRun \'cpl --help\' for command specific information\'s\n')
+ Console.write(f"{description}")
+ Console.write_line("\nRun 'cpl --help' for command specific information's\n")
diff --git a/src/cpl_cli/command/install_service.py b/src/cpl_cli/command/install_service.py
index bc756527..4192a645 100644
--- a/src/cpl_cli/command/install_service.py
+++ b/src/cpl_cli/command/install_service.py
@@ -21,9 +21,14 @@ from cpl_core.utils.pip import Pip
class InstallService(CommandABC):
-
- def __init__(self, config: ConfigurationABC, env: ApplicationEnvironmentABC, build_settings: BuildSettings,
- project_settings: ProjectSettings, cli_settings: CLISettings):
+ def __init__(
+ self,
+ config: ConfigurationABC,
+ env: ApplicationEnvironmentABC,
+ build_settings: BuildSettings,
+ project_settings: ProjectSettings,
+ cli_settings: CLISettings,
+ ):
"""
Service for the CLI command install
:param config:
@@ -44,17 +49,19 @@ class InstallService(CommandABC):
self._is_virtual = False
self._is_dev = False
- self._project_file = f'{self._project_settings.name}.json'
+ self._project_file = f"{self._project_settings.name}.json"
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Installs given package via pip
Usage: cpl install
Arguments:
package The package to install
- """)
+ """
+ )
def _wait(self, t: int, *args, source: str = None, stdout=None, stderr=None):
time.sleep(t)
@@ -65,43 +72,45 @@ class InstallService(CommandABC):
:return:
"""
if self._project_settings is None or self._build_settings is None:
- Error.error('The command requires to be run in an CPL project, but a project could not be found.')
+ Error.error("The command requires to be run in an CPL project, but a project could not be found.")
return
if self._project_settings.dependencies is None:
- Error.error(f'Found invalid dependencies in {self._project_file}.')
+ Error.error(f"Found invalid dependencies in {self._project_file}.")
return
for dependency in self._project_settings.dependencies:
Console.spinner(
- f'Installing: {dependency}',
- Pip.install if not self._is_virtual else self._wait, dependency if not self._is_virtual else 2,
- '--upgrade',
+ f"Installing: {dependency}",
+ Pip.install if not self._is_virtual else self._wait,
+ dependency if not self._is_virtual else 2,
+ "--upgrade",
source=self._cli_settings.pip_path,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
local_package = Pip.get_package(dependency)
if local_package is None:
- Error.warn(f'Installation of package {dependency} failed!')
+ Error.warn(f"Installation of package {dependency} failed!")
return
for dependency in self._project_settings.dev_dependencies:
Console.spinner(
- f'Installing dev: {dependency}',
- Pip.install if not self._is_virtual else self._wait, dependency if not self._is_virtual else 2,
- '--upgrade',
+ f"Installing dev: {dependency}",
+ Pip.install if not self._is_virtual else self._wait,
+ dependency if not self._is_virtual else 2,
+ "--upgrade",
source=self._cli_settings.pip_path,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
local_package = Pip.get_package(dependency)
if local_package is None:
- Error.warn(f'Installation of package {dependency} failed!')
+ Error.warn(f"Installation of package {dependency} failed!")
return
if not self._is_virtual:
@@ -115,18 +124,18 @@ class InstallService(CommandABC):
"""
is_already_in_project = False
if self._project_settings is None or self._build_settings is None:
- Error.error('The command requires to be run in an CPL project, but a project could not be found.')
+ Error.error("The command requires to be run in an CPL project, but a project could not be found.")
return
if self._project_settings.dependencies is None:
- Error.error(f'Found invalid dependencies in {self._project_file}.')
+ Error.error(f"Found invalid dependencies in {self._project_file}.")
return
- package_version = ''
+ package_version = ""
name = package
- if '==' in package:
- name = package.split('==')[0]
- package_version = package.split('==')[1]
+ if "==" in package:
+ name = package.split("==")[0]
+ package_version = package.split("==")[1]
to_remove_list = []
deps = self._project_settings.dependencies
@@ -134,13 +143,13 @@ class InstallService(CommandABC):
deps = self._project_settings.dev_dependencies
for dependency in deps:
- dependency_version = ''
+ dependency_version = ""
- if '==' in dependency:
- dependency_version = dependency.split('==')[1]
+ if "==" in dependency:
+ dependency_version = dependency.split("==")[1]
if name in dependency:
- if package_version != '' and version.parse(package_version) != version.parse(dependency_version):
+ if package_version != "" and version.parse(package_version) != version.parse(dependency_version):
to_remove_list.append(dependency)
break
else:
@@ -154,45 +163,48 @@ class InstallService(CommandABC):
local_package = Pip.get_package(package)
if local_package is not None and local_package in self._project_settings.dependencies:
- Error.warn(f'Package {local_package} is already installed.')
+ Error.warn(f"Package {local_package} is already installed.")
return
elif is_already_in_project:
- Error.warn(f'Package {package} is already installed.')
+ Error.warn(f"Package {package} is already installed.")
return
Console.spinner(
- f'Installing: {package}' if not self._is_dev else f'Installing dev: {package}',
- Pip.install if not self._is_virtual else self._wait, package if not self._is_virtual else 2,
+ f"Installing: {package}" if not self._is_dev else f"Installing dev: {package}",
+ Pip.install if not self._is_virtual else self._wait,
+ package if not self._is_virtual else 2,
source=self._cli_settings.pip_path,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
if self._is_virtual:
new_package = name
else:
new_package = Pip.get_package(name)
- if new_package is None \
- or '==' in package and \
- version.parse(package.split('==')[1]) != version.parse(new_package.split('==')[1]):
- Console.error(f'Installation of package {package} failed')
+ if (
+ new_package is None
+ or "==" in package
+ and version.parse(package.split("==")[1]) != version.parse(new_package.split("==")[1])
+ ):
+ Console.error(f"Installation of package {package} failed")
return
if not is_already_in_project:
new_name = package
- if '==' in new_package:
+ if "==" in new_package:
new_name = new_package
- elif '==' in name:
+ elif "==" in name:
new_name = name
- if '/' in new_name:
- new_name = new_name.split('/')[0]
+ if "/" in new_name:
+ new_name = new_name.split("/")[0]
- if '\r' in new_name:
- new_name = new_name.replace('\r', '')
+ if "\r" in new_name:
+ new_name = new_name.replace("\r", "")
if self._is_dev:
self._project_settings.dev_dependencies.append(new_name)
@@ -202,10 +214,10 @@ class InstallService(CommandABC):
if not self._is_simulation:
config = {
ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(self._project_settings),
- BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings)
+ BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings),
}
- with open(os.path.join(self._env.working_directory, self._project_file), 'w') as project_file:
+ with open(os.path.join(self._env.working_directory, self._project_file), "w") as project_file:
project_file.write(json.dumps(config, indent=2))
project_file.close()
@@ -217,31 +229,31 @@ class InstallService(CommandABC):
:param args:
:return:
"""
- if 'dev' in args:
+ if "dev" in args:
self._is_dev = True
- args.remove('dev')
+ args.remove("dev")
- if 'virtual' in args:
+ if "virtual" in args:
self._is_virtual = True
- args.remove('virtual')
- Console.write_line('Running in virtual mode:')
+ args.remove("virtual")
+ Console.write_line("Running in virtual mode:")
- if 'simulate' in args:
+ if "simulate" in args:
self._is_simulation = True
- args.remove('simulate')
- Console.write_line('Running in simulation mode:')
+ args.remove("simulate")
+ Console.write_line("Running in simulation mode:")
- if 'cpl-prod' in args:
- args.remove('cpl-prod')
- self._cli_settings.from_dict({'PipPath': 'https://pip.sh-edraft.de'})
+ if "cpl-prod" in args:
+ args.remove("cpl-prod")
+ self._cli_settings.from_dict({"PipPath": "https://pip.sh-edraft.de"})
- if 'cpl-exp' in args:
- args.remove('cpl-exp')
- self._cli_settings.from_dict({'PipPath': 'https://pip-exp.sh-edraft.de'})
+ if "cpl-exp" in args:
+ args.remove("cpl-exp")
+ self._cli_settings.from_dict({"PipPath": "https://pip-exp.sh-edraft.de"})
- if 'cpl-dev' in args:
- args.remove('cpl-dev')
- self._cli_settings.from_dict({'PipPath': 'https://pip-dev.sh-edraft.de'})
+ if "cpl-dev" in args:
+ args.remove("cpl-dev")
+ self._cli_settings.from_dict({"PipPath": "https://pip-dev.sh-edraft.de"})
VenvHelper.init_venv(self._is_virtual, self._env, self._project_settings)
diff --git a/src/cpl_cli/command/new_service.py b/src/cpl_cli/command/new_service.py
index 3c7ada15..82f76f88 100644
--- a/src/cpl_cli/command/new_service.py
+++ b/src/cpl_cli/command/new_service.py
@@ -28,7 +28,6 @@ from cpl_core.utils.string import String
class NewService(CommandABC):
-
def __init__(self, configuration: ConfigurationABC):
"""
Service for the CLI command new
@@ -47,8 +46,8 @@ class NewService(CommandABC):
self._project_type_classes = set()
- self._name: str = ''
- self._rel_path: str = ''
+ self._name: str = ""
+ self._rel_path: str = ""
self._project_type: ProjectTypeEnum = ProjectTypeEnum.console
self._use_nothing: bool = False
self._use_application_api: bool = False
@@ -60,7 +59,8 @@ class NewService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Generates a workspace and initial project or add a project to workspace.
Usage: cpl new
@@ -72,37 +72,32 @@ class NewService(CommandABC):
console (c|C)
library (l|L)
unittest (ut|UT)
- """)
+ """
+ )
def _create_project_settings(self):
self._rel_path = os.path.dirname(self._name)
self._project_dict = {
ProjectSettingsNameEnum.name.value: os.path.basename(self._name),
ProjectSettingsNameEnum.version.value: {
- VersionSettingsNameEnum.major.value: '0',
- VersionSettingsNameEnum.minor.value: '0',
- VersionSettingsNameEnum.micro.value: '0'
+ VersionSettingsNameEnum.major.value: "0",
+ VersionSettingsNameEnum.minor.value: "0",
+ VersionSettingsNameEnum.micro.value: "0",
},
- ProjectSettingsNameEnum.author.value: '',
- ProjectSettingsNameEnum.author_email.value: '',
- ProjectSettingsNameEnum.description.value: '',
- ProjectSettingsNameEnum.long_description.value: '',
- ProjectSettingsNameEnum.url.value: '',
- ProjectSettingsNameEnum.copyright_date.value: '',
- ProjectSettingsNameEnum.copyright_name.value: '',
- ProjectSettingsNameEnum.license_name.value: '',
- ProjectSettingsNameEnum.license_description.value: '',
- ProjectSettingsNameEnum.dependencies.value: [
- f'cpl-core>={version.parse(cpl_core.__version__)}'
- ],
- ProjectSettingsNameEnum.dev_dependencies.value: [
- f'cpl-cli>={version.parse(cpl_cli.__version__)}'
- ],
+ ProjectSettingsNameEnum.author.value: "",
+ ProjectSettingsNameEnum.author_email.value: "",
+ ProjectSettingsNameEnum.description.value: "",
+ ProjectSettingsNameEnum.long_description.value: "",
+ ProjectSettingsNameEnum.url.value: "",
+ ProjectSettingsNameEnum.copyright_date.value: "",
+ ProjectSettingsNameEnum.copyright_name.value: "",
+ ProjectSettingsNameEnum.license_name.value: "",
+ ProjectSettingsNameEnum.license_description.value: "",
+ ProjectSettingsNameEnum.dependencies.value: [f"cpl-core>={version.parse(cpl_core.__version__)}"],
+ ProjectSettingsNameEnum.dev_dependencies.value: [f"cpl-cli>={version.parse(cpl_cli.__version__)}"],
ProjectSettingsNameEnum.python_version.value: f'>={sys.version.split(" ")[0]}',
- ProjectSettingsNameEnum.python_path.value: {
- sys.platform: '../../venv/' if self._use_venv else ''
- },
- ProjectSettingsNameEnum.classifiers.value: []
+ ProjectSettingsNameEnum.python_path.value: {sys.platform: "../../venv/" if self._use_venv else ""},
+ ProjectSettingsNameEnum.classifiers.value: [],
}
self._project.from_dict(self._project_dict)
@@ -110,19 +105,15 @@ class NewService(CommandABC):
def _create_build_settings(self, project_type: str):
self._build_dict = {
BuildSettingsNameEnum.project_type.value: project_type,
- BuildSettingsNameEnum.source_path.value: '',
- BuildSettingsNameEnum.output_path.value: '../../dist',
- BuildSettingsNameEnum.main.value: f'{String.convert_to_snake_case(self._project.name)}.main',
+ BuildSettingsNameEnum.source_path.value: "",
+ BuildSettingsNameEnum.output_path.value: "../../dist",
+ BuildSettingsNameEnum.main.value: f"{String.convert_to_snake_case(self._project.name)}.main",
BuildSettingsNameEnum.entry_point.value: self._project.name,
BuildSettingsNameEnum.include_package_data.value: False,
BuildSettingsNameEnum.included.value: [],
- BuildSettingsNameEnum.excluded.value: [
- '*/__pycache__',
- '*/logs',
- '*/tests'
- ],
+ BuildSettingsNameEnum.excluded.value: ["*/__pycache__", "*/logs", "*/tests"],
BuildSettingsNameEnum.package_data.value: {},
- BuildSettingsNameEnum.project_references.value: []
+ BuildSettingsNameEnum.project_references.value: [],
}
self._build.from_dict(self._build_dict)
@@ -131,10 +122,7 @@ class NewService(CommandABC):
Creates cpl.json content
:return:
"""
- self._project_json = {
- ProjectSettings.__name__: self._project_dict,
- BuildSettings.__name__: self._build_dict
- }
+ self._project_json = {ProjectSettings.__name__: self._project_dict, BuildSettings.__name__: self._build_dict}
def _get_project_path(self) -> Optional[str]:
"""
@@ -144,12 +132,14 @@ class NewService(CommandABC):
if self._workspace is None:
project_path = os.path.join(self._env.working_directory, self._rel_path, self._project.name)
else:
- base = '' if self._use_base else 'src'
- project_path = os.path.join(self._env.working_directory, base, self._rel_path, String.convert_to_snake_case(self._project.name))
+ base = "" if self._use_base else "src"
+ project_path = os.path.join(
+ self._env.working_directory, base, self._rel_path, String.convert_to_snake_case(self._project.name)
+ )
if os.path.isdir(project_path) and len(os.listdir(project_path)) > 0:
Console.write_line(project_path)
- Console.error('Project path is not empty\n')
+ Console.error("Project path is not empty\n")
return None
return project_path
@@ -159,27 +149,33 @@ class NewService(CommandABC):
Gets project information's from user
:return:
"""
- is_unittest = project_type == 'unittest'
- is_library = project_type == 'library'
+ is_unittest = project_type == "unittest"
+ is_library = project_type == "library"
if is_library:
return
- if self._use_application_api or self._use_startup or self._use_service_providing or self._use_async or self._use_nothing:
+ if (
+ self._use_application_api
+ or self._use_startup
+ or self._use_service_providing
+ or self._use_async
+ or self._use_nothing
+ ):
Console.set_foreground_color(ForegroundColorEnum.default)
- Console.write_line('Skipping question due to given flags')
+ Console.write_line("Skipping question due to given flags")
return
if not is_unittest and not is_library:
- self._use_application_api = Console.read('Do you want to use application base? (y/n) ').lower() == 'y'
+ self._use_application_api = Console.read("Do you want to use application base? (y/n) ").lower() == "y"
if not is_unittest and self._use_application_api:
- self._use_startup = Console.read('Do you want to use startup? (y/n) ').lower() == 'y'
+ self._use_startup = Console.read("Do you want to use startup? (y/n) ").lower() == "y"
if not is_unittest and not self._use_application_api:
- self._use_service_providing = Console.read('Do you want to use service providing? (y/n) ').lower() == 'y'
+ self._use_service_providing = Console.read("Do you want to use service providing? (y/n) ").lower() == "y"
if not self._use_async:
- self._use_async = Console.read('Do you want to use async? (y/n) ').lower() == 'y'
+ self._use_async = Console.read("Do you want to use async? (y/n) ").lower() == "y"
Console.set_foreground_color(ForegroundColorEnum.default)
@@ -189,30 +185,32 @@ class NewService(CommandABC):
project = self._workspace.default_project
if self._env.working_directory.endswith(project):
- project = ''
+ project = ""
if self._workspace is None and self._use_base:
- project = f'{self._rel_path}/{project}'
+ project = f"{self._rel_path}/{project}"
VenvHelper.init_venv(
False,
self._env,
self._project,
- explicit_path=os.path.join(self._env.working_directory, project, self._project.python_executable.replace('../', ''))
+ explicit_path=os.path.join(
+ self._env.working_directory, project, self._project.python_executable.replace("../", "")
+ ),
)
def _read_custom_project_types_from_path(self, path: str):
- if not os.path.exists(os.path.join(path, '.cpl')):
+ if not os.path.exists(os.path.join(path, ".cpl")):
return
- sys.path.insert(0, os.path.join(path, '.cpl'))
- for r, d, f in os.walk(os.path.join(path, '.cpl')):
+ sys.path.insert(0, os.path.join(path, ".cpl"))
+ for r, d, f in os.walk(os.path.join(path, ".cpl")):
for file in f:
- if file.startswith('project_file_') or not file.startswith('project_') or not file.endswith('.py'):
+ if file.startswith("project_file_") or not file.startswith("project_") or not file.endswith(".py"):
continue
try:
- exec(open(os.path.join(r, file), 'r').read())
+ exec(open(os.path.join(r, file), "r").read())
self._project_type_classes.update(ProjectTypeABC.__subclasses__())
except Exception as e:
Console.error(str(e), traceback.format_exc())
@@ -220,7 +218,7 @@ class NewService(CommandABC):
def _create_project(self, project_type: str):
for package_name in Dependencies.get_cpl_packages():
- if package_name == 'cpl-cli':
+ if package_name == "cpl-cli":
continue
package = importlib.import_module(String.convert_to_snake_case(package_name[0]))
self._read_custom_project_types_from_path(os.path.dirname(package.__file__))
@@ -229,7 +227,7 @@ class NewService(CommandABC):
self._read_custom_project_types_from_path(self._env.runtime_directory)
if len(self._project_type_classes) == 0:
- Console.error(f'No project types found in template directory: .cpl')
+ Console.error(f"No project types found in template directory: .cpl")
sys.exit()
project_class = None
@@ -242,7 +240,7 @@ class NewService(CommandABC):
project_class = p
if project_class is None:
- Console.error(f'Project type {project_type} not found in template directory: .cpl/')
+ Console.error(f"Project type {project_type} not found in template directory: .cpl/")
sys.exit()
project_type = String.convert_to_snake_case(project_class.__name__)
@@ -255,60 +253,60 @@ class NewService(CommandABC):
self._get_project_information(project_type)
project_name = self._project.name
- if self._rel_path != '':
- project_name = f'{self._rel_path}/{project_name}'
+ if self._rel_path != "":
+ project_name = f"{self._rel_path}/{project_name}"
- base = 'src/'
- split_project_name = project_name.split('/')
+ base = "src/"
+ split_project_name = project_name.split("/")
if self._use_base and len(split_project_name) > 0:
- base = f'{split_project_name[0]}/'
+ base = f"{split_project_name[0]}/"
project = project_class(
- base if self._workspace is not None else 'src/',
+ base if self._workspace is not None else "src/",
project_name,
self._workspace,
self._use_application_api,
self._use_startup,
self._use_service_providing,
self._use_async,
- self._project_json
+ self._project_json,
)
if self._workspace is None:
TemplateBuilder.create_workspace(
- f'{project_name}/cpl-workspace.json',
- project_name.split('/')[-1],
+ f"{project_name}/cpl-workspace.json",
+ project_name.split("/")[-1],
{
project_name: f'{base if self._workspace is not None else "src/"}{String.convert_to_snake_case(project_name)}/{project_name}.json'
},
- {}
+ {},
)
else:
- self._workspace.projects[project_name] = f'{base if self._workspace is not None else "src/"}{String.convert_to_snake_case(project_name)}/{project_name}.json'
- TemplateBuilder.create_workspace('cpl-workspace.json', self._workspace.default_project, self._workspace.projects, self._workspace.scripts)
+ self._workspace.projects[
+ project_name
+ ] = f'{base if self._workspace is not None else "src/"}{String.convert_to_snake_case(project_name)}/{project_name}.json'
+ TemplateBuilder.create_workspace(
+ "cpl-workspace.json", self._workspace.default_project, self._workspace.projects, self._workspace.scripts
+ )
for template in project.templates:
- rel_base = '/'.join(project_name.split('/')[:-1])
- template_path_base = template.path.split('/')[0]
- if not self._use_base and rel_base != '' and template_path_base != '' and template_path_base != rel_base:
- template.path = template.path.replace(f'{template_path_base}/', f'{template_path_base}/{rel_base}/')
+ rel_base = "/".join(project_name.split("/")[:-1])
+ template_path_base = template.path.split("/")[0]
+ if not self._use_base and rel_base != "" and template_path_base != "" and template_path_base != rel_base:
+ template.path = template.path.replace(f"{template_path_base}/", f"{template_path_base}/{rel_base}/")
if template.name.endswith(f'{project_name.split("/")[-1]}.json'):
pass
- file_path = os.path.join(
- project_name if self._workspace is None else '',
- template.path,
- template.name
- )
+ file_path = os.path.join(project_name if self._workspace is None else "", template.path, template.name)
Console.spinner(
- f'Creating {file_path}',
+ f"Creating {file_path}",
TemplateBuilder.build,
file_path,
template,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
if self._use_venv:
@@ -320,42 +318,42 @@ class NewService(CommandABC):
:param args:
:return:
"""
- if 'nothing' in args:
+ if "nothing" in args:
self._use_nothing = True
self._use_async = False
self._use_application_api = False
self._use_startup = False
self._use_service_providing = False
- if 'async' in args:
- args.remove('async')
- if 'application-base' in args:
- args.remove('application-base')
- if 'startup' in args:
- args.remove('startup')
- if 'service-providing' in args:
- args.remove('service-providing')
+ if "async" in args:
+ args.remove("async")
+ if "application-base" in args:
+ args.remove("application-base")
+ if "startup" in args:
+ args.remove("startup")
+ if "service-providing" in args:
+ args.remove("service-providing")
- if 'async' in args:
+ if "async" in args:
self._use_async = True
- args.remove('async')
- if 'application-base' in args:
+ args.remove("async")
+ if "application-base" in args:
self._use_application_api = True
- args.remove('application-base')
- if 'startup' in args:
+ args.remove("application-base")
+ if "startup" in args:
self._use_startup = True
- args.remove('startup')
- if 'service-providing' in args:
+ args.remove("startup")
+ if "service-providing" in args:
self._use_service_providing = True
- args.remove('service-providing')
- if 'venv' in args:
+ args.remove("service-providing")
+ if "venv" in args:
self._use_venv = True
- args.remove('venv')
- if 'base' in args:
+ args.remove("venv")
+ if "base" in args:
self._use_base = True
- args.remove('base')
+ args.remove("base")
if len(args) <= 1:
- Console.error(f'Project type not found')
+ Console.error(f"Project type not found")
Console.write_line(self.help_message)
return
diff --git a/src/cpl_cli/command/publish_service.py b/src/cpl_cli/command/publish_service.py
index f455e16c..4db4b972 100644
--- a/src/cpl_cli/command/publish_service.py
+++ b/src/cpl_cli/command/publish_service.py
@@ -5,7 +5,6 @@ from cpl_cli.publish.publisher_abc import PublisherABC
class PublishService(CommandABC):
-
def __init__(self, publisher: PublisherABC):
"""
Service for the CLI command publish
@@ -17,10 +16,12 @@ class PublishService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Prepares files for publish into an output directory named dist/ at the given output path and executes setup.py.
Usage: cpl publish
- """)
+ """
+ )
def execute(self, args: list[str]):
"""
diff --git a/src/cpl_cli/command/remove_service.py b/src/cpl_cli/command/remove_service.py
index 87db8b7a..d0dca5b0 100644
--- a/src/cpl_cli/command/remove_service.py
+++ b/src/cpl_cli/command/remove_service.py
@@ -10,11 +10,16 @@ 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, BuildSettingsNameEnum, ProjectSettings, BuildSettings
+from cpl_cli.configuration import (
+ WorkspaceSettings,
+ WorkspaceSettingsNameEnum,
+ BuildSettingsNameEnum,
+ ProjectSettings,
+ BuildSettings,
+)
class RemoveService(CommandABC):
-
def __init__(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
"""
Service for CLI command remove
@@ -31,13 +36,15 @@ class RemoveService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Removes a project from workspace.
Usage: cpl remove
Arguments:
project The name of the project to delete
- """)
+ """
+ )
def _create_file(self, file_name: str, content: dict):
if self._is_simulation:
@@ -50,7 +57,7 @@ class RemoveService(CommandABC):
if not os.path.isdir(path):
os.makedirs(path)
- with open(file_name, 'w') as project_json:
+ with open(file_name, "w") as project_json:
project_json.write(json.dumps(content, indent=2))
project_json.close()
@@ -64,14 +71,14 @@ class RemoveService(CommandABC):
WorkspaceSettings.__name__: {
WorkspaceSettingsNameEnum.default_project.value: self._workspace.default_project,
WorkspaceSettingsNameEnum.projects.value: self._workspace.projects,
- WorkspaceSettingsNameEnum.scripts.value: self._workspace.scripts
+ WorkspaceSettingsNameEnum.scripts.value: self._workspace.scripts,
}
}
self._create_file(path, ws_dict)
def _get_project_settings(self, project: str) -> dict:
- with open(os.path.join(os.getcwd(), self._workspace.projects[project]), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), self._workspace.projects[project]), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -79,11 +86,12 @@ class RemoveService(CommandABC):
return project_json
def _write_project_settings(self, project: str, project_settings: dict, build_settings: dict):
- with open(os.path.join(os.getcwd(), self._workspace.projects[project]), 'w', encoding='utf-8') as file:
- file.write(json.dumps({
- ProjectSettings.__name__: project_settings,
- BuildSettings.__name__: build_settings
- }, indent=2))
+ with open(os.path.join(os.getcwd(), self._workspace.projects[project]), "w", encoding="utf-8") as file:
+ file.write(
+ json.dumps(
+ {ProjectSettings.__name__: project_settings, BuildSettings.__name__: build_settings}, indent=2
+ )
+ )
file.close()
def _find_deps_in_projects(self, project_name: str, rel_path: str):
@@ -92,26 +100,34 @@ class RemoveService(CommandABC):
continue
project_settings = self._get_project_settings(project)
- if BuildSettings.__name__ not in project_settings or BuildSettingsNameEnum.project_references.value not in project_settings[BuildSettings.__name__]:
+ if (
+ BuildSettings.__name__ not in project_settings
+ or BuildSettingsNameEnum.project_references.value not in project_settings[BuildSettings.__name__]
+ ):
continue
- ref_to_delete = ''
+ ref_to_delete = ""
for ref in project_settings[BuildSettings.__name__][BuildSettingsNameEnum.project_references.value]:
- if os.path.basename(ref) == f'{project_name}.json':
+ if os.path.basename(ref) == f"{project_name}.json":
ref_to_delete = ref
- if ref_to_delete not in project_settings[BuildSettings.__name__][BuildSettingsNameEnum.project_references.value]:
+ if (
+ ref_to_delete
+ not in project_settings[BuildSettings.__name__][BuildSettingsNameEnum.project_references.value]
+ ):
continue
- project_settings[BuildSettings.__name__][BuildSettingsNameEnum.project_references.value].remove(ref_to_delete)
+ project_settings[BuildSettings.__name__][BuildSettingsNameEnum.project_references.value].remove(
+ ref_to_delete
+ )
Console.spinner(
- f'Removing {project_name} from {project}',
+ f"Removing {project_name} from {project}",
self._write_project_settings,
project,
project_settings[ProjectSettings.__name__],
project_settings[BuildSettings.__name__],
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
def execute(self, args: list[str]):
@@ -120,37 +136,37 @@ class RemoveService(CommandABC):
:param args:
:return:
"""
- if 'simulate' in args:
- args.remove('simulate')
- Console.write_line('Running in simulation mode:')
+ if "simulate" in args:
+ args.remove("simulate")
+ Console.write_line("Running in simulation mode:")
self._is_simulation = True
project_name = args[0]
if project_name not in self._workspace.projects:
- Console.error(f'Project {project_name} not found in workspace.')
+ Console.error(f"Project {project_name} not found in workspace.")
return
if project_name == self._workspace.default_project:
- Console.error(f'Project {project_name} is the default project.')
+ Console.error(f"Project {project_name} is the default project.")
return
src_path = os.path.dirname(self._workspace.projects[project_name])
Console.spinner(
- f'Removing {src_path}',
+ f"Removing {src_path}",
self._remove_sources,
os.path.abspath(src_path),
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
self._find_deps_in_projects(project_name, src_path)
del self._workspace.projects[project_name]
- path = 'cpl-workspace.json'
+ path = "cpl-workspace.json"
Console.spinner(
- f'Changing {path}',
+ f"Changing {path}",
self._create_workspace,
path,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
diff --git a/src/cpl_cli/command/run_service.py b/src/cpl_cli/command/run_service.py
index 8e2fe2b8..6d9360d6 100644
--- a/src/cpl_cli/command/run_service.py
+++ b/src/cpl_cli/command/run_service.py
@@ -17,16 +17,16 @@ from cpl_core.utils.string import String
class RunService(CommandABC):
-
- def __init__(self,
- config: ConfigurationABC,
- env: ApplicationEnvironmentABC,
- services: ServiceProviderABC,
- project_settings: ProjectSettings,
- build_settings: BuildSettings,
- workspace: WorkspaceSettings,
- publisher: PublisherService,
- ):
+ def __init__(
+ self,
+ config: ConfigurationABC,
+ env: ApplicationEnvironmentABC,
+ services: ServiceProviderABC,
+ project_settings: ProjectSettings,
+ build_settings: BuildSettings,
+ workspace: WorkspaceSettings,
+ publisher: PublisherService,
+ ):
"""
Service for the CLI command start
:param config:
@@ -51,18 +51,20 @@ class RunService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Starts your application.
Usage: cpl run
- """)
+ """
+ )
def _set_project_by_args(self, name: str):
if self._workspace is None:
- Error.error('The command requires to be run in an CPL workspace, but a workspace could not be found.')
+ Error.error("The command requires to be run in an CPL workspace, but a workspace could not be found.")
sys.exit()
if name not in self._workspace.projects:
- Error.error(f'Project {name} not found in workspace')
+ Error.error(f"Project {name} not found in workspace")
sys.exit()
project_path = self._workspace.projects[name]
@@ -70,7 +72,7 @@ class RunService(CommandABC):
self._config.add_configuration(ProjectSettings, None)
self._config.add_configuration(BuildSettings, None)
- working_directory = self._config.get_configuration('PATH_WORKSPACE')
+ working_directory = self._config.get_configuration("PATH_WORKSPACE")
if working_directory is not None:
self._env.set_working_directory(working_directory)
@@ -80,7 +82,7 @@ class RunService(CommandABC):
self._build_settings: BuildSettings = self._config.get_configuration(BuildSettings)
if self._project_settings is None or self._build_settings is None:
- Error.error(f'Project {name} not found')
+ Error.error(f"Project {name} not found")
sys.exit()
self._src_dir = os.path.dirname(json_file)
@@ -92,13 +94,15 @@ class RunService(CommandABC):
self._env.set_working_directory(self._src_dir)
self._publisher.build()
self._env.set_working_directory(self._src_dir)
- self._src_dir = os.path.abspath(os.path.join(
- self._src_dir,
- self._build_settings.output_path,
- self._project_settings.name,
- 'build',
- String.convert_to_snake_case(self._project_settings.name)
- ))
+ self._src_dir = os.path.abspath(
+ os.path.join(
+ self._src_dir,
+ self._build_settings.output_path,
+ self._project_settings.name,
+ "build",
+ String.convert_to_snake_case(self._project_settings.name),
+ )
+ )
def execute(self, args: list[str]):
"""
@@ -106,9 +110,9 @@ class RunService(CommandABC):
:param args:
:return:
"""
- if 'dev' in args:
+ if "dev" in args:
self._is_dev = True
- args.remove('dev')
+ args.remove("dev")
if len(args) >= 1:
self._set_project_by_args(args[0])
diff --git a/src/cpl_cli/command/start_service.py b/src/cpl_cli/command/start_service.py
index e638dcd7..2f9e2b7a 100644
--- a/src/cpl_cli/command/start_service.py
+++ b/src/cpl_cli/command/start_service.py
@@ -5,7 +5,6 @@ from cpl_cli.live_server.live_server_service import LiveServerService
class StartService(CommandABC):
-
def __init__(self, live_server: LiveServerService):
"""
Service for the CLI command start
@@ -17,10 +16,12 @@ class StartService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Starts your application, restarting on file changes.
Usage: cpl start
- """)
+ """
+ )
def execute(self, args: list[str]):
"""
diff --git a/src/cpl_cli/command/uninstall_service.py b/src/cpl_cli/command/uninstall_service.py
index 585f728a..7f687961 100644
--- a/src/cpl_cli/command/uninstall_service.py
+++ b/src/cpl_cli/command/uninstall_service.py
@@ -17,9 +17,13 @@ from cpl_cli.configuration.settings_helper import SettingsHelper
class UninstallService(CommandABC):
-
- def __init__(self, config: ConfigurationABC, env: ApplicationEnvironmentABC, build_settings: BuildSettings,
- project_settings: ProjectSettings):
+ def __init__(
+ self,
+ config: ConfigurationABC,
+ env: ApplicationEnvironmentABC,
+ build_settings: BuildSettings,
+ project_settings: ProjectSettings,
+ ):
"""
Service for the CLI command uninstall
:param config:
@@ -33,23 +37,25 @@ class UninstallService(CommandABC):
self._env = env
self._build_settings = build_settings
self._project_settings = project_settings
-
+
self._is_simulating = False
self._is_virtual = False
self._is_dev = False
- self._project_file = f'{self._project_settings.name}.json'
+ self._project_file = f"{self._project_settings.name}.json"
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Uninstalls given package via pip
Usage: cpl uninstall
Arguments:
package The package to uninstall
- """)
-
+ """
+ )
+
def _wait(self, t: int, *args, source: str = None, stdout=None, stderr=None):
time.sleep(t)
@@ -60,23 +66,23 @@ class UninstallService(CommandABC):
:return:
"""
if len(args) == 0:
- Console.error(f'Expected package')
- Console.error(f'Usage: cpl uninstall ')
+ Console.error(f"Expected package")
+ Console.error(f"Usage: cpl uninstall ")
return
- if 'dev' in args:
+ if "dev" in args:
self._is_dev = True
- args.remove('dev')
+ args.remove("dev")
- if '--virtual' in args:
+ if "--virtual" in args:
self._is_virtual = True
- args.remove('--virtual')
- Console.write_line('Running in virtual mode:')
-
- if '--simulate' in args:
+ args.remove("--virtual")
+ Console.write_line("Running in virtual mode:")
+
+ if "--simulate" in args:
self._is_virtual = True
- args.remove('--simulate')
- Console.write_line('Running in simulation mode:')
+ args.remove("--simulate")
+ Console.write_line("Running in simulation mode:")
VenvHelper.init_venv(self._is_virtual, self._env, self._project_settings)
@@ -98,19 +104,20 @@ class UninstallService(CommandABC):
package = dependency
if not is_in_dependencies and pip_package is None:
- Console.error(f'Package {package} not found')
+ Console.error(f"Package {package} not found")
return
elif not is_in_dependencies and pip_package is not None:
package = pip_package
Console.spinner(
- f'Uninstalling: {package}' if not self._is_dev else f'Uninstalling dev: {package}',
- Pip.uninstall if not self._is_virtual else self._wait, package if not self._is_virtual else 2,
+ f"Uninstalling: {package}" if not self._is_dev else f"Uninstalling dev: {package}",
+ Pip.uninstall if not self._is_virtual else self._wait,
+ package if not self._is_virtual else 2,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
deps = self._project_settings.dependencies
@@ -122,12 +129,12 @@ class UninstallService(CommandABC):
if not self._is_simulating:
config = {
ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(self._project_settings),
- BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings)
+ BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings),
}
- with open(os.path.join(self._env.working_directory, self._project_file), 'w') as project_file:
+ with open(os.path.join(self._env.working_directory, self._project_file), "w") as project_file:
project_file.write(json.dumps(config, indent=2))
project_file.close()
- Console.write_line(f'Removed {package}')
+ Console.write_line(f"Removed {package}")
if not self._is_virtual:
Pip.reset_executable()
diff --git a/src/cpl_cli/command/update_service.py b/src/cpl_cli/command/update_service.py
index 6a2c8712..bb8964dc 100644
--- a/src/cpl_cli/command/update_service.py
+++ b/src/cpl_cli/command/update_service.py
@@ -18,14 +18,15 @@ from cpl_cli.configuration.settings_helper import SettingsHelper
class UpdateService(CommandABC):
-
- def __init__(self,
- config: ConfigurationABC,
- env: ApplicationEnvironmentABC,
- build_settings: BuildSettings,
- project_settings: ProjectSettings,
- cli_settings: CLISettings,
- migrations: MigrationServiceABC):
+ def __init__(
+ self,
+ config: ConfigurationABC,
+ env: ApplicationEnvironmentABC,
+ build_settings: BuildSettings,
+ project_settings: ProjectSettings,
+ cli_settings: CLISettings,
+ migrations: MigrationServiceABC,
+ ):
"""
Service for the CLI command update
:param config:
@@ -44,14 +45,16 @@ class UpdateService(CommandABC):
self._migrations = migrations
self._is_simulation = False
- self._project_file = f'{self._project_settings.name}.json'
+ self._project_file = f"{self._project_settings.name}.json"
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Updates the CPL and project dependencies.
Usage: cpl update
- """)
+ """
+ )
def _collect_project_dependencies(self) -> list[tuple]:
"""
@@ -61,8 +64,8 @@ class UpdateService(CommandABC):
dependencies = []
for package in [*self._project_settings.dependencies, *self._project_settings.dev_dependencies]:
name = package
- if '==' in package:
- name = package.split('==')[0]
+ if "==" in package:
+ name = package.split("==")[0]
dependencies.append((package, name))
@@ -76,17 +79,17 @@ class UpdateService(CommandABC):
for package, name in dependencies:
Pip.install(
name,
- '--upgrade',
- '--upgrade-strategy',
- 'eager',
+ "--upgrade",
+ "--upgrade-strategy",
+ "eager",
source=self._cli_settings.pip_path,
stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL
+ stderr=subprocess.DEVNULL,
)
new_package = Pip.get_package(name)
if new_package is None:
- Console.error(f'Update for package {package} failed')
+ Console.error(f"Update for package {package} failed")
continue
self._project_json_update_dependency(package, new_package)
@@ -97,27 +100,32 @@ class UpdateService(CommandABC):
:return:
"""
dependencies = Console.spinner(
- 'Collecting installed dependencies', self._collect_project_dependencies,
+ "Collecting installed dependencies",
+ self._collect_project_dependencies,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
Console.spinner(
- 'Updating installed dependencies', self._update_project_dependencies, dependencies,
+ "Updating installed dependencies",
+ self._update_project_dependencies,
+ dependencies,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
- if 'cpl-cli' in [y for x, y in dependencies]:
+ if "cpl-cli" in [y for x, y in dependencies]:
import cpl_cli
Console.spinner(
- 'Running migrations', self._migrations.migrate_from, cpl_cli.__version__,
+ "Running migrations",
+ self._migrations.migrate_from,
+ cpl_cli.__version__,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
- Console.write_line(f'Found {len(self._project_settings.dependencies)} dependencies.')
+ Console.write_line(f"Found {len(self._project_settings.dependencies)} dependencies.")
@staticmethod
def _check_outdated():
@@ -126,19 +134,20 @@ class UpdateService(CommandABC):
:return:
"""
table_str: bytes = Console.spinner(
- 'Analyzing for available package updates', Pip.get_outdated,
+ "Analyzing for available package updates",
+ Pip.get_outdated,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
- table = str(table_str, 'utf-8').split('\n')
- if len(table) > 1 and table[0] != '':
- Console.write_line('\tAvailable updates for packages:')
+ table = str(table_str, "utf-8").split("\n")
+ if len(table) > 1 and table[0] != "":
+ Console.write_line("\tAvailable updates for packages:")
for row in table:
- Console.write_line(f'\t{row}')
+ Console.write_line(f"\t{row}")
Console.set_foreground_color(ForegroundColorEnum.yellow)
- Console.write_line(f'\tUpdate with {Pip.get_executable()} -m pip install --upgrade ')
+ Console.write_line(f"\tUpdate with {Pip.get_executable()} -m pip install --upgrade ")
Console.set_foreground_color(ForegroundColorEnum.default)
def _project_json_update_dependency(self, old_package: str, new_package: str):
@@ -153,20 +162,20 @@ class UpdateService(CommandABC):
if old_package in self._project_settings.dependencies:
index = self._project_settings.dependencies.index(old_package)
- if '/' in new_package:
- new_package = new_package.split('/')[0]
+ if "/" in new_package:
+ new_package = new_package.split("/")[0]
- if '\r' in new_package:
- new_package = new_package.replace('\r', '')
+ if "\r" in new_package:
+ new_package = new_package.replace("\r", "")
self._project_settings.dependencies[index] = new_package
config = {
ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(self._project_settings),
- BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings)
+ BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings),
}
- with open(os.path.join(self._env.working_directory, self._project_file), 'w') as project:
+ with open(os.path.join(self._env.working_directory, self._project_file), "w") as project:
project.write(json.dumps(config, indent=2))
project.close()
@@ -176,22 +185,22 @@ class UpdateService(CommandABC):
:param args:
:return:
"""
- if 'simulate' in args:
- args.remove('simulate')
- Console.write_line('Running in simulation mode:')
+ if "simulate" in args:
+ args.remove("simulate")
+ Console.write_line("Running in simulation mode:")
self._is_simulation = True
- if 'cpl-prod' in args:
- args.remove('cpl-prod')
- self._cli_settings.from_dict({'PipPath': 'https://pip.sh-edraft.de'})
+ if "cpl-prod" in args:
+ args.remove("cpl-prod")
+ self._cli_settings.from_dict({"PipPath": "https://pip.sh-edraft.de"})
- if 'cpl-exp' in args:
- args.remove('cpl-exp')
- self._cli_settings.from_dict({'PipPath': 'https://pip-exp.sh-edraft.de'})
+ if "cpl-exp" in args:
+ args.remove("cpl-exp")
+ self._cli_settings.from_dict({"PipPath": "https://pip-exp.sh-edraft.de"})
- if 'cpl-dev' in args:
- args.remove('cpl-dev')
- self._cli_settings.from_dict({'PipPath': 'https://pip-dev.sh-edraft.de'})
+ if "cpl-dev" in args:
+ args.remove("cpl-dev")
+ self._cli_settings.from_dict({"PipPath": "https://pip-dev.sh-edraft.de"})
VenvHelper.init_venv(False, self._env, self._project_settings)
diff --git a/src/cpl_cli/command/version_service.py b/src/cpl_cli/command/version_service.py
index 03ae7726..fb9837d6 100644
--- a/src/cpl_cli/command/version_service.py
+++ b/src/cpl_cli/command/version_service.py
@@ -12,7 +12,6 @@ from cpl_cli.command_abc import CommandABC
class VersionService(CommandABC):
-
def __init__(self):
"""
Service for the CLI command version
@@ -21,10 +20,12 @@ class VersionService(CommandABC):
@property
def help_message(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
Lists the version of CPL, CPL CLI and all installed packages from pip.
Usage: cpl version
- """)
+ """
+ )
def execute(self, args: list[str]):
"""
@@ -33,16 +34,16 @@ class VersionService(CommandABC):
:return:
"""
Console.set_foreground_color(ForegroundColorEnum.yellow)
- Console.banner('CPL CLI')
+ Console.banner("CPL CLI")
Console.set_foreground_color(ForegroundColorEnum.default)
- if '__version__' in dir(cpl_cli):
- Console.write_line(f'Common Python library CLI: ')
+ if "__version__" in dir(cpl_cli):
+ Console.write_line(f"Common Python library CLI: ")
Console.write(cpl_cli.__version__)
- Console.write_line(f'Python: ')
- Console.write(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')
- Console.write_line(f'OS: {platform.system()} {platform.processor()}')
- Console.write_line('\nCPL packages:')
- Console.table(['Name', 'Version'], Dependencies.get_cpl_packages())
- Console.write_line('\nPython packages:')
- Console.table(['Name', 'Version'], Dependencies.get_packages())
+ Console.write_line(f"Python: ")
+ Console.write(f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")
+ Console.write_line(f"OS: {platform.system()} {platform.processor()}")
+ Console.write_line("\nCPL packages:")
+ Console.table(["Name", "Version"], Dependencies.get_cpl_packages())
+ Console.write_line("\nPython packages:")
+ Console.table(["Name", "Version"], Dependencies.get_packages())
diff --git a/src/cpl_cli/command_abc.py b/src/cpl_cli/command_abc.py
index 59ec51e4..cb6a662f 100644
--- a/src/cpl_cli/command_abc.py
+++ b/src/cpl_cli/command_abc.py
@@ -5,20 +5,21 @@ from cpl_core.console import Console
class CommandABC(ArgumentExecutableABC):
-
@abstractmethod
def __init__(self):
ABC.__init__(self)
@property
@abstractmethod
- def help_message(self) -> str: pass
+ def help_message(self) -> str:
+ pass
@abstractmethod
- def execute(self, args: list[str]): pass
+ def execute(self, args: list[str]):
+ pass
def run(self, args: list[str]):
- if 'help' in args:
+ if "help" in args:
Console.write_line(self.help_message)
return
diff --git a/src/cpl_cli/configuration/__init__.py b/src/cpl_cli/configuration/__init__.py
index 406767ad..f0deecc5 100644
--- a/src/cpl_cli/configuration/__init__.py
+++ b/src/cpl_cli/configuration/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.configuration'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.configuration"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -30,5 +30,5 @@ from .version_settings_name_enum import VersionSettingsNameEnum
from .workspace_settings import WorkspaceSettings
from .workspace_settings_name_enum import WorkspaceSettingsNameEnum
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/configuration/build_settings.py b/src/cpl_cli/configuration/build_settings.py
index 1909469a..027f4e15 100644
--- a/src/cpl_cli/configuration/build_settings.py
+++ b/src/cpl_cli/configuration/build_settings.py
@@ -10,7 +10,6 @@ from cpl_cli.configuration.project_type_enum import ProjectTypeEnum
class BuildSettings(ConfigurationModelABC):
-
def __init__(self):
ConfigurationModelABC.__init__(self)
@@ -82,27 +81,26 @@ class BuildSettings(ConfigurationModelABC):
else:
self._project_references = []
- if sys.platform == 'win32':
- self._source_path = str(self._source_path).replace('/', '\\')
- self._output_path = str(self._output_path).replace('/', '\\')
+ if sys.platform == "win32":
+ self._source_path = str(self._source_path).replace("/", "\\")
+ self._output_path = str(self._output_path).replace("/", "\\")
# windows paths for excluded files
excluded = []
for ex in self._excluded:
- excluded.append(str(ex).replace('/', '\\'))
+ excluded.append(str(ex).replace("/", "\\"))
self._excluded = excluded
# windows paths for included files
included = []
for inc in self._included:
- included.append(str(inc).replace('/', '\\'))
+ included.append(str(inc).replace("/", "\\"))
self._included = included
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
- Console.write_line(
- f'[ ERROR ] [ {__name__} ]: Reading error in {BuildSettings.__name__} settings')
- Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.write_line(f"[ ERROR ] [ {__name__} ]: Reading error in {BuildSettings.__name__} settings")
+ Console.write_line(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
Console.set_foreground_color(ForegroundColorEnum.default)
diff --git a/src/cpl_cli/configuration/build_settings_name_enum.py b/src/cpl_cli/configuration/build_settings_name_enum.py
index 5c0dee28..7b5e0cf3 100644
--- a/src/cpl_cli/configuration/build_settings_name_enum.py
+++ b/src/cpl_cli/configuration/build_settings_name_enum.py
@@ -2,14 +2,13 @@ from enum import Enum
class BuildSettingsNameEnum(Enum):
-
- project_type = 'ProjectType'
- source_path = 'SourcePath'
- output_path = 'OutputPath'
- main = 'Main'
- entry_point = 'EntryPoint'
- include_package_data = 'IncludePackageData'
- included = 'Included'
- excluded = 'Excluded'
- package_data = 'PackageData'
- project_references = 'ProjectReferences'
+ project_type = "ProjectType"
+ source_path = "SourcePath"
+ output_path = "OutputPath"
+ main = "Main"
+ entry_point = "EntryPoint"
+ include_package_data = "IncludePackageData"
+ included = "Included"
+ excluded = "Excluded"
+ package_data = "PackageData"
+ project_references = "ProjectReferences"
diff --git a/src/cpl_cli/configuration/project_settings.py b/src/cpl_cli/configuration/project_settings.py
index 86e2dbc3..1b99af6e 100644
--- a/src/cpl_cli/configuration/project_settings.py
+++ b/src/cpl_cli/configuration/project_settings.py
@@ -12,7 +12,6 @@ from cpl_core.console.foreground_color_enum import ForegroundColorEnum
class ProjectSettings(ConfigurationModelABC):
-
def __init__(self):
ConfigurationModelABC.__init__(self)
@@ -122,15 +121,18 @@ class ProjectSettings(ConfigurationModelABC):
self._python_version = settings[ProjectSettingsNameEnum.python_version.value]
self._python_path = settings[ProjectSettingsNameEnum.python_path.value]
- if ProjectSettingsNameEnum.python_path.value in settings and sys.platform in settings[ProjectSettingsNameEnum.python_path.value]:
- path = f'{settings[ProjectSettingsNameEnum.python_path.value][sys.platform]}'
+ if (
+ ProjectSettingsNameEnum.python_path.value in settings
+ and sys.platform in settings[ProjectSettingsNameEnum.python_path.value]
+ ):
+ path = f"{settings[ProjectSettingsNameEnum.python_path.value][sys.platform]}"
- if path == '' or path is None:
- Error.warn(f'{ProjectSettingsNameEnum.python_path.value} not set')
+ if path == "" or path is None:
+ Error.warn(f"{ProjectSettingsNameEnum.python_path.value} not set")
path = sys.executable
else:
- if not path.endswith('bin/python'):
- path = os.path.join(path, 'bin/python')
+ if not path.endswith("bin/python"):
+ path = os.path.join(path, "bin/python")
else:
path = sys.executable
@@ -143,6 +145,6 @@ class ProjectSettings(ConfigurationModelABC):
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
- Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {ProjectSettings.__name__} settings')
- Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.write_line(f"[ ERROR ] [ {__name__} ]: Reading error in {ProjectSettings.__name__} settings")
+ Console.write_line(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
Console.set_foreground_color(ForegroundColorEnum.default)
diff --git a/src/cpl_cli/configuration/project_settings_name_enum.py b/src/cpl_cli/configuration/project_settings_name_enum.py
index 17d2319b..fbd45ff3 100644
--- a/src/cpl_cli/configuration/project_settings_name_enum.py
+++ b/src/cpl_cli/configuration/project_settings_name_enum.py
@@ -2,19 +2,19 @@ from enum import Enum
class ProjectSettingsNameEnum(Enum):
- name = 'Name'
- version = 'Version'
- author = 'Author'
- author_email = 'AuthorEmail'
- description = 'Description'
- long_description = 'LongDescription'
- url = 'URL'
- copyright_date = 'CopyrightDate'
- copyright_name = 'CopyrightName'
- license_name = 'LicenseName'
- license_description = 'LicenseDescription'
- dependencies = 'Dependencies'
- dev_dependencies = 'DevDependencies'
- python_version = 'PythonVersion'
- python_path = 'PythonPath'
- classifiers = 'Classifiers'
+ name = "Name"
+ version = "Version"
+ author = "Author"
+ author_email = "AuthorEmail"
+ description = "Description"
+ long_description = "LongDescription"
+ url = "URL"
+ copyright_date = "CopyrightDate"
+ copyright_name = "CopyrightName"
+ license_name = "LicenseName"
+ license_description = "LicenseDescription"
+ dependencies = "Dependencies"
+ dev_dependencies = "DevDependencies"
+ python_version = "PythonVersion"
+ python_path = "PythonPath"
+ classifiers = "Classifiers"
diff --git a/src/cpl_cli/configuration/project_type_enum.py b/src/cpl_cli/configuration/project_type_enum.py
index 235e59c2..78004bdb 100644
--- a/src/cpl_cli/configuration/project_type_enum.py
+++ b/src/cpl_cli/configuration/project_type_enum.py
@@ -2,7 +2,6 @@ from enum import Enum
class ProjectTypeEnum(Enum):
-
- console = 'console'
- library = 'library'
- unittest = 'unittest'
+ console = "console"
+ library = "library"
+ unittest = "unittest"
diff --git a/src/cpl_cli/configuration/schematic_collection.py b/src/cpl_cli/configuration/schematic_collection.py
index a3469077..23365d38 100644
--- a/src/cpl_cli/configuration/schematic_collection.py
+++ b/src/cpl_cli/configuration/schematic_collection.py
@@ -6,10 +6,7 @@ class SchematicCollection:
@classmethod
def register(cls, template: type, schematic: str, aliases: list[str]):
- cls._schematics[schematic] = {
- "Template": template,
- "Aliases": aliases
- }
+ cls._schematics[schematic] = {"Template": template, "Aliases": aliases}
@classmethod
def get_schematics(cls) -> dict:
diff --git a/src/cpl_cli/configuration/settings_helper.py b/src/cpl_cli/configuration/settings_helper.py
index 660c1285..94d2c620 100644
--- a/src/cpl_cli/configuration/settings_helper.py
+++ b/src/cpl_cli/configuration/settings_helper.py
@@ -6,7 +6,6 @@ from cpl_cli.configuration.project_settings_name_enum import ProjectSettingsName
class SettingsHelper:
-
@staticmethod
def get_project_settings_dict(project: ProjectSettings) -> dict:
return {
@@ -14,7 +13,7 @@ class SettingsHelper:
ProjectSettingsNameEnum.version.value: {
VersionSettingsNameEnum.major.value: project.version.major,
VersionSettingsNameEnum.minor.value: project.version.minor,
- VersionSettingsNameEnum.micro.value: project.version.micro
+ VersionSettingsNameEnum.micro.value: project.version.micro,
},
ProjectSettingsNameEnum.author.value: project.author,
ProjectSettingsNameEnum.author_email.value: project.author_email,
@@ -29,7 +28,7 @@ class SettingsHelper:
ProjectSettingsNameEnum.dev_dependencies.value: project.dev_dependencies,
ProjectSettingsNameEnum.python_version.value: project.python_version,
ProjectSettingsNameEnum.python_path.value: project.python_path,
- ProjectSettingsNameEnum.classifiers.value: project.classifiers
+ ProjectSettingsNameEnum.classifiers.value: project.classifiers,
}
@staticmethod
@@ -44,5 +43,5 @@ class SettingsHelper:
BuildSettingsNameEnum.included.value: build.included,
BuildSettingsNameEnum.excluded.value: build.excluded,
BuildSettingsNameEnum.package_data.value: build.package_data,
- BuildSettingsNameEnum.project_references.value: build.project_references
+ BuildSettingsNameEnum.project_references.value: build.project_references,
}
diff --git a/src/cpl_cli/configuration/venv_helper_service.py b/src/cpl_cli/configuration/venv_helper_service.py
index 9cd1d861..a84ec966 100644
--- a/src/cpl_cli/configuration/venv_helper_service.py
+++ b/src/cpl_cli/configuration/venv_helper_service.py
@@ -11,24 +11,25 @@ from cpl_core.console import Console, ForegroundColorEnum
class VenvHelper:
-
@staticmethod
- def init_venv(is_virtual: bool, env: ApplicationEnvironmentABC, project_settings: ProjectSettings, explicit_path=None):
+ def init_venv(
+ is_virtual: bool, env: ApplicationEnvironmentABC, project_settings: ProjectSettings, explicit_path=None
+ ):
if is_virtual:
return
- venv_path = os.path.abspath(os.path.join(env.working_directory, project_settings.python_executable, '../../'))
+ venv_path = os.path.abspath(os.path.join(env.working_directory, project_settings.python_executable, "../../"))
if explicit_path is not None:
venv_path = os.path.abspath(explicit_path)
if not os.path.exists(venv_path):
Console.spinner(
- f'Creating venv: {venv_path}',
+ f"Creating venv: {venv_path}",
VenvHelper.create_venv,
venv_path,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
Pip.set_executable(project_settings.python_executable)
@@ -36,8 +37,8 @@ class VenvHelper:
@staticmethod
def create_venv(path):
subprocess.run(
- [sys.executable, '-m', 'venv', os.path.abspath(os.path.join(path, '../../'))],
+ [sys.executable, "-m", "venv", os.path.abspath(os.path.join(path, "../../"))],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
- stdin=subprocess.DEVNULL
+ stdin=subprocess.DEVNULL,
)
diff --git a/src/cpl_cli/configuration/version_settings.py b/src/cpl_cli/configuration/version_settings.py
index ef1af9b6..c1439673 100644
--- a/src/cpl_cli/configuration/version_settings.py
+++ b/src/cpl_cli/configuration/version_settings.py
@@ -5,13 +5,7 @@ from cpl_cli.configuration.version_settings_name_enum import VersionSettingsName
class VersionSettings(ConfigurationModelABC):
-
- def __init__(
- self,
- major: str = None,
- minor: str = None,
- micro: str = None
- ):
+ def __init__(self, major: str = None, minor: str = None, micro: str = None):
ConfigurationModelABC.__init__(self)
self._major: Optional[str] = major
@@ -32,15 +26,15 @@ class VersionSettings(ConfigurationModelABC):
def to_str(self) -> str:
if self._micro is None:
- return f'{self._major}.{self._minor}'
+ return f"{self._major}.{self._minor}"
else:
- return f'{self._major}.{self._minor}.{self._micro}'
+ return f"{self._major}.{self._minor}.{self._micro}"
def from_dict(self, settings: dict):
self._major = settings[VersionSettingsNameEnum.major.value]
self._minor = settings[VersionSettingsNameEnum.minor.value]
micro = settings[VersionSettingsNameEnum.micro.value]
- if micro != '':
+ if micro != "":
self._micro = micro
def to_dict(self) -> dict:
diff --git a/src/cpl_cli/configuration/version_settings_name_enum.py b/src/cpl_cli/configuration/version_settings_name_enum.py
index 23eab9e1..06c972c7 100644
--- a/src/cpl_cli/configuration/version_settings_name_enum.py
+++ b/src/cpl_cli/configuration/version_settings_name_enum.py
@@ -2,7 +2,6 @@ from enum import Enum
class VersionSettingsNameEnum(Enum):
-
- major = 'Major'
- minor = 'Minor'
- micro = 'Micro'
+ major = "Major"
+ minor = "Minor"
+ micro = "Micro"
diff --git a/src/cpl_cli/configuration/workspace_settings.py b/src/cpl_cli/configuration/workspace_settings.py
index 7bf97f04..10ba93ac 100644
--- a/src/cpl_cli/configuration/workspace_settings.py
+++ b/src/cpl_cli/configuration/workspace_settings.py
@@ -7,14 +7,13 @@ from cpl_cli.configuration.workspace_settings_name_enum import WorkspaceSettings
class WorkspaceSettings(ConfigurationModelABC):
-
def __init__(self):
ConfigurationModelABC.__init__(self)
-
+
self._default_project: Optional[str] = None
self._projects: dict[str, str] = {}
self._scripts: dict[str, str] = {}
-
+
@property
def default_project(self) -> str:
return self._default_project
@@ -37,5 +36,5 @@ class WorkspaceSettings(ConfigurationModelABC):
else:
self._scripts = {}
except Exception as e:
- Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(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 7e16f65e..acd742be 100644
--- a/src/cpl_cli/configuration/workspace_settings_name_enum.py
+++ b/src/cpl_cli/configuration/workspace_settings_name_enum.py
@@ -2,7 +2,6 @@ from enum import Enum
class WorkspaceSettingsNameEnum(Enum):
-
- default_project = 'DefaultProject'
- projects = 'Projects'
- scripts = 'Scripts'
+ default_project = "DefaultProject"
+ projects = "Projects"
+ scripts = "Scripts"
diff --git a/src/cpl_cli/cpl-cli.json b/src/cpl_cli/cpl-cli.json
index 83680ef7..e73437ed 100644
--- a/src/cpl_cli/cpl-cli.json
+++ b/src/cpl_cli/cpl-cli.json
@@ -2,21 +2,21 @@
"ProjectSettings": {
"Name": "cpl-cli",
"Version": {
- "Major": "2022",
- "Minor": "12",
- "Micro": "1"
+ "Major": "2023",
+ "Minor": "2",
+ "Micro": "0"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
- "Description": "sh-edraft Common Python library CLI",
- "LongDescription": "sh-edraft Common Python library Command Line Interface",
+ "Description": "CPL CLI",
+ "LongDescription": "CPL Command Line Interface",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2020 - 2023",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
- "cpl-core>=2022.12.1"
+ "cpl-core>=2023.2.0"
],
"DevDependencies": [],
"PythonVersion": ">=3.10",
diff --git a/src/cpl_cli/error.py b/src/cpl_cli/error.py
index 56a33c32..7cc16d96 100644
--- a/src/cpl_cli/error.py
+++ b/src/cpl_cli/error.py
@@ -3,15 +3,13 @@ from cpl_core.console.console import Console
class Error:
-
@staticmethod
def error(message: str):
Console.error(message)
- Console.error('Run \'cpl help\'\n')
+ Console.error("Run 'cpl help'\n")
@staticmethod
def warn(message: str):
Console.set_foreground_color(ForegroundColorEnum.yellow)
- Console.write_line(message, '\n')
+ Console.write_line(message, "\n")
Console.set_foreground_color(ForegroundColorEnum.default)
-
diff --git a/src/cpl_cli/helper/__init__.py b/src/cpl_cli/helper/__init__.py
index 124de6fe..5cab2e70 100644
--- a/src/cpl_cli/helper/__init__.py
+++ b/src/cpl_cli/helper/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.helper'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.helper"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/helper/dependencies.py b/src/cpl_cli/helper/dependencies.py
index 80d7cf44..b4b5002b 100644
--- a/src/cpl_cli/helper/dependencies.py
+++ b/src/cpl_cli/helper/dependencies.py
@@ -7,7 +7,7 @@ class Dependencies:
_dependencies = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)
for p in _dependencies:
- if str(p).startswith('cpl-'):
+ if str(p).startswith("cpl-"):
_cpl_packages.append([p, _dependencies[p]])
continue
diff --git a/src/cpl_cli/live_server/__init__.py b/src/cpl_cli/live_server/__init__.py
index 943290d4..6f7870d9 100644
--- a/src/cpl_cli/live_server/__init__.py
+++ b/src/cpl_cli/live_server/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.live_server'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.live_server"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/live_server/live_server_service.py b/src/cpl_cli/live_server/live_server_service.py
index a9f6ffd3..077904f8 100644
--- a/src/cpl_cli/live_server/live_server_service.py
+++ b/src/cpl_cli/live_server/live_server_service.py
@@ -16,13 +16,12 @@ from cpl_core.utils import String
class LiveServerService(FileSystemEventHandler):
-
def __init__(
- self,
- env: ApplicationEnvironmentABC,
- project_settings: ProjectSettings,
- build_settings: BuildSettings,
- publisher: PublisherService,
+ self,
+ env: ApplicationEnvironmentABC,
+ project_settings: ProjectSettings,
+ build_settings: BuildSettings,
+ publisher: PublisherService,
):
"""
Service for the live development server
@@ -51,7 +50,7 @@ class LiveServerService(FileSystemEventHandler):
:return:
"""
self._observer = Observer()
- self._observer.schedule(self, path=os.path.abspath(os.path.join(self._src_dir, '../')), recursive=True)
+ self._observer.schedule(self, path=os.path.abspath(os.path.join(self._src_dir, "../")), recursive=True)
self._observer.start()
def _restart(self):
@@ -64,7 +63,7 @@ class LiveServerService(FileSystemEventHandler):
if proc.cmdline() == self._ls_thread.command:
proc.kill()
- Console.write_line('Restart\n')
+ Console.write_line("Restart\n")
while self._ls_thread.is_alive():
time.sleep(1)
@@ -80,7 +79,7 @@ class LiveServerService(FileSystemEventHandler):
return None
# Event is modified, you can process it now
- if str(event.src_path).endswith('.py'):
+ if str(event.src_path).endswith(".py"):
self._observer.stop()
self._restart()
@@ -88,11 +87,7 @@ class LiveServerService(FileSystemEventHandler):
self._build()
self._start_observer()
self._ls_thread = LiveServerThread(
- self._project_settings.python_executable,
- self._wd,
- self._args,
- self._env,
- self._build_settings
+ self._project_settings.python_executable, self._wd, self._args, self._env, self._build_settings
)
self._ls_thread.start()
self._ls_thread.join()
@@ -105,13 +100,15 @@ class LiveServerService(FileSystemEventHandler):
self._env.set_working_directory(self._src_dir)
self._publisher.build()
self._env.set_working_directory(self._src_dir)
- self._wd = os.path.abspath(os.path.join(
- self._src_dir,
- self._build_settings.output_path,
- self._project_settings.name,
- 'build',
- String.convert_to_snake_case(self._project_settings.name)
- ))
+ self._wd = os.path.abspath(
+ os.path.join(
+ self._src_dir,
+ self._build_settings.output_path,
+ self._project_settings.name,
+ "build",
+ String.convert_to_snake_case(self._project_settings.name),
+ )
+ )
def start(self, args: list[str]):
"""
@@ -119,14 +116,14 @@ class LiveServerService(FileSystemEventHandler):
:param args:
:return:
"""
- if self._build_settings.main == '':
- Console.error('Project has no entry point.')
+ if self._build_settings.main == "":
+ Console.error("Project has no entry point.")
return
- if 'dev' in args:
+ if "dev" in args:
self._is_dev = True
- args.remove('dev')
+ args.remove("dev")
self._args = args
- Console.write_line('** CPL live development server is running **')
+ Console.write_line("** CPL live development server is running **")
self._start()
diff --git a/src/cpl_cli/live_server/live_server_thread.py b/src/cpl_cli/live_server/live_server_thread.py
index 3018b5ef..a4301397 100644
--- a/src/cpl_cli/live_server/live_server_thread.py
+++ b/src/cpl_cli/live_server/live_server_thread.py
@@ -11,9 +11,9 @@ from cpl_cli.configuration import BuildSettings
class LiveServerThread(threading.Thread):
-
- def __init__(self, executable: str, path: str, args: list[str], env: ApplicationEnvironmentABC,
- build_settings: BuildSettings):
+ def __init__(
+ self, executable: str, path: str, args: list[str], env: ApplicationEnvironmentABC, build_settings: BuildSettings
+ ):
"""
Thread to start the CPL project for the live development server
:param executable:
@@ -31,7 +31,7 @@ class LiveServerThread(threading.Thread):
self._env = env
self._build_settings = build_settings
- self._main = ''
+ self._main = ""
self._command = []
self._env_vars = os.environ
@@ -49,27 +49,29 @@ class LiveServerThread(threading.Thread):
:return:
"""
main = self._build_settings.main
- if '.' in self._build_settings.main:
- length = len(self._build_settings.main.split('.')) - 1
- main = self._build_settings.main.split('.')[length]
+ if "." in self._build_settings.main:
+ length = len(self._build_settings.main.split(".")) - 1
+ main = self._build_settings.main.split(".")[length]
- self._main = os.path.join(self._path, f'{main}.py')
+ self._main = os.path.join(self._path, f"{main}.py")
if not os.path.isfile(self._main):
- Console.error('Entry point main.py not found')
+ Console.error("Entry point main.py not found")
return
# set cwd to src/
self._env.set_working_directory(os.path.abspath(os.path.join(self._path)))
- src_cwd = os.path.abspath(os.path.join(self._path, '../'))
- if sys.platform == 'win32':
- self._env_vars['PYTHONPATH'] = f'{src_cwd};' \
- f'{os.path.join(self._env.working_directory, self._build_settings.source_path)}'
+ src_cwd = os.path.abspath(os.path.join(self._path, "../"))
+ if sys.platform == "win32":
+ self._env_vars["PYTHONPATH"] = (
+ f"{src_cwd};" f"{os.path.join(self._env.working_directory, self._build_settings.source_path)}"
+ )
else:
- self._env_vars['PYTHONPATH'] = f'{src_cwd}:' \
- f'{os.path.join(self._env.working_directory, self._build_settings.source_path)}'
+ self._env_vars["PYTHONPATH"] = (
+ f"{src_cwd}:" f"{os.path.join(self._env.working_directory, self._build_settings.source_path)}"
+ )
Console.set_foreground_color(ForegroundColorEnum.green)
- Console.write_line('Read successfully')
+ Console.write_line("Read successfully")
Console.set_foreground_color(ForegroundColorEnum.cyan)
now = datetime.now()
Console.write_line(f'Started at {now.strftime("%Y-%m-%d %H:%M:%S")}\n\n')
diff --git a/src/cpl_cli/live_server/start_executable.py b/src/cpl_cli/live_server/start_executable.py
index a72dc402..2eef533a 100644
--- a/src/cpl_cli/live_server/start_executable.py
+++ b/src/cpl_cli/live_server/start_executable.py
@@ -10,7 +10,6 @@ from cpl_cli.configuration.build_settings import BuildSettings
class StartExecutable:
-
def __init__(self, env: ApplicationEnvironmentABC, build_settings: BuildSettings):
"""
Service to start the CPL project for the live development server
@@ -23,7 +22,7 @@ class StartExecutable:
self._env = env
self._build_settings = build_settings
- self._main = ''
+ self._main = ""
self._command = []
self._env_vars = os.environ
@@ -34,42 +33,44 @@ class StartExecutable:
return
path = os.path.abspath(os.path.dirname(os.path.dirname(self._executable)))
- if sys.platform == 'win32':
- self._env_vars['PATH'] = f'{path}\\bin' + os.pathsep + os.environ.get('PATH', '')
+ if sys.platform == "win32":
+ self._env_vars["PATH"] = f"{path}\\bin" + os.pathsep + os.environ.get("PATH", "")
else:
- self._env_vars['PATH'] = f'{path}/bin' + os.pathsep + os.environ.get('PATH', '')
+ self._env_vars["PATH"] = f"{path}/bin" + os.pathsep + os.environ.get("PATH", "")
- self._env_vars['VIRTUAL_ENV'] = path
+ self._env_vars["VIRTUAL_ENV"] = path
def run(self, args: list[str], executable: str, path: str, output=True):
self._executable = os.path.abspath(os.path.join(self._env.working_directory, executable))
if not os.path.exists(self._executable):
- Console.error(f'Executable not found')
+ Console.error(f"Executable not found")
return
main = self._build_settings.main
- if '.' in self._build_settings.main:
- length = len(self._build_settings.main.split('.')) - 1
- main = self._build_settings.main.split('.')[length]
+ if "." in self._build_settings.main:
+ length = len(self._build_settings.main.split(".")) - 1
+ main = self._build_settings.main.split(".")[length]
- self._main = os.path.join(path, f'{main}.py')
+ self._main = os.path.join(path, f"{main}.py")
if not os.path.isfile(self._main):
- Console.error('Entry point main.py not found')
+ Console.error("Entry point main.py not found")
return
# set cwd to src/
self._env.set_working_directory(os.path.abspath(os.path.join(path)))
- src_cwd = os.path.abspath(os.path.join(path, '../'))
- if sys.platform == 'win32':
- self._env_vars['PYTHONPATH'] = f'{src_cwd};' \
- f'{os.path.join(self._env.working_directory, self._build_settings.source_path)}'
+ src_cwd = os.path.abspath(os.path.join(path, "../"))
+ if sys.platform == "win32":
+ self._env_vars["PYTHONPATH"] = (
+ f"{src_cwd};" f"{os.path.join(self._env.working_directory, self._build_settings.source_path)}"
+ )
else:
- self._env_vars['PYTHONPATH'] = f'{src_cwd}:' \
- f'{os.path.join(self._env.working_directory, self._build_settings.source_path)}'
+ self._env_vars["PYTHONPATH"] = (
+ f"{src_cwd}:" f"{os.path.join(self._env.working_directory, self._build_settings.source_path)}"
+ )
if output:
Console.set_foreground_color(ForegroundColorEnum.green)
- Console.write_line('Read successfully')
+ Console.write_line("Read successfully")
Console.set_foreground_color(ForegroundColorEnum.cyan)
Console.write_line(f'Started at {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}\n\n')
Console.set_foreground_color(ForegroundColorEnum.default)
diff --git a/src/cpl_cli/main.py b/src/cpl_cli/main.py
index 4bf4d83d..f9c2bb83 100644
--- a/src/cpl_cli/main.py
+++ b/src/cpl_cli/main.py
@@ -13,18 +13,18 @@ from cpl_core.console import Console
def get_startup_extensions() -> list[Type[StartupExtensionABC]]:
- blacklisted_packages = ['cpl-cli']
+ blacklisted_packages = ["cpl-cli"]
startup_extensions = []
installed_packages = pkg_resources.working_set
for p in installed_packages:
- package = str(p).split(' ')[0]
- if not package.startswith('cpl-') or package in blacklisted_packages:
+ package = str(p).split(" ")[0]
+ if not package.startswith("cpl-") or package in blacklisted_packages:
continue
- package = package.replace('-', '_')
+ package = package.replace("-", "_")
loaded_package = __import__(package)
- if '__cli_startup_extension__' not in dir(loaded_package):
+ if "__cli_startup_extension__" not in dir(loaded_package):
continue
startup_extensions.append(loaded_package.__cli_startup_extension__)
@@ -44,7 +44,7 @@ def main():
Console.write_line()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
# ((
diff --git a/src/cpl_cli/migrations/__init__.py b/src/cpl_cli/migrations/__init__.py
index d1c8ff93..884ff742 100644
--- a/src/cpl_cli/migrations/__init__.py
+++ b/src/cpl_cli/migrations/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.migrations'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.migrations"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/migrations/base/__init__.py b/src/cpl_cli/migrations/base/__init__.py
index 3c86ea88..5c0949a2 100644
--- a/src/cpl_cli/migrations/base/__init__.py
+++ b/src/cpl_cli/migrations/base/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.migrations.base'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.migrations.base"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/migrations/base/migration_abc.py b/src/cpl_cli/migrations/base/migration_abc.py
index 47fc71f7..9848ea5f 100644
--- a/src/cpl_cli/migrations/base/migration_abc.py
+++ b/src/cpl_cli/migrations/base/migration_abc.py
@@ -2,7 +2,6 @@ from abc import ABC, abstractmethod
class MigrationABC(ABC):
-
@abstractmethod
def __init__(self, version: str):
self._version = version
@@ -12,4 +11,5 @@ class MigrationABC(ABC):
return self._version
@abstractmethod
- def migrate(self): pass
+ def migrate(self):
+ pass
diff --git a/src/cpl_cli/migrations/base/migration_service_abc.py b/src/cpl_cli/migrations/base/migration_service_abc.py
index 37ec0e3f..4d6d9639 100644
--- a/src/cpl_cli/migrations/base/migration_service_abc.py
+++ b/src/cpl_cli/migrations/base/migration_service_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class MigrationServiceABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- def migrate_from(self, version: str): pass
+ def migrate_from(self, version: str):
+ pass
diff --git a/src/cpl_cli/migrations/migration_2022_10.py b/src/cpl_cli/migrations/migration_2022_10.py
index 6c5bc2f3..ae54b684 100644
--- a/src/cpl_cli/migrations/migration_2022_10.py
+++ b/src/cpl_cli/migrations/migration_2022_10.py
@@ -2,9 +2,8 @@ from cpl_cli.migrations.base.migration_abc import MigrationABC
class Migration202210(MigrationABC):
-
def __init__(self):
- MigrationABC.__init__(self, '2022.10')
+ MigrationABC.__init__(self, "2022.10")
def migrate(self):
# This migration could be deleted, but stays as an example.
diff --git a/src/cpl_cli/migrations/service/__init__.py b/src/cpl_cli/migrations/service/__init__.py
index d32c377e..ba64c7c7 100644
--- a/src/cpl_cli/migrations/service/__init__.py
+++ b/src/cpl_cli/migrations/service/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.migrations.service'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.migrations.service"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/migrations/service/migration_service.py b/src/cpl_cli/migrations/service/migration_service.py
index 403e57a1..4779ed52 100644
--- a/src/cpl_cli/migrations/service/migration_service.py
+++ b/src/cpl_cli/migrations/service/migration_service.py
@@ -6,7 +6,6 @@ from cpl_core.dependency_injection import ServiceProviderABC
class MigrationService(MigrationServiceABC):
-
def __init__(self, services: ServiceProviderABC):
MigrationServiceABC.__init__(self)
diff --git a/src/cpl_cli/publish/__init__.py b/src/cpl_cli/publish/__init__.py
index 8e9f1d9a..0bcd9dc1 100644
--- a/src/cpl_cli/publish/__init__.py
+++ b/src/cpl_cli/publish/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.publish'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.publish"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -24,5 +24,5 @@ from collections import namedtuple
from .publisher_abc import PublisherABC
from .publisher_service import PublisherService
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/publish/publisher_abc.py b/src/cpl_cli/publish/publisher_abc.py
index c33ed644..01f79230 100644
--- a/src/cpl_cli/publish/publisher_abc.py
+++ b/src/cpl_cli/publish/publisher_abc.py
@@ -2,27 +2,32 @@ from abc import abstractmethod, ABC
class PublisherABC(ABC):
-
@abstractmethod
def __init__(self):
ABC.__init__(self)
@property
@abstractmethod
- def source_path(self) -> str: pass
+ def source_path(self) -> str:
+ pass
@property
@abstractmethod
- def dist_path(self) -> str: pass
+ def dist_path(self) -> str:
+ pass
@abstractmethod
- def include(self, path: str): pass
+ def include(self, path: str):
+ pass
@abstractmethod
- def exclude(self, path: str): pass
+ def exclude(self, path: str):
+ pass
@abstractmethod
- def build(self): pass
+ def build(self):
+ pass
@abstractmethod
- def publish(self): pass
+ def publish(self):
+ pass
diff --git a/src/cpl_cli/publish/publisher_service.py b/src/cpl_cli/publish/publisher_service.py
index 22ebe291..5aa2de96 100644
--- a/src/cpl_cli/publish/publisher_service.py
+++ b/src/cpl_cli/publish/publisher_service.py
@@ -19,9 +19,9 @@ from cpl_cli._templates.publish.setup_template import SetupTemplate
class PublisherService(PublisherABC):
-
- def __init__(self, config: ConfigurationABC,
- env: ApplicationEnvironmentABC, project: ProjectSettings, build: BuildSettings):
+ def __init__(
+ self, config: ConfigurationABC, env: ApplicationEnvironmentABC, project: ProjectSettings, build: BuildSettings
+ ):
"""
Service to build or publish files for distribution
:param config:
@@ -43,11 +43,11 @@ class PublisherService(PublisherABC):
self._included_dirs: list[str] = []
self._distributed_files: list[str] = []
- self._path_mark = '/'
- if sys.platform == 'win32':
- self._path_mark = '\\'
+ self._path_mark = "/"
+ if sys.platform == "win32":
+ self._path_mark = "\\"
- self._src_path_part = f'src{self._path_mark}'
+ self._src_path_part = f"src{self._path_mark}"
@property
def source_path(self) -> str:
@@ -64,17 +64,17 @@ class PublisherService(PublisherABC):
:return:
"""
if self._src_path_part in file:
- file = file.split(self._src_path_part)[1].replace(self._src_path_part, '', 1)
+ file = file.split(self._src_path_part)[1].replace(self._src_path_part, "", 1)
dirs = os.path.dirname(file).split(self._path_mark)
for d in dirs:
- if d.__contains__('.'):
+ if d.__contains__("."):
dirs.remove(d)
if len(dirs) == 0:
return os.path.basename(file)
else:
- return '.'.join(dirs)
+ return ".".join(dirs)
@staticmethod
def _delete_path(path: str):
@@ -87,7 +87,7 @@ class PublisherService(PublisherABC):
try:
shutil.rmtree(path)
except Exception as e:
- Console.error(f'{e}')
+ Console.error(f"{e}")
sys.exit()
@staticmethod
@@ -101,7 +101,7 @@ class PublisherService(PublisherABC):
try:
os.makedirs(path)
except Exception as e:
- Console.error(f'{e}')
+ Console.error(f"{e}")
sys.exit()
def _is_path_included(self, path: str) -> bool:
@@ -111,8 +111,8 @@ class PublisherService(PublisherABC):
:return:
"""
for included in self._build_settings.included:
- if included.startswith('*'):
- included = included.replace('*', '')
+ if included.startswith("*"):
+ included = included.replace("*", "")
if included in path and path not in self._build_settings.excluded:
return True
@@ -126,8 +126,8 @@ class PublisherService(PublisherABC):
:return:
"""
for excluded in self._build_settings.excluded:
- if excluded.startswith('*'):
- excluded = excluded.replace('*', '')
+ if excluded.startswith("*"):
+ excluded = excluded.replace("*", "")
if excluded in path and not self._is_path_included(path):
return True
@@ -141,8 +141,8 @@ class PublisherService(PublisherABC):
:return:
"""
for excluded in self._build_settings.excluded:
- if excluded.startswith('*'):
- excluded = excluded.replace('*', '')
+ if excluded.startswith("*"):
+ excluded = excluded.replace("*", "")
if excluded in file and not self._is_path_included(file):
return True
@@ -194,10 +194,10 @@ class PublisherService(PublisherABC):
for project in self._build_settings.project_references:
project = os.path.abspath(os.path.join(self._source_path, project))
if not os.path.isfile(os.path.abspath(project)):
- Console.error(f'Cannot import project: {project}')
+ Console.error(f"Cannot import project: {project}")
return
- self.exclude(f'*/{os.path.basename(project)}')
+ self.exclude(f"*/{os.path.basename(project)}")
self._read_sources_from_path(os.path.dirname(project))
def _create_packages(self):
@@ -206,44 +206,48 @@ class PublisherService(PublisherABC):
:return:
"""
for file in self._included_files:
- if not file.endswith('__init__.py'):
+ if not file.endswith("__init__.py"):
continue
- template_content = ''
+ template_content = ""
module_file_lines: list[str] = []
title = self._get_module_name_from_dirs(file)
- if title == '':
+ if title == "":
title = self._project_settings.name
module_py_lines: list[str] = []
- imports = ''
+ imports = ""
- with open(file, 'r') as py_file:
+ with open(file, "r") as py_file:
module_file_lines = py_file.readlines()
py_file.close()
if len(module_file_lines) == 0:
- imports = '# imports:'
+ imports = "# imports:"
else:
is_started = False
build_ignore = False
for line in module_file_lines:
- if line.__contains__('# imports'):
+ if line.__contains__("# imports"):
is_started = True
- if line.__contains__('# build-ignore'):
+ 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', ''))
+ 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', ''))
+ 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", ""))
if len(module_py_lines) > 0:
- imports = '\n'.join(module_py_lines)
+ imports = "\n".join(module_py_lines)
template_content = stringTemplate(InitTemplate.get_init_py()).substitute(
Name=self._project_settings.name,
@@ -253,16 +257,16 @@ class PublisherService(PublisherABC):
CopyrightName=self._project_settings.copyright_name,
LicenseName=self._project_settings.license_name,
LicenseDescription=self._project_settings.license_description,
- Title=title if title is not None and title != '' else self._project_settings.name,
+ Title=title if title is not None and title != "" else self._project_settings.name,
Author=self._project_settings.author,
Version=version.parse(self._project_settings.version.to_str()),
Major=self._project_settings.version.major,
Minor=self._project_settings.version.minor,
Micro=self._project_settings.version.micro,
- Imports=imports
+ Imports=imports,
)
- with open(file, 'w+') as py_file:
+ with open(file, "w+") as py_file:
py_file.write(template_content)
py_file.close()
@@ -278,7 +282,7 @@ class PublisherService(PublisherABC):
for file in self._included_files:
dist_file = file
if self._src_path_part in dist_file:
- dist_file = dist_file.replace(self._src_path_part, '', 1)
+ dist_file = dist_file.replace(self._src_path_part, "", 1)
output_path = os.path.join(build_path, os.path.dirname(dist_file))
output_file = os.path.join(build_path, dist_file)
@@ -287,20 +291,20 @@ class PublisherService(PublisherABC):
if not os.path.isdir(output_path):
os.makedirs(output_path, exist_ok=True)
except Exception as e:
- Console.error(__name__, f'Cannot create directories: {output_path} -> {e}')
+ Console.error(__name__, f"Cannot create directories: {output_path} -> {e}")
return
try:
self._distributed_files.append(output_file)
shutil.copy(os.path.abspath(file), output_file)
except Exception as e:
- Console.error(__name__, f'Cannot copy file: {file} to {output_path} -> {e}')
+ Console.error(__name__, f"Cannot copy file: {file} to {output_path} -> {e}")
return
for empty_dir in self._included_dirs:
dist_dir = empty_dir
if self._src_path_part in dist_dir:
- dist_dir = dist_dir.replace(self._src_path_part, '', 1)
+ dist_dir = dist_dir.replace(self._src_path_part, "", 1)
output_path = os.path.join(build_path, dist_dir)
if not os.path.isdir(output_path):
@@ -329,7 +333,7 @@ class PublisherService(PublisherABC):
Dependencies: ProjectSettings, BuildSettings
:return:
"""
- setup_file = os.path.join(self._output_path, 'setup.py')
+ setup_file = os.path.join(self._output_path, "setup.py")
if os.path.isfile(setup_file):
os.remove(setup_file)
@@ -339,19 +343,19 @@ class PublisherService(PublisherABC):
try:
main_name = self._build_settings.main
- if '.' in self._build_settings.main:
- length = len(self._build_settings.main.split('.'))
- main_name = self._build_settings.main.split('.')[length - 1]
+ if "." in self._build_settings.main:
+ length = len(self._build_settings.main.split("."))
+ main_name = self._build_settings.main.split(".")[length - 1]
- sys.path.insert(0, os.path.join(self._source_path, '../'))
+ sys.path.insert(0, os.path.join(self._source_path, "../"))
main_mod = __import__(self._build_settings.main)
main = getattr(main_mod, main_name)
except Exception as e:
- Console.error('Could not find entry point', str(e))
+ Console.error("Could not find entry point", str(e))
return
- if main is None or not callable(main) and not hasattr(main, 'main'):
- Console.error('Could not find entry point')
+ if main is None or not callable(main) and not hasattr(main, "main"):
+ Console.error("Could not find entry point")
return
if callable(main):
@@ -361,13 +365,9 @@ class PublisherService(PublisherABC):
mod_name = main.__name__
func_name = main.main.__name__
- entry_points = {
- 'console_scripts': [
- f'{self._build_settings.entry_point} = {mod_name}:{func_name}'
- ]
- }
+ entry_points = {"console_scripts": [f"{self._build_settings.entry_point} = {mod_name}:{func_name}"]}
- with open(setup_file, 'w+') as setup_py:
+ with open(setup_file, "w+") as setup_py:
setup_string = stringTemplate(SetupTemplate.get_setup_py()).substitute(
Name=self._project_settings.name,
Version=self._project_settings.version.to_str(),
@@ -381,7 +381,7 @@ class PublisherService(PublisherABC):
PyRequires=self._project_settings.python_version,
Dependencies=self._project_settings.dependencies,
EntryPoints=entry_points,
- PackageData=self._build_settings.package_data
+ PackageData=self._build_settings.package_data,
)
setup_py.write(setup_string)
setup_py.close()
@@ -391,22 +391,25 @@ class PublisherService(PublisherABC):
Starts setup.py
:return:
"""
- setup_py = os.path.join(self._output_path, 'setup.py')
+ setup_py = os.path.join(self._output_path, "setup.py")
if not os.path.isfile(setup_py):
- Console.error(__name__, f'setup.py not found in {self._output_path}')
+ Console.error(__name__, f"setup.py not found in {self._output_path}")
return
try:
- sandbox.run_setup(os.path.abspath(setup_py), [
- 'sdist',
- f'--dist-dir={os.path.join(self._output_path, "setup")}',
- 'bdist_wheel',
- f'--bdist-dir={os.path.join(self._output_path, "bdist")}',
- f'--dist-dir={os.path.join(self._output_path, "setup")}'
- ])
+ sandbox.run_setup(
+ os.path.abspath(setup_py),
+ [
+ "sdist",
+ f'--dist-dir={os.path.join(self._output_path, "setup")}',
+ "bdist_wheel",
+ f'--bdist-dir={os.path.join(self._output_path, "bdist")}',
+ f'--dist-dir={os.path.join(self._output_path, "setup")}',
+ ],
+ )
os.remove(setup_py)
except Exception as e:
- Console.error('Executing setup.py failed', str(e))
+ Console.error("Executing setup.py failed", str(e))
def include(self, path: str):
"""
@@ -433,17 +436,30 @@ class PublisherService(PublisherABC):
3. Copies all included source files to dist_path/build
:return:
"""
- self._env.set_working_directory(os.path.join(self._env.working_directory, '../')) # probably causing some errors (#125)
- self.exclude(f'*/{self._project_settings.name}.json')
- self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, 'build'))
+ self._env.set_working_directory(
+ os.path.join(self._env.working_directory, "../")
+ ) # probably causing some errors (#125)
+ self.exclude(f"*/{self._project_settings.name}.json")
+ self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, "build"))
- Console.spinner('Reading source files:', self._read_sources, text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue)
- Console.spinner('Creating internal packages:', self._create_packages,
- text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue)
- Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue)
+ Console.spinner(
+ "Reading source files:",
+ self._read_sources,
+ text_foreground_color=ForegroundColorEnum.green,
+ spinner_foreground_color=ForegroundColorEnum.blue,
+ )
+ Console.spinner(
+ "Creating internal packages:",
+ self._create_packages,
+ text_foreground_color=ForegroundColorEnum.green,
+ spinner_foreground_color=ForegroundColorEnum.blue,
+ )
+ Console.spinner(
+ "Building application:",
+ self._dist_files,
+ text_foreground_color=ForegroundColorEnum.green,
+ spinner_foreground_color=ForegroundColorEnum.blue,
+ )
Console.write_line()
def publish(self):
@@ -456,46 +472,48 @@ class PublisherService(PublisherABC):
4. Remove all included source from dist_path/publish
:return:
"""
- self._env.set_working_directory(os.path.join(self._env.working_directory, '../')) # probably causing some errors (#125)
- self.exclude(f'*/{self._project_settings.name}.json')
- self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, 'publish'))
+ self._env.set_working_directory(
+ os.path.join(self._env.working_directory, "../")
+ ) # probably causing some errors (#125)
+ self.exclude(f"*/{self._project_settings.name}.json")
+ self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, "publish"))
- Console.write_line('Build:')
+ Console.write_line("Build:")
Console.spinner(
- 'Reading source files:',
+ "Reading source files:",
self._read_sources,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue
+ spinner_foreground_color=ForegroundColorEnum.blue,
)
Console.spinner(
- 'Creating internal packages:',
+ "Creating internal packages:",
self._create_packages,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue
+ spinner_foreground_color=ForegroundColorEnum.blue,
)
Console.spinner(
- 'Building application:',
+ "Building application:",
self._dist_files,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue
+ spinner_foreground_color=ForegroundColorEnum.blue,
)
- Console.write_line('\nPublish:')
+ Console.write_line("\nPublish:")
Console.spinner(
- 'Generating setup.py:',
+ "Generating setup.py:",
self._create_setup,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue
+ spinner_foreground_color=ForegroundColorEnum.blue,
)
- Console.write_line('Running setup.py:\n')
+ Console.write_line("Running setup.py:\n")
self._run_setup()
Console.spinner(
- 'Cleaning dist path:',
+ "Cleaning dist path:",
self._clean_dist_files,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.blue
+ spinner_foreground_color=ForegroundColorEnum.blue,
)
Console.write_line()
diff --git a/src/cpl_cli/source_creator/__init__.py b/src/cpl_cli/source_creator/__init__.py
index 5d65164f..244632b0 100644
--- a/src/cpl_cli/source_creator/__init__.py
+++ b/src/cpl_cli/source_creator/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.source_creator'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.source_creator"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/source_creator/template_builder.py b/src/cpl_cli/source_creator/template_builder.py
index 798b4a9b..a5691870 100644
--- a/src/cpl_cli/source_creator/template_builder.py
+++ b/src/cpl_cli/source_creator/template_builder.py
@@ -7,7 +7,6 @@ from cpl_core.console import Console, ForegroundColorEnum
class TemplateBuilder:
-
@staticmethod
def build_cpl_file(file_name: str, content: dict):
if not os.path.isabs(file_name):
@@ -17,7 +16,7 @@ class TemplateBuilder:
if not os.path.isdir(path):
os.makedirs(path)
- with open(file_name, 'w') as project_json:
+ with open(file_name, "w") as project_json:
project_json.write(json.dumps(content, indent=2))
project_json.close()
@@ -27,17 +26,17 @@ class TemplateBuilder:
WorkspaceSettings.__name__: {
WorkspaceSettingsNameEnum.default_project.value: project_name,
WorkspaceSettingsNameEnum.projects.value: projects,
- WorkspaceSettingsNameEnum.scripts.value: scripts
+ WorkspaceSettingsNameEnum.scripts.value: scripts,
}
}
Console.spinner(
- f'Creating {path}',
+ f"Creating {path}",
cls.build_cpl_file,
path,
ws_dict,
text_foreground_color=ForegroundColorEnum.green,
- spinner_foreground_color=ForegroundColorEnum.cyan
+ spinner_foreground_color=ForegroundColorEnum.cyan,
)
@staticmethod
@@ -51,6 +50,6 @@ class TemplateBuilder:
if not os.path.isdir(os.path.dirname(file_path)):
os.makedirs(os.path.dirname(file_path))
- with open(file_path, 'w') as file:
+ with open(file_path, "w") as file:
file.write(template.value)
file.close()
diff --git a/src/cpl_cli/startup.py b/src/cpl_cli/startup.py
index 847f8e3c..f8958547 100644
--- a/src/cpl_cli/startup.py
+++ b/src/cpl_cli/startup.py
@@ -32,26 +32,31 @@ from cpl_core.environment.application_environment_abc import ApplicationEnvironm
class Startup(StartupABC):
-
def __init__(self):
StartupABC.__init__(self)
- def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC) -> ConfigurationABC:
+ def configure_configuration(
+ self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC
+ ) -> ConfigurationABC:
environment.set_runtime_directory(os.path.dirname(__file__))
configuration.argument_error_function = Error.error
- configuration.add_environment_variables('PYTHON_')
- configuration.add_environment_variables('CPL_')
+ configuration.add_environment_variables("PYTHON_")
+ configuration.add_environment_variables("CPL_")
- is_unittest = configuration.get_configuration('IS_UNITTEST')
- if is_unittest == 'YES':
+ is_unittest = configuration.get_configuration("IS_UNITTEST")
+ if is_unittest == "YES":
Console.disable()
- configuration.add_json_file('appsettings.json', path=environment.runtime_directory, optional=False, output=False)
+ configuration.add_json_file(
+ "appsettings.json", path=environment.runtime_directory, optional=False, output=False
+ )
return configuration
- def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironmentABC) -> ServiceProviderABC:
+ def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironmentABC
+ ) -> ServiceProviderABC:
services.add_transient(PublisherABC, PublisherService)
services.add_transient(LiveServerService)
diff --git a/src/cpl_cli/startup_argument_extension.py b/src/cpl_cli/startup_argument_extension.py
index 07de63dd..6ec54482 100644
--- a/src/cpl_cli/startup_argument_extension.py
+++ b/src/cpl_cli/startup_argument_extension.py
@@ -21,50 +21,83 @@ from cpl_core.environment.application_environment_abc import ApplicationEnvironm
class StartupArgumentExtension(StartupExtensionABC):
-
def __init__(self):
pass
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'add', ['a', 'A'], AddService, True, validators=[WorkspaceValidator]) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'build', ['b', 'B'], BuildService, True, validators=[ProjectValidator])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'generate', ['g', 'G'], GenerateService, True)
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'install', ['i', 'I'], InstallService, True, validators=[ProjectValidator]) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'dev', ['d', 'D']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-prod', ['cp', 'CP']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-exp', ['ce', 'CE']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-dev', ['cd', 'CD'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService, True) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'async', ['a', 'A']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'application-base', ['ab', 'AB']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'startup', ['s', 'S']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'service-providing', ['sp', 'SP']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'nothing', ['n', 'N']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'venv', ['v', 'V']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'base', ['b', 'B'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService, True, validators=[ProjectValidator])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService, True, validators=[WorkspaceValidator]) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'run', [], RunService, True, validators=[ProjectValidator]) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'dev', ['d', 'D'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'start', ['s', 'S'], StartService, True, validators=[ProjectValidator]) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'dev', ['d', 'D'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'uninstall', ['ui', 'UI'], UninstallService, True, validators=[ProjectValidator]) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'dev', ['d', 'D']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'update', ['u', 'U'], UpdateService, True, validators=[ProjectValidator]) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-prod', ['cp', 'CP']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-exp', ['ce', 'CE']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-dev', ['cd', 'CD'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'version', ['v', 'V'], VersionService, True)
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "add", ["a", "A"], AddService, True, validators=[WorkspaceValidator]
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "simulate", ["s", "S"])
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "build", ["b", "B"], BuildService, True, validators=[ProjectValidator]
+ )
+ config.create_console_argument(ArgumentTypeEnum.Executable, "", "generate", ["g", "G"], GenerateService, True)
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "install", ["i", "I"], InstallService, True, validators=[ProjectValidator]
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "dev", ["d", "D"]).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "virtual", ["v", "V"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "simulate", ["s", "S"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "cpl-prod", ["cp", "CP"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "cpl-exp", ["ce", "CE"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "cpl-dev", ["cd", "CD"]
+ )
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "new", ["n", "N"], NewService, True
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "async", ["a", "A"]).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "application-base", ["ab", "AB"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "startup", ["s", "S"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "service-providing", ["sp", "SP"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "nothing", ["n", "N"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "venv", ["v", "V"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "base", ["b", "B"]
+ )
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "publish", ["p", "P"], PublishService, True, validators=[ProjectValidator]
+ )
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "remove", ["r", "R"], RemoveService, True, validators=[WorkspaceValidator]
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "simulate", ["s", "S"])
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "run", [], RunService, True, validators=[ProjectValidator]
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "dev", ["d", "D"])
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "start", ["s", "S"], StartService, True, validators=[ProjectValidator]
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "dev", ["d", "D"])
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable,
+ "",
+ "uninstall",
+ ["ui", "UI"],
+ UninstallService,
+ True,
+ validators=[ProjectValidator],
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "dev", ["d", "D"]).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "virtual", ["v", "V"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "simulate", ["s", "S"]
+ )
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "update", ["u", "U"], UpdateService, True, validators=[ProjectValidator]
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "simulate", ["s", "S"]).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "cpl-prod", ["cp", "CP"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "cpl-exp", ["ce", "CE"]
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "cpl-dev", ["cd", "CD"]
+ )
+ config.create_console_argument(ArgumentTypeEnum.Executable, "", "version", ["v", "V"], VersionService, True)
- config.for_each_argument(lambda a: a.add_console_argument(ArgumentTypeEnum.Flag, '--', 'help', ['h', 'H']))
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'help', ['h', 'H'], HelpService)
+ config.for_each_argument(lambda a: a.add_console_argument(ArgumentTypeEnum.Flag, "--", "help", ["h", "H"]))
+ config.create_console_argument(ArgumentTypeEnum.Executable, "", "help", ["h", "H"], HelpService)
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
pass
diff --git a/src/cpl_cli/startup_migration_extension.py b/src/cpl_cli/startup_migration_extension.py
index e8d8d4d6..c8597837 100644
--- a/src/cpl_cli/startup_migration_extension.py
+++ b/src/cpl_cli/startup_migration_extension.py
@@ -9,7 +9,6 @@ from cpl_core.environment.application_environment_abc import ApplicationEnvironm
class StartupMigrationExtension(StartupExtensionABC):
-
def __init__(self):
pass
diff --git a/src/cpl_cli/startup_workspace_extension.py b/src/cpl_cli/startup_workspace_extension.py
index 26fe4d0d..2c79e10e 100644
--- a/src/cpl_cli/startup_workspace_extension.py
+++ b/src/cpl_cli/startup_workspace_extension.py
@@ -12,7 +12,6 @@ from cpl_core.utils.string import String
class StartupWorkspaceExtension(StartupExtensionABC):
-
def __init__(self):
pass
@@ -22,9 +21,12 @@ class StartupWorkspaceExtension(StartupExtensionABC):
name = os.path.basename(working_directory)
for r, d, f in os.walk(working_directory):
for file in f:
- if file.endswith('.json'):
- f_name = file.split('.json')[0]
- if f_name == name or String.convert_to_camel_case(f_name).lower() == String.convert_to_camel_case(name).lower():
+ if file.endswith(".json"):
+ f_name = file.split(".json")[0]
+ if (
+ f_name == name
+ or String.convert_to_camel_case(f_name).lower() == String.convert_to_camel_case(name).lower()
+ ):
project_name = f_name
break
@@ -32,15 +34,15 @@ class StartupWorkspaceExtension(StartupExtensionABC):
def _read_cpl_environment(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
workspace: Optional[WorkspaceSettings] = config.get_configuration(WorkspaceSettings)
- config.add_configuration('PATH_WORKSPACE', env.working_directory)
+ config.add_configuration("PATH_WORKSPACE", env.working_directory)
if workspace is not None:
for script in workspace.scripts:
- config.create_console_argument(ArgumentTypeEnum.Executable, '', script, [], CustomScriptService)
+ config.create_console_argument(ArgumentTypeEnum.Executable, "", script, [], CustomScriptService)
return
project = self._search_project_json(env.working_directory)
if project is not None:
- project = f'{project}.json'
+ project = f"{project}.json"
if project is None:
return
@@ -48,7 +50,7 @@ class StartupWorkspaceExtension(StartupExtensionABC):
config.add_json_file(project, optional=True, output=False)
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
- config.add_json_file('cpl-workspace.json', path=env.working_directory, optional=True, output=False)
+ config.add_json_file("cpl-workspace.json", path=env.working_directory, optional=True, output=False)
self._read_cpl_environment(config, env)
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
diff --git a/src/cpl_cli/validators/__init__.py b/src/cpl_cli/validators/__init__.py
index d12f3ddb..3ee9c30c 100644
--- a/src/cpl_cli/validators/__init__.py
+++ b/src/cpl_cli/validators/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-cli sh-edraft Common Python library CLI
+cpl-cli CPL CLI
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Command Line Interface
+CPL Command Line Interface
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_cli.validators'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_cli.validators"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_cli/validators/project_validator.py b/src/cpl_cli/validators/project_validator.py
index bfd0cf80..75b22785 100644
--- a/src/cpl_cli/validators/project_validator.py
+++ b/src/cpl_cli/validators/project_validator.py
@@ -8,8 +8,13 @@ from cpl_core.environment import ApplicationEnvironmentABC
class ProjectValidator(ValidatorABC):
-
- def __init__(self, config: ConfigurationABC, env: ApplicationEnvironmentABC, workspace: WorkspaceSettings, project: ProjectSettings):
+ def __init__(
+ self,
+ config: ConfigurationABC,
+ env: ApplicationEnvironmentABC,
+ workspace: WorkspaceSettings,
+ project: ProjectSettings,
+ ):
self._config: ConfigurationABC = config
self._env: ApplicationEnvironmentABC = env
self._workspace: WorkspaceSettings = workspace
@@ -26,5 +31,5 @@ class ProjectValidator(ValidatorABC):
result = self._project is not None or self._workspace is not None
if not result:
- Error.error('The command requires to be run in an CPL project, but a project could not be found.')
+ Error.error("The command requires to be run in an CPL project, but a project could not be found.")
return result
diff --git a/src/cpl_cli/validators/workspace_validator.py b/src/cpl_cli/validators/workspace_validator.py
index d8c50033..994d0166 100644
--- a/src/cpl_cli/validators/workspace_validator.py
+++ b/src/cpl_cli/validators/workspace_validator.py
@@ -4,7 +4,6 @@ from cpl_core.configuration.validator_abc import ValidatorABC
class WorkspaceValidator(ValidatorABC):
-
def __init__(self, workspace: WorkspaceSettings):
self._workspace = workspace
@@ -13,5 +12,5 @@ class WorkspaceValidator(ValidatorABC):
def validate(self) -> bool:
result = self._workspace is not None
if not result:
- Error.error('The command requires to be run in an CPL workspace, but a workspace could not be found.')
+ Error.error("The command requires to be run in an CPL workspace, but a workspace could not be found.")
return result
diff --git a/src/cpl_core/__init__.py b/src/cpl_core/__init__.py
index c3d854c2..9d6075d5 100644
--- a/src/cpl_core/__init__.py
+++ b/src/cpl_core/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/application/__init__.py b/src/cpl_core/application/__init__.py
index d088dc08..bce58fea 100644
--- a/src/cpl_core/application/__init__.py
+++ b/src/cpl_core/application/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.application'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.application"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -28,5 +28,5 @@ from .application_extension_abc import ApplicationExtensionABC
from .startup_abc import StartupABC
from .startup_extension_abc import StartupExtensionABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/application/application_abc.py b/src/cpl_core/application/application_abc.py
index 06e01e24..df4ede17 100644
--- a/src/cpl_core/application/application_abc.py
+++ b/src/cpl_core/application/application_abc.py
@@ -10,8 +10,7 @@ from cpl_core.environment.application_environment_abc import ApplicationEnvironm
class ApplicationABC(ABC):
r"""ABC for the Application class
- Parameters
- ----------
+ Parameters:
config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
Contains object loaded from appsettings
services: :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC`
@@ -34,7 +33,7 @@ class ApplicationABC(ABC):
self.main()
except KeyboardInterrupt:
Console.close()
-
+
async def run_async(self):
r"""Entry point
diff --git a/src/cpl_core/application/application_builder.py b/src/cpl_core/application/application_builder.py
index 9f05e870..57c1e57e 100644
--- a/src/cpl_core/application/application_builder.py
+++ b/src/cpl_core/application/application_builder.py
@@ -12,8 +12,7 @@ from cpl_core.dependency_injection.service_collection import ServiceCollection
class ApplicationBuilder(ApplicationBuilderABC):
r"""This is class is used to build an object of :class:`cpl_core.application.application_abc.ApplicationABC`
- Parameter
- ---------
+ Parameter:
app: Type[:class:`cpl_core.application.application_abc.ApplicationABC`]
Application to build
"""
@@ -30,11 +29,13 @@ class ApplicationBuilder(ApplicationBuilderABC):
self._app_extensions: list[Callable] = []
self._startup_extensions: list[Callable] = []
- def use_startup(self, startup: Type[StartupABC]) -> 'ApplicationBuilder':
+ def use_startup(self, startup: Type[StartupABC]) -> "ApplicationBuilder":
self._startup = startup()
return self
- def use_extension(self, extension: Type[Union[ApplicationExtensionABC, StartupExtensionABC]]) -> 'ApplicationBuilder':
+ def use_extension(
+ self, extension: Type[Union[ApplicationExtensionABC, StartupExtensionABC]]
+ ) -> "ApplicationBuilder":
if issubclass(extension, ApplicationExtensionABC) and extension not in self._app_extensions:
self._app_extensions.append(extension)
elif issubclass(extension, StartupExtensionABC) and extension not in self._startup_extensions:
diff --git a/src/cpl_core/application/application_builder_abc.py b/src/cpl_core/application/application_builder_abc.py
index 2ced6ad1..f2f2640b 100644
--- a/src/cpl_core/application/application_builder_abc.py
+++ b/src/cpl_core/application/application_builder_abc.py
@@ -16,8 +16,7 @@ class ApplicationBuilderABC(ABC):
def use_startup(self, startup: Type[StartupABC]):
r"""Sets the custom startup class to use
- Parameter
- ---------
+ Parameter:
startup: Type[:class:`cpl_core.application.startup_abc.StartupABC`]
Startup class to use
"""
@@ -27,8 +26,7 @@ class ApplicationBuilderABC(ABC):
async def use_startup(self, startup: Type[StartupABC]):
r"""Sets the custom startup class to use async
- Parameter
- ---------
+ Parameter:
startup: Type[:class:`cpl_core.application.startup_abc.StartupABC`]
Startup class to use
"""
@@ -38,8 +36,7 @@ class ApplicationBuilderABC(ABC):
def build(self) -> ApplicationABC:
r"""Creates custom application object
- Returns
- -------
+ Returns:
Object of :class:`cpl_core.application.application_abc.ApplicationABC`
"""
pass
@@ -48,8 +45,7 @@ class ApplicationBuilderABC(ABC):
async def build_async(self) -> ApplicationABC:
r"""Creates custom application object async
- Returns
- -------
+ Returns:
Object of :class:`cpl_core.application.application_abc.ApplicationABC`
"""
pass
diff --git a/src/cpl_core/application/application_extension_abc.py b/src/cpl_core/application/application_extension_abc.py
index a7092fcf..8b35f575 100644
--- a/src/cpl_core/application/application_extension_abc.py
+++ b/src/cpl_core/application/application_extension_abc.py
@@ -5,12 +5,14 @@ from cpl_core.dependency_injection import ServiceProviderABC
class ApplicationExtensionABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
+ def run(self, config: ConfigurationABC, services: ServiceProviderABC):
+ pass
@abstractmethod
- def run(self, config: ConfigurationABC, services: ServiceProviderABC): pass
-
- @abstractmethod
- async def run(self, config: ConfigurationABC, services: ServiceProviderABC): pass
+ async def run(self, config: ConfigurationABC, services: ServiceProviderABC):
+ pass
diff --git a/src/cpl_core/application/startup_abc.py b/src/cpl_core/application/startup_abc.py
index 1c25dbf7..00bd955d 100644
--- a/src/cpl_core/application/startup_abc.py
+++ b/src/cpl_core/application/startup_abc.py
@@ -10,19 +10,18 @@ class StartupABC(ABC):
r"""ABC for the startup class"""
@abstractmethod
- def __init__(self): pass
+ def __init__(self):
+ pass
@abstractmethod
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC) -> ConfigurationABC:
r"""Creates configuration of application
- Parameter
- ---------
+ Parameter:
config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
env: :class:`cpl_core.environment.application_environment_abc`
- Returns
- -------
+ Returns:
Object of :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
"""
pass
@@ -31,13 +30,11 @@ class StartupABC(ABC):
def configure_services(self, service: ServiceCollectionABC, env: ApplicationEnvironmentABC) -> ServiceProviderABC:
r"""Creates service provider
- Parameter
- ---------
+ Parameter:
services: :class:`cpl_core.dependency_injection.service_collection_abc`
env: :class:`cpl_core.environment.application_environment_abc`
- Returns
- -------
+ Returns:
Object of :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC`
"""
pass
diff --git a/src/cpl_core/application/startup_extension_abc.py b/src/cpl_core/application/startup_extension_abc.py
index 5ca19cde..1bf88945 100644
--- a/src/cpl_core/application/startup_extension_abc.py
+++ b/src/cpl_core/application/startup_extension_abc.py
@@ -9,14 +9,14 @@ class StartupExtensionABC(ABC):
r"""ABC for startup extension classes"""
@abstractmethod
- def __init__(self): pass
+ def __init__(self):
+ pass
@abstractmethod
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
r"""Creates configuration of application
- Parameter
- ---------
+ Parameter:
config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
env: :class:`cpl_core.environment.application_environment_abc`
"""
@@ -26,8 +26,7 @@ class StartupExtensionABC(ABC):
def configure_services(self, service: ServiceCollectionABC, env: ApplicationEnvironmentABC):
r"""Creates service provider
- Parameter
- ---------
+ Parameter:
services: :class:`cpl_core.dependency_injection.service_collection_abc`
env: :class:`cpl_core.environment.application_environment_abc`
"""
diff --git a/src/cpl_core/configuration/__init__.py b/src/cpl_core/configuration/__init__.py
index 18ebabec..22029e2d 100644
--- a/src/cpl_core/configuration/__init__.py
+++ b/src/cpl_core/configuration/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.configuration'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.configuration"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -34,5 +34,5 @@ from .flag_argument import FlagArgument
from .validator_abc import ValidatorABC
from .variable_argument import VariableArgument
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/configuration/argument_abc.py b/src/cpl_core/configuration/argument_abc.py
index 50f7cfa6..51a84c88 100644
--- a/src/cpl_core/configuration/argument_abc.py
+++ b/src/cpl_core/configuration/argument_abc.py
@@ -4,19 +4,18 @@ from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum
class ArgumentABC(ABC):
-
@abstractmethod
- def __init__(self,
- token: str,
- name: str,
- aliases: list[str],
- prevent_next_executable: bool = False,
- console_arguments: list['ArgumentABC'] = None
- ):
+ def __init__(
+ self,
+ token: str,
+ name: str,
+ aliases: list[str],
+ prevent_next_executable: bool = False,
+ console_arguments: list["ArgumentABC"] = None,
+ ):
r"""Representation of an console argument
- Parameter
- ---------
+ Parameter:
token: :class:`str`
name: :class:`str`
aliases: list[:class:`str`]
@@ -45,22 +44,21 @@ class ArgumentABC(ABC):
return self._prevent_next_executable
@property
- def console_arguments(self) -> list['ArgumentABC']:
+ def console_arguments(self) -> list["ArgumentABC"]:
return self._console_arguments
- def add_console_argument(self, arg_type: ArgumentTypeEnum, *args, **kwargs) -> 'ArgumentABC':
+ def add_console_argument(self, arg_type: ArgumentTypeEnum, *args, **kwargs) -> "ArgumentABC":
r"""Creates and adds a console argument to known console arguments
- Parameter
- ---------
+ Parameter:
arg_type: :class:`str`
Specifies the specific type of the argument
- Returns
- ------
+ Returns:
self :class:`cpl_core.configuration.console_argument.ConsoleArgument` not created argument!
"""
from cpl_core.configuration.argument_builder import ArgumentBuilder
+
argument = ArgumentBuilder.build_argument(arg_type, *args, *kwargs)
self._console_arguments.append(argument)
return self
diff --git a/src/cpl_core/configuration/argument_builder.py b/src/cpl_core/configuration/argument_builder.py
index 9d797d76..bbb06afc 100644
--- a/src/cpl_core/configuration/argument_builder.py
+++ b/src/cpl_core/configuration/argument_builder.py
@@ -8,10 +8,10 @@ from cpl_core.console import Console
class ArgumentBuilder:
-
@staticmethod
- def build_argument(arg_type: ArgumentTypeEnum, *args, **kwargs) -> Union[
- ExecutableArgument, FlagArgument, VariableArgument]:
+ def build_argument(
+ arg_type: ArgumentTypeEnum, *args, **kwargs
+ ) -> Union[ExecutableArgument, FlagArgument, VariableArgument]:
argument = None
try:
match arg_type:
@@ -22,7 +22,7 @@ class ArgumentBuilder:
case ArgumentTypeEnum.Variable:
argument = VariableArgument(*args, **kwargs)
case _:
- Console.error('Invalid argument type')
+ Console.error("Invalid argument type")
Console.close()
except TypeError as e:
Console.error(str(e))
diff --git a/src/cpl_core/configuration/argument_executable_abc.py b/src/cpl_core/configuration/argument_executable_abc.py
index d7f3319a..99546498 100644
--- a/src/cpl_core/configuration/argument_executable_abc.py
+++ b/src/cpl_core/configuration/argument_executable_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class ArgumentExecutableABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- def run(self, args: list[str]): pass
+ def run(self, args: list[str]):
+ pass
diff --git a/src/cpl_core/configuration/argument_type_enum.py b/src/cpl_core/configuration/argument_type_enum.py
index d8acc8fb..08972534 100644
--- a/src/cpl_core/configuration/argument_type_enum.py
+++ b/src/cpl_core/configuration/argument_type_enum.py
@@ -2,7 +2,6 @@ from enum import Enum
class ArgumentTypeEnum(Enum):
-
Flag = 0
Executable = 1
Variable = 3
diff --git a/src/cpl_core/configuration/configuration.py b/src/cpl_core/configuration/configuration.py
index 84ba9011..4f8942d8 100644
--- a/src/cpl_core/configuration/configuration.py
+++ b/src/cpl_core/configuration/configuration.py
@@ -11,7 +11,9 @@ from cpl_core.configuration.argument_executable_abc import ArgumentExecutableABC
from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum
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.configuration_variable_name_enum import (
+ ConfigurationVariableNameEnum,
+)
from cpl_core.configuration.executable_argument import ExecutableArgument
from cpl_core.configuration.flag_argument import FlagArgument
from cpl_core.configuration.validator_abc import ValidatorABC
@@ -26,7 +28,6 @@ from cpl_core.type import T
class Configuration(ConfigurationABC):
-
def __init__(self):
r"""Representation of configuration"""
ConfigurationABC.__init__(self)
@@ -65,52 +66,48 @@ class Configuration(ConfigurationABC):
def _print_info(name: str, message: str):
r"""Prints an info message
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Info name
message: :class:`str`
Info message
"""
Console.set_foreground_color(ForegroundColorEnum.green)
- Console.write_line(f'[{name}] {message}')
+ Console.write_line(f"[{name}] {message}")
Console.set_foreground_color(ForegroundColorEnum.default)
@staticmethod
def _print_warn(name: str, message: str):
r"""Prints a warning
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Warning name
message: :class:`str`
Warning message
"""
Console.set_foreground_color(ForegroundColorEnum.yellow)
- Console.write_line(f'[{name}] {message}')
+ Console.write_line(f"[{name}] {message}")
Console.set_foreground_color(ForegroundColorEnum.default)
@staticmethod
def _print_error(name: str, message: str):
r"""Prints an error
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Error name
message: :class:`str`
Error message
"""
Console.set_foreground_color(ForegroundColorEnum.red)
- Console.write_line(f'[{name}] {message}')
+ Console.write_line(f"[{name}] {message}")
Console.set_foreground_color(ForegroundColorEnum.default)
def _set_variable(self, name: str, value: any):
r"""Sets variable to given value
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Name of the variable
value: :class:`any`
@@ -131,34 +128,33 @@ class Configuration(ConfigurationABC):
def _load_json_file(self, file: str, output: bool) -> dict:
r"""Reads the json file
- Parameter
- ---------
+ Parameter:
file: :class:`str`
Name of the file
output: :class:`bool`
Specifies whether an output should take place
- Returns
- -------
+ Returns:
Object of :class:`dict`
"""
try:
# open config file, create if not exists
- with open(file, encoding='utf-8') as cfg:
+ with open(file, encoding="utf-8") as cfg:
# load json
json_cfg = json.load(cfg)
if output:
- self._print_info(__name__, f'Loaded config file: {file}')
+ self._print_info(__name__, f"Loaded config file: {file}")
return json_cfg
except Exception as e:
- self._print_error(__name__, f'Cannot load config file: {file}! -> {e}')
+ self._print_error(__name__, f"Cannot load config file: {file}! -> {e}")
return {}
def _handle_pre_or_post_executables(self, pre: bool, argument: ExecutableArgument, services: ServiceProviderABC):
- script_type = 'pre-' if pre else 'post-'
+ script_type = "pre-" if pre else "post-"
from cpl_cli.configuration.workspace_settings import WorkspaceSettings
+
workspace: Optional[WorkspaceSettings] = self.get_configuration(WorkspaceSettings)
if workspace is None or len(workspace.scripts) == 0:
return
@@ -172,15 +168,21 @@ class Configuration(ConfigurationABC):
continue
from cpl_cli.command.custom_script_service import CustomScriptService
+
css: CustomScriptService = services.get_service(CustomScriptService)
if css is None:
continue
Console.write_line()
- self._set_variable('ACTIVE_EXECUTABLE', script)
+ self._set_variable("ACTIVE_EXECUTABLE", script)
css.run(self._additional_arguments)
- def _parse_arguments(self, executables: list[ArgumentABC], arg_list: list[str], args_types: list[ArgumentABC]):
+ def _parse_arguments(
+ self,
+ executables: list[ArgumentABC],
+ arg_list: list[str],
+ args_types: list[ArgumentABC],
+ ):
for i in range(0, len(arg_list)):
arg_str = arg_list[i]
for n in range(0, len(args_types)):
@@ -191,10 +193,14 @@ class Configuration(ConfigurationABC):
# executable
if isinstance(arg, ExecutableArgument):
- if arg_str.startswith(arg.token) and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases:
+ if (
+ arg_str.startswith(arg.token)
+ and arg_str_without_token == arg.name
+ or arg_str_without_token in arg.aliases
+ ):
executables.append(arg)
self._handled_args.append(arg_str)
- self._parse_arguments(executables, arg_list[i + 1:], arg.console_arguments)
+ self._parse_arguments(executables, arg_list[i + 1 :], arg.console_arguments)
# variables
elif isinstance(arg, VariableArgument):
@@ -202,24 +208,32 @@ class Configuration(ConfigurationABC):
if arg.value_token in arg_str_without_value:
arg_str_without_value = arg_str_without_token.split(arg.value_token)[0]
- if arg_str.startswith(arg.token) and arg_str_without_value == arg.name or arg_str_without_value in arg.aliases:
- if arg.value_token != ' ':
+ if (
+ arg_str.startswith(arg.token)
+ and arg_str_without_value == arg.name
+ or arg_str_without_value in arg.aliases
+ ):
+ if arg.value_token != " ":
value = arg_str_without_token.split(arg.value_token)[1]
else:
value = arg_list[i + 1]
self._set_variable(arg.name, value)
self._handled_args.append(arg_str)
self._handled_args.append(value)
- self._parse_arguments(executables, arg_list[i + 1:], arg.console_arguments)
+ self._parse_arguments(executables, arg_list[i + 1 :], arg.console_arguments)
# flags
elif isinstance(arg, FlagArgument):
- if arg_str.startswith(arg.token) and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases:
+ if (
+ arg_str.startswith(arg.token)
+ and arg_str_without_token == arg.name
+ or arg_str_without_token in arg.aliases
+ ):
if arg_str in self._additional_arguments:
self._additional_arguments.remove(arg_str)
self._additional_arguments.append(arg.name)
self._handled_args.append(arg_str)
- self._parse_arguments(executables, arg_list[i + 1:], arg.console_arguments)
+ self._parse_arguments(executables, arg_list[i + 1 :], arg.console_arguments)
# add left over values to args
if arg_str not in self._additional_arguments and arg_str not in self._handled_args:
@@ -230,7 +244,7 @@ class Configuration(ConfigurationABC):
if not env_var.startswith(prefix):
continue
- self._set_variable(env_var.replace(prefix, ''), os.environ[env_var])
+ self._set_variable(env_var.replace(prefix, ""), os.environ[env_var])
def add_console_argument(self, argument: ArgumentABC):
self._argument_types.append(argument)
@@ -243,27 +257,27 @@ class Configuration(ConfigurationABC):
if path is not None:
path_root = path
- if str(path_root).endswith('/') and not name.startswith('/'):
- file_path = f'{path_root}{name}'
+ if str(path_root).endswith("/") and not name.startswith("/"):
+ file_path = f"{path_root}{name}"
else:
- file_path = f'{path_root}/{name}'
+ file_path = f"{path_root}/{name}"
if not os.path.isfile(file_path):
if optional is not True:
if output:
- self._print_error(__name__, f'File not found: {file_path}')
+ self._print_error(__name__, f"File not found: {file_path}")
sys.exit()
if output:
- self._print_warn(__name__, f'Not Loaded config file: {file_path}')
+ self._print_warn(__name__, f"Not Loaded config file: {file_path}")
return None
config_from_file = self._load_json_file(file_path, output)
for sub in ConfigurationModelABC.__subclasses__():
for key, value in config_from_file.items():
- if sub.__name__ == key or sub.__name__.replace('Settings', '') == key:
+ if sub.__name__ == key or sub.__name__.replace("Settings", "") == key:
configuration = sub()
configuration.from_dict(value)
self.add_configuration(sub, configuration)
@@ -271,8 +285,15 @@ class Configuration(ConfigurationABC):
def add_configuration(self, key_type: T, value: any):
self._config[key_type] = value
- def create_console_argument(self, arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str],
- *args, **kwargs) -> ArgumentABC:
+ def create_console_argument(
+ self,
+ arg_type: ArgumentTypeEnum,
+ token: str,
+ name: str,
+ aliases: list[str],
+ *args,
+ **kwargs,
+ ) -> ArgumentABC:
argument = ArgumentBuilder.build_argument(arg_type, token, name, aliases, *args, **kwargs)
self._argument_types.append(argument)
return argument
@@ -302,7 +323,7 @@ class Configuration(ConfigurationABC):
def parse_console_arguments(self, services: ServiceProviderABC, error: bool = None) -> bool:
# sets environment variables as possible arguments as: --VAR=VALUE
for arg_name in ConfigurationVariableNameEnum.to_list():
- self.add_console_argument(VariableArgument('--', str(arg_name).upper(), [str(arg_name).lower()], '='))
+ self.add_console_argument(VariableArgument("--", str(arg_name).upper(), [str(arg_name).lower()], "="))
success = False
try:
@@ -310,7 +331,7 @@ class Configuration(ConfigurationABC):
executables: list[ExecutableArgument] = []
self._parse_arguments(executables, arg_list, self._argument_types)
except Exception as e:
- Console.error('An error occurred while parsing arguments.')
+ Console.error("An error occurred while parsing arguments.")
sys.exit()
try:
@@ -333,11 +354,11 @@ class Configuration(ConfigurationABC):
cmd: ArgumentExecutableABC = services.get_service(exe.executable_type)
self._handle_pre_or_post_executables(True, exe, services)
- self._set_variable('ACTIVE_EXECUTABLE', exe.name)
- args = self.get_configuration('ARGS')
+ self._set_variable("ACTIVE_EXECUTABLE", exe.name)
+ args = self.get_configuration("ARGS")
if args is not None:
- for arg in args.split(' '):
- if arg == '':
+ for arg in args.split(" "):
+ if arg == "":
continue
self._additional_arguments.append(arg)
@@ -346,7 +367,7 @@ class Configuration(ConfigurationABC):
prevent = exe.prevent_next_executable
success = True
except Exception as e:
- Console.error('An error occurred while executing arguments.', traceback.format_exc())
+ Console.error("An error occurred while executing arguments.", traceback.format_exc())
sys.exit()
return success
diff --git a/src/cpl_core/configuration/configuration_abc.py b/src/cpl_core/configuration/configuration_abc.py
index fd1ccced..2f8d7a4c 100644
--- a/src/cpl_core/configuration/configuration_abc.py
+++ b/src/cpl_core/configuration/configuration_abc.py
@@ -10,7 +10,6 @@ from cpl_core.type import T
class ConfigurationABC(ABC):
-
@abstractmethod
def __init__(self):
r"""ABC for the :class:`cpl_core.configuration.configuration.Configuration`"""
@@ -18,30 +17,34 @@ class ConfigurationABC(ABC):
@property
@abstractmethod
- def environment(self) -> ApplicationEnvironmentABC: pass
+ def environment(self) -> ApplicationEnvironmentABC:
+ pass
@property
@abstractmethod
- def additional_arguments(self) -> list[str]: pass
+ def additional_arguments(self) -> list[str]:
+ pass
@property
@abstractmethod
- def argument_error_function(self) -> Optional[Callable]: pass
+ def argument_error_function(self) -> Optional[Callable]:
+ pass
@argument_error_function.setter
@abstractmethod
- def argument_error_function(self, argument_error_function: Callable): pass
+ def argument_error_function(self, argument_error_function: Callable):
+ pass
@property
@abstractmethod
- def arguments(self) -> list[ArgumentABC]: pass
+ def arguments(self) -> list[ArgumentABC]:
+ pass
@abstractmethod
def add_environment_variables(self, prefix: str):
r"""Reads the environment variables
- Parameter
- ---------
+ Parameter:
prefix: :class:`str`
Prefix of the variables
"""
@@ -51,8 +54,7 @@ class ConfigurationABC(ABC):
def add_console_argument(self, argument: ArgumentABC):
r"""Adds console argument to known console arguments
- Parameter
- ---------
+ Parameter:
argument: :class:`cpl_core.configuration.console_argument.ConsoleArgumentABC`
Specifies the console argument
"""
@@ -62,8 +64,7 @@ class ConfigurationABC(ABC):
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):
r"""Reads and saves settings from given json file
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Name of the file
optional: :class:`str`
@@ -79,8 +80,7 @@ class ConfigurationABC(ABC):
def add_configuration(self, key_type: T, value: any):
r"""Add configuration object
- Parameter
- ---------
+ Parameter:
key_type: Union[:class:`str`, :class:`type`]
Type of the value
value: any
@@ -89,12 +89,12 @@ class ConfigurationABC(ABC):
pass
@abstractmethod
- def create_console_argument(self, arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str],
- *args, **kwargs) -> ArgumentABC:
+ def create_console_argument(
+ self, arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str], *args, **kwargs
+ ) -> ArgumentABC:
r"""Creates and adds a console argument to known console arguments
- Parameter
- ---------
+ Parameter:
token: :class:`str`
Specifies optional beginning of argument
name :class:`str`
@@ -108,8 +108,7 @@ class ConfigurationABC(ABC):
runnable: :class:`cpl_core.configuration.console_argument.ConsoleArgumentABC`
Specifies class to run when called if value is not None
- Returns
- ------
+ Returns:
Object of :class:`cpl_core.configuration.console_argument.ConsoleArgumentABC`
"""
pass
@@ -118,8 +117,7 @@ class ConfigurationABC(ABC):
def for_each_argument(self, call: Callable):
r"""Iterates through all arguments and calls the call function
- Parameter
- ---------
+ Parameter:
call: :class:`Callable`
Call for each argument
"""
@@ -129,28 +127,24 @@ class ConfigurationABC(ABC):
def get_configuration(self, search_type: Type[T]) -> Optional[T]:
r"""Returns value from configuration by given type
- Parameter
- ---------
+ Parameter:
search_type: Union[:class:`str`, Type[:class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]]
Type to search for
- Returns
- -------
+ Returns:
Object of Union[:class:`str`, :class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]
"""
pass
@abstractmethod
- def parse_console_arguments(self, services: 'ServiceProviderABC', error: bool = None) -> bool:
+ def parse_console_arguments(self, services: "ServiceProviderABC", error: bool = None) -> bool:
r"""Reads the console arguments
- Parameter
- ---------
+ Parameter:
error: :class:`bool`
Defines is invalid argument error will be shown or not
- Returns
- -------
+ Returns:
Bool to specify if executables were executed or not.
"""
pass
diff --git a/src/cpl_core/configuration/configuration_model_abc.py b/src/cpl_core/configuration/configuration_model_abc.py
index 8c1e6849..674610b4 100644
--- a/src/cpl_core/configuration/configuration_model_abc.py
+++ b/src/cpl_core/configuration/configuration_model_abc.py
@@ -2,7 +2,6 @@ from abc import ABC, abstractmethod
class ConfigurationModelABC(ABC):
-
@abstractmethod
def __init__(self):
r"""ABC for settings representation"""
@@ -12,8 +11,7 @@ class ConfigurationModelABC(ABC):
def from_dict(self, settings: dict):
r"""Converts attributes to dict
- Parameter
- ---------
+ Parameter:
settings: :class:`dict`
"""
pass
diff --git a/src/cpl_core/configuration/configuration_variable_name_enum.py b/src/cpl_core/configuration/configuration_variable_name_enum.py
index 7db3688d..23a36206 100644
--- a/src/cpl_core/configuration/configuration_variable_name_enum.py
+++ b/src/cpl_core/configuration/configuration_variable_name_enum.py
@@ -2,10 +2,9 @@ from enum import Enum
class ConfigurationVariableNameEnum(Enum):
-
- environment = 'ENVIRONMENT'
- name = 'NAME'
- customer = 'CUSTOMER'
+ environment = "ENVIRONMENT"
+ name = "NAME"
+ customer = "CUSTOMER"
@staticmethod
def to_list():
diff --git a/src/cpl_core/configuration/executable_argument.py b/src/cpl_core/configuration/executable_argument.py
index 6d2254dd..75a0b206 100644
--- a/src/cpl_core/configuration/executable_argument.py
+++ b/src/cpl_core/configuration/executable_argument.py
@@ -6,17 +6,16 @@ from cpl_core.configuration.validator_abc import ValidatorABC
class ExecutableArgument(ArgumentABC):
-
- def __init__(self,
- token: str,
- name: str,
- aliases: list[str],
- executable: Type[ArgumentExecutableABC],
- prevent_next_executable: bool = False,
- validators: list[Type[ValidatorABC]] = None,
- console_arguments: list['ArgumentABC'] = None
- ):
-
+ def __init__(
+ self,
+ token: str,
+ name: str,
+ aliases: list[str],
+ executable: Type[ArgumentExecutableABC],
+ prevent_next_executable: bool = False,
+ validators: list[Type[ValidatorABC]] = None,
+ console_arguments: list["ArgumentABC"] = None,
+ ):
self._executable_type = executable
self._validators = validators
self._executable: Optional[ArgumentExecutableABC] = None
@@ -35,8 +34,7 @@ class ExecutableArgument(ArgumentABC):
return self._validators
def run(self, args: list[str]):
- r"""Executes runnable if exists
- """
+ r"""Executes runnable if exists"""
if self._executable is None:
return
self._executable.execute(args)
diff --git a/src/cpl_core/configuration/flag_argument.py b/src/cpl_core/configuration/flag_argument.py
index c22c5689..55e974c6 100644
--- a/src/cpl_core/configuration/flag_argument.py
+++ b/src/cpl_core/configuration/flag_argument.py
@@ -2,13 +2,12 @@ from cpl_core.configuration.argument_abc import ArgumentABC
class FlagArgument(ArgumentABC):
-
- def __init__(self,
- token: str,
- name: str,
- aliases: list[str],
- prevent_next_executable: bool = False,
- console_arguments: list['ArgumentABC'] = None
- ):
-
+ def __init__(
+ self,
+ token: str,
+ name: str,
+ aliases: list[str],
+ prevent_next_executable: bool = False,
+ console_arguments: list["ArgumentABC"] = None,
+ ):
ArgumentABC.__init__(self, token, name, aliases, prevent_next_executable, console_arguments)
diff --git a/src/cpl_core/configuration/validator_abc.py b/src/cpl_core/configuration/validator_abc.py
index a79e8621..060d7898 100644
--- a/src/cpl_core/configuration/validator_abc.py
+++ b/src/cpl_core/configuration/validator_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class ValidatorABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- def validate(self) -> bool: pass
+ def validate(self) -> bool:
+ pass
diff --git a/src/cpl_core/configuration/variable_argument.py b/src/cpl_core/configuration/variable_argument.py
index 1f8597e5..6c86f265 100644
--- a/src/cpl_core/configuration/variable_argument.py
+++ b/src/cpl_core/configuration/variable_argument.py
@@ -2,17 +2,17 @@ from cpl_core.configuration.argument_abc import ArgumentABC
class VariableArgument(ArgumentABC):
-
- def __init__(self,
- token: str,
- name: str,
- aliases: list[str],
- value_token: str,
- prevent_next_executable: bool = False,
- console_arguments: list['ArgumentABC'] = None
- ):
+ def __init__(
+ self,
+ token: str,
+ name: str,
+ aliases: list[str],
+ value_token: str,
+ prevent_next_executable: bool = False,
+ console_arguments: list["ArgumentABC"] = None,
+ ):
self._value_token = value_token
- self._value: str = ''
+ self._value: str = ""
ArgumentABC.__init__(self, token, name, aliases, prevent_next_executable, console_arguments)
diff --git a/src/cpl_core/console/__init__.py b/src/cpl_core/console/__init__.py
index 4e227f6b..ee160268 100644
--- a/src/cpl_core/console/__init__.py
+++ b/src/cpl_core/console/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.console'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.console"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -27,5 +27,5 @@ from .console_call import ConsoleCall
from .foreground_color_enum import ForegroundColorEnum
from .spinner_thread import SpinnerThread
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/console/background_color_enum.py b/src/cpl_core/console/background_color_enum.py
index 64258332..6b23501f 100644
--- a/src/cpl_core/console/background_color_enum.py
+++ b/src/cpl_core/console/background_color_enum.py
@@ -2,13 +2,12 @@ from enum import Enum
class BackgroundColorEnum(Enum):
-
- default = 'on_default'
- grey = 'on_grey'
- red = 'on_red'
- green = 'on_green'
- yellow = 'on_yellow'
- blue = 'on_blue'
- magenta = 'on_magenta'
- cyan = 'on_cyan'
- white = 'on_white'
+ default = "on_default"
+ grey = "on_grey"
+ red = "on_red"
+ green = "on_green"
+ yellow = "on_yellow"
+ blue = "on_blue"
+ magenta = "on_magenta"
+ cyan = "on_cyan"
+ white = "on_white"
diff --git a/src/cpl_core/console/console.py b/src/cpl_core/console/console.py
index c10b3590..1b783410 100644
--- a/src/cpl_core/console/console.py
+++ b/src/cpl_core/console/console.py
@@ -32,7 +32,7 @@ class Console:
_select_menu_items: list[str] = []
_is_first_select_menu_output = True
_selected_menu_item_index: int = 0
- _selected_menu_item_char: str = ''
+ _selected_menu_item_char: str = ""
_selected_menu_option_foreground_color: ForegroundColorEnum = ForegroundColorEnum.default
_selected_menu_option_background_color: BackgroundColorEnum = BackgroundColorEnum.default
_selected_menu_cursor_foreground_color: ForegroundColorEnum = ForegroundColorEnum.default
@@ -60,8 +60,7 @@ class Console:
def set_background_color(cls, color: Union[BackgroundColorEnum, str]):
r"""Sets the background color
- Parameter
- ---------
+ Parameter:
color: Union[:class:`cpl_core.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
Background color of the console
"""
@@ -74,8 +73,7 @@ class Console:
def set_foreground_color(cls, color: Union[ForegroundColorEnum, str]):
r"""Sets the foreground color
- Parameter
- ---------
+ Parameter:
color: Union[:class:`cpl_core.console.background_color_enum.BackgroundColorEnum`, :class:`str`]
Foreground color of the console
"""
@@ -94,8 +92,7 @@ class Console:
def set_cursor_position(cls, x: int, y: int):
r"""Sets cursor position
- Parameter
- ---------
+ Parameter:
x: :class:`int`
X coordinate
y: :class:`int`
@@ -110,8 +107,7 @@ class Console:
def _output(cls, string: str, x: int = None, y: int = None, end: str = None):
r"""Prints given output with given format
- Parameter
- ---------
+ Parameter:
string: :class:`str`
Message to print
x: :class:`int`
@@ -125,21 +121,30 @@ class Console:
cls._is_first_write = False
if end is None:
- end = '\n'
+ end = "\n"
args = []
colored_args = []
if x is not None and y is not None:
- args.append(f'\033[{y};{x}H')
+ args.append(f"\033[{y};{x}H")
elif cls._x is not None and cls._y is not None:
- args.append(f'\033[{cls._y};{cls._x}H')
+ args.append(f"\033[{cls._y};{cls._x}H")
colored_args.append(string)
- if cls._foreground_color != ForegroundColorEnum.default and cls._background_color == BackgroundColorEnum.default:
+ if (
+ cls._foreground_color != ForegroundColorEnum.default
+ and cls._background_color == BackgroundColorEnum.default
+ ):
colored_args.append(cls._foreground_color.value)
- elif cls._foreground_color == ForegroundColorEnum.default and cls._background_color != BackgroundColorEnum.default:
+ elif (
+ cls._foreground_color == ForegroundColorEnum.default
+ and cls._background_color != BackgroundColorEnum.default
+ ):
colored_args.append(cls._background_color.value)
- elif cls._foreground_color != ForegroundColorEnum.default and cls._background_color != BackgroundColorEnum.default:
+ elif (
+ cls._foreground_color != ForegroundColorEnum.default
+ and cls._background_color != BackgroundColorEnum.default
+ ):
colored_args.append(cls._foreground_color.value)
colored_args.append(cls._background_color.value)
@@ -151,22 +156,23 @@ class Console:
r"""Shows the select menu"""
if not cls._is_first_select_menu_output:
for _ in range(0, len(cls._select_menu_items) + 1):
- sys.stdout.write('\x1b[1A\x1b[2K')
+ sys.stdout.write("\x1b[1A\x1b[2K")
else:
cls._is_first_select_menu_output = False
for i in range(0, len(cls._select_menu_items)):
Console.set_foreground_color(cls._selected_menu_cursor_foreground_color)
Console.set_background_color(cls._selected_menu_cursor_background_color)
- placeholder = ''
+ placeholder = ""
for _ in cls._selected_menu_item_char:
- placeholder += ' '
+ placeholder += " "
Console.write_line(
- f'{cls._selected_menu_item_char if cls._selected_menu_item_index == i else placeholder} ')
+ f"{cls._selected_menu_item_char if cls._selected_menu_item_index == i else placeholder} "
+ )
Console.set_foreground_color(cls._selected_menu_option_foreground_color)
Console.set_background_color(cls._selected_menu_option_background_color)
- Console.write(f'{cls._select_menu_items[i]}')
+ Console.write(f"{cls._select_menu_items[i]}")
Console.write_line()
@@ -174,12 +180,12 @@ class Console:
def _select_menu_key_press(cls, key):
r"""Event function when key press is detected
- Parameter
- ---------
+ Parameter:
key: :class:`pynput.keyboard.Key`
Pressed key
"""
from pynput.keyboard import Key
+
if key == Key.down:
if cls._selected_menu_item_index == len(cls._select_menu_items) - 1:
return
@@ -201,8 +207,7 @@ class Console:
def banner(cls, string: str):
r"""Prints the string as a banner
- Parameter
- ---------
+ Parameter:
string: :class:`str`
Message to print as banner
"""
@@ -228,7 +233,7 @@ class Console:
cls._hold_back_calls.append(ConsoleCall(cls.clear))
return
- os.system('cls' if os.name == 'nt' else 'clear')
+ os.system("cls" if os.name == "nt" else "clear")
@classmethod
def close(cls):
@@ -241,7 +246,7 @@ class Console:
return
Console.color_reset()
- Console.write('\n\n\nPress any key to continue...')
+ Console.write("\n\n\nPress any key to continue...")
Console.read()
sys.exit()
@@ -254,8 +259,7 @@ class Console:
def error(cls, string: str, tb: str = None):
r"""Prints an error with traceback
- Parameter
- ---------
+ Parameter:
string: :class:`str`
Error message
tb: :class:`str`
@@ -268,12 +272,12 @@ class Console:
cls._hold_back_calls.append(ConsoleCall(cls.error, string, tb))
return
- cls.set_foreground_color('red')
+ cls.set_foreground_color("red")
if tb is not None:
- cls.write_line(f'{string} -> {tb}')
+ cls.write_line(f"{string} -> {tb}")
else:
cls.write_line(string)
- cls.set_foreground_color('default')
+ cls.set_foreground_color("default")
@classmethod
def enable(cls):
@@ -284,13 +288,11 @@ class Console:
def read(cls, output: str = None) -> str:
r"""Reads in line
- Parameter
- ---------
+ Parameter:
output: :class:`str`
String to print before input
- Returns
- -------
+ Returns:
input()
"""
if output is not None and not cls._hold_back:
@@ -302,22 +304,20 @@ class Console:
def read_line(cls, output: str = None) -> str:
r"""Reads in next line
- Parameter
- ---------
+ Parameter:
output: :class:`str`
String to print before input
- Returns
- -------
+ Returns:
input()
"""
if cls._disabled and not cls._hold_back:
- return ''
+ return ""
if output is not None:
cls.write_line(output)
- cls._output('\n', end='')
+ cls._output("\n", end="")
return input()
@@ -325,8 +325,7 @@ class Console:
def table(cls, header: list[str], values: list[list[str]]):
r"""Prints a table with header and values
- Parameter
- ---------
+ Parameter:
header: List[:class:`str`]
Header of the table
values: List[List[:class:`str`]]
@@ -342,21 +341,24 @@ class Console:
table = tabulate(values, headers=header)
Console.write_line(table)
- Console.write('\n')
+ Console.write("\n")
@classmethod
- def select(cls, char: str, message: str, options: list[str],
- header_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
- header_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default,
- option_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
- option_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default,
- cursor_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
- cursor_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default
- ) -> str:
+ def select(
+ cls,
+ char: str,
+ message: str,
+ options: list[str],
+ header_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
+ header_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default,
+ option_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
+ option_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default,
+ cursor_foreground_color: Union[str, ForegroundColorEnum] = ForegroundColorEnum.default,
+ cursor_background_color: Union[str, BackgroundColorEnum] = BackgroundColorEnum.default,
+ ) -> str:
r"""Prints select menu
- Parameter
- ---------
+ Parameter:
char: :class:`str`
Character to show which element is selected
message: :class:`str`
@@ -376,8 +378,7 @@ class Console:
cursor_background_color: Union[:class:`str`, :class:`cpl_core.console.background_color_enum.BackgroundColorEnum`]
Background color of the cursor
- Returns
- -------
+ Returns:
Selected option as :class:`str`
"""
cls._selected_menu_item_char = char
@@ -396,27 +397,32 @@ class Console:
Console.set_foreground_color(header_foreground_color)
Console.set_background_color(header_background_color)
- Console.write_line(message, '\n')
+ Console.write_line(message, "\n")
cls._show_select_menu()
from pynput import keyboard
- with keyboard.Listener(
- on_press=cls._select_menu_key_press, suppress=False
- ) as listener:
+
+ with keyboard.Listener(on_press=cls._select_menu_key_press, suppress=False) as listener:
listener.join()
Console.color_reset()
return cls._select_menu_items[cls._selected_menu_item_index]
@classmethod
- def spinner(cls, message: str, call: Callable, *args, text_foreground_color: Union[str, ForegroundColorEnum] = None,
- spinner_foreground_color: Union[str, ForegroundColorEnum] = None,
- text_background_color: Union[str, BackgroundColorEnum] = None,
- spinner_background_color: Union[str, BackgroundColorEnum] = None, **kwargs) -> any:
+ def spinner(
+ cls,
+ message: str,
+ call: Callable,
+ *args,
+ text_foreground_color: Union[str, ForegroundColorEnum] = None,
+ spinner_foreground_color: Union[str, ForegroundColorEnum] = None,
+ text_background_color: Union[str, BackgroundColorEnum] = None,
+ spinner_background_color: Union[str, BackgroundColorEnum] = None,
+ **kwargs,
+ ) -> any:
r"""Shows spinner and calls given function, when function has ended the spinner stops
- Parameter
- ---------
+ Parameter:
message: :class:`str`
Message of the spinner
call: :class:`Callable`
@@ -434,8 +440,7 @@ class Console:
kwargs: :class:`dict`
Keyword arguments of the call
- Returns
- -------
+ Returns:
Return value of call
"""
if cls._hold_back:
@@ -486,11 +491,10 @@ class Console:
return return_value
@classmethod
- def write(cls, *args, end=''):
+ def write(cls, *args, end=""):
r"""Prints in active line
- Parameter
- ---------
+ Parameter:
args: :class:`list`
Elements to print
end: :class:`str`
@@ -503,15 +507,14 @@ class Console:
cls._hold_back_calls.append(ConsoleCall(cls.write, *args))
return
- string = ' '.join(map(str, args))
+ string = " ".join(map(str, args))
cls._output(string, end=end)
@classmethod
def write_at(cls, x: int, y: int, *args):
r"""Prints at given position
- Parameter
- ---------
+ Parameter:
x: :class:`int`
X coordinate
y: :class:`int`
@@ -526,15 +529,14 @@ class Console:
cls._hold_back_calls.append(ConsoleCall(cls.write_at, x, y, *args))
return
- string = ' '.join(map(str, args))
- cls._output(string, x, y, end='')
+ string = " ".join(map(str, args))
+ cls._output(string, x, y, end="")
@classmethod
def write_line(cls, *args):
r"""Prints to new line
- Parameter
- ---------
+ Parameter:
args: :class:`list`
Elements to print
"""
@@ -545,17 +547,16 @@ class Console:
cls._hold_back_calls.append(ConsoleCall(cls.write_line, *args))
return
- string = ' '.join(map(str, args))
+ string = " ".join(map(str, args))
if not cls._is_first_write:
- cls._output('')
- cls._output(string, end='')
+ cls._output("")
+ cls._output(string, end="")
@classmethod
def write_line_at(cls, x: int, y: int, *args):
r"""Prints new line at given position
- Parameter
- ---------
+ Parameter:
x: :class:`int`
X coordinate
y: :class:`int`
@@ -570,7 +571,7 @@ class Console:
cls._hold_back_calls.append(ConsoleCall(cls.write_line_at, x, y, *args))
return
- string = ' '.join(map(str, args))
+ string = " ".join(map(str, args))
if not cls._is_first_write:
- cls._output('', end='')
- cls._output(string, x, y, end='')
+ cls._output("", end="")
+ cls._output(string, x, y, end="")
diff --git a/src/cpl_core/console/console_call.py b/src/cpl_core/console/console_call.py
index 950f6c64..6734bf1e 100644
--- a/src/cpl_core/console/console_call.py
+++ b/src/cpl_core/console/console_call.py
@@ -4,8 +4,7 @@ from collections.abc import Callable
class ConsoleCall:
r"""Represents a console call, for hold back when spinner is active
- Parameter
- ---------
+ Parameter:
function: :class:`Callable`
Function to call
args: :class:`list`
diff --git a/src/cpl_core/console/foreground_color_enum.py b/src/cpl_core/console/foreground_color_enum.py
index 7ee02c30..b0f27087 100644
--- a/src/cpl_core/console/foreground_color_enum.py
+++ b/src/cpl_core/console/foreground_color_enum.py
@@ -2,13 +2,12 @@ from enum import Enum
class ForegroundColorEnum(Enum):
-
- default = 'default'
- grey = 'grey'
- red = 'red'
- green = 'green'
- yellow = 'yellow'
- blue = 'blue'
- magenta = 'magenta'
- cyan = 'cyan'
- white = 'white'
+ default = "default"
+ grey = "grey"
+ red = "red"
+ green = "green"
+ yellow = "yellow"
+ blue = "blue"
+ magenta = "magenta"
+ cyan = "cyan"
+ white = "white"
diff --git a/src/cpl_core/console/spinner_thread.py b/src/cpl_core/console/spinner_thread.py
index 681ba234..131cd28a 100644
--- a/src/cpl_core/console/spinner_thread.py
+++ b/src/cpl_core/console/spinner_thread.py
@@ -12,8 +12,7 @@ from cpl_core.console.foreground_color_enum import ForegroundColorEnum
class SpinnerThread(threading.Thread):
r"""Thread to show spinner in terminal
- Parameter
- ---------
+ Parameter:
msg_len: :class:`int`
Length of the message
foreground_color: :class:`cpl_core.console.foreground_color.ForegroundColorEnum`
@@ -36,7 +35,7 @@ class SpinnerThread(threading.Thread):
def _spinner():
r"""Selects active spinner char"""
while True:
- for cursor in '|/-\\':
+ for cursor in "|/-\\":
yield cursor
def _get_color_args(self) -> list[str]:
@@ -53,37 +52,37 @@ class SpinnerThread(threading.Thread):
def run(self) -> None:
r"""Entry point of thread, shows the spinner"""
columns = 0
- if sys.platform == 'win32':
+ if sys.platform == "win32":
columns = os.get_terminal_size().columns
else:
- term_rows, term_columns = os.popen('stty size', 'r').read().split()
+ term_rows, term_columns = os.popen("stty size", "r").read().split()
columns = int(term_columns)
- end_msg = 'done'
+ end_msg = "done"
end_msg_pos = columns - self._msg_len - len(end_msg)
if end_msg_pos > 0:
- print(f'{"" : >{end_msg_pos}}', end='')
+ print(f'{"" : >{end_msg_pos}}', end="")
else:
- print('', end='')
+ print("", end="")
first = True
spinner = self._spinner()
while self._is_spinning:
if first:
first = False
- print(colored(f'{next(spinner): >{len(end_msg) - 1}}', *self._get_color_args()), end='')
+ print(colored(f"{next(spinner): >{len(end_msg) - 1}}", *self._get_color_args()), end="")
else:
- print(colored(f'{next(spinner): >{len(end_msg)}}', *self._get_color_args()), end='')
+ print(colored(f"{next(spinner): >{len(end_msg)}}", *self._get_color_args()), end="")
time.sleep(0.1)
- back = ''
+ back = ""
for i in range(0, len(end_msg)):
- back += '\b'
+ back += "\b"
- print(back, end='')
+ print(back, end="")
sys.stdout.flush()
if not self._exit:
- print(colored(end_msg, *self._get_color_args()), end='')
+ print(colored(end_msg, *self._get_color_args()), end="")
def stop_spinning(self):
r"""Stops the spinner"""
diff --git a/src/cpl_core/cpl-core.json b/src/cpl_core/cpl-core.json
index 1af2960f..5aa713a7 100644
--- a/src/cpl_core/cpl-core.json
+++ b/src/cpl_core/cpl-core.json
@@ -2,14 +2,14 @@
"ProjectSettings": {
"Name": "cpl-core",
"Version": {
- "Major": "2022",
- "Minor": "12",
- "Micro": "1"
+ "Major": "2023",
+ "Minor": "2",
+ "Micro": "0"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
- "Description": "sh-edraft Common Python library",
- "LongDescription": "sh-edraft Common Python library",
+ "Description": "CPL core",
+ "LongDescription": "CPL core package",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2020 - 2023",
"CopyrightName": "sh-edraft.de",
@@ -31,8 +31,9 @@
"DevDependencies": [
"Sphinx==5.0.2",
"sphinx-rtd-theme==1.0.0",
- "myst-parser==0.18.0",
- "twine==4.0.2"
+ "myst-parser==0.18.1",
+ "twine==4.0.2",
+ "sphinx-markdown-builder==0.5.5"
],
"PythonVersion": ">=3.10",
"PythonPath": {},
diff --git a/src/cpl_core/database/__init__.py b/src/cpl_core/database/__init__.py
index d3c418a4..d677f78c 100644
--- a/src/cpl_core/database/__init__.py
+++ b/src/cpl_core/database/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.database'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.database"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -25,5 +25,5 @@ from .database_settings_name_enum import DatabaseSettingsNameEnum
from .database_settings import DatabaseSettings
from .table_abc import TableABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/database/connection/__init__.py b/src/cpl_core/database/connection/__init__.py
index fcc95e63..3d2fe414 100644
--- a/src/cpl_core/database/connection/__init__.py
+++ b/src/cpl_core/database/connection/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.database.connection'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.database.connection"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -24,5 +24,5 @@ from collections import namedtuple
from .database_connection import DatabaseConnection
from .database_connection_abc import DatabaseConnectionABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/database/connection/database_connection.py b/src/cpl_core/database/connection/database_connection.py
index 8af62160..32ba2211 100644
--- a/src/cpl_core/database/connection/database_connection.py
+++ b/src/cpl_core/database/connection/database_connection.py
@@ -1,8 +1,7 @@
from typing import Optional
import mysql.connector as sql
-from cpl_core.database.connection.database_connection_abc import \
- DatabaseConnectionABC
+from cpl_core.database.connection.database_connection_abc import DatabaseConnectionABC
from cpl_core.database.database_settings import DatabaseSettings
from cpl_core.utils.credential_manager import CredentialManager
from mysql.connector.abstracts import MySQLConnectionAbstract
@@ -10,8 +9,7 @@ from mysql.connector.cursor import MySQLCursorBuffered
class DatabaseConnection(DatabaseConnectionABC):
- r"""Representation of the database connection
- """
+ r"""Representation of the database connection"""
def __init__(self):
DatabaseConnectionABC.__init__(self)
@@ -36,10 +34,9 @@ class DatabaseConnection(DatabaseConnectionABC):
charset=database_settings.charset,
use_unicode=database_settings.use_unicode,
buffered=database_settings.buffered,
- auth_plugin=database_settings.auth_plugin
+ auth_plugin=database_settings.auth_plugin,
)
- connection.cursor().execute(
- f'CREATE DATABASE IF NOT EXISTS `{database_settings.database}`;')
+ connection.cursor().execute(f"CREATE DATABASE IF NOT EXISTS `{database_settings.database}`;")
self._database = sql.connect(
host=database_settings.host,
port=database_settings.port,
@@ -49,6 +46,6 @@ class DatabaseConnection(DatabaseConnectionABC):
charset=database_settings.charset,
use_unicode=database_settings.use_unicode,
buffered=database_settings.buffered,
- auth_plugin=database_settings.auth_plugin
+ auth_plugin=database_settings.auth_plugin,
)
self._cursor = self._database.cursor()
diff --git a/src/cpl_core/database/connection/database_connection_abc.py b/src/cpl_core/database/connection/database_connection_abc.py
index c9564d8b..92f70917 100644
--- a/src/cpl_core/database/connection/database_connection_abc.py
+++ b/src/cpl_core/database/connection/database_connection_abc.py
@@ -9,22 +9,24 @@ class DatabaseConnectionABC(ABC):
r"""ABC for the :class:`cpl_core.database.connection.database_connection.DatabaseConnection`"""
@abstractmethod
- def __init__(self): pass
+ def __init__(self):
+ pass
@property
@abstractmethod
- def server(self) -> MySQLConnectionAbstract: pass
-
+ def server(self) -> MySQLConnectionAbstract:
+ pass
+
@property
@abstractmethod
- def cursor(self) -> MySQLCursorBuffered: pass
-
+ def cursor(self) -> MySQLCursorBuffered:
+ pass
+
@abstractmethod
def connect(self, database_settings: DatabaseSettings):
r"""Connects to a database by connection string
- Parameter
- ---------
+ Parameter:
connection_string: :class:`str`
Database connection string, see: https://docs.sqlalchemy.org/en/14/core/engines.html
"""
diff --git a/src/cpl_core/database/context/__init__.py b/src/cpl_core/database/context/__init__.py
index 5f819a4e..0f87b4ba 100644
--- a/src/cpl_core/database/context/__init__.py
+++ b/src/cpl_core/database/context/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.database.context'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.database.context"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -24,5 +24,5 @@ from collections import namedtuple
from .database_context import DatabaseContext
from .database_context_abc import DatabaseContextABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/database/context/database_context.py b/src/cpl_core/database/context/database_context.py
index e634eb0c..809d206b 100644
--- a/src/cpl_core/database/context/database_context.py
+++ b/src/cpl_core/database/context/database_context.py
@@ -1,11 +1,9 @@
-
from typing import Optional
import mysql
from cpl_core.database.connection.database_connection import DatabaseConnection
-from cpl_core.database.connection.database_connection_abc import \
- DatabaseConnectionABC
+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.table_abc import TableABC
@@ -15,8 +13,7 @@ from mysql.connector.cursor import MySQLCursorBuffered
class DatabaseContext(DatabaseContextABC):
r"""Representation of the database context
- Parameter
- ---------
+ Parameter:
database_settings: :class:`cpl_core.database.database_settings.DatabaseSettings`
"""
@@ -38,7 +35,7 @@ class DatabaseContext(DatabaseContextABC):
except mysql.connector.Error as err:
# reconnect your cursor as you did in __init__ or wherever
if self._settings is None:
- raise Exception('Call DatabaseContext.connect first')
+ raise Exception("Call DatabaseContext.connect first")
self.connect(self._settings)
def connect(self, database_settings: DatabaseSettings):
@@ -53,7 +50,7 @@ class DatabaseContext(DatabaseContextABC):
def save_changes(self):
self._ping_and_reconnect()
self._db.server.commit()
-
+
def select(self, statement: str) -> list[tuple]:
self._ping_and_reconnect()
self._db.cursor.execute(statement)
diff --git a/src/cpl_core/database/context/database_context_abc.py b/src/cpl_core/database/context/database_context_abc.py
index 3a28bc5f..68738dd8 100644
--- a/src/cpl_core/database/context/database_context_abc.py
+++ b/src/cpl_core/database/context/database_context_abc.py
@@ -13,33 +13,31 @@ class DatabaseContextABC(ABC):
@property
@abstractmethod
- def cursor(self) -> MySQLCursorBuffered: pass
-
+ def cursor(self) -> MySQLCursorBuffered:
+ pass
+
@abstractmethod
def connect(self, database_settings: DatabaseSettings):
r"""Connects to a database by connection settings
- Parameter
- ---------
+ Parameter:
database_settings :class:`cpl_core.database.database_settings.DatabaseSettings`
"""
pass
-
+
@abstractmethod
def save_changes(self):
r"""Saves changes of the database"""
pass
-
+
@abstractmethod
def select(self, statement: str) -> list[tuple]:
r"""Runs SQL Statements
-
- Parameter
- ---------
+
+ Parameter:
statement: :class:`str`
-
- Returns
- -------
+
+ Returns:
list: Fetched list of selected elements
"""
pass
diff --git a/src/cpl_core/database/database_settings.py b/src/cpl_core/database/database_settings.py
index f9fbdd40..987742da 100644
--- a/src/cpl_core/database/database_settings.py
+++ b/src/cpl_core/database/database_settings.py
@@ -62,8 +62,7 @@ class DatabaseSettings(ConfigurationModelABC):
def from_dict(self, settings: dict):
r"""Sets attributes from given dict
- Parameter
- ---------
+ Parameter:
settings: :class:`dict`
"""
try:
@@ -75,20 +74,20 @@ class DatabaseSettings(ConfigurationModelABC):
self._user = settings[DatabaseSettingsNameEnum.user.value]
self._password = settings[DatabaseSettingsNameEnum.password.value]
self._databse = settings[DatabaseSettingsNameEnum.database.value]
-
+
if DatabaseSettingsNameEnum.charset.value in settings:
self._charset = settings[DatabaseSettingsNameEnum.charset.value]
-
+
if DatabaseSettingsNameEnum.buffered.value in settings:
self._use_unicode = bool(settings[DatabaseSettingsNameEnum.use_unicode.value])
-
+
if DatabaseSettingsNameEnum.buffered.value in settings:
self._buffered = bool(settings[DatabaseSettingsNameEnum.buffered.value])
-
+
if DatabaseSettingsNameEnum.auth_plugin.value in settings:
self._auth_plugin = settings[DatabaseSettingsNameEnum.auth_plugin.value]
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
- Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.write_line(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
+ Console.write_line(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
Console.set_foreground_color(ForegroundColorEnum.default)
diff --git a/src/cpl_core/database/database_settings_name_enum.py b/src/cpl_core/database/database_settings_name_enum.py
index 3748a642..56b59a3f 100644
--- a/src/cpl_core/database/database_settings_name_enum.py
+++ b/src/cpl_core/database/database_settings_name_enum.py
@@ -2,13 +2,12 @@ from enum import Enum
class DatabaseSettingsNameEnum(Enum):
-
- host = 'Host'
- port = 'Port'
- user = 'User'
- password = 'Password'
- database = 'Database'
- charset = 'Charset'
- use_unicode = 'UseUnicode'
- buffered = 'Buffered'
- auth_plugin = 'AuthPlugin'
+ host = "Host"
+ port = "Port"
+ user = "User"
+ password = "Password"
+ database = "Database"
+ charset = "Charset"
+ use_unicode = "UseUnicode"
+ buffered = "Buffered"
+ auth_plugin = "AuthPlugin"
diff --git a/src/cpl_core/database/table_abc.py b/src/cpl_core/database/table_abc.py
index 2f276ad6..748503bd 100644
--- a/src/cpl_core/database/table_abc.py
+++ b/src/cpl_core/database/table_abc.py
@@ -4,16 +4,15 @@ from typing import Optional
class TableABC(ABC):
-
@abstractmethod
def __init__(self):
self._created_at: Optional[datetime] = datetime.now().isoformat()
self._modified_at: Optional[datetime] = datetime.now().isoformat()
-
+
@property
def created_at(self) -> datetime:
return self._created_at
-
+
@property
def modified_at(self) -> datetime:
return self._modified_at
@@ -21,15 +20,18 @@ class TableABC(ABC):
@modified_at.setter
def modified_at(self, value: datetime):
self._modified_at = value
-
+
@property
@abstractmethod
- def insert_string(self) -> str: pass
-
+ def insert_string(self) -> str:
+ pass
+
@property
@abstractmethod
- def udpate_string(self) -> str: pass
-
+ def udpate_string(self) -> str:
+ pass
+
@property
@abstractmethod
- def delete_string(self) -> str: pass
+ def delete_string(self) -> str:
+ pass
diff --git a/src/cpl_core/dependency_injection/__init__.py b/src/cpl_core/dependency_injection/__init__.py
index c52c7f25..12154458 100644
--- a/src/cpl_core/dependency_injection/__init__.py
+++ b/src/cpl_core/dependency_injection/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.dependency_injection'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.dependency_injection"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -30,5 +30,5 @@ from .service_lifetime_enum import ServiceLifetimeEnum
from .service_provider import ServiceProvider
from .service_provider_abc import ServiceProviderABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/dependency_injection/scope.py b/src/cpl_core/dependency_injection/scope.py
index 14531e66..57a7f045 100644
--- a/src/cpl_core/dependency_injection/scope.py
+++ b/src/cpl_core/dependency_injection/scope.py
@@ -1,11 +1,9 @@
-
from cpl_core.console.console import Console
from cpl_core.dependency_injection.scope_abc import ScopeABC
from cpl_core.dependency_injection.service_provider_abc import ServiceProviderABC
class Scope(ScopeABC):
-
def __init__(self, service_provider: ServiceProviderABC):
self._service_provider = service_provider
self._service_provider.set_scope(self)
@@ -20,6 +18,6 @@ class Scope(ScopeABC):
@property
def service_provider(self) -> ServiceProviderABC:
return self._service_provider
-
+
def dispose(self):
self._service_provider = None
diff --git a/src/cpl_core/dependency_injection/scope_abc.py b/src/cpl_core/dependency_injection/scope_abc.py
index daf76d13..f4f081c2 100644
--- a/src/cpl_core/dependency_injection/scope_abc.py
+++ b/src/cpl_core/dependency_injection/scope_abc.py
@@ -1,24 +1,23 @@
from abc import ABC, abstractmethod
+
class ScopeABC(ABC):
r"""ABC for the class :class:`cpl_core.dependency_injection.scope.Scope`"""
-
+
def __init__(self):
pass
-
+
@property
@abstractmethod
def service_provider(self):
r"""Returns to service provider of scope
- Returns
- -------
+ Returns:
Object of type :class:`cpl_core.dependency_injection.service_provider_abc.ServiceProviderABC`
"""
pass
-
+
@abstractmethod
def dispose(self):
- r"""Sets service_provider to None
- """
- pass
\ No newline at end of file
+ r"""Sets service_provider to None"""
+ pass
diff --git a/src/cpl_core/dependency_injection/scope_builder.py b/src/cpl_core/dependency_injection/scope_builder.py
index 595b9a80..4e949205 100644
--- a/src/cpl_core/dependency_injection/scope_builder.py
+++ b/src/cpl_core/dependency_injection/scope_builder.py
@@ -5,15 +5,14 @@ from cpl_core.dependency_injection.service_provider_abc import ServiceProviderAB
class ScopeBuilder:
r"""Class to build :class:`cpl_core.dependency_injection.scope.Scope`"""
-
+
def __init__(self, service_provider: ServiceProviderABC) -> None:
self._service_provider = service_provider
-
+
def build(self) -> ScopeABC:
r"""Returns scope
- Returns
- -------
+ Returns:
Object of type :class:`cpl_core.dependency_injection.scope.Scope`
"""
return Scope(self._service_provider)
diff --git a/src/cpl_core/dependency_injection/service_collection.py b/src/cpl_core/dependency_injection/service_collection.py
index af861881..acdf099f 100644
--- a/src/cpl_core/dependency_injection/service_collection.py
+++ b/src/cpl_core/dependency_injection/service_collection.py
@@ -35,7 +35,7 @@ class ServiceCollection(ServiceCollectionABC):
if not isinstance(service, type):
service_type = type(service)
- raise Exception(f'Service of type {service_type} already exists')
+ raise Exception(f"Service of type {service_type} already exists")
self._service_descriptors.append(ServiceDescriptor(service, lifetime, base_type))
diff --git a/src/cpl_core/dependency_injection/service_collection_abc.py b/src/cpl_core/dependency_injection/service_collection_abc.py
index 7de41dd2..8da9a519 100644
--- a/src/cpl_core/dependency_injection/service_collection_abc.py
+++ b/src/cpl_core/dependency_injection/service_collection_abc.py
@@ -19,8 +19,7 @@ class ServiceCollectionABC(ABC):
def add_db_context(self, db_context_type: Type[DatabaseContextABC], db_settings: DatabaseSettings):
r"""Adds database context
- Parameter
- ---------
+ Parameter:
db_context: Type[:class:`cpl_core.database.context.database_context_abc.DatabaseContextABC`]
Database context
"""
@@ -38,62 +37,56 @@ class ServiceCollectionABC(ABC):
def add_discord(self):
r"""Adds the CPL discord"""
- raise NotImplementedError('You should install and use the cpl-discord package')
+ raise NotImplementedError("You should install and use the cpl-discord package")
pass
def add_translation(self):
r"""Adds the CPL translation"""
- raise NotImplementedError('You should install and use the cpl-translation package')
+ raise NotImplementedError("You should install and use the cpl-translation package")
pass
@abstractmethod
- def add_transient(self, service_type: T, service: T = None) -> 'ServiceCollectionABC':
+ def add_transient(self, service_type: T, service: T = None) -> "ServiceCollectionABC":
r"""Adds a service with transient lifetime
- Parameter
- ---------
+ Parameter:
service_type: :class:`Type`
Type of the service
service: :class:`Callable`
Object of the service
- Returns
- ------
- self: :class:`cpl_core.dependency_injection.service_collection_abc.ServiceCollectionABC
+ Returns:
+ self: :class:`cpl_core.dependency_injection.service_collection_abc.ServiceCollectionABC`
"""
pass
@abstractmethod
- def add_scoped(self, service_type: T, service: T = None) -> 'ServiceCollectionABC':
+ def add_scoped(self, service_type: T, service: T = None) -> "ServiceCollectionABC":
r"""Adds a service with scoped lifetime
- Parameter
- ---------
+ Parameter:
service_type: :class:`Type`
Type of the service
service: :class:`Callable`
Object of the service
- Returns
- ------
- self: :class:`cpl_core.dependency_injection.service_collection_abc.ServiceCollectionABC
+ Returns:
+ self: :class:`cpl_core.dependency_injection.service_collection_abc.ServiceCollectionABC`
"""
pass
@abstractmethod
- def add_singleton(self, service_type: T, service: T = None) -> 'ServiceCollectionABC':
+ def add_singleton(self, service_type: T, service: T = None) -> "ServiceCollectionABC":
r"""Adds a service with singleton lifetime
- Parameter
- ---------
+ Parameter:
service_type: :class:`Type`
Type of the service
service: :class:`Callable`
Object of the service
- Returns
- ------
- self: :class:`cpl_core.dependency_injection.service_collection_abc.ServiceCollectionABC
+ Returns:
+ self: :class:`cpl_core.dependency_injection.service_collection_abc.ServiceCollectionABC`
"""
pass
@@ -101,8 +94,7 @@ class ServiceCollectionABC(ABC):
def build_service_provider(self) -> ServiceProviderABC:
r"""Creates instance of the service provider
- Returns
- -------
+ Returns:
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 1c559b1f..5e5c050a 100644
--- a/src/cpl_core/dependency_injection/service_descriptor.py
+++ b/src/cpl_core/dependency_injection/service_descriptor.py
@@ -7,8 +7,7 @@ from cpl_core.dependency_injection.service_lifetime_enum import ServiceLifetimeE
class ServiceDescriptor:
r"""Descriptor of a service
- Parameter
- ---------
+ Parameter:
implementation: Union[:class:`type`, Optional[:class:`object`]]
Object or type of service
lifetime: :class:`cpl_core.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum`
@@ -16,7 +15,6 @@ class ServiceDescriptor:
"""
def __init__(self, implementation: Union[type, Optional[object]], lifetime: ServiceLifetimeEnum, base_type=None):
-
self._service_type = implementation
self._implementation = implementation
self._lifetime = lifetime
diff --git a/src/cpl_core/dependency_injection/service_lifetime_enum.py b/src/cpl_core/dependency_injection/service_lifetime_enum.py
index 0b4cf16d..339d78ea 100644
--- a/src/cpl_core/dependency_injection/service_lifetime_enum.py
+++ b/src/cpl_core/dependency_injection/service_lifetime_enum.py
@@ -2,7 +2,6 @@ from enum import Enum
class ServiceLifetimeEnum(Enum):
-
singleton = 0
scoped = 1
transient = 2
diff --git a/src/cpl_core/dependency_injection/service_provider.py b/src/cpl_core/dependency_injection/service_provider.py
index 4e388440..8355885e 100644
--- a/src/cpl_core/dependency_injection/service_provider.py
+++ b/src/cpl_core/dependency_injection/service_provider.py
@@ -18,8 +18,7 @@ from cpl_core.type import T
class ServiceProvider(ServiceProviderABC):
r"""Provider for the services
- Parameter
- ---------
+ Parameter:
service_descriptors: list[:class:`cpl_core.dependency_injection.service_descriptor.ServiceDescriptor`]
Descriptor of the service
config: :class:`cpl_core.configuration.configuration_abc.ConfigurationABC`
@@ -28,7 +27,12 @@ class ServiceProvider(ServiceProviderABC):
Database representation
"""
- def __init__(self, service_descriptors: list[ServiceDescriptor], config: ConfigurationABC, db_context: Optional[DatabaseContextABC]):
+ def __init__(
+ self,
+ service_descriptors: list[ServiceDescriptor],
+ config: ConfigurationABC,
+ db_context: Optional[DatabaseContextABC],
+ ):
ServiceProviderABC.__init__(self)
self._service_descriptors: list[ServiceDescriptor] = service_descriptors
@@ -45,7 +49,9 @@ class ServiceProvider(ServiceProviderABC):
def _get_service(self, parameter: Parameter) -> Optional[object]:
for descriptor in self._service_descriptors:
- if descriptor.service_type == parameter.annotation or issubclass(descriptor.service_type, parameter.annotation):
+ if descriptor.service_type == parameter.annotation or issubclass(
+ descriptor.service_type, parameter.annotation
+ ):
if descriptor.implementation is not None:
return descriptor.implementation
@@ -77,8 +83,7 @@ class ServiceProvider(ServiceProviderABC):
params = []
for param in sig.parameters.items():
parameter = param[1]
- if parameter.name != 'self' and parameter.annotation != Parameter.empty:
-
+ if parameter.name != "self" and parameter.annotation != Parameter.empty:
if typing.get_origin(parameter.annotation) == list:
params.append(self._get_services(typing.get_args(parameter.annotation)[0]))
@@ -121,7 +126,9 @@ class ServiceProvider(ServiceProviderABC):
self._scope = scope
def create_scope(self) -> ScopeABC:
- sb = ScopeBuilder(ServiceProvider(copy.deepcopy(self._service_descriptors), self._configuration, self._database_context))
+ sb = ScopeBuilder(
+ ServiceProvider(copy.deepcopy(self._service_descriptors), self._configuration, self._database_context)
+ )
return sb.build()
def get_service(self, service_type: T) -> Optional[T]:
@@ -134,7 +141,11 @@ class ServiceProvider(ServiceProviderABC):
return result.implementation
implementation = self.build_service(service_type)
- if result.lifetime == ServiceLifetimeEnum.singleton or result.lifetime == ServiceLifetimeEnum.scoped and self._scope is not None:
+ if (
+ result.lifetime == ServiceLifetimeEnum.singleton
+ or result.lifetime == ServiceLifetimeEnum.scoped
+ and self._scope is not None
+ ):
result.implementation = implementation
return implementation
@@ -143,7 +154,7 @@ class ServiceProvider(ServiceProviderABC):
implementations = []
if typing.get_origin(service_type) != list:
- raise Exception(f'Invalid type {service_type}! Expected list of type')
+ raise Exception(f"Invalid type {service_type}! Expected list of type")
implementations.extend(self._get_services(typing.get_args(service_type)[0]))
diff --git a/src/cpl_core/dependency_injection/service_provider_abc.py b/src/cpl_core/dependency_injection/service_provider_abc.py
index a3f7158c..f11c3050 100644
--- a/src/cpl_core/dependency_injection/service_provider_abc.py
+++ b/src/cpl_core/dependency_injection/service_provider_abc.py
@@ -10,29 +10,29 @@ from cpl_core.type import T
class ServiceProviderABC(ABC):
r"""ABC for the class :class:`cpl_core.dependency_injection.service_provider.ServiceProvider`"""
- _provider: Optional['ServiceProviderABC'] = None
+ _provider: Optional["ServiceProviderABC"] = None
@abstractmethod
- def __init__(self): pass
+ def __init__(self):
+ pass
@classmethod
- def set_global_provider(cls, provider: 'ServiceProviderABC'):
+ def set_global_provider(cls, provider: "ServiceProviderABC"):
cls._provider = provider
@abstractmethod
- def build_by_signature(self, sig: Signature) -> list[T]: pass
+ def build_by_signature(self, sig: Signature) -> list[T]:
+ pass
@abstractmethod
def build_service(self, service_type: type) -> object:
r"""Creates instance of given type
- Parameter
- ---------
+ Parameter:
instance_type: :class:`type`
The type of the searched instance
- Returns
- -------
+ Returns:
Object of the given type
"""
pass
@@ -41,8 +41,7 @@ class ServiceProviderABC(ABC):
def set_scope(self, scope: ScopeABC):
r"""Sets the scope of service provider
- Parameter
- ---------
+ Parameter:
Object of type :class:`cpl_core.dependency_injection.scope_abc.ScopeABC`
Service scope
"""
@@ -52,23 +51,20 @@ class ServiceProviderABC(ABC):
def create_scope(self) -> ScopeABC:
r"""Creates a service scope
- Returns
- -------
+ Returns:
Object of type :class:`cpl_core.dependency_injection.scope_abc.ScopeABC`
"""
pass
@abstractmethod
- def get_service(self, instance_type: T) -> Optional[T]:
+ def get_service(self, instance_type: Type[T]) -> Optional[T]:
r"""Returns instance of given type
- Parameter
- ---------
+ Parameter:
instance_type: :class:`cpl_core.type.T`
The type of the searched instance
- Returns
- -------
+ Returns:
Object of type Optional[:class:`cpl_core.type.T`]
"""
pass
@@ -77,13 +73,11 @@ class ServiceProviderABC(ABC):
def get_services(self, service_type: T) -> list[Optional[T]]:
r"""Returns instance of given type
- Parameter
- ---------
+ Parameter:
instance_type: :class:`cpl_core.type.T`
The type of the searched instance
- Returns
- -------
+ Returns:
Object of type list[Optional[:class:`cpl_core.type.T`]
"""
pass
@@ -92,12 +86,10 @@ class ServiceProviderABC(ABC):
def inject(cls, f=None):
r"""Decorator to allow injection into static and class methods
- Parameter
- ---------
+ Parameter:
f: Callable
- Returns
- -------
+ Returns:
function
"""
if f is None:
@@ -106,7 +98,7 @@ class ServiceProviderABC(ABC):
@functools.wraps(f)
def inner(*args, **kwargs):
if cls._provider is None:
- raise Exception(f'{cls.__name__} not build!')
+ raise Exception(f"{cls.__name__} not build!")
injection = cls._provider.build_by_signature(signature(f))
return f(*injection, *args, **kwargs)
diff --git a/src/cpl_core/environment/__init__.py b/src/cpl_core/environment/__init__.py
index b0ab6498..4a89d740 100644
--- a/src/cpl_core/environment/__init__.py
+++ b/src/cpl_core/environment/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.environment'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.environment"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -25,5 +25,5 @@ from .application_environment_abc import ApplicationEnvironmentABC
from .environment_name_enum import EnvironmentNameEnum
from .application_environment import ApplicationEnvironment
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/environment/application_environment.py b/src/cpl_core/environment/application_environment.py
index 73f82571..bd3f0c0c 100644
--- a/src/cpl_core/environment/application_environment.py
+++ b/src/cpl_core/environment/application_environment.py
@@ -10,8 +10,7 @@ from cpl_core.environment.environment_name_enum import EnvironmentNameEnum
class ApplicationEnvironment(ApplicationEnvironmentABC):
r"""Represents environment of the application
- Parameter
- ---------
+ Parameter:
name: :class:`cpl_core.environment.environment_name_enum.EnvironmentNameEnum`
"""
@@ -37,7 +36,7 @@ class ApplicationEnvironment(ApplicationEnvironmentABC):
@property
def application_name(self) -> str:
- return self._app_name if self._app_name is not None else ''
+ return self._app_name if self._app_name is not None else ""
@application_name.setter
def application_name(self, application_name: str):
@@ -45,7 +44,7 @@ class ApplicationEnvironment(ApplicationEnvironmentABC):
@property
def customer(self) -> str:
- return self._customer if self._customer is not None else ''
+ return self._customer if self._customer is not None else ""
@customer.setter
def customer(self, customer: str):
@@ -80,17 +79,17 @@ class ApplicationEnvironment(ApplicationEnvironmentABC):
return str(self._runtime_directory)
def set_runtime_directory(self, runtime_directory: str):
- if runtime_directory != '':
+ if runtime_directory != "":
self._runtime_directory = runtime_directory
return
self._runtime_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def set_working_directory(self, working_directory: str):
- if working_directory != '':
+ if working_directory != "":
self._working_directory = working_directory
os.chdir(self._working_directory)
return
- self._working_directory = os.path.abspath('./')
+ self._working_directory = os.path.abspath("./")
os.chdir(self._working_directory)
diff --git a/src/cpl_core/environment/application_environment_abc.py b/src/cpl_core/environment/application_environment_abc.py
index f5b9bd43..07f3444f 100644
--- a/src/cpl_core/environment/application_environment_abc.py
+++ b/src/cpl_core/environment/application_environment_abc.py
@@ -11,66 +11,79 @@ class ApplicationEnvironmentABC(ABC):
@property
@abstractmethod
- def environment_name(self) -> str: pass
+ def environment_name(self) -> str:
+ pass
@environment_name.setter
@abstractmethod
- def environment_name(self, environment_name: str): pass
+ def environment_name(self, environment_name: str):
+ pass
@property
@abstractmethod
- def application_name(self) -> str: pass
+ def application_name(self) -> str:
+ pass
@application_name.setter
@abstractmethod
- def application_name(self, application_name: str): pass
+ def application_name(self, application_name: str):
+ pass
@property
@abstractmethod
- def customer(self) -> str: pass
+ def customer(self) -> str:
+ pass
@customer.setter
@abstractmethod
- def customer(self, customer: str): pass
+ def customer(self, customer: str):
+ pass
@property
@abstractmethod
- def host_name(self) -> str: pass
+ def host_name(self) -> str:
+ pass
@property
@abstractmethod
- def start_time(self) -> datetime: pass
+ def start_time(self) -> datetime:
+ pass
@start_time.setter
@abstractmethod
- def start_time(self, start_time: datetime): pass
+ def start_time(self, start_time: datetime):
+ pass
@property
@abstractmethod
- def end_time(self): pass
+ def end_time(self):
+ pass
@end_time.setter
@abstractmethod
- def end_time(self, end_time: datetime): pass
+ def end_time(self, end_time: datetime):
+ pass
@property
@abstractmethod
- def date_time_now(self) -> datetime: pass
+ def date_time_now(self) -> datetime:
+ pass
@property
@abstractmethod
- def working_directory(self) -> str: pass
+ def working_directory(self) -> str:
+ pass
@property
@abstractmethod
- def runtime_directory(self) -> str: pass
+ def runtime_directory(self) -> str:
+ pass
@abstractmethod
def set_runtime_directory(self, runtime_directory: str):
r"""Sets the current runtime directory
- Parameter
- ---------
+ Parameter:
runtime_directory: :class:`str`
Path of the runtime directory
"""
@@ -80,8 +93,7 @@ class ApplicationEnvironmentABC(ABC):
def set_working_directory(self, working_directory: str):
r"""Sets the current working directory
- Parameter
- ---------
+ Parameter:
working_directory: :class:`str`
Path of the current working directory
"""
diff --git a/src/cpl_core/environment/environment_name_enum.py b/src/cpl_core/environment/environment_name_enum.py
index 8ff90237..f2ade14c 100644
--- a/src/cpl_core/environment/environment_name_enum.py
+++ b/src/cpl_core/environment/environment_name_enum.py
@@ -2,8 +2,7 @@ from enum import Enum
class EnvironmentNameEnum(Enum):
-
- production = 'production'
- staging = 'staging'
- testing = 'testing'
- development = 'development'
+ production = "production"
+ staging = "staging"
+ testing = "testing"
+ development = "development"
diff --git a/src/cpl_core/logging/__init__.py b/src/cpl_core/logging/__init__.py
index 6c781e79..7a2ad7de 100644
--- a/src/cpl_core/logging/__init__.py
+++ b/src/cpl_core/logging/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.logging'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.logging"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -27,5 +27,5 @@ from .logging_level_enum import LoggingLevelEnum
from .logging_settings import LoggingSettings
from .logging_settings_name_enum import LoggingSettingsNameEnum
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/logging/logger_abc.py b/src/cpl_core/logging/logger_abc.py
index 60a878c9..a57ddf5d 100644
--- a/src/cpl_core/logging/logger_abc.py
+++ b/src/cpl_core/logging/logger_abc.py
@@ -12,8 +12,7 @@ class LoggerABC(ABC):
def header(self, string: str):
r"""Writes a header message
- Parameter
- ---------
+ Parameter:
string: :class:`str`
String to write as header
"""
@@ -23,8 +22,7 @@ class LoggerABC(ABC):
def trace(self, name: str, message: str):
r"""Writes a trace message
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Message name
message: :class:`str`
@@ -36,8 +34,7 @@ class LoggerABC(ABC):
def debug(self, name: str, message: str):
r"""Writes a debug message
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Message name
message: :class:`str`
@@ -49,8 +46,7 @@ class LoggerABC(ABC):
def info(self, name: str, message: str):
r"""Writes an information
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Message name
message: :class:`str`
@@ -62,8 +58,7 @@ class LoggerABC(ABC):
def warn(self, name: str, message: str):
r"""Writes an warning
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Message name
message: :class:`str`
@@ -75,8 +70,7 @@ class LoggerABC(ABC):
def error(self, name: str, message: str, ex: Exception = None):
r"""Writes an error
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Error name
message: :class:`str`
@@ -90,8 +84,7 @@ class LoggerABC(ABC):
def fatal(self, name: str, message: str, ex: Exception = None):
r"""Writes an error and ends the program
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Error name
message: :class:`str`
diff --git a/src/cpl_core/logging/logger_service.py b/src/cpl_core/logging/logger_service.py
index 86feda55..9067b527 100644
--- a/src/cpl_core/logging/logger_service.py
+++ b/src/cpl_core/logging/logger_service.py
@@ -17,8 +17,7 @@ from cpl_core.time.time_format_settings import TimeFormatSettings
class Logger(LoggerABC):
r"""Service for logging
- Parameter
- ---------
+ Parameter:
logging_settings: :class:`cpl_core.logging.logging_settings.LoggingSettings`
Settings for the logger
time_format: :class:`cpl_core.time.time_format_settings.TimeFormatSettings`
@@ -27,7 +26,9 @@ class Logger(LoggerABC):
Environment of the application
"""
- def __init__(self, logging_settings: LoggingSettings, time_format: TimeFormatSettings, env: ApplicationEnvironmentABC):
+ def __init__(
+ self, logging_settings: LoggingSettings, time_format: TimeFormatSettings, env: ApplicationEnvironmentABC
+ ):
LoggerABC.__init__(self)
self._env = env
@@ -48,7 +49,7 @@ class Logger(LoggerABC):
date_time_now=self._env.date_time_now.strftime(self._time_format_settings.date_time_format),
date_now=self._env.date_time_now.strftime(self._time_format_settings.date_format),
time_now=self._env.date_time_now.strftime(self._time_format_settings.time_format),
- start_time=self._env.start_time.strftime(self._time_format_settings.date_time_log_format)
+ start_time=self._env.start_time.strftime(self._time_format_settings.date_time_log_format),
)
@property
@@ -57,38 +58,36 @@ class Logger(LoggerABC):
date_time_now=self._env.date_time_now.strftime(self._time_format_settings.date_time_format),
date_now=self._env.date_time_now.strftime(self._time_format_settings.date_format),
time_now=self._env.date_time_now.strftime(self._time_format_settings.time_format),
- start_time=self._env.start_time.strftime(self._time_format_settings.date_time_log_format)
+ start_time=self._env.start_time.strftime(self._time_format_settings.date_time_log_format),
)
def _check_for_settings(self, settings: ConfigurationModelABC, settings_type: type):
self._level = LoggingLevelEnum.OFF
self._console = LoggingLevelEnum.FATAL
if settings is None:
- self.fatal(__name__, f'Configuration for {settings_type} not found')
+ self.fatal(__name__, f"Configuration for {settings_type} not found")
def _get_datetime_now(self) -> str:
r"""Returns the date and time by given format
- Returns
- -------
+ Returns:
Date and time in given format
"""
try:
return datetime.datetime.now().strftime(self._time_format_settings.date_time_format)
except Exception as e:
- self.error(__name__, 'Cannot get time', ex=e)
+ self.error(__name__, "Cannot get time", ex=e)
def _get_date(self) -> str:
r"""Returns the date by given format
- Returns
- -------
+ Returns:
Date in given format
"""
try:
return datetime.datetime.now().strftime(self._time_format_settings.date_format)
except Exception as e:
- self.error(__name__, 'Cannot get date', ex=e)
+ self.error(__name__, "Cannot get date", ex=e)
def create(self) -> None:
r"""Creates path tree and logfile"""
@@ -99,46 +98,44 @@ class Logger(LoggerABC):
if not os.path.exists(self._path):
os.makedirs(self._path)
except Exception as e:
- self._fatal_console(__name__, 'Cannot create log dir', ex=e)
+ self._fatal_console(__name__, "Cannot create log dir", ex=e)
""" create new log file """
try:
# open log file, create if not exists
- path = f'{self._path}{self._log}'
- permission = 'a+'
+ path = f"{self._path}{self._log}"
+ permission = "a+"
if not os.path.isfile(path):
- permission = 'w+'
+ permission = "w+"
f = open(path, permission)
- Console.write_line(f'[{__name__}]: Using log file: {path}')
+ Console.write_line(f"[{__name__}]: Using log file: {path}")
f.close()
except Exception as e:
- self._fatal_console(__name__, 'Cannot open log file', ex=e)
+ self._fatal_console(__name__, "Cannot open log file", ex=e)
def _append_log(self, string: str):
r"""Writes to logfile
- Parameter
- ---------
+ Parameter:
string: :class:`str`
"""
try:
# open log file and append always
if not os.path.isdir(self._path):
- self._warn_console(__name__, 'Log directory not found, try to recreate logger')
+ self._warn_console(__name__, "Log directory not found, try to recreate logger")
self.create()
with open(self._path + self._log, "a+", encoding="utf-8") as f:
- f.write(string + '\n')
+ f.write(string + "\n")
f.close()
except Exception as e:
- self._fatal_console(__name__, f'Cannot append log file, message: {string}', ex=e)
+ self._fatal_console(__name__, f"Cannot append log file, message: {string}", ex=e)
def _get_string(self, name: str, level: LoggingLevelEnum, message: str) -> str:
r"""Returns input as log entry format
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Name of the message
level: :class:`cpl_core.logging.logging_level_enum.LoggingLevelEnum`
@@ -146,12 +143,11 @@ class Logger(LoggerABC):
message: :class:`str`
Log message
- Returns
- -------
+ Returns:
Formatted string for logging
"""
log_level = level.name
- return f'<{self._get_datetime_now()}> [ {log_level} ] [ {name} ]: {message}'
+ return f"<{self._get_datetime_now()}> [ {log_level} ] [ {name} ]: {message}"
def header(self, string: str):
# append log and print message
@@ -213,11 +209,11 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default)
def error(self, name: str, message: str, ex: Exception = None):
- output = ''
+ output = ""
if ex is not None:
tb = traceback.format_exc()
self.error(name, message)
- output = self._get_string(name, LoggingLevelEnum.ERROR, f'{ex} -> {tb}')
+ output = self._get_string(name, LoggingLevelEnum.ERROR, f"{ex} -> {tb}")
else:
output = self._get_string(name, LoggingLevelEnum.ERROR, message)
@@ -232,11 +228,11 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default)
def fatal(self, name: str, message: str, ex: Exception = None):
- output = ''
+ output = ""
if ex is not None:
tb = traceback.format_exc()
self.error(name, message)
- output = self._get_string(name, LoggingLevelEnum.FATAL, f'{ex} -> {tb}')
+ output = self._get_string(name, LoggingLevelEnum.FATAL, f"{ex} -> {tb}")
else:
output = self._get_string(name, LoggingLevelEnum.FATAL, message)
@@ -255,8 +251,7 @@ class Logger(LoggerABC):
def _warn_console(self, name: str, message: str):
r"""Writes a warning to console only
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Error name
message: :class:`str`
@@ -271,8 +266,7 @@ class Logger(LoggerABC):
def _fatal_console(self, name: str, message: str, ex: Exception = None):
r"""Writes an error to console only
- Parameter
- ---------
+ Parameter:
name: :class:`str`
Error name
message: :class:`str`
@@ -280,11 +274,11 @@ class Logger(LoggerABC):
ex: :class:`Exception`
Thrown exception
"""
- output = ''
+ output = ""
if ex is not None:
tb = traceback.format_exc()
self.error(name, message)
- output = self._get_string(name, LoggingLevelEnum.ERROR, f'{ex} -> {tb}')
+ output = self._get_string(name, LoggingLevelEnum.ERROR, f"{ex} -> {tb}")
else:
output = self._get_string(name, LoggingLevelEnum.ERROR, message)
diff --git a/src/cpl_core/logging/logging_level_enum.py b/src/cpl_core/logging/logging_level_enum.py
index f9b6259b..e6cb8884 100644
--- a/src/cpl_core/logging/logging_level_enum.py
+++ b/src/cpl_core/logging/logging_level_enum.py
@@ -2,11 +2,10 @@ from enum import Enum
class LoggingLevelEnum(Enum):
-
- OFF = 0 # Nothing
- FATAL = 1 # Error that cause exit
- ERROR = 2 # Non fatal error
- WARN = 3 # Error that can later be fatal
- INFO = 4 # Normal information's
- DEBUG = 5 # Detailed app state
- TRACE = 6 # Detailed app information's
+ OFF = 0 # Nothing
+ FATAL = 1 # Error that cause exit
+ ERROR = 2 # Non fatal error
+ WARN = 3 # Error that can later be fatal
+ INFO = 4 # Normal information's
+ DEBUG = 5 # Detailed app state
+ TRACE = 6 # Detailed app information's
diff --git a/src/cpl_core/logging/logging_settings.py b/src/cpl_core/logging/logging_settings.py
index fdd756a6..71d44d80 100644
--- a/src/cpl_core/logging/logging_settings.py
+++ b/src/cpl_core/logging/logging_settings.py
@@ -58,6 +58,6 @@ class LoggingSettings(ConfigurationModelABC):
self._level = LoggingLevelEnum[settings[LoggingSettingsNameEnum.file_level.value]]
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
- Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.write_line(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
+ Console.write_line(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
Console.set_foreground_color(ForegroundColorEnum.default)
diff --git a/src/cpl_core/logging/logging_settings_name_enum.py b/src/cpl_core/logging/logging_settings_name_enum.py
index 3b682428..81915698 100644
--- a/src/cpl_core/logging/logging_settings_name_enum.py
+++ b/src/cpl_core/logging/logging_settings_name_enum.py
@@ -2,8 +2,7 @@ from enum import Enum
class LoggingSettingsNameEnum(Enum):
-
- path = 'Path'
- filename = 'Filename'
- console_level = 'ConsoleLogLevel'
- file_level = 'FileLogLevel'
+ path = "Path"
+ filename = "Filename"
+ console_level = "ConsoleLogLevel"
+ file_level = "FileLogLevel"
diff --git a/src/cpl_core/mailing/__init__.py b/src/cpl_core/mailing/__init__.py
index 2fcf2337..8369836f 100644
--- a/src/cpl_core/mailing/__init__.py
+++ b/src/cpl_core/mailing/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.mailing'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.mailing"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -27,5 +27,5 @@ from .email_client_abc import EMailClientABC
from .email_client_settings import EMailClientSettings
from .email_client_settings_name_enum import EMailClientSettingsNameEnum
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/mailing/email.py b/src/cpl_core/mailing/email.py
index d4d149e7..0dc5c8bc 100644
--- a/src/cpl_core/mailing/email.py
+++ b/src/cpl_core/mailing/email.py
@@ -4,8 +4,7 @@ import re
class EMail:
r"""Represents an email
- Parameter
- ---------
+ Parameter:
header: list[:class:`str`]
Header of the E-Mail
subject: :class:`str`
@@ -18,8 +17,14 @@ class EMail:
Receiver of the E-Mail
"""
- def __init__(self, header: list[str] = None, subject: str = None, body: str = None, transceiver: str = None,
- receiver: list[str] = None):
+ def __init__(
+ self,
+ header: list[str] = None,
+ subject: str = None,
+ body: str = None,
+ transceiver: str = None,
+ receiver: list[str] = None,
+ ):
self._header: list[str] = header
self._subject: str = subject
@@ -30,7 +35,7 @@ class EMail:
@property
def header(self) -> str:
- return '\r\n'.join(self._header)
+ return "\r\n".join(self._header)
@property
def header_list(self) -> list[str]:
@@ -65,11 +70,11 @@ class EMail:
if self.check_mail(transceiver):
self._transceiver = transceiver
else:
- raise Exception(f'Invalid email: {transceiver}')
+ raise Exception(f"Invalid email: {transceiver}")
@property
def receiver(self) -> str:
- return ','.join(self._receiver)
+ return ",".join(self._receiver)
@property
def receiver_list(self) -> list[str]:
@@ -83,22 +88,19 @@ class EMail:
def check_mail(address: str) -> bool:
r"""Checks if an email is valid
- Parameter
- ---------
+ Parameter:
address: :class:`str`
The address to check
- Returns
- -------
+ Returns:
Result if E-Mail is valid or not
"""
- return bool(re.search('^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(.\\w{2,3})+$', address))
+ return bool(re.search("^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(.\\w{2,3})+$", address))
def add_header(self, header: str):
r"""Adds header
- Parameter
- ---------
+ Parameter:
header: :class:`str`
The header of the E-Mail
"""
@@ -110,8 +112,7 @@ class EMail:
def add_receiver(self, receiver: str):
r"""Adds receiver
- Parameter
- ---------
+ Parameter:
receiver: :class:`str`
The receiver of the E-Mail
"""
@@ -121,20 +122,18 @@ class EMail:
if self.check_mail(receiver):
self._receiver.append(receiver)
else:
- raise Exception(f'Invalid email: {receiver}')
+ raise Exception(f"Invalid email: {receiver}")
def get_content(self, transceiver: str):
r"""Returns the mail as string
- Parameter
- ---------
+ Parameter:
transceiver: :class:`str`
The transceiver of the E-Mail
- Returns
- -------
+ Returns:
E-Mail as string
"""
return str(
- f'From: {transceiver}\r\nTo: {self.receiver}\r\n{self.header}\r\nSubject: {self.subject}\r\n{self.body}').encode(
- 'utf-8')
+ f"From: {transceiver}\r\nTo: {self.receiver}\r\n{self.header}\r\nSubject: {self.subject}\r\n{self.body}"
+ ).encode("utf-8")
diff --git a/src/cpl_core/mailing/email_client_abc.py b/src/cpl_core/mailing/email_client_abc.py
index ae103e60..9b1609ef 100644
--- a/src/cpl_core/mailing/email_client_abc.py
+++ b/src/cpl_core/mailing/email_client_abc.py
@@ -19,8 +19,7 @@ class EMailClientABC(ABC):
def send_mail(self, email: EMail):
r"""Sends email
- Parameter
- ---------
+ Parameter:
email: :class:`cpl_core.mailing.email.EMail`
Object of the E-Mail to send
"""
diff --git a/src/cpl_core/mailing/email_client_service.py b/src/cpl_core/mailing/email_client_service.py
index 5cbcc5d9..5ace549d 100644
--- a/src/cpl_core/mailing/email_client_service.py
+++ b/src/cpl_core/mailing/email_client_service.py
@@ -13,8 +13,7 @@ from cpl_core.utils.credential_manager import CredentialManager
class EMailClient(EMailClientABC):
r"""Service to send emails
- Parameter
- ---------
+ Parameter:
environment: :class:`cpl_core.environment.application_environment_abc.ApplicationEnvironmentABC`
Environment of the application
logger: :class:`cpl_core.logging.logger_abc.LoggerABC`
@@ -36,44 +35,54 @@ class EMailClient(EMailClientABC):
def create(self):
r"""Creates connection"""
- self._logger.trace(__name__, f'Started {__name__}.create')
+ self._logger.trace(__name__, f"Started {__name__}.create")
self.connect()
- self._logger.trace(__name__, f'Stopped {__name__}.create')
+ self._logger.trace(__name__, f"Stopped {__name__}.create")
def connect(self):
- self._logger.trace(__name__, f'Started {__name__}.connect')
+ self._logger.trace(__name__, f"Started {__name__}.connect")
try:
- self._logger.debug(__name__, f'Try to connect to {self._mail_settings.host}:{self._mail_settings.port}')
+ self._logger.debug(__name__, f"Try to connect to {self._mail_settings.host}:{self._mail_settings.port}")
self._server = SMTP(self._mail_settings.host, self._mail_settings.port)
- self._logger.info(__name__, f'Connected to {self._mail_settings.host}:{self._mail_settings.port}')
+ self._logger.info(__name__, f"Connected to {self._mail_settings.host}:{self._mail_settings.port}")
- self._logger.debug(__name__, 'Try to start tls')
+ self._logger.debug(__name__, "Try to start tls")
self._server.starttls(context=ssl.create_default_context())
- self._logger.info(__name__, 'Started tls')
+ self._logger.info(__name__, "Started tls")
except Exception as e:
- self._logger.error(__name__, 'Cannot connect to mail server', e)
+ self._logger.error(__name__, "Cannot connect to mail server", e)
- self._logger.trace(__name__, f'Stopped {__name__}.connect')
+ self._logger.trace(__name__, f"Stopped {__name__}.connect")
def login(self):
r"""Login to server"""
- self._logger.trace(__name__, f'Started {__name__}.login')
+ self._logger.trace(__name__, f"Started {__name__}.login")
try:
- self._logger.debug(__name__, f'Try to login {self._mail_settings.user_name}@{self._mail_settings.host}:{self._mail_settings.port}')
- self._server.login(self._mail_settings.user_name, CredentialManager.decrypt(self._mail_settings.credentials))
- self._logger.info(__name__, f'Logged on as {self._mail_settings.user_name} to {self._mail_settings.host}:{self._mail_settings.port}')
+ self._logger.debug(
+ __name__,
+ f"Try to login {self._mail_settings.user_name}@{self._mail_settings.host}:{self._mail_settings.port}",
+ )
+ self._server.login(
+ self._mail_settings.user_name, CredentialManager.decrypt(self._mail_settings.credentials)
+ )
+ self._logger.info(
+ __name__,
+ f"Logged on as {self._mail_settings.user_name} to {self._mail_settings.host}:{self._mail_settings.port}",
+ )
except Exception as e:
- self._logger.error(__name__, 'Cannot login to mail server', e)
+ self._logger.error(__name__, "Cannot login to mail server", e)
- self._logger.trace(__name__, f'Stopped {__name__}.login')
+ self._logger.trace(__name__, f"Stopped {__name__}.login")
def send_mail(self, email: EMail):
- self._logger.trace(__name__, f'Started {__name__}.send_mail')
+ self._logger.trace(__name__, f"Started {__name__}.send_mail")
try:
self.login()
- self._logger.debug(__name__, f'Try to send email to {email.receiver_list}')
- self._server.sendmail(self._mail_settings.user_name, email.receiver_list, email.get_content(self._mail_settings.user_name))
- self._logger.info(__name__, f'Sent email to {email.receiver_list}')
+ self._logger.debug(__name__, f"Try to send email to {email.receiver_list}")
+ self._server.sendmail(
+ self._mail_settings.user_name, email.receiver_list, email.get_content(self._mail_settings.user_name)
+ )
+ self._logger.info(__name__, f"Sent email to {email.receiver_list}")
except Exception as e:
- self._logger.error(__name__, f'Cannot send mail to {email.receiver_list}', e)
- self._logger.trace(__name__, f'Stopped {__name__}.send_mail')
+ self._logger.error(__name__, f"Cannot send mail to {email.receiver_list}", e)
+ self._logger.trace(__name__, f"Stopped {__name__}.send_mail")
diff --git a/src/cpl_core/mailing/email_client_settings.py b/src/cpl_core/mailing/email_client_settings.py
index 4530252e..50dfdff4 100644
--- a/src/cpl_core/mailing/email_client_settings.py
+++ b/src/cpl_core/mailing/email_client_settings.py
@@ -11,10 +11,10 @@ class EMailClientSettings(ConfigurationModelABC):
def __init__(self):
ConfigurationModelABC.__init__(self)
- self._host: str = ''
+ self._host: str = ""
self._port: int = 0
- self._user_name: str = ''
- self._credentials: str = ''
+ self._user_name: str = ""
+ self._credentials: str = ""
@property
def host(self) -> str:
@@ -55,6 +55,5 @@ class EMailClientSettings(ConfigurationModelABC):
self._user_name = settings[EMailClientSettingsNameEnum.user_name.value]
self._credentials = settings[EMailClientSettingsNameEnum.credentials.value]
except Exception as e:
- Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
-
+ Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
+ Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
diff --git a/src/cpl_core/mailing/email_client_settings_name_enum.py b/src/cpl_core/mailing/email_client_settings_name_enum.py
index 782abdd2..b40c71e2 100644
--- a/src/cpl_core/mailing/email_client_settings_name_enum.py
+++ b/src/cpl_core/mailing/email_client_settings_name_enum.py
@@ -2,8 +2,7 @@ from enum import Enum
class EMailClientSettingsNameEnum(Enum):
-
- host = 'Host'
- port = 'Port'
- user_name = 'UserName'
- credentials = 'Credentials'
+ host = "Host"
+ port = "Port"
+ user_name = "UserName"
+ credentials = "Credentials"
diff --git a/src/cpl_core/pipes/__init__.py b/src/cpl_core/pipes/__init__.py
index cff6ea21..e136c326 100644
--- a/src/cpl_core/pipes/__init__.py
+++ b/src/cpl_core/pipes/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.pipes'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.pipes"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -29,5 +29,5 @@ from .pipe_abc import PipeABC
from .to_camel_case_pipe import ToCamelCasePipe
from .to_snake_case_pipe import ToSnakeCasePipe
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/pipes/bool_pipe.py b/src/cpl_core/pipes/bool_pipe.py
index daf3ad94..158f5ff3 100644
--- a/src/cpl_core/pipes/bool_pipe.py
+++ b/src/cpl_core/pipes/bool_pipe.py
@@ -2,8 +2,8 @@ from cpl_core.pipes.pipe_abc import PipeABC
class BoolPipe(PipeABC):
-
- def __init__(self): pass
+ def __init__(self):
+ pass
def transform(self, value: bool, *args):
- return 'True' if value else 'False'
+ return "True" if value else "False"
diff --git a/src/cpl_core/pipes/first_char_to_lower_pipe.py b/src/cpl_core/pipes/first_char_to_lower_pipe.py
index 59b5c80d..b9e7630e 100644
--- a/src/cpl_core/pipes/first_char_to_lower_pipe.py
+++ b/src/cpl_core/pipes/first_char_to_lower_pipe.py
@@ -2,19 +2,17 @@ from cpl_core.pipes.pipe_abc import PipeABC
class FirstCharToLowerPipe(PipeABC):
-
- def __init__(self): pass
+ def __init__(self):
+ pass
def transform(self, value: any, *args):
r"""Converts first char to lower
- Parameter
- ---------
+ Parameter:
value: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String with first char as lower
"""
- return f'{value[0].lower()}{value[1:]}'
+ return f"{value[0].lower()}{value[1:]}"
diff --git a/src/cpl_core/pipes/first_to_upper_pipe.py b/src/cpl_core/pipes/first_to_upper_pipe.py
index c6787b60..fbc7cb29 100644
--- a/src/cpl_core/pipes/first_to_upper_pipe.py
+++ b/src/cpl_core/pipes/first_to_upper_pipe.py
@@ -2,19 +2,17 @@ from cpl_core.pipes.pipe_abc import PipeABC
class FirstToUpperPipe(PipeABC):
-
- def __init__(self): pass
+ def __init__(self):
+ pass
def transform(self, value: str, *args):
r"""Converts first char to upper
- Parameter
- ---------
+ Parameter:
chars: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String with first char as upper
"""
- return f'{value[0].upper()}{value[1:]}'
+ return f"{value[0].upper()}{value[1:]}"
diff --git a/src/cpl_core/pipes/ip_address_pipe.py b/src/cpl_core/pipes/ip_address_pipe.py
index a33852b3..00dc43b0 100644
--- a/src/cpl_core/pipes/ip_address_pipe.py
+++ b/src/cpl_core/pipes/ip_address_pipe.py
@@ -2,23 +2,23 @@ from cpl_core.pipes.pipe_abc import PipeABC
class IPAddressPipe(PipeABC):
-
- def __init__(self): pass
+ def __init__(self):
+ pass
def transform(self, value: list[int], *args):
string = ""
if len(value) != 4:
- raise Exception('Invalid IP')
+ raise Exception("Invalid IP")
for i in range(0, len(value)):
byte = value[i]
if byte > 255:
- raise Exception('Invalid IP')
+ raise Exception("Invalid IP")
if i == len(value) - 1:
- string += f'{byte}'
+ string += f"{byte}"
else:
- string += f'{byte}.'
+ string += f"{byte}."
return string
diff --git a/src/cpl_core/pipes/pipe_abc.py b/src/cpl_core/pipes/pipe_abc.py
index 2726dbc1..9795a9b5 100644
--- a/src/cpl_core/pipes/pipe_abc.py
+++ b/src/cpl_core/pipes/pipe_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class PipeABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- def transform(self, value: any, *args): pass
+ def transform(self, value: any, *args):
+ pass
diff --git a/src/cpl_core/pipes/to_camel_case_pipe.py b/src/cpl_core/pipes/to_camel_case_pipe.py
index 69769b1e..6418b97b 100644
--- a/src/cpl_core/pipes/to_camel_case_pipe.py
+++ b/src/cpl_core/pipes/to_camel_case_pipe.py
@@ -4,25 +4,23 @@ from cpl_core.pipes import PipeABC
class ToCamelCasePipe(PipeABC):
-
- def __init__(self): pass
+ def __init__(self):
+ pass
def transform(self, value: str, *args) -> str:
r"""Converts string to camel case
- Parameter
- ---------
+ Parameter:
chars: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String converted to CamelCase
"""
converted_name = value
- char_set = string.punctuation + ' '
+ char_set = string.punctuation + " "
for char in char_set:
if char in converted_name:
- converted_name = ''.join(word.title() for word in converted_name.split(char))
+ converted_name = "".join(word.title() for word in converted_name.split(char))
return converted_name
diff --git a/src/cpl_core/pipes/to_snake_case_pipe.py b/src/cpl_core/pipes/to_snake_case_pipe.py
index 9b268af7..e4528ab0 100644
--- a/src/cpl_core/pipes/to_snake_case_pipe.py
+++ b/src/cpl_core/pipes/to_snake_case_pipe.py
@@ -4,26 +4,24 @@ from cpl_core.pipes import PipeABC
class ToSnakeCasePipe(PipeABC):
-
- def __init__(self): pass
+ def __init__(self):
+ pass
def transform(self, value: str, *args) -> str:
r"""Converts string to snake case
- Parameter
- ---------
+ Parameter:
chars: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String converted to snake_case
"""
# convert to train-case to CamelCase
- if '-' in value:
- value = ''.join(word.title() for word in value.split('-'))
+ if "-" in value:
+ value = "".join(word.title() for word in value.split("-"))
- pattern1 = re.compile(r'(.)([A-Z][a-z]+)')
- pattern2 = re.compile(r'([a-z0-9])([A-Z])')
- file_name = re.sub(pattern1, r'\1_\2', value)
- return re.sub(pattern2, r'\1_\2', file_name).lower()
+ pattern1 = re.compile(r"(.)([A-Z][a-z]+)")
+ pattern2 = re.compile(r"([a-z0-9])([A-Z])")
+ file_name = re.sub(pattern1, r"\1_\2", value)
+ return re.sub(pattern2, r"\1_\2", file_name).lower()
diff --git a/src/cpl_core/pipes/version_pipe.py b/src/cpl_core/pipes/version_pipe.py
index f4e891aa..c6031578 100644
--- a/src/cpl_core/pipes/version_pipe.py
+++ b/src/cpl_core/pipes/version_pipe.py
@@ -3,15 +3,15 @@ from cpl_core.pipes.pipe_abc import PipeABC
class VersionPipe(PipeABC):
-
- def __init__(self): pass
+ def __init__(self):
+ pass
def transform(self, value: dict, *args):
for atr in VersionSettingsNameEnum:
if atr.value not in value:
raise KeyError(atr.value)
- v_str = f'{value[VersionSettingsNameEnum.major.value]}.{value[VersionSettingsNameEnum.minor.value]}'
+ v_str = f"{value[VersionSettingsNameEnum.major.value]}.{value[VersionSettingsNameEnum.minor.value]}"
if value[VersionSettingsNameEnum.micro.value] is not None:
- v_str += f'.{value[VersionSettingsNameEnum.micro.value]}'
+ v_str += f".{value[VersionSettingsNameEnum.micro.value]}"
return v_str
diff --git a/src/cpl_core/time/__init__.py b/src/cpl_core/time/__init__.py
index 4718504f..f03e16f8 100644
--- a/src/cpl_core/time/__init__.py
+++ b/src/cpl_core/time/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.time'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.time"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -24,5 +24,5 @@ from collections import namedtuple
from .time_format_settings import TimeFormatSettings
from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/time/time_format_settings.py b/src/cpl_core/time/time_format_settings.py
index e68a235e..d44e9d85 100644
--- a/src/cpl_core/time/time_format_settings.py
+++ b/src/cpl_core/time/time_format_settings.py
@@ -57,6 +57,6 @@ class TimeFormatSettings(ConfigurationModelABC):
self._date_time_log_format = settings[TimeFormatSettingsNamesEnum.date_time_log_format.value]
except Exception as e:
Console.set_foreground_color(ForegroundColorEnum.red)
- Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.write_line(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
+ Console.write_line(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
Console.set_foreground_color(ForegroundColorEnum.default)
diff --git a/src/cpl_core/time/time_format_settings_names_enum.py b/src/cpl_core/time/time_format_settings_names_enum.py
index 63bf373d..33a7c4f1 100644
--- a/src/cpl_core/time/time_format_settings_names_enum.py
+++ b/src/cpl_core/time/time_format_settings_names_enum.py
@@ -2,8 +2,7 @@ from enum import Enum
class TimeFormatSettingsNamesEnum(Enum):
-
- date_format = 'DateFormat'
- time_format = 'TimeFormat'
- date_time_format = 'DateTimeFormat'
- date_time_log_format = 'DateTimeLogFormat'
+ date_format = "DateFormat"
+ time_format = "TimeFormat"
+ date_time_format = "DateTimeFormat"
+ date_time_log_format = "DateTimeLogFormat"
diff --git a/src/cpl_core/type.py b/src/cpl_core/type.py
index 853073b5..b186d5ad 100644
--- a/src/cpl_core/type.py
+++ b/src/cpl_core/type.py
@@ -1,3 +1,3 @@
from typing import TypeVar
-T = TypeVar('T')
+T = TypeVar("T")
diff --git a/src/cpl_core/utils/__init__.py b/src/cpl_core/utils/__init__.py
index 3ced2335..769fa41c 100644
--- a/src/cpl_core/utils/__init__.py
+++ b/src/cpl_core/utils/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-core sh-edraft Common Python library
+cpl-core CPL core
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library
+CPL core package
:copyright: (c) 2020 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_core.utils'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_core.utils"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -25,5 +25,5 @@ from .credential_manager import CredentialManager
from .string import String
from .pip import Pip
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_core/utils/credential_manager.py b/src/cpl_core/utils/credential_manager.py
index f5265403..ef46f387 100644
--- a/src/cpl_core/utils/credential_manager.py
+++ b/src/cpl_core/utils/credential_manager.py
@@ -8,46 +8,39 @@ class CredentialManager:
def encrypt(string: str) -> str:
r"""Encode with base64
- Parameter
- ---------
+ Parameter:
string: :class:`str`
String to encode
- Returns
- -------
+ Returns:
Encoded string
"""
- return base64.b64encode(string.encode('utf-8')).decode('utf-8')
+ return base64.b64encode(string.encode("utf-8")).decode("utf-8")
@staticmethod
def decrypt(string: str) -> str:
r"""Decode with base64
- Parameter
- ---------
+ Parameter:
string: :class:`str`
String to decode
- Returns
- -------
+ Returns:
Decoded string
"""
- return base64.b64decode(string).decode('utf-8')
+ return base64.b64decode(string).decode("utf-8")
@staticmethod
def build_string(string: str, credentials: str):
r"""Builds string with credentials in it
- Parameter
- ---------
+ Parameter:
string: :class:`str`
String in which the variable is replaced by credentials
credentials: :class:`str`
String to encode
- Returns
- -------
+ Returns:
Decoded string
"""
- return string.replace('$credentials', CredentialManager.decrypt(credentials))
-
+ return string.replace("$credentials", CredentialManager.decrypt(credentials))
diff --git a/src/cpl_core/utils/pip.py b/src/cpl_core/utils/pip.py
index a75d69a4..fb403645 100644
--- a/src/cpl_core/utils/pip.py
+++ b/src/cpl_core/utils/pip.py
@@ -24,8 +24,7 @@ class Pip:
def set_executable(cls, executable: str):
r"""Sets the executable
- Parameter
- ---------
+ Parameter:
executable: :class:`str`
The python command
"""
@@ -38,11 +37,11 @@ class Pip:
path = os.path.dirname(os.path.dirname(cls._executable))
cls._env = os.environ
- if sys.platform == 'win32':
- cls._env['PATH'] = f'{path}\\bin' + os.pathsep + os.environ.get('PATH', '')
+ if sys.platform == "win32":
+ cls._env["PATH"] = f"{path}\\bin" + os.pathsep + os.environ.get("PATH", "")
else:
- cls._env['PATH'] = f'{path}/bin' + os.pathsep + os.environ.get('PATH', '')
- cls._env['VIRTUAL_ENV'] = path
+ cls._env["PATH"] = f"{path}/bin" + os.pathsep + os.environ.get("PATH", "")
+ cls._env["VIRTUAL_ENV"] = path
@classmethod
def reset_executable(cls):
@@ -55,26 +54,21 @@ class Pip:
def get_package(cls, package: str) -> Optional[str]:
r"""Gets given package py local pip list
- Parameter
- ---------
+ Parameter:
package: :class:`str`
- Returns
- -------
+ Returns:
The package name as string
"""
result = None
with suppress(Exception):
args = [cls._executable, "-m", "pip", "freeze", "--all"]
- result = subprocess.check_output(
- args,
- stderr=subprocess.DEVNULL, env=cls._env
- )
+ result = subprocess.check_output(args, stderr=subprocess.DEVNULL, env=cls._env)
if result is None:
return None
- for p in str(result.decode()).split('\n'):
+ for p in str(result.decode()).split("\n"):
if p.startswith(package):
return p
@@ -84,8 +78,7 @@ class Pip:
def get_outdated(cls) -> bytes:
r"""Gets table of outdated packages
- Returns
- -------
+ Returns:
Bytes string of the command result
"""
args = [cls._executable, "-m", "pip", "list", "--outdated"]
@@ -96,8 +89,7 @@ class Pip:
def install(cls, package: str, *args, source: str = None, stdout=None, stderr=None):
r"""Installs given package
- Parameter
- ---------
+ Parameter:
package: :class:`str`
The name of the package
args: :class:`list`
@@ -117,7 +109,7 @@ class Pip:
pip_args.append(package)
if source is not None:
- pip_args.append(f'--extra-index-url')
+ pip_args.append(f"--extra-index-url")
pip_args.append(source)
subprocess.run(pip_args, stdout=stdout, stderr=stderr, env=cls._env)
@@ -126,8 +118,7 @@ class Pip:
def uninstall(cls, package: str, stdout=None, stderr=None):
r"""Uninstalls given package
- Parameter
- ---------
+ Parameter:
package: :class:`str`
The name of the package
stdout: :class:`str`
@@ -137,7 +128,4 @@ class Pip:
"""
args = [cls._executable, "-m", "pip", "uninstall", "--yes", package]
- subprocess.run(
- args,
- stdout=stdout, stderr=stderr, env=cls._env
- )
+ subprocess.run(args, stdout=stdout, stderr=stderr, env=cls._env)
diff --git a/src/cpl_core/utils/string.py b/src/cpl_core/utils/string.py
index 5866c8b6..cfeea681 100644
--- a/src/cpl_core/utils/string.py
+++ b/src/cpl_core/utils/string.py
@@ -10,20 +10,18 @@ class String:
def convert_to_camel_case(chars: str) -> str:
r"""Converts string to camel case
- Parameter
- ---------
+ Parameter:
chars: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String converted to CamelCase
"""
converted_name = chars
- char_set = string.punctuation + ' '
+ char_set = string.punctuation + " "
for char in char_set:
if char in converted_name:
- converted_name = ''.join(word.title() for word in converted_name.split(char))
+ converted_name = "".join(word.title() for word in converted_name.split(char))
return converted_name
@@ -31,61 +29,54 @@ class String:
def convert_to_snake_case(chars: str) -> str:
r"""Converts string to snake case
- Parameter
- ---------
+ Parameter:
chars: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String converted to snake_case
"""
# convert to train-case to CamelCase
- if '-' in chars:
- chars = ''.join(word.title() for word in chars.split('-'))
+ if "-" in chars:
+ chars = "".join(word.title() for word in chars.split("-"))
- pattern1 = re.compile(r'(.)([A-Z][a-z]+)')
- pattern2 = re.compile(r'([a-z0-9])([A-Z])')
- file_name = re.sub(pattern1, r'\1_\2', chars)
- return re.sub(pattern2, r'\1_\2', file_name).lower()
+ pattern1 = re.compile(r"(.)([A-Z][a-z]+)")
+ pattern2 = re.compile(r"([a-z0-9])([A-Z])")
+ file_name = re.sub(pattern1, r"\1_\2", chars)
+ return re.sub(pattern2, r"\1_\2", file_name).lower()
@staticmethod
def first_to_upper(chars: str) -> str:
r"""Converts first char to upper
- Parameter
- ---------
+ Parameter:
chars: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String with first char as upper
"""
- return f'{chars[0].upper()}{chars[1:]}'
+ return f"{chars[0].upper()}{chars[1:]}"
@staticmethod
def first_to_lower(chars: str) -> str:
r"""Converts first char to lower
- Parameter
- ---------
+ Parameter:
chars: :class:`str`
String to convert
- Returns
- -------
+ Returns:
String with first char as lower
"""
- return f'{chars[0].lower()}{chars[1:]}'
+ return f"{chars[0].lower()}{chars[1:]}"
@staticmethod
def random_string(chars: str, length: int) -> str:
r"""Creates random string by given chars and length
- Returns
- -------
+ Returns:
String of random chars
"""
- return ''.join(random.choice(chars) for _ in range(length))
+ return "".join(random.choice(chars) for _ in range(length))
diff --git a/src/cpl_discord/.cpl/__init__.py b/src/cpl_discord/.cpl/__init__.py
index e2b391ae..a3df6419 100644
--- a/src/cpl_discord/.cpl/__init__.py
+++ b/src/cpl_discord/.cpl/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/.cpl/project_discord_bot.py b/src/cpl_discord/.cpl/project_discord_bot.py
index e78d5d8d..1ed6a121 100644
--- a/src/cpl_discord/.cpl/project_discord_bot.py
+++ b/src/cpl_discord/.cpl/project_discord_bot.py
@@ -6,17 +6,16 @@ from cpl_core.utils import String
class DiscordBot(ProjectTypeABC):
-
def __init__(
- self,
- base_path: str,
- project_name: str,
- workspace: WorkspaceSettings,
- use_application_api: bool,
- use_startup: bool,
- use_service_providing: bool,
- use_async: bool,
- project_file_data: dict,
+ self,
+ base_path: str,
+ project_name: str,
+ workspace: WorkspaceSettings,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ project_file_data: dict,
):
from project_file_discord import DiscordBotProjectFile
from project_file_discord_appsettings import DiscordBotProjectFileAppsettings
@@ -31,24 +30,56 @@ class DiscordBot(ProjectTypeABC):
use_application_api, use_startup, use_service_providing, use_async = True, True, True, True
- ProjectTypeABC.__init__(self, base_path, project_name, workspace, use_application_api, use_startup, use_service_providing, use_async, project_file_data)
+ ProjectTypeABC.__init__(
+ self,
+ base_path,
+ project_name,
+ workspace,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ project_file_data,
+ )
project_path = f'{base_path}{String.convert_to_snake_case(project_name.split("/")[-1])}/'
- self.add_template(DiscordBotProjectFile(project_name.split('/')[-1], project_path, project_file_data))
+ self.add_template(DiscordBotProjectFile(project_name.split("/")[-1], project_path, project_file_data))
if workspace is None:
- self.add_template(DiscordBotProjectFileLicense(''))
- self.add_template(DiscordBotProjectFileReadme(''))
- self.add_template(DiscordBotInit('', 'init', f'{base_path}tests/'))
+ self.add_template(DiscordBotProjectFileLicense(""))
+ self.add_template(DiscordBotProjectFileReadme(""))
+ self.add_template(DiscordBotInit("", "init", f"{base_path}tests/"))
- self.add_template(DiscordBotInit('', 'init', project_path))
+ self.add_template(DiscordBotInit("", "init", project_path))
self.add_template(DiscordBotProjectFileAppsettings(project_path))
- self.add_template(DiscordBotInit('', 'init', f'{project_path}events/'))
- self.add_template(Event('OnReady', 'event', f'{project_path}events/'))
- self.add_template(DiscordBotInit('', 'init', f'{project_path}commands/'))
- self.add_template(Command('Ping', 'command', f'{project_path}commands/'))
+ self.add_template(DiscordBotInit("", "init", f"{project_path}events/"))
+ self.add_template(Event("OnReady", "event", f"{project_path}events/"))
+ self.add_template(DiscordBotInit("", "init", f"{project_path}commands/"))
+ self.add_template(Command("Ping", "command", f"{project_path}commands/"))
- self.add_template(DiscordBotProjectFileApplication(project_path, use_application_api, use_startup, use_service_providing, use_async))
- self.add_template(DiscordBotProjectFileStartup(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
- self.add_template(DiscordBotProjectFileMain(project_name.split('/')[-1], project_path, use_application_api, use_startup, use_service_providing, use_async))
+ self.add_template(
+ DiscordBotProjectFileApplication(
+ project_path, use_application_api, use_startup, use_service_providing, use_async
+ )
+ )
+ self.add_template(
+ DiscordBotProjectFileStartup(
+ project_name.split("/")[-1],
+ project_path,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ )
+ )
+ self.add_template(
+ DiscordBotProjectFileMain(
+ project_name.split("/")[-1],
+ project_path,
+ use_application_api,
+ use_startup,
+ use_service_providing,
+ use_async,
+ )
+ )
diff --git a/src/cpl_discord/.cpl/project_file_discord.py b/src/cpl_discord/.cpl/project_file_discord.py
index 1027c949..cae5b29a 100644
--- a/src/cpl_discord/.cpl/project_file_discord.py
+++ b/src/cpl_discord/.cpl/project_file_discord.py
@@ -4,10 +4,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class DiscordBotProjectFile(FileTemplateABC):
-
def __init__(self, name: str, path: str, code: dict):
- FileTemplateABC.__init__(self, '', path, '{}')
- self._name = f'{name}.json'
+ FileTemplateABC.__init__(self, "", path, "{}")
+ self._name = f"{name}.json"
self._code = code
def get_code(self) -> str:
diff --git a/src/cpl_discord/.cpl/project_file_discord_appsettings.py b/src/cpl_discord/.cpl/project_file_discord_appsettings.py
index cf0c29ad..2f046d6d 100644
--- a/src/cpl_discord/.cpl/project_file_discord_appsettings.py
+++ b/src/cpl_discord/.cpl/project_file_discord_appsettings.py
@@ -4,13 +4,13 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class DiscordBotProjectFileAppsettings(FileTemplateABC):
-
def __init__(self, path: str):
- FileTemplateABC.__init__(self, '', path, '{}')
- self._name = 'appsettings.json'
+ FileTemplateABC.__init__(self, "", path, "{}")
+ self._name = "appsettings.json"
def get_code(self) -> str:
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
@@ -31,4 +31,5 @@ class DiscordBotProjectFileAppsettings(FileTemplateABC):
"Prefix": "!bot "
}
}
- """)
+ """
+ )
diff --git a/src/cpl_discord/.cpl/project_file_discord_code_application.py b/src/cpl_discord/.cpl/project_file_discord_code_application.py
index dbdd4f23..a7aef9f9 100644
--- a/src/cpl_discord/.cpl/project_file_discord_code_application.py
+++ b/src/cpl_discord/.cpl/project_file_discord_code_application.py
@@ -2,14 +2,18 @@ from cpl_cli.abc.code_file_template_abc import CodeFileTemplateABC
class DiscordBotProjectFileApplication(CodeFileTemplateABC):
-
- def __init__(self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'application', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "application", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
def get_code(self) -> str:
import textwrap
- return textwrap.dedent("""\
+ return textwrap.dedent(
+ """\
from cpl_core.application import ApplicationABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.console import Console
@@ -50,4 +54,5 @@ class DiscordBotProjectFileApplication(CodeFileTemplateABC):
self._logger.error(__name__, 'stop failed', e)
Console.write_line()
- """)
+ """
+ )
diff --git a/src/cpl_discord/.cpl/project_file_discord_code_main.py b/src/cpl_discord/.cpl/project_file_discord_code_main.py
index e99183ce..fdfb6858 100644
--- a/src/cpl_discord/.cpl/project_file_discord_code_main.py
+++ b/src/cpl_discord/.cpl/project_file_discord_code_main.py
@@ -3,15 +3,25 @@ from cpl_core.utils import String
class DiscordBotProjectFileMain(CodeFileTemplateABC):
-
- def __init__(self, name: str, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'main', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self,
+ name: str,
+ path: str,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "main", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
import textwrap
- import_pkg = f'{String.convert_to_snake_case(name)}.'
+ import_pkg = f"{String.convert_to_snake_case(name)}."
- self._main_with_application_host_and_startup = textwrap.dedent(f"""\
+ self._main_with_application_host_and_startup = textwrap.dedent(
+ f"""\
import asyncio
from typing import Optional
@@ -41,7 +51,8 @@ class DiscordBotProjectFileMain(CodeFileTemplateABC):
asyncio.run(program.main())
except KeyboardInterrupt:
asyncio.run(program.stop())
- """)
+ """
+ )
def get_code(self) -> str:
return self._main_with_application_host_and_startup
diff --git a/src/cpl_discord/.cpl/project_file_discord_code_startup.py b/src/cpl_discord/.cpl/project_file_discord_code_startup.py
index 885aea67..a1bfaba1 100644
--- a/src/cpl_discord/.cpl/project_file_discord_code_startup.py
+++ b/src/cpl_discord/.cpl/project_file_discord_code_startup.py
@@ -3,17 +3,27 @@ from cpl_core.utils import String
class DiscordBotProjectFileStartup(CodeFileTemplateABC):
-
- def __init__(self, project_name: str, path: str, use_application_api: bool, use_startup: bool, use_service_providing: bool, use_async: bool):
- CodeFileTemplateABC.__init__(self, 'startup', path, '', use_application_api, use_startup, use_service_providing, use_async)
+ def __init__(
+ self,
+ project_name: str,
+ path: str,
+ use_application_api: bool,
+ use_startup: bool,
+ use_service_providing: bool,
+ use_async: bool,
+ ):
+ CodeFileTemplateABC.__init__(
+ self, "startup", path, "", use_application_api, use_startup, use_service_providing, use_async
+ )
self._project_name = project_name
def get_code(self) -> str:
import textwrap
- import_pkg = f'{String.convert_to_snake_case(self._project_name)}.'
+ import_pkg = f"{String.convert_to_snake_case(self._project_name)}."
- return textwrap.dedent(f"""\
+ return textwrap.dedent(
+ f"""\
from cpl_core.application import StartupABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
@@ -44,4 +54,5 @@ class DiscordBotProjectFileStartup(CodeFileTemplateABC):
dc_collection.add_command(PingCommand)
return services.build_service_provider()
- """)
+ """
+ )
diff --git a/src/cpl_discord/.cpl/project_file_discord_license.py b/src/cpl_discord/.cpl/project_file_discord_license.py
index 4592aba0..76a8a2b1 100644
--- a/src/cpl_discord/.cpl/project_file_discord_license.py
+++ b/src/cpl_discord/.cpl/project_file_discord_license.py
@@ -2,10 +2,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class DiscordBotProjectFileLicense(FileTemplateABC):
-
def __init__(self, path: str):
- FileTemplateABC.__init__(self, '', path, '')
- self._name = 'LICENSE'
+ FileTemplateABC.__init__(self, "", path, "")
+ self._name = "LICENSE"
def get_code(self) -> str:
return self._code
diff --git a/src/cpl_discord/.cpl/project_file_discord_readme.py b/src/cpl_discord/.cpl/project_file_discord_readme.py
index e3dceea1..18ce8f12 100644
--- a/src/cpl_discord/.cpl/project_file_discord_readme.py
+++ b/src/cpl_discord/.cpl/project_file_discord_readme.py
@@ -2,10 +2,9 @@ from cpl_cli.abc.file_template_abc import FileTemplateABC
class DiscordBotProjectFileReadme(FileTemplateABC):
-
def __init__(self, path: str):
- FileTemplateABC.__init__(self, '', path, '')
- self._name = 'README.md'
+ FileTemplateABC.__init__(self, "", path, "")
+ self._name = "README.md"
def get_code(self) -> str:
return self._code
diff --git a/src/cpl_discord/.cpl/schematic_discord_command.py b/src/cpl_discord/.cpl/schematic_discord_command.py
index e120aa72..d070189f 100644
--- a/src/cpl_discord/.cpl/schematic_discord_command.py
+++ b/src/cpl_discord/.cpl/schematic_discord_command.py
@@ -4,7 +4,6 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Command(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -37,8 +36,4 @@ class Command(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'command',
- []
- )
+ GenerateSchematicABC.register(cls, "command", [])
diff --git a/src/cpl_discord/.cpl/schematic_discord_event.py b/src/cpl_discord/.cpl/schematic_discord_event.py
index 43f08354..a5b8f967 100644
--- a/src/cpl_discord/.cpl/schematic_discord_event.py
+++ b/src/cpl_discord/.cpl/schematic_discord_event.py
@@ -7,15 +7,15 @@ from cpl_core.utils import String
class Event(GenerateSchematicABC):
-
def __init__(self, name: str, schematic: str, path: str):
GenerateSchematicABC.__init__(self, name, schematic, path)
event = None
from cpl_discord.discord_event_types_enum import DiscordEventTypesEnum
+
for event_type in DiscordEventTypesEnum:
- event_name = event_type.value.__name__.replace("ABC", '')
+ event_name = event_type.value.__name__.replace("ABC", "")
if event_name in name:
name = name.replace(event_name, "")
@@ -23,18 +23,18 @@ class Event(GenerateSchematicABC):
break
if event is None:
- Console.error(f'No valid event found in name {name}')
- Console.write_line('Available events:')
+ Console.error(f"No valid event found in name {name}")
+ Console.write_line("Available events:")
for event_type in DiscordEventTypesEnum:
Console.write_line(f'\t{event_type.value.__name__.replace("ABC", "")}')
sys.exit()
- self._event_class = f'{event}ABC'
+ self._event_class = f"{event}ABC"
self._name = f'{String.convert_to_snake_case(self._event_class.replace("ABC", ""))}_{schematic}.py'
self._class_name = f'{self._event_class.replace("ABC", "")}{String.first_to_upper(schematic)}'
- if name != '':
- self._name = f'{String.convert_to_snake_case(name)}_{self._name}'
- self._class_name = f'{String.first_to_upper(name)}{self._class_name}'
+ if name != "":
+ self._name = f"{String.convert_to_snake_case(name)}_{self._name}"
+ self._class_name = f"{String.first_to_upper(name)}{self._class_name}"
def get_code(self) -> str:
code = """\
@@ -62,8 +62,4 @@ class Event(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'event',
- []
- )
+ GenerateSchematicABC.register(cls, "event", [])
diff --git a/src/cpl_discord/.cpl/schematic_discord_init.py b/src/cpl_discord/.cpl/schematic_discord_init.py
index 8b7ce010..dcb92826 100644
--- a/src/cpl_discord/.cpl/schematic_discord_init.py
+++ b/src/cpl_discord/.cpl/schematic_discord_init.py
@@ -4,10 +4,9 @@ from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class DiscordBotInit(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
- self._name = f'__init__.py'
+ self._name = f"__init__.py"
def get_code(self) -> str:
code = """\
@@ -17,8 +16,4 @@ class DiscordBotInit(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'init',
- []
- )
+ GenerateSchematicABC.register(cls, "init", [])
diff --git a/src/cpl_discord/__init__.py b/src/cpl_discord/__init__.py
index b90ee3d0..eed82b75 100644
--- a/src/cpl_discord/__init__.py
+++ b/src/cpl_discord/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -35,24 +35,28 @@ def add_discord(self):
self.add_singleton(DiscordServiceABC, DiscordService)
self.add_singleton(DiscordBotServiceABC, DiscordBotService)
except ImportError as e:
- Console.error('cpl-discord is not installed', str(e))
+ Console.error("cpl-discord is not installed", str(e))
def init():
from cpl_core.dependency_injection import ServiceCollection
+
ServiceCollection.add_discord = add_discord
init()
-def get_discord_collection(services: 'ServiceCollectionABC') -> 'DiscordCollectionABC':
+def get_discord_collection(services: "ServiceCollectionABC") -> "DiscordCollectionABC":
from cpl_discord.service.discord_collection import DiscordCollection
from cpl_discord.service.discord_collection_abc import DiscordCollectionABC
+
collection = DiscordCollection(services)
services.add_singleton(DiscordCollectionABC, collection)
return collection
+
+
# build-ignore-end
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/application/__init__.py b/src/cpl_discord/application/__init__.py
index cdfee203..cf44aef8 100644
--- a/src/cpl_discord/application/__init__.py
+++ b/src/cpl_discord/application/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord.application'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord.application"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -23,5 +23,5 @@ from collections import namedtuple
# imports
from .discord_bot_application_abc import DiscordBotApplicationABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/application/discord_bot_application_abc.py b/src/cpl_discord/application/discord_bot_application_abc.py
index 69c2be09..d9ad42cf 100644
--- a/src/cpl_discord/application/discord_bot_application_abc.py
+++ b/src/cpl_discord/application/discord_bot_application_abc.py
@@ -6,9 +6,9 @@ from cpl_core.dependency_injection.service_provider_abc import ServiceProviderAB
class DiscordBotApplicationABC(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@abstractmethod
- def stop_async(self): pass
+ def stop_async(self):
+ pass
diff --git a/src/cpl_discord/command/__init__.py b/src/cpl_discord/command/__init__.py
index f0306bd2..f3de7e25 100644
--- a/src/cpl_discord/command/__init__.py
+++ b/src/cpl_discord/command/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord.command'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord.command"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -24,5 +24,5 @@ from collections import namedtuple
from .discord_command_abc import DiscordCommandABC
from .discord_commands_meta import DiscordCogMeta
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/command/discord_command_abc.py b/src/cpl_discord/command/discord_command_abc.py
index fe3072be..312e56d6 100644
--- a/src/cpl_discord/command/discord_command_abc.py
+++ b/src/cpl_discord/command/discord_command_abc.py
@@ -6,6 +6,6 @@ from cpl_discord.command.discord_commands_meta import DiscordCogMeta
class DiscordCommandABC(ABC, commands.Cog, metaclass=DiscordCogMeta):
-
@abstractmethod
- def __init__(self): pass
+ def __init__(self):
+ pass
diff --git a/src/cpl_discord/command/discord_commands_meta.py b/src/cpl_discord/command/discord_commands_meta.py
index 9a32b758..4876704b 100644
--- a/src/cpl_discord/command/discord_commands_meta.py
+++ b/src/cpl_discord/command/discord_commands_meta.py
@@ -2,4 +2,5 @@ from abc import ABCMeta
from discord.ext import commands
-class DiscordCogMeta(ABCMeta, commands.CogMeta): pass
+class DiscordCogMeta(ABCMeta, commands.CogMeta):
+ pass
diff --git a/src/cpl_discord/configuration/__init__.py b/src/cpl_discord/configuration/__init__.py
index 5fcaa9a4..7bab63a6 100644
--- a/src/cpl_discord/configuration/__init__.py
+++ b/src/cpl_discord/configuration/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord.configuration'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord.configuration"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -23,5 +23,5 @@ from collections import namedtuple
# imports
from .discord_bot_settings import DiscordBotSettings
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/configuration/discord_bot_settings.py b/src/cpl_discord/configuration/discord_bot_settings.py
index 1a1581c8..6c96ba63 100644
--- a/src/cpl_discord/configuration/discord_bot_settings.py
+++ b/src/cpl_discord/configuration/discord_bot_settings.py
@@ -5,12 +5,11 @@ from cpl_core.console import Console
class DiscordBotSettings(ConfigurationModelABC):
-
def __init__(self):
ConfigurationModelABC.__init__(self)
- self._token = ''
- self._prefix = ''
+ self._token = ""
+ self._prefix = ""
@property
def token(self) -> str:
@@ -22,8 +21,8 @@ class DiscordBotSettings(ConfigurationModelABC):
def from_dict(self, settings: dict):
try:
- self._token = settings['Token']
- self._prefix = settings['Prefix']
+ self._token = settings["Token"]
+ self._prefix = settings["Prefix"]
except Exception as e:
- Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {__name__} settings')
- Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {__name__} settings")
+ Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
diff --git a/src/cpl_discord/container/__init__.py b/src/cpl_discord/container/__init__.py
index 2b27e09c..15a40c30 100644
--- a/src/cpl_discord/container/__init__.py
+++ b/src/cpl_discord/container/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord.container'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord.container"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -30,5 +30,5 @@ from .text_channel import TextChannel
from .thread import Thread
from .voice_channel import VoiceChannel
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/container/category_channel.py b/src/cpl_discord/container/category_channel.py
index 52e93ac9..1454535b 100644
--- a/src/cpl_discord/container/category_channel.py
+++ b/src/cpl_discord/container/category_channel.py
@@ -8,7 +8,6 @@ from cpl_query.extension import List
class CategoryChannel(discord.CategoryChannel, Container):
-
def __init__(self, _t: discord.CategoryChannel):
Container.__init__(self, _t, CategoryChannel)
diff --git a/src/cpl_discord/container/container.py b/src/cpl_discord/container/container.py
index b55e1d0d..a41e26d8 100644
--- a/src/cpl_discord/container/container.py
+++ b/src/cpl_discord/container/container.py
@@ -3,7 +3,6 @@ from typing import Callable
class Container:
-
def __init__(self, _o: object, _t: type):
self._object = _o
self._type = _t
diff --git a/src/cpl_discord/container/guild.py b/src/cpl_discord/container/guild.py
index 5a5a1055..063ad1a1 100644
--- a/src/cpl_discord/container/guild.py
+++ b/src/cpl_discord/container/guild.py
@@ -11,7 +11,6 @@ from cpl_query.extension import List
class Guild(Container, discord.Guild):
-
def __init__(self, _t: discord.Guild):
self._object: discord.Guild = _t
diff --git a/src/cpl_discord/container/member.py b/src/cpl_discord/container/member.py
index 9f785422..21b6bcbb 100644
--- a/src/cpl_discord/container/member.py
+++ b/src/cpl_discord/container/member.py
@@ -6,11 +6,11 @@ from cpl_query.extension.list import List
class Member(discord.Member, Container):
-
def __init__(self, _t: discord.Member):
Container.__init__(self, _t, Member)
@property
- def roles(self) -> List['Role']:
+ def roles(self) -> List["Role"]:
from cpl_discord.container.role import Role
+
return List(Role, ToContainersConverter.convert(self._object.roles, Role))
diff --git a/src/cpl_discord/container/role.py b/src/cpl_discord/container/role.py
index 74f8c874..6a174933 100644
--- a/src/cpl_discord/container/role.py
+++ b/src/cpl_discord/container/role.py
@@ -7,11 +7,11 @@ from cpl_query.extension.list import List
class Role(discord.Role, Container):
-
def __init__(self, _t: discord.Role):
Container.__init__(self, _t, Role)
@property
- def members(self) -> List['Member']:
+ def members(self) -> List["Member"]:
from cpl_discord.container.member import Member
+
return List(Member, ToContainersConverter.convert(self._object.members, Member))
diff --git a/src/cpl_discord/container/text_channel.py b/src/cpl_discord/container/text_channel.py
index 49099b7b..9e158cc2 100644
--- a/src/cpl_discord/container/text_channel.py
+++ b/src/cpl_discord/container/text_channel.py
@@ -8,7 +8,6 @@ from cpl_query.extension import List
class TextChannel(discord.TextChannel, Container):
-
def __init__(self, _t: discord.TextChannel):
Container.__init__(self, _t, TextChannel)
diff --git a/src/cpl_discord/container/thread.py b/src/cpl_discord/container/thread.py
index 03b11ac4..62c1269f 100644
--- a/src/cpl_discord/container/thread.py
+++ b/src/cpl_discord/container/thread.py
@@ -7,7 +7,6 @@ from cpl_query.extension import List
class Thread(discord.Thread, Container):
-
def __init__(self, _t: discord.Thread):
Container.__init__(self, _t, Thread)
diff --git a/src/cpl_discord/container/voice_channel.py b/src/cpl_discord/container/voice_channel.py
index 805ea4bb..20eb3edb 100644
--- a/src/cpl_discord/container/voice_channel.py
+++ b/src/cpl_discord/container/voice_channel.py
@@ -7,7 +7,6 @@ from cpl_query.extension import List
class VoiceChannel(discord.VoiceChannel, Container):
-
def __init__(self, _t: discord.VoiceChannel):
Container.__init__(self, _t, VoiceChannel)
diff --git a/src/cpl_discord/cpl-discord.json b/src/cpl_discord/cpl-discord.json
index cd29ffcf..7761a2c3 100644
--- a/src/cpl_discord/cpl-discord.json
+++ b/src/cpl_discord/cpl-discord.json
@@ -2,26 +2,26 @@
"ProjectSettings": {
"Name": "cpl-discord",
"Version": {
- "Major": "2022",
- "Minor": "12",
- "Micro": "1"
+ "Major": "2023",
+ "Minor": "2",
+ "Micro": "0"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
- "Description": "sh-edraft Common Python library Discord",
- "LongDescription": "sh-edraft Common Python library link between discord.py and CPL",
+ "Description": "CPL Discord",
+ "LongDescription": "Link between discord.py and CPL",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022 - 2023",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
- "cpl-core>=2022.12.1",
+ "cpl-core>=2023.2.0",
"discord.py==2.1.0",
- "cpl-query>=2022.12.2.post1"
+ "cpl-query>=2023.2.0"
],
"DevDependencies": [
- "cpl-cli>=2022.12.1"
+ "cpl-cli>=2023.2.0"
],
"PythonVersion": ">=3.10",
"PythonPath": {},
diff --git a/src/cpl_discord/events/__init__.py b/src/cpl_discord/events/__init__.py
index e5259830..011174cc 100644
--- a/src/cpl_discord/events/__init__.py
+++ b/src/cpl_discord/events/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord.events'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord.events"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -68,5 +68,5 @@ from .on_user_update_abc import OnUserUpdateABC
from .on_voice_state_update_abc import OnVoiceStateUpdateABC
from .on_webhooks_update_abc import OnWebhooksUpdateABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/events/on_bulk_message_delete_abc.py b/src/cpl_discord/events/on_bulk_message_delete_abc.py
index 15a19c64..637c7226 100644
--- a/src/cpl_discord/events/on_bulk_message_delete_abc.py
+++ b/src/cpl_discord/events/on_bulk_message_delete_abc.py
@@ -3,9 +3,10 @@ import discord
class OnBulkMessageDeleteABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_bulk_message_delete(self, messages: list[discord.Message]): pass
+ async def on_bulk_message_delete(self, messages: list[discord.Message]):
+ pass
diff --git a/src/cpl_discord/events/on_command_abc.py b/src/cpl_discord/events/on_command_abc.py
index addda92b..4b3bdd30 100644
--- a/src/cpl_discord/events/on_command_abc.py
+++ b/src/cpl_discord/events/on_command_abc.py
@@ -4,9 +4,10 @@ from discord.ext.commands import Context
class OnCommandABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_command(self, ctx: Context): pass
+ async def on_command(self, ctx: Context):
+ pass
diff --git a/src/cpl_discord/events/on_command_completion_abc.py b/src/cpl_discord/events/on_command_completion_abc.py
index d87c6077..bb6053f8 100644
--- a/src/cpl_discord/events/on_command_completion_abc.py
+++ b/src/cpl_discord/events/on_command_completion_abc.py
@@ -4,9 +4,10 @@ from discord.ext.commands import Context, CommandError
class OnCommandCompletionABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_command_completion(self, ctx: Context): pass
+ async def on_command_completion(self, ctx: Context):
+ pass
diff --git a/src/cpl_discord/events/on_command_error_abc.py b/src/cpl_discord/events/on_command_error_abc.py
index e40989a4..c5f68145 100644
--- a/src/cpl_discord/events/on_command_error_abc.py
+++ b/src/cpl_discord/events/on_command_error_abc.py
@@ -4,9 +4,10 @@ from discord.ext.commands import Context, CommandError
class OnCommandErrorABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_command_error(self, ctx: Context, error: CommandError): pass
+ async def on_command_error(self, ctx: Context, error: CommandError):
+ pass
diff --git a/src/cpl_discord/events/on_connect_abc.py b/src/cpl_discord/events/on_connect_abc.py
index 96d1909b..eeebc349 100644
--- a/src/cpl_discord/events/on_connect_abc.py
+++ b/src/cpl_discord/events/on_connect_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class OnConnectABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_connect(self): pass
+ async def on_connect(self):
+ pass
diff --git a/src/cpl_discord/events/on_disconnect_abc.py b/src/cpl_discord/events/on_disconnect_abc.py
index eb3be9a6..eaea1378 100644
--- a/src/cpl_discord/events/on_disconnect_abc.py
+++ b/src/cpl_discord/events/on_disconnect_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class OnDisconnectABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_disconnect(self): pass
\ No newline at end of file
+ async def on_disconnect(self):
+ pass
diff --git a/src/cpl_discord/events/on_error_abc.py b/src/cpl_discord/events/on_error_abc.py
index ff4badbb..e757c685 100644
--- a/src/cpl_discord/events/on_error_abc.py
+++ b/src/cpl_discord/events/on_error_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class OnErrorABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_error(self, event: str, *args, **kwargs): pass
\ No newline at end of file
+ async def on_error(self, event: str, *args, **kwargs):
+ pass
diff --git a/src/cpl_discord/events/on_group_join_abc.py b/src/cpl_discord/events/on_group_join_abc.py
index 70fffbb7..96ab9867 100644
--- a/src/cpl_discord/events/on_group_join_abc.py
+++ b/src/cpl_discord/events/on_group_join_abc.py
@@ -3,10 +3,10 @@ import discord
class OnGroupJoinABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_group_join(
- self, channel: discord.GroupChannel, user: discord.User): pass
+ async def on_group_join(self, channel: discord.GroupChannel, user: discord.User):
+ pass
diff --git a/src/cpl_discord/events/on_group_remove_abc.py b/src/cpl_discord/events/on_group_remove_abc.py
index dc6fda84..73ccc3d9 100644
--- a/src/cpl_discord/events/on_group_remove_abc.py
+++ b/src/cpl_discord/events/on_group_remove_abc.py
@@ -1,11 +1,12 @@
from abc import ABC, abstractmethod
import discord
+
class OnGroupRemoveABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_group_remove(
- self, chhanel: discord.GroupChannel, user: discord.User): pass
+ async def on_group_remove(self, chhanel: discord.GroupChannel, user: discord.User):
+ pass
diff --git a/src/cpl_discord/events/on_guild_available_abc.py b/src/cpl_discord/events/on_guild_available_abc.py
index 8b6eaa91..d7ed0ba5 100644
--- a/src/cpl_discord/events/on_guild_available_abc.py
+++ b/src/cpl_discord/events/on_guild_available_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildAvailableABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_available(self, guild: discord.Guild): pass
+ async def on_guild_available(self, guild: discord.Guild):
+ pass
diff --git a/src/cpl_discord/events/on_guild_channel_create_abc.py b/src/cpl_discord/events/on_guild_channel_create_abc.py
index 3d367771..bdb3e79d 100644
--- a/src/cpl_discord/events/on_guild_channel_create_abc.py
+++ b/src/cpl_discord/events/on_guild_channel_create_abc.py
@@ -3,10 +3,10 @@ import discord
class OnGuildChannelCreateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_channel_create(self, channel: discord.abc.GuildChannel): pass
-
\ No newline at end of file
+ async def on_guild_channel_create(self, channel: discord.abc.GuildChannel):
+ pass
diff --git a/src/cpl_discord/events/on_guild_channel_delete_abc.py b/src/cpl_discord/events/on_guild_channel_delete_abc.py
index c34e7f11..7a986732 100644
--- a/src/cpl_discord/events/on_guild_channel_delete_abc.py
+++ b/src/cpl_discord/events/on_guild_channel_delete_abc.py
@@ -3,10 +3,10 @@ import discord
class OnGuildChannelDeleteABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_channel_delete(self, channel: discord.abc.GuildChannel): pass
-
\ No newline at end of file
+ async def on_guild_channel_delete(self, channel: discord.abc.GuildChannel):
+ pass
diff --git a/src/cpl_discord/events/on_guild_channel_pins_update_abc.py b/src/cpl_discord/events/on_guild_channel_pins_update_abc.py
index 3408e547..4a7a7d2b 100644
--- a/src/cpl_discord/events/on_guild_channel_pins_update_abc.py
+++ b/src/cpl_discord/events/on_guild_channel_pins_update_abc.py
@@ -5,10 +5,10 @@ import discord
class OnGuildChannelPinsUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_channel_pins_update(self, channel: discord.abc.GuildChannel, list_pin: Optional[datetime]): pass
-
+ async def on_guild_channel_pins_update(self, channel: discord.abc.GuildChannel, list_pin: Optional[datetime]):
+ pass
diff --git a/src/cpl_discord/events/on_guild_channel_update_abc.py b/src/cpl_discord/events/on_guild_channel_update_abc.py
index 17a86340..95ffa01e 100644
--- a/src/cpl_discord/events/on_guild_channel_update_abc.py
+++ b/src/cpl_discord/events/on_guild_channel_update_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildChannelUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_channel_update(self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel): pass
+ async def on_guild_channel_update(self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel):
+ pass
diff --git a/src/cpl_discord/events/on_guild_emojis_update_abc.py b/src/cpl_discord/events/on_guild_emojis_update_abc.py
index 40a32475..d9522af1 100644
--- a/src/cpl_discord/events/on_guild_emojis_update_abc.py
+++ b/src/cpl_discord/events/on_guild_emojis_update_abc.py
@@ -4,9 +4,12 @@ import discord
class OnGuildEmojisUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_emojis_update(self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]): pass
+ async def on_guild_emojis_update(
+ self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]
+ ):
+ pass
diff --git a/src/cpl_discord/events/on_guild_integrations_update_abc.py b/src/cpl_discord/events/on_guild_integrations_update_abc.py
index 9e5f4f07..3476266a 100644
--- a/src/cpl_discord/events/on_guild_integrations_update_abc.py
+++ b/src/cpl_discord/events/on_guild_integrations_update_abc.py
@@ -3,10 +3,10 @@ import discord
class OnGuildIntegrationsUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_integrations_update(self, guild: discord.Guild): pass
-
\ No newline at end of file
+ async def on_guild_integrations_update(self, guild: discord.Guild):
+ pass
diff --git a/src/cpl_discord/events/on_guild_join_abc.py b/src/cpl_discord/events/on_guild_join_abc.py
index c6e82f1f..b7f83b8f 100644
--- a/src/cpl_discord/events/on_guild_join_abc.py
+++ b/src/cpl_discord/events/on_guild_join_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildJoinABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_join(self, guild: discord.Guild): pass
+ async def on_guild_join(self, guild: discord.Guild):
+ pass
diff --git a/src/cpl_discord/events/on_guild_remove_abc.py b/src/cpl_discord/events/on_guild_remove_abc.py
index 04f0e34b..9f748d20 100644
--- a/src/cpl_discord/events/on_guild_remove_abc.py
+++ b/src/cpl_discord/events/on_guild_remove_abc.py
@@ -3,8 +3,10 @@ import discord
class OnGuildRemoveABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
- @abstractmethod
- async def on_guild_remove(self, guild: discord.Guild): pass
+ async def on_guild_remove(self, guild: discord.Guild):
+ pass
diff --git a/src/cpl_discord/events/on_guild_role_create_abc.py b/src/cpl_discord/events/on_guild_role_create_abc.py
index f828988b..6722b839 100644
--- a/src/cpl_discord/events/on_guild_role_create_abc.py
+++ b/src/cpl_discord/events/on_guild_role_create_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildRoleCreateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_role_create(self, role: discord.Role): pass
+ async def on_guild_role_create(self, role: discord.Role):
+ pass
diff --git a/src/cpl_discord/events/on_guild_role_delete_abc.py b/src/cpl_discord/events/on_guild_role_delete_abc.py
index a26bdd25..62652074 100644
--- a/src/cpl_discord/events/on_guild_role_delete_abc.py
+++ b/src/cpl_discord/events/on_guild_role_delete_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildRoleDeleteABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_role_delete(self, role: discord.Role): pass
+ async def on_guild_role_delete(self, role: discord.Role):
+ pass
diff --git a/src/cpl_discord/events/on_guild_role_update_abc.py b/src/cpl_discord/events/on_guild_role_update_abc.py
index 905efb50..5a82fc11 100644
--- a/src/cpl_discord/events/on_guild_role_update_abc.py
+++ b/src/cpl_discord/events/on_guild_role_update_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildRoleUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_role_update(self, before: discord.Role, after: discord.Role): pass
+ async def on_guild_role_update(self, before: discord.Role, after: discord.Role):
+ pass
diff --git a/src/cpl_discord/events/on_guild_unavailable_abc.py b/src/cpl_discord/events/on_guild_unavailable_abc.py
index 5666407e..1de4a329 100644
--- a/src/cpl_discord/events/on_guild_unavailable_abc.py
+++ b/src/cpl_discord/events/on_guild_unavailable_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildUnavailableABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_unavailable(self, guild: discord.Guild): pass
+ async def on_guild_unavailable(self, guild: discord.Guild):
+ pass
diff --git a/src/cpl_discord/events/on_guild_update_abc.py b/src/cpl_discord/events/on_guild_update_abc.py
index 7ed4c1ad..4901da1b 100644
--- a/src/cpl_discord/events/on_guild_update_abc.py
+++ b/src/cpl_discord/events/on_guild_update_abc.py
@@ -3,9 +3,10 @@ import discord
class OnGuildUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_guild_update(self, before: discord.Guild, after: discord.Guild): pass
+ async def on_guild_update(self, before: discord.Guild, after: discord.Guild):
+ pass
diff --git a/src/cpl_discord/events/on_invite_create_abc.py b/src/cpl_discord/events/on_invite_create_abc.py
index ce4e2e0b..7931c9b7 100644
--- a/src/cpl_discord/events/on_invite_create_abc.py
+++ b/src/cpl_discord/events/on_invite_create_abc.py
@@ -3,10 +3,10 @@ import discord
class OnInviteCreateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_invite_create(self, invite: discord.Invite): pass
-
\ No newline at end of file
+ async def on_invite_create(self, invite: discord.Invite):
+ pass
diff --git a/src/cpl_discord/events/on_invite_delete_abc.py b/src/cpl_discord/events/on_invite_delete_abc.py
index bbd848cd..779a778c 100644
--- a/src/cpl_discord/events/on_invite_delete_abc.py
+++ b/src/cpl_discord/events/on_invite_delete_abc.py
@@ -3,9 +3,10 @@ import discord
class OnInviteDeleteABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_invite_delete(self, invite: discord.Invite): pass
+ async def on_invite_delete(self, invite: discord.Invite):
+ pass
diff --git a/src/cpl_discord/events/on_member_ban_abc.py b/src/cpl_discord/events/on_member_ban_abc.py
index 45e3f0db..5102af01 100644
--- a/src/cpl_discord/events/on_member_ban_abc.py
+++ b/src/cpl_discord/events/on_member_ban_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMemberBanABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_member_ban(self, guild: discord.Guild, user: discord.User): pass
+ async def on_member_ban(self, guild: discord.Guild, user: discord.User):
+ pass
diff --git a/src/cpl_discord/events/on_member_join_abc.py b/src/cpl_discord/events/on_member_join_abc.py
index 599f1783..5a9ea95b 100644
--- a/src/cpl_discord/events/on_member_join_abc.py
+++ b/src/cpl_discord/events/on_member_join_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMemberJoinABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_member_join(self, member: discord.Member): pass
+ async def on_member_join(self, member: discord.Member):
+ pass
diff --git a/src/cpl_discord/events/on_member_remove_abc.py b/src/cpl_discord/events/on_member_remove_abc.py
index b24f3d5f..faa965fe 100644
--- a/src/cpl_discord/events/on_member_remove_abc.py
+++ b/src/cpl_discord/events/on_member_remove_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMemberRemoveABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_member_remove(self, member: discord.Member): pass
+ async def on_member_remove(self, member: discord.Member):
+ pass
diff --git a/src/cpl_discord/events/on_member_unban_abc.py b/src/cpl_discord/events/on_member_unban_abc.py
index c5bbb8c7..6a82095c 100644
--- a/src/cpl_discord/events/on_member_unban_abc.py
+++ b/src/cpl_discord/events/on_member_unban_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMemberUnbanABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_member_unban(self, guild: discord.Guild, user: discord.User): pass
+ async def on_member_unban(self, guild: discord.Guild, user: discord.User):
+ pass
diff --git a/src/cpl_discord/events/on_member_update_abc.py b/src/cpl_discord/events/on_member_update_abc.py
index 6ca11dff..fe1e1835 100644
--- a/src/cpl_discord/events/on_member_update_abc.py
+++ b/src/cpl_discord/events/on_member_update_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMemberUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_member_update(self, before: discord.Member, after: discord.Member): pass
+ async def on_member_update(self, before: discord.Member, after: discord.Member):
+ pass
diff --git a/src/cpl_discord/events/on_message_abc.py b/src/cpl_discord/events/on_message_abc.py
index 08e38165..15cfaee8 100644
--- a/src/cpl_discord/events/on_message_abc.py
+++ b/src/cpl_discord/events/on_message_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMessageABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_message(self, message: discord.Message): pass
+ async def on_message(self, message: discord.Message):
+ pass
diff --git a/src/cpl_discord/events/on_message_delete_abc.py b/src/cpl_discord/events/on_message_delete_abc.py
index 57cf30e8..39737550 100644
--- a/src/cpl_discord/events/on_message_delete_abc.py
+++ b/src/cpl_discord/events/on_message_delete_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMessageDeleteABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_message_delete(self, message: discord.Message): pass
\ No newline at end of file
+ async def on_message_delete(self, message: discord.Message):
+ pass
diff --git a/src/cpl_discord/events/on_message_edit_abc.py b/src/cpl_discord/events/on_message_edit_abc.py
index b8d4df8a..b2307240 100644
--- a/src/cpl_discord/events/on_message_edit_abc.py
+++ b/src/cpl_discord/events/on_message_edit_abc.py
@@ -3,9 +3,10 @@ import discord
class OnMessageEditABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_message_edit(self, before: discord.Message, after: discord.Message): pass
+ async def on_message_edit(self, before: discord.Message, after: discord.Message):
+ pass
diff --git a/src/cpl_discord/events/on_private_channel_create_abc.py b/src/cpl_discord/events/on_private_channel_create_abc.py
index 371ccaf6..fa12e739 100644
--- a/src/cpl_discord/events/on_private_channel_create_abc.py
+++ b/src/cpl_discord/events/on_private_channel_create_abc.py
@@ -3,10 +3,10 @@ import discord
class OnPrivateChannelCreateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_private_channel_create(self, channel: discord.abc.PrivateChannel): pass
-
\ No newline at end of file
+ async def on_private_channel_create(self, channel: discord.abc.PrivateChannel):
+ pass
diff --git a/src/cpl_discord/events/on_private_channel_delete_abc.py b/src/cpl_discord/events/on_private_channel_delete_abc.py
index 0e6f775f..bb0cef00 100644
--- a/src/cpl_discord/events/on_private_channel_delete_abc.py
+++ b/src/cpl_discord/events/on_private_channel_delete_abc.py
@@ -3,10 +3,10 @@ import discord
class OnPrivateChannelDeleteABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_private_channel_delete(self, channel: discord.abc.PrivateChannel): pass
-
+ async def on_private_channel_delete(self, channel: discord.abc.PrivateChannel):
+ pass
diff --git a/src/cpl_discord/events/on_private_channel_pins_update_abc.py b/src/cpl_discord/events/on_private_channel_pins_update_abc.py
index 4634b878..b3f9d56b 100644
--- a/src/cpl_discord/events/on_private_channel_pins_update_abc.py
+++ b/src/cpl_discord/events/on_private_channel_pins_update_abc.py
@@ -5,10 +5,10 @@ import discord
class OnPrivateChannelPinsUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_private_channel_pins_update(self, channel: discord.abc.PrivateChannel, list_pin: Optional[datetime]): pass
-
\ No newline at end of file
+ async def on_private_channel_pins_update(self, channel: discord.abc.PrivateChannel, list_pin: Optional[datetime]):
+ pass
diff --git a/src/cpl_discord/events/on_private_channel_update_abc.py b/src/cpl_discord/events/on_private_channel_update_abc.py
index 6c37031c..16a498c7 100644
--- a/src/cpl_discord/events/on_private_channel_update_abc.py
+++ b/src/cpl_discord/events/on_private_channel_update_abc.py
@@ -3,10 +3,10 @@ import discord
class OnPrivateChannelUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_private_channel_update(self, before: discord.GroupChannel, after: discord.GroupChannel): pass
-
\ No newline at end of file
+ async def on_private_channel_update(self, before: discord.GroupChannel, after: discord.GroupChannel):
+ pass
diff --git a/src/cpl_discord/events/on_raw_reaction_add_abc.py b/src/cpl_discord/events/on_raw_reaction_add_abc.py
index 99e6fcbf..385af8bf 100644
--- a/src/cpl_discord/events/on_raw_reaction_add_abc.py
+++ b/src/cpl_discord/events/on_raw_reaction_add_abc.py
@@ -4,10 +4,10 @@ from discord import RawReactionActionEvent
class OnRawReactionAddABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_raw_reaction_add(self, payload: RawReactionActionEvent): pass
-
\ No newline at end of file
+ async def on_raw_reaction_add(self, payload: RawReactionActionEvent):
+ pass
diff --git a/src/cpl_discord/events/on_raw_reaction_clear_abc.py b/src/cpl_discord/events/on_raw_reaction_clear_abc.py
index dc1895b5..9937abe4 100644
--- a/src/cpl_discord/events/on_raw_reaction_clear_abc.py
+++ b/src/cpl_discord/events/on_raw_reaction_clear_abc.py
@@ -4,10 +4,10 @@ from discord import RawReactionActionEvent
class OnRawReactionClearABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_raw_reaction_clear(self, payload: RawReactionActionEvent): pass
-
\ No newline at end of file
+ async def on_raw_reaction_clear(self, payload: RawReactionActionEvent):
+ pass
diff --git a/src/cpl_discord/events/on_raw_reaction_clear_emoji_abc.py b/src/cpl_discord/events/on_raw_reaction_clear_emoji_abc.py
index 6bd5b953..70521836 100644
--- a/src/cpl_discord/events/on_raw_reaction_clear_emoji_abc.py
+++ b/src/cpl_discord/events/on_raw_reaction_clear_emoji_abc.py
@@ -4,10 +4,10 @@ from discord import RawReactionActionEvent
class OnRawReactionClearEmojiABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_raw_reaction_clear_emoji(self, payload: RawReactionActionEvent): pass
-
+ async def on_raw_reaction_clear_emoji(self, payload: RawReactionActionEvent):
+ pass
diff --git a/src/cpl_discord/events/on_raw_reaction_remove_abc.py b/src/cpl_discord/events/on_raw_reaction_remove_abc.py
index fcd02d40..50efb2d2 100644
--- a/src/cpl_discord/events/on_raw_reaction_remove_abc.py
+++ b/src/cpl_discord/events/on_raw_reaction_remove_abc.py
@@ -4,10 +4,10 @@ from discord import RawReactionActionEvent
class OnRawReactionRemoveABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_raw_reaction_remove(self, payload: RawReactionActionEvent): pass
-
\ No newline at end of file
+ async def on_raw_reaction_remove(self, payload: RawReactionActionEvent):
+ pass
diff --git a/src/cpl_discord/events/on_reaction_add_abc.py b/src/cpl_discord/events/on_reaction_add_abc.py
index c1682227..1bfa872f 100644
--- a/src/cpl_discord/events/on_reaction_add_abc.py
+++ b/src/cpl_discord/events/on_reaction_add_abc.py
@@ -3,10 +3,10 @@ import discord
class OnReactionAddABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User): pass
-
\ No newline at end of file
+ async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User):
+ pass
diff --git a/src/cpl_discord/events/on_reaction_clear_abc.py b/src/cpl_discord/events/on_reaction_clear_abc.py
index 7d2ef669..881c6632 100644
--- a/src/cpl_discord/events/on_reaction_clear_abc.py
+++ b/src/cpl_discord/events/on_reaction_clear_abc.py
@@ -3,10 +3,10 @@ import discord
class OnReactionClearABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_reaction_clear(self, message: discord.Message, reactions: list[discord.Reaction]): pass
-
\ No newline at end of file
+ async def on_reaction_clear(self, message: discord.Message, reactions: list[discord.Reaction]):
+ pass
diff --git a/src/cpl_discord/events/on_reaction_clear_emoji_abc.py b/src/cpl_discord/events/on_reaction_clear_emoji_abc.py
index 1e683eb3..bfd7e876 100644
--- a/src/cpl_discord/events/on_reaction_clear_emoji_abc.py
+++ b/src/cpl_discord/events/on_reaction_clear_emoji_abc.py
@@ -3,10 +3,10 @@ import discord
class OnReactionClearEmojiABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_reaction_clear_emoji(self, reaction: discord.Reaction): pass
-
+ async def on_reaction_clear_emoji(self, reaction: discord.Reaction):
+ pass
diff --git a/src/cpl_discord/events/on_reaction_remove_abc.py b/src/cpl_discord/events/on_reaction_remove_abc.py
index 6dc34d15..b43d890a 100644
--- a/src/cpl_discord/events/on_reaction_remove_abc.py
+++ b/src/cpl_discord/events/on_reaction_remove_abc.py
@@ -3,10 +3,10 @@ import discord
class OnReactionRemoveABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_reaction_remove(self, reaction: discord.Reaction, user: discord.User): pass
-
\ No newline at end of file
+ async def on_reaction_remove(self, reaction: discord.Reaction, user: discord.User):
+ pass
diff --git a/src/cpl_discord/events/on_ready_abc.py b/src/cpl_discord/events/on_ready_abc.py
index 053bf799..91eb4a37 100644
--- a/src/cpl_discord/events/on_ready_abc.py
+++ b/src/cpl_discord/events/on_ready_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class OnReadyABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_ready(self): pass
+ async def on_ready(self):
+ pass
diff --git a/src/cpl_discord/events/on_resume_abc.py b/src/cpl_discord/events/on_resume_abc.py
index 28e63f95..6409b4db 100644
--- a/src/cpl_discord/events/on_resume_abc.py
+++ b/src/cpl_discord/events/on_resume_abc.py
@@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
class OnResumeABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_resume(self): pass
\ No newline at end of file
+ async def on_resume(self):
+ pass
diff --git a/src/cpl_discord/events/on_typing_abc.py b/src/cpl_discord/events/on_typing_abc.py
index 76b89a08..3776c0a7 100644
--- a/src/cpl_discord/events/on_typing_abc.py
+++ b/src/cpl_discord/events/on_typing_abc.py
@@ -5,9 +5,12 @@ import discord
class OnTypingABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_typing(self, channel: discord.abc.Messageable, user: Union[discord.User, discord.Member], when: datetime): pass
+ async def on_typing(
+ self, channel: discord.abc.Messageable, user: Union[discord.User, discord.Member], when: datetime
+ ):
+ pass
diff --git a/src/cpl_discord/events/on_user_update_abc.py b/src/cpl_discord/events/on_user_update_abc.py
index 0a9b7c9a..6fd90e91 100644
--- a/src/cpl_discord/events/on_user_update_abc.py
+++ b/src/cpl_discord/events/on_user_update_abc.py
@@ -3,9 +3,10 @@ import discord
class OnUserUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_user_update(self, before: discord.User, after: discord.User): pass
+ async def on_user_update(self, before: discord.User, after: discord.User):
+ pass
diff --git a/src/cpl_discord/events/on_voice_state_update_abc.py b/src/cpl_discord/events/on_voice_state_update_abc.py
index 60d586f8..150a8b3f 100644
--- a/src/cpl_discord/events/on_voice_state_update_abc.py
+++ b/src/cpl_discord/events/on_voice_state_update_abc.py
@@ -3,9 +3,12 @@ import discord
class OnVoiceStateUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
- @abstractmethod
- async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState,after: discord.VoiceState): pass
+ async def on_voice_state_update(
+ self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState
+ ):
+ pass
diff --git a/src/cpl_discord/events/on_webhooks_update_abc.py b/src/cpl_discord/events/on_webhooks_update_abc.py
index db92f583..6b497681 100644
--- a/src/cpl_discord/events/on_webhooks_update_abc.py
+++ b/src/cpl_discord/events/on_webhooks_update_abc.py
@@ -3,10 +3,10 @@ import discord
class OnWebhooksUpdateABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
-
-
- @abstractmethod
- async def on_webhooks_update(self, channel: discord.abc.GuildChannel): pass
+ async def on_webhooks_update(self, channel: discord.abc.GuildChannel):
+ pass
diff --git a/src/cpl_discord/helper/__init__.py b/src/cpl_discord/helper/__init__.py
index dd67de1f..c6f8fe66 100644
--- a/src/cpl_discord/helper/__init__.py
+++ b/src/cpl_discord/helper/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord.helper'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord.helper"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -23,5 +23,5 @@ from collections import namedtuple
# imports
from .to_containers_converter import ToContainersConverter
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/helper/to_containers_converter.py b/src/cpl_discord/helper/to_containers_converter.py
index 70d8bfec..1389f6b6 100644
--- a/src/cpl_discord/helper/to_containers_converter.py
+++ b/src/cpl_discord/helper/to_containers_converter.py
@@ -4,7 +4,6 @@ from cpl_discord.container.container import Container
class ToContainersConverter:
-
@staticmethod
def convert(_l: Union[list[object], Sequence[object]], _t: type) -> list[Container]:
values = []
diff --git a/src/cpl_discord/service/__init__.py b/src/cpl_discord/service/__init__.py
index 110b1d4b..00a54d86 100644
--- a/src/cpl_discord/service/__init__.py
+++ b/src/cpl_discord/service/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-discord sh-edraft Common Python library Discord
+cpl-discord CPL Discord
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library link between discord.py and CPL
+Link between discord.py and CPL
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_discord.service'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_discord.service"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -28,5 +28,5 @@ from .discord_collection import DiscordCollection
from .discord_service import DiscordService
from .discord_service_abc import DiscordServiceABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_discord/service/command_error_handler_service.py b/src/cpl_discord/service/command_error_handler_service.py
index 0893d866..3b33b4bc 100644
--- a/src/cpl_discord/service/command_error_handler_service.py
+++ b/src/cpl_discord/service/command_error_handler_service.py
@@ -5,10 +5,9 @@ from cpl_discord.events.on_command_error_abc import OnCommandErrorABC
class CommandErrorHandlerService(OnCommandErrorABC):
-
def __init__(self, logger: LoggerABC):
OnCommandErrorABC.__init__(self)
self._logger = logger
async def on_command_error(self, ctx: Context, error: CommandError):
- self._logger.error(__name__, f'Error in command: {ctx.command}', error)
+ self._logger.error(__name__, f"Error in command: {ctx.command}", error)
diff --git a/src/cpl_discord/service/discord_bot_service.py b/src/cpl_discord/service/discord_bot_service.py
index fe86b908..23590a06 100644
--- a/src/cpl_discord/service/discord_bot_service.py
+++ b/src/cpl_discord/service/discord_bot_service.py
@@ -13,15 +13,14 @@ from cpl_query.extension.list import List
class DiscordBotService(DiscordBotServiceABC):
-
def __init__(
- self,
- config: ConfigurationABC,
- logger: LoggerABC,
- discord_bot_settings: DiscordBotSettings,
- env: ApplicationEnvironmentABC,
- logging_st: LoggingSettings,
- discord_service: DiscordServiceABC
+ self,
+ config: ConfigurationABC,
+ logger: LoggerABC,
+ discord_bot_settings: DiscordBotSettings,
+ env: ApplicationEnvironmentABC,
+ logging_st: LoggingSettings,
+ discord_service: DiscordServiceABC,
):
# services
self._config = config
@@ -34,51 +33,57 @@ class DiscordBotService(DiscordBotServiceABC):
self._discord_settings = self._get_settings(discord_bot_settings)
# setup super
- DiscordBotServiceABC.__init__(self, command_prefix=self._discord_settings.prefix, help_command=None, intents=discord.Intents().all())
+ DiscordBotServiceABC.__init__(
+ self, command_prefix=self._discord_settings.prefix, help_command=None, intents=discord.Intents().all()
+ )
self._base = super(DiscordBotServiceABC, self)
@staticmethod
def _is_string_invalid(x):
- return x is None or x == ''
+ return x is None or x == ""
def _get_settings(self, settings_from_config: DiscordBotSettings) -> DiscordBotSettings:
new_settings = DiscordBotSettings()
token = None if settings_from_config is None else settings_from_config.token
prefix = None if settings_from_config is None else settings_from_config.prefix
- env_token = self._config.get_configuration('TOKEN')
- env_prefix = self._config.get_configuration('PREFIX')
+ env_token = self._config.get_configuration("TOKEN")
+ env_prefix = self._config.get_configuration("PREFIX")
- new_settings.from_dict({
- 'Token': env_token if token is None or token == '' else token,
- 'Prefix': ('! ' if self._is_string_invalid(env_prefix) else env_prefix) if self._is_string_invalid(prefix) else prefix
- })
- if new_settings.token is None or new_settings.token == '':
- raise Exception('You have to configure discord token by appsettings or environment variables')
+ new_settings.from_dict(
+ {
+ "Token": env_token if token is None or token == "" else token,
+ "Prefix": ("! " if self._is_string_invalid(env_prefix) else env_prefix)
+ if self._is_string_invalid(prefix)
+ else prefix,
+ }
+ )
+ if new_settings.token is None or new_settings.token == "":
+ raise Exception("You have to configure discord token by appsettings or environment variables")
return new_settings
async def start_async(self):
- self._logger.trace(__name__, 'Try to connect to discord')
+ self._logger.trace(__name__, "Try to connect to discord")
await self.start(self._discord_settings.token)
# continue at on_ready
async def stop_async(self):
- self._logger.trace(__name__, 'Try to disconnect from discord')
+ self._logger.trace(__name__, "Try to disconnect from discord")
try:
await self.close()
except Exception as e:
- self._logger.error(__name__, 'Stop failed', e)
+ self._logger.error(__name__, "Stop failed", e)
async def on_ready(self):
- self._logger.info(__name__, 'Connected to discord')
+ self._logger.info(__name__, "Connected to discord")
- self._logger.header(f'{self.user.name}:')
+ self._logger.header(f"{self.user.name}:")
if self._logging_st.console.value >= LoggingLevelEnum.INFO.value:
- Console.banner(self._env.application_name if self._env.application_name != '' else 'A bot')
+ Console.banner(self._env.application_name if self._env.application_name != "" else "A bot")
await self._discord_service.init(self)
await self.wait_until_ready()
await self.tree.sync()
- self._logger.debug(__name__, f'Finished syncing commands')
+ self._logger.debug(__name__, f"Finished syncing commands")
await self._discord_service.on_ready()
diff --git a/src/cpl_discord/service/discord_bot_service_abc.py b/src/cpl_discord/service/discord_bot_service_abc.py
index b96a5ee8..01c106f0 100644
--- a/src/cpl_discord/service/discord_bot_service_abc.py
+++ b/src/cpl_discord/service/discord_bot_service_abc.py
@@ -7,19 +7,22 @@ from cpl_query.extension.list import List
class DiscordBotServiceABC(commands.Bot):
-
def __init__(self, **kwargs):
commands.Bot.__init__(self, **kwargs)
@abstractmethod
- async def start_async(self): pass
+ async def start_async(self):
+ pass
@abstractmethod
- async def stop_async(self): pass
+ async def stop_async(self):
+ pass
@abstractmethod
- async def on_ready(self): pass
+ async def on_ready(self):
+ pass
@property
@abstractmethod
- def guilds(self) -> List[Guild]: pass
+ def guilds(self) -> List[Guild]:
+ pass
diff --git a/src/cpl_discord/service/discord_collection.py b/src/cpl_discord/service/discord_collection.py
index e6f0a93c..e93806ec 100644
--- a/src/cpl_discord/service/discord_collection.py
+++ b/src/cpl_discord/service/discord_collection.py
@@ -9,7 +9,6 @@ from cpl_query.extension import List
class DiscordCollection(DiscordCollectionABC):
-
def __init__(self, service_collection: ServiceCollectionABC):
DiscordCollectionABC.__init__(self)
diff --git a/src/cpl_discord/service/discord_collection_abc.py b/src/cpl_discord/service/discord_collection_abc.py
index 719c3526..f6982806 100644
--- a/src/cpl_discord/service/discord_collection_abc.py
+++ b/src/cpl_discord/service/discord_collection_abc.py
@@ -6,18 +6,21 @@ from cpl_query.extension import List
class DiscordCollectionABC(ABC):
-
def __init__(self):
ABC.__init__(self)
@abstractmethod
- def add_command(self, _t: Type[DiscordCommandABC]): pass
+ def add_command(self, _t: Type[DiscordCommandABC]):
+ pass
@abstractmethod
- def get_commands(self) -> List[DiscordCommandABC]: pass
+ def get_commands(self) -> List[DiscordCommandABC]:
+ pass
@abstractmethod
- def add_event(self, _t_event: Type, _t: Type): pass
+ def add_event(self, _t_event: Type, _t: Type):
+ pass
@abstractmethod
- def get_events_by_base(self, _t_event: Type): pass
+ def get_events_by_base(self, _t_event: Type):
+ pass
diff --git a/src/cpl_discord/service/discord_service.py b/src/cpl_discord/service/discord_service.py
index 6316952d..a05fb6a7 100644
--- a/src/cpl_discord/service/discord_service.py
+++ b/src/cpl_discord/service/discord_service.py
@@ -66,13 +66,7 @@ from cpl_discord.service.discord_service_abc import DiscordServiceABC
class DiscordService(DiscordServiceABC, commands.Cog, metaclass=DiscordCogMeta):
-
- def __init__(
- self,
- logger: LoggerABC,
- dc_collection: DiscordCollectionABC,
- services: ServiceProviderABC
- ):
+ def __init__(self, logger: LoggerABC, dc_collection: DiscordCollectionABC, services: ServiceProviderABC):
DiscordServiceABC.__init__(self)
self._logger = logger
self._collection = dc_collection
@@ -87,8 +81,8 @@ class DiscordService(DiscordServiceABC, commands.Cog, metaclass=DiscordCogMeta):
event_instance = self._services.get_service(event_type)
func_name = event.__name__
- if func_name.endswith('ABC'):
- func_name = func_name.replace('ABC', '')
+ if func_name.endswith("ABC"):
+ func_name = func_name.replace("ABC", "")
func_name = String.convert_to_snake_case(func_name)
@@ -96,280 +90,286 @@ class DiscordService(DiscordServiceABC, commands.Cog, metaclass=DiscordCogMeta):
func = getattr(event_instance, func_name)
await func(*args, **kwargs)
except Exception as e:
- self._logger.error(__name__, f'Cannot execute {func_name} of {type(event_instance).__name__}', e)
+ self._logger.error(__name__, f"Cannot execute {func_name} of {type(event_instance).__name__}", e)
async def init(self, bot: commands.Bot):
try:
await bot.add_cog(self)
except Exception as e:
- self._logger.error(__name__, f'{type(self).__name__} initialization failed', e)
+ self._logger.error(__name__, f"{type(self).__name__} initialization failed", e)
try:
for command_type in self._collection.get_commands():
- self._logger.trace(__name__, f'Register command {command_type.__name__}')
+ self._logger.trace(__name__, f"Register command {command_type.__name__}")
command: Cog = self._services.get_service(command_type)
if command is None:
- self._logger.warn(__name__, f'Instance of {command_type.__name__} not found')
+ self._logger.warn(__name__, f"Instance of {command_type.__name__} not found")
continue
await bot.add_cog(command)
except Exception as e:
- self._logger.error(__name__, f'Registration of commands failed', e)
+ self._logger.error(__name__, f"Registration of commands failed", e)
@commands.Cog.listener()
async def on_connect(self):
- self._logger.trace(__name__, f'Received on_connect')
+ self._logger.trace(__name__, f"Received on_connect")
await self._handle_event(OnConnectABC)
@commands.Cog.listener()
async def on_command(self, ctx: Context):
- self._logger.trace(__name__, f'Received on_command')
+ self._logger.trace(__name__, f"Received on_command")
await self._handle_event(OnCommandABC, ctx)
@commands.Cog.listener()
async def on_command_error(self, ctx: Context, error: CommandError):
- self._logger.trace(__name__, f'Received on_command_error')
+ self._logger.trace(__name__, f"Received on_command_error")
await self._handle_event(OnCommandErrorABC, ctx, error)
@commands.Cog.listener()
async def on_command_completion(self, ctx: Context):
- self._logger.trace(__name__, f'Received on_command_completion')
+ self._logger.trace(__name__, f"Received on_command_completion")
await self._handle_event(OnCommandCompletionABC, ctx)
@commands.Cog.listener()
async def on_disconnect(self):
- self._logger.trace(__name__, f'Received on_disconnect')
+ self._logger.trace(__name__, f"Received on_disconnect")
await self._handle_event(OnDisconnectABC)
@commands.Cog.listener()
async def on_error(self, event: str, *args, **kwargs):
- self._logger.trace(__name__, f'Received on_error')
+ self._logger.trace(__name__, f"Received on_error")
await self._handle_event(OnErrorABC, event, *args, **kwargs)
async def on_ready(self):
- self._logger.trace(__name__, f'Received on_ready')
+ self._logger.trace(__name__, f"Received on_ready")
await self._handle_event(OnReadyABC)
@commands.Cog.listener()
async def on_resume(self):
- self._logger.trace(__name__, f'Received on_resume')
+ self._logger.trace(__name__, f"Received on_resume")
await self._handle_event(OnResumeABC)
@commands.Cog.listener()
async def on_error(self, event: str, *args, **kwargs):
- self._logger.trace(__name__, f'Received on_error:\n\t{event}\n\t{args}\n\t{kwargs}')
+ self._logger.trace(__name__, f"Received on_error:\n\t{event}\n\t{args}\n\t{kwargs}")
await self._handle_event(OnReadyABC, event, *args, **kwargs)
@commands.Cog.listener()
- async def on_typing(self, channel: discord.abc.Messageable, user: Union[discord.User, discord.Member], when: datetime):
- self._logger.trace(__name__, f'Received on_typing:\n\t{channel}\n\t{user}\n\t{when}')
+ async def on_typing(
+ self, channel: discord.abc.Messageable, user: Union[discord.User, discord.Member], when: datetime
+ ):
+ self._logger.trace(__name__, f"Received on_typing:\n\t{channel}\n\t{user}\n\t{when}")
await self._handle_event(OnTypingABC, channel, user, when)
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
- self._logger.trace(__name__, f'Received on_message:\n\t{message}')
+ self._logger.trace(__name__, f"Received on_message:\n\t{message}")
await self._handle_event(OnMessageABC, message)
@commands.Cog.listener()
async def on_message_delete(self, message: discord.Message):
- self._logger.trace(__name__, f'Received on_message_delete:\n\t{message}')
+ self._logger.trace(__name__, f"Received on_message_delete:\n\t{message}")
await self._handle_event(OnMessageDeleteABC, message)
@commands.Cog.listener()
async def on_bulk_message_delete(self, messages: list[discord.Message]):
- self._logger.trace(__name__, f'Received on_bulk_message_delete:\n\t{len(messages)}')
+ self._logger.trace(__name__, f"Received on_bulk_message_delete:\n\t{len(messages)}")
await self._handle_event(OnBulkMessageDeleteABC, messages)
@commands.Cog.listener()
async def on_message_edit(self, before: discord.Message, after: discord.Message):
- self._logger.trace(__name__, f'Received on_message_edit:\n\t{before}\n\t{after}')
+ self._logger.trace(__name__, f"Received on_message_edit:\n\t{before}\n\t{after}")
await self._handle_event(OnMessageEditABC, before, after)
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: RawReactionActionEvent):
- self._logger.trace(__name__, f'Received on_raw_reaction_add')
+ self._logger.trace(__name__, f"Received on_raw_reaction_add")
await self._handle_event(OnRawReactionAddABC, payload)
@commands.Cog.listener()
async def on_raw_reaction_remove(self, payload: RawReactionActionEvent):
- self._logger.trace(__name__, f'Received on_raw_reaction_remove')
+ self._logger.trace(__name__, f"Received on_raw_reaction_remove")
await self._handle_event(OnRawReactionRemoveABC, payload)
@commands.Cog.listener()
async def on_raw_reaction_clear(self, payload: RawReactionActionEvent):
- self._logger.trace(__name__, f'Received on_raw_reaction_clear')
+ self._logger.trace(__name__, f"Received on_raw_reaction_clear")
await self._handle_event(OnRawReactionClearABC, payload)
@commands.Cog.listener()
async def on_raw_reaction_clear_emoji(self, payload: RawReactionActionEvent):
- self._logger.trace(__name__, f'Received on_raw_reaction_clear_emoji')
+ self._logger.trace(__name__, f"Received on_raw_reaction_clear_emoji")
await self._handle_event(OnRawReactionClearEmojiABC, payload)
@commands.Cog.listener()
async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User):
- self._logger.trace(__name__, f'Received on_reaction_add:\n\t{reaction}\n\t{user}')
+ self._logger.trace(__name__, f"Received on_reaction_add:\n\t{reaction}\n\t{user}")
await self._handle_event(OnReactionAddABC, reaction, user)
@commands.Cog.listener()
async def on_reaction_remove(self, reaction: discord.Reaction, user: discord.User):
- self._logger.trace(__name__, f'Received on_reaction_remove:\n\t{reaction}\n\t{user}')
+ self._logger.trace(__name__, f"Received on_reaction_remove:\n\t{reaction}\n\t{user}")
await self._handle_event(OnReactionRemoveABC, reaction, user)
@commands.Cog.listener()
async def on_reaction_clear(self, message: discord.Message, reactions: list[discord.Reaction]):
- self._logger.trace(__name__, f'Received on_reaction_reon_reaction_clearmove:\n\t{message}\n\t{len(reactions)}')
+ self._logger.trace(__name__, f"Received on_reaction_reon_reaction_clearmove:\n\t{message}\n\t{len(reactions)}")
await self._handle_event(OnReactionClearABC, message, reactions)
@commands.Cog.listener()
async def on_reaction_clear_emoji(self, reaction: discord.Reaction):
- self._logger.trace(__name__, f'Received on_reaction_clear_emoji:\n\t{reaction}')
+ self._logger.trace(__name__, f"Received on_reaction_clear_emoji:\n\t{reaction}")
await self._handle_event(OnReactionClearEmojiABC, reaction)
@commands.Cog.listener()
async def on_private_channel_delete(self, channel: discord.abc.PrivateChannel):
- self._logger.trace(__name__, f'Received on_private_channel_delete:\n\t{channel}')
+ self._logger.trace(__name__, f"Received on_private_channel_delete:\n\t{channel}")
await self._handle_event(OnPrivateChannelDeleteABC, channel)
@commands.Cog.listener()
async def on_private_channel_create(self, channel: discord.abc.PrivateChannel):
- self._logger.trace(__name__, f'Received on_private_channel_create:\n\t{channel}')
+ self._logger.trace(__name__, f"Received on_private_channel_create:\n\t{channel}")
await self._handle_event(OnPrivateChannelCreateABC, channel)
@commands.Cog.listener()
async def on_private_channel_update(self, before: discord.GroupChannel, after: discord.GroupChannel):
- self._logger.trace(__name__, f'Received on_private_channel_update:\n\t{before}\n\t{after}')
+ self._logger.trace(__name__, f"Received on_private_channel_update:\n\t{before}\n\t{after}")
await self._handle_event(OnPrivateChannelUpdateABC, before, after)
@commands.Cog.listener()
async def on_private_channel_pins_update(self, channel: discord.abc.PrivateChannel, list_pin: Optional[datetime]):
- self._logger.trace(__name__, f'Received on_private_channel_pins_update:\n\t{channel}\n\t{list_pin}')
+ self._logger.trace(__name__, f"Received on_private_channel_pins_update:\n\t{channel}\n\t{list_pin}")
await self._handle_event(OnPrivateChannelPinsUpdateABC, channel, list_pin)
@commands.Cog.listener()
async def on_guild_channel_delete(self, channel: discord.abc.GuildChannel):
- self._logger.trace(__name__, f'Received on_guild_channel_delete:\n\t{channel}')
+ self._logger.trace(__name__, f"Received on_guild_channel_delete:\n\t{channel}")
await self._handle_event(OnGuildChannelDeleteABC, channel)
@commands.Cog.listener()
async def on_guild_channel_create(self, channel: discord.abc.GuildChannel):
- self._logger.trace(__name__, f'Received on_guild_channel_create:\n\t{channel}')
+ self._logger.trace(__name__, f"Received on_guild_channel_create:\n\t{channel}")
await self._handle_event(OnGuildChannelCreateABC, channel)
@commands.Cog.listener()
async def on_guild_channel_update(self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel):
- self._logger.trace(__name__, f'Received on_guild_channel_update:\n\t{before}\n\t{after}')
+ self._logger.trace(__name__, f"Received on_guild_channel_update:\n\t{before}\n\t{after}")
await self._handle_event(OnGuildChannelUpdateABC, before, after)
@commands.Cog.listener()
async def on_guild_channel_pins_update(self, channel: discord.abc.GuildChannel, list_pin: Optional[datetime]):
- self._logger.trace(__name__, f'Received on_guild_channel_pins_update:\n\t{channel}\n\t{list_pin}')
+ self._logger.trace(__name__, f"Received on_guild_channel_pins_update:\n\t{channel}\n\t{list_pin}")
await self._handle_event(OnGuildChannelPinsUpdateABC, channel, list_pin)
@commands.Cog.listener()
async def on_guild_integrations_update(self, guild: discord.Guild):
- self._logger.trace(__name__, f'Received on_guild_integrations_update:\n\t{guild}')
+ self._logger.trace(__name__, f"Received on_guild_integrations_update:\n\t{guild}")
await self._handle_event(OnGuildIntegrationsUpdateABC, guild)
@commands.Cog.listener()
async def on_webhooks_update(self, channel: discord.abc.GuildChannel):
- self._logger.trace(__name__, f'Received on_webhooks_update:\n\t{channel}')
+ self._logger.trace(__name__, f"Received on_webhooks_update:\n\t{channel}")
await self._handle_event(OnWebhooksUpdateABC, channel)
@commands.Cog.listener()
async def on_member_join(self, member: discord.Member):
- self._logger.trace(__name__, f'Received on_member_join:\n\t{member}')
+ self._logger.trace(__name__, f"Received on_member_join:\n\t{member}")
await self._handle_event(OnMemberJoinABC, member)
@commands.Cog.listener()
async def on_member_remove(self, member: discord.Member):
- self._logger.trace(__name__, f'Received on_member_remove:\n\t{member}')
+ self._logger.trace(__name__, f"Received on_member_remove:\n\t{member}")
await self._handle_event(OnMemberRemoveABC, member)
@commands.Cog.listener()
async def on_member_update(self, before: discord.Member, after: discord.Member):
- self._logger.trace(__name__, f'Received on_member_update:\n\t{before}\n\t{after}')
+ self._logger.trace(__name__, f"Received on_member_update:\n\t{before}\n\t{after}")
await self._handle_event(OnMemberUpdateABC, before, after)
@commands.Cog.listener()
async def on_user_update(self, before: discord.User, after: discord.User):
- self._logger.trace(__name__, f'Received on_user_update:\n\t{before}\n\t{after}')
+ self._logger.trace(__name__, f"Received on_user_update:\n\t{before}\n\t{after}")
await self._handle_event(OnUserUpdateABC, before, after)
@commands.Cog.listener()
async def on_guild_join(self, guild: discord.Guild):
- self._logger.trace(__name__, f'Received on_guild_join:\n\t{guild}')
+ self._logger.trace(__name__, f"Received on_guild_join:\n\t{guild}")
await self._handle_event(OnGuildJoinABC, guild)
@commands.Cog.listener()
async def on_guild_remove(self, guild: discord.Guild):
- self._logger.trace(__name__, f'Received on_guild_remove:\n\t{guild}')
+ self._logger.trace(__name__, f"Received on_guild_remove:\n\t{guild}")
await self._handle_event(OnGuildRemoveABC, guild)
@commands.Cog.listener()
async def on_guild_update(self, before: discord.Guild, after: discord.Guild):
- self._logger.trace(__name__, f'Received on_guild_update:\n\t{before}\n\t{after}')
+ self._logger.trace(__name__, f"Received on_guild_update:\n\t{before}\n\t{after}")
await self._handle_event(OnGuildUpdateABC, before, after)
@commands.Cog.listener()
async def on_guild_role_create(self, role: discord.Role):
- self._logger.trace(__name__, f'Received on_guild_role_create:\n\t{role}')
+ self._logger.trace(__name__, f"Received on_guild_role_create:\n\t{role}")
await self._handle_event(OnGuildRoleCreateABC, role)
@commands.Cog.listener()
async def on_guild_role_delete(self, role: discord.Role):
- self._logger.trace(__name__, f'Received on_guild_role_delete:\n\t{role}')
+ self._logger.trace(__name__, f"Received on_guild_role_delete:\n\t{role}")
await self._handle_event(OnGuildRoleDeleteABC, role)
@commands.Cog.listener()
async def on_guild_role_update(self, before: discord.Role, after: discord.Role):
- self._logger.trace(__name__, f'Received on_guild_role_update:\n\t{before}\n\t{after}')
+ self._logger.trace(__name__, f"Received on_guild_role_update:\n\t{before}\n\t{after}")
await self._handle_event(OnGuildRoleUpdateABC, before, after)
@commands.Cog.listener()
- async def on_guild_emojis_update(self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]):
- self._logger.trace(__name__, f'Received on_guild_emojis_update:\n\t{guild}\n\t{before}\n\t{after}')
+ async def on_guild_emojis_update(
+ self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]
+ ):
+ self._logger.trace(__name__, f"Received on_guild_emojis_update:\n\t{guild}\n\t{before}\n\t{after}")
await self._handle_event(OnGuildEmojisUpdateABC, guild, before, after)
@commands.Cog.listener()
async def on_guild_available(self, guild: discord.Guild):
- self._logger.trace(__name__, f'Received on_guild_available:\n\t{guild}')
+ self._logger.trace(__name__, f"Received on_guild_available:\n\t{guild}")
await self._handle_event(OnGuildAvailableABC, guild)
@commands.Cog.listener()
async def on_guild_unavailable(self, guild: discord.Guild):
- self._logger.trace(__name__, f'Received on_guild_unavailable:\n\t{guild}')
+ self._logger.trace(__name__, f"Received on_guild_unavailable:\n\t{guild}")
await self._handle_event(OnGuildUnavailableABC, guild)
@commands.Cog.listener()
- async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState):
- self._logger.trace(__name__, f'Received on_voice_state_update:\n\t{member}\n\t{before}\n\t{after}')
+ async def on_voice_state_update(
+ self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState
+ ):
+ self._logger.trace(__name__, f"Received on_voice_state_update:\n\t{member}\n\t{before}\n\t{after}")
await self._handle_event(OnVoiceStateUpdateABC, member, before, after)
@commands.Cog.listener()
async def on_member_ban(self, guild: discord.Guild, user: discord.User):
- self._logger.trace(__name__, f'Received on_member_ban:\n\t{guild}\n\t{user}')
+ self._logger.trace(__name__, f"Received on_member_ban:\n\t{guild}\n\t{user}")
await self._handle_event(OnMemberBanABC, guild, user)
@commands.Cog.listener()
async def on_member_unban(self, guild: discord.Guild, user: discord.User):
- self._logger.trace(__name__, f'Received on_member_unban:\n\t{guild}\n\t{user}')
+ self._logger.trace(__name__, f"Received on_member_unban:\n\t{guild}\n\t{user}")
await self._handle_event(OnMemberUnbanABC, guild, user)
@commands.Cog.listener()
async def on_invite_create(self, invite: discord.Invite):
- self._logger.trace(__name__, f'Received on_invite_create:\n\t{invite}')
+ self._logger.trace(__name__, f"Received on_invite_create:\n\t{invite}")
await self._handle_event(OnInviteCreateABC, invite)
@commands.Cog.listener()
async def on_invite_delete(self, invite: discord.Invite):
- self._logger.trace(__name__, f'Received on_invite_create:\n\t{invite}')
+ self._logger.trace(__name__, f"Received on_invite_create:\n\t{invite}")
await self._handle_event(OnInviteDeleteABC, invite)
@commands.Cog.listener()
async def on_group_join(self, channel: discord.GroupChannel, user: discord.User):
- self._logger.trace(__name__, f'Received on_group_join:\n\t{channel}\n\t{user}')
+ self._logger.trace(__name__, f"Received on_group_join:\n\t{channel}\n\t{user}")
await self._handle_event(OnGroupJoinABC, channel, user)
@commands.Cog.listener()
async def on_group_remove(self, channel: discord.GroupChannel, user: discord.User):
- self._logger.trace(__name__, f'Received on_group_remove:\n\t{channel}\n\t{user}')
+ self._logger.trace(__name__, f"Received on_group_remove:\n\t{channel}\n\t{user}")
await self._handle_event(OnGroupRemoveABC, channel, user)
diff --git a/src/cpl_discord/service/discord_service_abc.py b/src/cpl_discord/service/discord_service_abc.py
index ca2993a3..3065387d 100644
--- a/src/cpl_discord/service/discord_service_abc.py
+++ b/src/cpl_discord/service/discord_service_abc.py
@@ -7,153 +7,207 @@ from discord.ext import commands
class DiscordServiceABC(ABC):
-
def __init__(self):
ABC.__init__(self)
@abstractmethod
- def init(self, bot: commands.Bot): pass
+ def init(self, bot: commands.Bot):
+ pass
@abstractmethod
- async def on_connect(self): pass
+ async def on_connect(self):
+ pass
@abstractmethod
- async def on_command(self): pass
+ async def on_command(self):
+ pass
@abstractmethod
- async def on_command_error(self): pass
+ async def on_command_error(self):
+ pass
@abstractmethod
- async def on_command_completion(self): pass
+ async def on_command_completion(self):
+ pass
@abstractmethod
- async def on_disconnect(self): pass
+ async def on_disconnect(self):
+ pass
@abstractmethod
- async def on_error(self, event: str, *args, **kwargs): pass
+ async def on_error(self, event: str, *args, **kwargs):
+ pass
@abstractmethod
- async def on_ready(self): pass
+ async def on_ready(self):
+ pass
@abstractmethod
- async def on_resume(self): pass
+ async def on_resume(self):
+ pass
@abstractmethod
- async def on_error(self, event: str, *args, **kwargs): pass
+ async def on_error(self, event: str, *args, **kwargs):
+ pass
@abstractmethod
- async def on_typing(self, channel: discord.abc.Messageable, user: Union[discord.User, discord.Member], when: datetime): pass
+ async def on_typing(
+ self, channel: discord.abc.Messageable, user: Union[discord.User, discord.Member], when: datetime
+ ):
+ pass
@abstractmethod
- async def on_message(self, message: discord.Message): pass
+ async def on_message(self, message: discord.Message):
+ pass
@abstractmethod
- async def on_message_delete(self, message: discord.Message): pass
+ async def on_message_delete(self, message: discord.Message):
+ pass
@abstractmethod
- async def on_bulk_message_delete(self, messages: list[discord.Message]): pass
+ async def on_bulk_message_delete(self, messages: list[discord.Message]):
+ pass
@abstractmethod
- async def on_message_edit(self, before: discord.Message, after: discord.Message): pass
+ async def on_message_edit(self, before: discord.Message, after: discord.Message):
+ pass
@abstractmethod
- async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User): pass
+ async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User):
+ pass
@abstractmethod
- async def on_reaction_remove(self, reaction: discord.Reaction, user: discord.User): pass
+ async def on_reaction_remove(self, reaction: discord.Reaction, user: discord.User):
+ pass
@abstractmethod
- async def on_reaction_clear(self, message: discord.Message, reactions: list[discord.Reaction]): pass
+ async def on_reaction_clear(self, message: discord.Message, reactions: list[discord.Reaction]):
+ pass
@abstractmethod
- async def on_reaction_clear_emoji(self, reaction: discord.Reaction): pass
+ async def on_reaction_clear_emoji(self, reaction: discord.Reaction):
+ pass
@abstractmethod
- async def on_private_channel_delete(self, channel: discord.abc.PrivateChannel): pass
+ async def on_private_channel_delete(self, channel: discord.abc.PrivateChannel):
+ pass
@abstractmethod
- async def on_private_channel_create(self, channel: discord.abc.PrivateChannel): pass
+ async def on_private_channel_create(self, channel: discord.abc.PrivateChannel):
+ pass
@abstractmethod
- async def on_private_channel_update(self, before: discord.GroupChannel, after: discord.GroupChannel): pass
+ async def on_private_channel_update(self, before: discord.GroupChannel, after: discord.GroupChannel):
+ pass
@abstractmethod
- async def on_private_channel_pins_update(self, channel: discord.abc.PrivateChannel, list_pin: Optional[datetime]): pass
+ async def on_private_channel_pins_update(self, channel: discord.abc.PrivateChannel, list_pin: Optional[datetime]):
+ pass
@abstractmethod
- async def on_guild_channel_delete(self, channel: discord.abc.GuildChannel): pass
+ async def on_guild_channel_delete(self, channel: discord.abc.GuildChannel):
+ pass
@abstractmethod
- async def on_guild_channel_create(self, channel: discord.abc.GuildChannel): pass
+ async def on_guild_channel_create(self, channel: discord.abc.GuildChannel):
+ pass
@abstractmethod
- async def on_guild_channel_update(self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel): pass
+ async def on_guild_channel_update(self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel):
+ pass
@abstractmethod
- async def on_guild_channel_pins_update(self, channel: discord.abc.GuildChannel, list_pin: Optional[datetime]): pass
+ async def on_guild_channel_pins_update(self, channel: discord.abc.GuildChannel, list_pin: Optional[datetime]):
+ pass
@abstractmethod
- async def on_guild_integrations_update(self, guild: discord.Guild): pass
+ async def on_guild_integrations_update(self, guild: discord.Guild):
+ pass
@abstractmethod
- async def on_webhooks_update(self, channel: discord.abc.GuildChannel): pass
+ async def on_webhooks_update(self, channel: discord.abc.GuildChannel):
+ pass
@abstractmethod
- async def on_member_join(self, member: discord.Member): pass
+ async def on_member_join(self, member: discord.Member):
+ pass
@abstractmethod
- async def on_member_remove(self, member: discord.Member): pass
+ async def on_member_remove(self, member: discord.Member):
+ pass
@abstractmethod
- async def on_member_update(self, before: discord.Member, after: discord.Member): pass
+ async def on_member_update(self, before: discord.Member, after: discord.Member):
+ pass
@abstractmethod
- async def on_user_update(self, before: discord.User, after: discord.User): pass
+ async def on_user_update(self, before: discord.User, after: discord.User):
+ pass
@abstractmethod
- async def on_guild_join(self, guild: discord.Guild): pass
+ async def on_guild_join(self, guild: discord.Guild):
+ pass
@abstractmethod
- async def on_guild_remove(self, guild: discord.Guild): pass
+ async def on_guild_remove(self, guild: discord.Guild):
+ pass
@abstractmethod
- async def on_guild_update(self, before: discord.Guild, after: discord.Guild): pass
+ async def on_guild_update(self, before: discord.Guild, after: discord.Guild):
+ pass
@abstractmethod
- async def on_guild_role_create(self, role: discord.Role): pass
+ async def on_guild_role_create(self, role: discord.Role):
+ pass
@abstractmethod
- async def on_guild_role_delete(self, role: discord.Role): pass
+ async def on_guild_role_delete(self, role: discord.Role):
+ pass
@abstractmethod
- async def on_guild_role_update(self, before: discord.Role, after: discord.Role): pass
+ async def on_guild_role_update(self, before: discord.Role, after: discord.Role):
+ pass
@abstractmethod
- async def on_guild_emojis_update(self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]): pass
+ async def on_guild_emojis_update(
+ self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]
+ ):
+ pass
@abstractmethod
- async def on_guild_available(self, guild: discord.Guild): pass
+ async def on_guild_available(self, guild: discord.Guild):
+ pass
@abstractmethod
- async def on_guild_unavailable(self, guild: discord.Guild): pass
+ async def on_guild_unavailable(self, guild: discord.Guild):
+ pass
@abstractmethod
- async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState): pass
+ async def on_voice_state_update(
+ self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState
+ ):
+ pass
@abstractmethod
- async def on_member_ban(self, guild: discord.Guild, user: discord.User): pass
+ async def on_member_ban(self, guild: discord.Guild, user: discord.User):
+ pass
@abstractmethod
- async def on_member_unban(self, guild: discord.Guild, user: discord.User): pass
+ async def on_member_unban(self, guild: discord.Guild, user: discord.User):
+ pass
@abstractmethod
- async def on_invite_create(self, invite: discord.Invite): pass
+ async def on_invite_create(self, invite: discord.Invite):
+ pass
@abstractmethod
- async def on_invite_delete(self, invite: discord.Invite): pass
+ async def on_invite_delete(self, invite: discord.Invite):
+ pass
@abstractmethod
- async def on_group_join(self, chhanel: discord.GroupChannel, user: discord.User): pass
+ async def on_group_join(self, chhanel: discord.GroupChannel, user: discord.User):
+ pass
@abstractmethod
- async def on_group_remove(self, chhanel: discord.GroupChannel, user: discord.User): pass
\ No newline at end of file
+ async def on_group_remove(self, chhanel: discord.GroupChannel, user: discord.User):
+ pass
diff --git a/src/cpl_query/__init__.py b/src/cpl_query/__init__.py
index 725fedf2..99ff3bc8 100644
--- a/src/cpl_query/__init__.py
+++ b/src/cpl_query/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-query sh-edraft Common Python library Query
+cpl-query CPL Queries
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Python integrated Queries
+CPL Python integrated Queries
:copyright: (c) 2021 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_query'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2021 - 2023 sh-edraft.de'
-__version__ = '2022.12.2.post1'
+__title__ = "cpl_query"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2021 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='2.post1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_query/base/__init__.py b/src/cpl_query/base/__init__.py
index 137b82cb..b32cff04 100644
--- a/src/cpl_query/base/__init__.py
+++ b/src/cpl_query/base/__init__.py
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-
"""
-cpl-query sh-edraft Common Python library Query
+cpl-query CPL Queries
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Python integrated Queries
+CPL Python integrated Queries
:copyright: (c) 2021 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_query.base'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2021 - 2023 sh-edraft.de'
-__version__ = '2022.12.2.post1'
+__title__ = "cpl_query.base"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2021 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='2.post1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_query/base/ordered_queryable.py b/src/cpl_query/base/ordered_queryable.py
index c7b3dbf7..96453089 100644
--- a/src/cpl_query/base/ordered_queryable.py
+++ b/src/cpl_query/base/ordered_queryable.py
@@ -6,8 +6,7 @@ from cpl_query.iterable.iterable import Iterable
class OrderedQueryable(OrderedQueryableABC):
- r"""Implementation of :class: `cpl_query.extension.Iterable` `cpl_query.extension.OrderedIterableABC`
- """
+ r"""Implementation of :class: `cpl_query.extension.Iterable` `cpl_query.extension.OrderedIterableABC`"""
def __init__(self, _t: type, _values: Iterable = None, _func: Callable = None):
OrderedQueryableABC.__init__(self, _t, _values, _func)
@@ -31,4 +30,6 @@ class OrderedQueryable(OrderedQueryableABC):
raise ArgumentNoneException(ExceptionArgument.func)
self._funcs.append(_func)
- return OrderedQueryable(self.type, sorted(self, key=lambda *args: [f(*args) for f in self._funcs], reverse=True), _func)
+ return OrderedQueryable(
+ self.type, sorted(self, key=lambda *args: [f(*args) for f in self._funcs], reverse=True), _func
+ )
diff --git a/src/cpl_query/base/ordered_queryable_abc.py b/src/cpl_query/base/ordered_queryable_abc.py
index f3ec56fc..b9cfb12a 100644
--- a/src/cpl_query/base/ordered_queryable_abc.py
+++ b/src/cpl_query/base/ordered_queryable_abc.py
@@ -6,7 +6,6 @@ from cpl_query.base.queryable_abc import QueryableABC
class OrderedQueryableABC(QueryableABC):
-
@abstractmethod
def __init__(self, _t: type, _values: Iterable = None, _func: Callable = None):
QueryableABC.__init__(self, _t, _values)
@@ -15,29 +14,25 @@ class OrderedQueryableABC(QueryableABC):
self._funcs.append(_func)
@abstractmethod
- def then_by(self, func: Callable) -> 'OrderedQueryableABC':
+ def then_by(self, func: Callable) -> "OrderedQueryableABC":
r"""Sorts OrderedList in ascending order by function
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
-
- Returns
- -------
+
+ Returns:
list of :class:`cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC`
"""
pass
@abstractmethod
- def then_by_descending(self, func: Callable) -> 'OrderedQueryableABC':
+ def then_by_descending(self, func: Callable) -> "OrderedQueryableABC":
r"""Sorts OrderedList in descending order by function
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
-
- Returns
- -------
+
+ Returns:
list of :class:`cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC`
"""
pass
diff --git a/src/cpl_query/base/queryable_abc.py b/src/cpl_query/base/queryable_abc.py
index e7d8f5ec..7d5653fe 100644
--- a/src/cpl_query/base/queryable_abc.py
+++ b/src/cpl_query/base/queryable_abc.py
@@ -2,7 +2,12 @@ from typing import Optional, Callable, Union, Iterable
from cpl_query._helper import is_number
from cpl_query.base.sequence import Sequence
-from cpl_query.exceptions import InvalidTypeException, ArgumentNoneException, ExceptionArgument, IndexOutOfRangeException
+from cpl_query.exceptions import (
+ InvalidTypeException,
+ ArgumentNoneException,
+ ExceptionArgument,
+ IndexOutOfRangeException,
+)
def _default_lambda(x: object) -> object:
@@ -10,20 +15,17 @@ def _default_lambda(x: object) -> object:
class QueryableABC(Sequence):
-
def __init__(self, t: type, values: Iterable = None):
Sequence.__init__(self, t, values)
def all(self, _func: Callable = None) -> bool:
r"""Checks if every element of list equals result found by function
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
bool
"""
if _func is None:
@@ -34,13 +36,11 @@ class QueryableABC(Sequence):
def any(self, _func: Callable = None) -> bool:
r"""Checks if list contains result found by function
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
bool
"""
if _func is None:
@@ -51,13 +51,11 @@ class QueryableABC(Sequence):
def average(self, _func: Callable = None) -> Union[int, float, complex]:
r"""Returns average value of list
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
Union[int, float, complex]
"""
if _func is None and not is_number(self.type):
@@ -68,13 +66,11 @@ class QueryableABC(Sequence):
def contains(self, _value: object) -> bool:
r"""Checks if list contains value given by function
- Parameter
- ---------
+ Parameter:
value: :class:`object`
value
- Returns
- -------
+ Returns:
bool
"""
if _value is None:
@@ -85,13 +81,11 @@ class QueryableABC(Sequence):
def count(self, _func: Callable = None) -> int:
r"""Returns length of list or count of found elements
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
int
"""
if _func is None:
@@ -99,16 +93,14 @@ class QueryableABC(Sequence):
return self.where(_func).count()
- def distinct(self, _func: Callable = None) -> 'QueryableABC':
+ def distinct(self, _func: Callable = None) -> "QueryableABC":
r"""Returns list without redundancies
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _func is None:
@@ -129,13 +121,11 @@ class QueryableABC(Sequence):
def element_at(self, _index: int) -> any:
r"""Returns element at given index
- Parameter
- ---------
+ Parameter:
_index: :class:`int`
index
- Returns
- -------
+ Returns:
Value at _index: any
"""
if _index is None:
@@ -153,13 +143,11 @@ class QueryableABC(Sequence):
def element_at_or_default(self, _index: int) -> Optional[any]:
r"""Returns element at given index or None
- Parameter
- ---------
+ Parameter:
_index: :class:`int`
index
- Returns
- -------
+ Returns:
Value at _index: Optional[any]
"""
if _index is None:
@@ -173,8 +161,7 @@ class QueryableABC(Sequence):
def first(self) -> any:
r"""Returns first element
- Returns
- -------
+ Returns:
First element of list: any
"""
if self.count() == 0:
@@ -185,8 +172,7 @@ class QueryableABC(Sequence):
def first_or_default(self) -> any:
r"""Returns first element or None
- Returns
- -------
+ Returns:
First element of list: Optional[any]
"""
if self.count() == 0:
@@ -197,8 +183,7 @@ class QueryableABC(Sequence):
def for_each(self, _func: Callable = None):
r"""Runs given function for each element of list
- Parameter
- ---------
+ Parameter:
func: :class: `Callable`
function to call
"""
@@ -208,11 +193,10 @@ class QueryableABC(Sequence):
return self
- def group_by(self, _func: Callable = None) -> 'QueryableABC':
+ def group_by(self, _func: Callable = None) -> "QueryableABC":
r"""Groups by func
- Returns
- -------
+ Returns:
Grouped list[list[any]]: any
"""
if _func is None:
@@ -235,8 +219,7 @@ class QueryableABC(Sequence):
def last(self) -> any:
r"""Returns last element
- Returns
- -------
+ Returns:
Last element of list: any
"""
if self.count() == 0:
@@ -247,8 +230,7 @@ class QueryableABC(Sequence):
def last_or_default(self) -> any:
r"""Returns last element or None
- Returns
- -------
+ Returns:
Last element of list: Optional[any]
"""
if self.count() == 0:
@@ -259,13 +241,11 @@ class QueryableABC(Sequence):
def max(self, _func: Callable = None) -> object:
r"""Returns the highest value
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
object
"""
if _func is None and not is_number(self.type):
@@ -279,8 +259,7 @@ class QueryableABC(Sequence):
def median(self, _func=None) -> Union[int, float]:
r"""Return the median value of data elements
- Returns
- -------
+ Returns:
Union[int, float]
"""
if _func is None:
@@ -289,22 +268,16 @@ class QueryableABC(Sequence):
result = self.order_by(_func).select(_func).to_list()
length = len(result)
i = int(length / 2)
- return (
- result[i]
- if length % 2 == 1
- else (float(result[i - 1]) + float(result[i])) / float(2)
- )
+ return result[i] if length % 2 == 1 else (float(result[i - 1]) + float(result[i])) / float(2)
def min(self, _func: Callable = None) -> object:
r"""Returns the lowest value
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
object
"""
if _func is None and not is_number(self.type):
@@ -315,56 +288,52 @@ class QueryableABC(Sequence):
return _func(min(self, key=_func))
- def order_by(self, _func: Callable = None) -> 'QueryableABC':
+ def order_by(self, _func: Callable = None) -> "QueryableABC":
r"""Sorts elements by function in ascending order
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _func is None:
_func = _default_lambda
from cpl_query.base.ordered_queryable import OrderedQueryable
+
return OrderedQueryable(self.type, sorted(self, key=_func), _func)
- def order_by_descending(self, _func: Callable = None) -> 'QueryableABC':
+ def order_by_descending(self, _func: Callable = None) -> "QueryableABC":
r"""Sorts elements by function in descending order
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _func is None:
_func = _default_lambda
from cpl_query.base.ordered_queryable import OrderedQueryable
+
return OrderedQueryable(self.type, sorted(self, key=_func, reverse=True), _func)
- def reverse(self) -> 'QueryableABC':
+ def reverse(self) -> "QueryableABC":
r"""Reverses list
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
return type(self)(self._type, reversed(self._values))
- def select(self, _func: Callable) -> 'QueryableABC':
+ def select(self, _func: Callable) -> "QueryableABC":
r"""Formats each element of list to a given format
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _func is None:
@@ -372,11 +341,10 @@ class QueryableABC(Sequence):
return type(self)(object, [_func(_o) for _o in self])
- def select_many(self, _func: Callable) -> 'QueryableABC':
+ def select_many(self, _func: Callable) -> "QueryableABC":
r"""Flattens resulting lists to one
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
# The line below is pain. I don't understand anything of it...
@@ -386,46 +354,41 @@ class QueryableABC(Sequence):
def single(self) -> any:
r"""Returns one single element of list
- Returns
- -------
+ Returns:
Found value: any
- Raises
- ------
+ Raises:
ArgumentNoneException: when argument is None
Exception: when argument is None or found more than one element
"""
if self.count() > 1:
- raise Exception('Found more than one element')
+ raise Exception("Found more than one element")
elif self.count() == 0:
- raise Exception('Found no element')
+ raise Exception("Found no element")
return self._values[0]
def single_or_default(self) -> Optional[any]:
r"""Returns one single element of list
- Returns
- -------
+ Returns:
Found value: Optional[any]
"""
if self.count() > 1:
- raise Exception('Index out of range')
+ raise Exception("Index out of range")
elif self.count() == 0:
return None
return self._values[0]
- def skip(self, _index: int) -> 'QueryableABC':
+ def skip(self, _index: int) -> "QueryableABC":
r"""Skips all elements from index
- Parameter
- ---------
+ Parameter:
_index: :class:`int`
index
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _index is None:
@@ -433,16 +396,14 @@ class QueryableABC(Sequence):
return type(self)(self.type, self._values[_index:])
- def skip_last(self, _index: int) -> 'QueryableABC':
+ def skip_last(self, _index: int) -> "QueryableABC":
r"""Skips all elements after index
- Parameter
- ---------
+ Parameter:
_index: :class:`int`
index
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _index is None:
@@ -454,13 +415,11 @@ class QueryableABC(Sequence):
def sum(self, _func: Callable = None) -> Union[int, float, complex]:
r"""Sum of all values
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
Union[int, float, complex]
"""
if _func is None and not is_number(self.type):
@@ -475,17 +434,15 @@ class QueryableABC(Sequence):
return result
- def split(self, _func: Callable) -> 'QueryableABC':
+ def split(self, _func: Callable) -> "QueryableABC":
r"""Splits the list by given function
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
seperator
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
groups = []
@@ -508,16 +465,14 @@ class QueryableABC(Sequence):
return type(self)(self._type, query_groups)
- def take(self, _index: int) -> 'QueryableABC':
+ def take(self, _index: int) -> "QueryableABC":
r"""Takes all elements from index
- Parameter
- ---------
+ Parameter:
_index: :class:`int`
index
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _index is None:
@@ -525,16 +480,14 @@ class QueryableABC(Sequence):
return type(self)(self._type, self._values[:_index])
- def take_last(self, _index: int) -> 'QueryableABC':
+ def take_last(self, _index: int) -> "QueryableABC":
r"""Takes all elements after index
- Parameter
- ---------
+ Parameter:
_index: :class:`int`
index
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
index = self.count() - _index
@@ -544,16 +497,14 @@ class QueryableABC(Sequence):
return type(self)(self._type, self._values[index:])
- def where(self, _func: Callable = None) -> 'QueryableABC':
+ def where(self, _func: Callable = None) -> "QueryableABC":
r"""Select element by function
- Parameter
- ---------
+ Parameter:
func: :class:`Callable`
selected value
- Returns
- -------
+ Returns:
:class: `cpl_query.base.queryable_abc.QueryableABC`
"""
if _func is None:
diff --git a/src/cpl_query/base/sequence.py b/src/cpl_query/base/sequence.py
index cb97b1b3..95aaaa0a 100644
--- a/src/cpl_query/base/sequence.py
+++ b/src/cpl_query/base/sequence.py
@@ -3,7 +3,6 @@ from typing import Iterable
class Sequence(ABC):
-
@abstractmethod
def __init__(self, t: type, values: Iterable = None):
if values is None:
@@ -30,7 +29,7 @@ class Sequence(ABC):
return _t
def __repr__(self):
- return f'<{type(self).__name__} {self.to_list().__repr__()}>'
+ return f"<{type(self).__name__} {self.to_list().__repr__()}>"
@property
def type(self) -> type:
@@ -40,33 +39,35 @@ class Sequence(ABC):
if self._type == any:
return
- if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type) and not issubclass(type(__object), self._type):
- raise Exception(f'Unexpected type: {type(__object)}\nExpected type: {self._type}')
+ if (
+ self._type is not None
+ and type(__object) != self._type
+ and not isinstance(type(__object), self._type)
+ and not issubclass(type(__object), self._type)
+ ):
+ raise Exception(f"Unexpected type: {type(__object)}\nExpected type: {self._type}")
def to_list(self) -> list:
r"""Converts :class: `cpl_query.base.sequence_abc.SequenceABC` to :class: `list`
- Returns
- -------
+ Returns:
:class: `list`
"""
return [x for x in self._values]
- def copy(self) -> 'Sequence':
+ def copy(self) -> "Sequence":
r"""Creates a copy of sequence
- Returns
- -------
+ Returns:
Sequence
"""
return type(self)(self._type, self.to_list())
@classmethod
- def empty(cls) -> 'Sequence':
+ def empty(cls) -> "Sequence":
r"""Returns an empty sequence
- Returns
- -------
+ Returns:
Sequence object that contains no elements
"""
return cls(object, [])
@@ -74,12 +75,10 @@ class Sequence(ABC):
def index_of(self, _object: object) -> int:
r"""Returns the index of given element
- Returns
- -------
+ Returns:
Index of object
- Raises
- -------
+ Raises:
IndexError if object not in sequence
"""
for i, o in enumerate(self):
@@ -89,5 +88,5 @@ class Sequence(ABC):
raise IndexError
@classmethod
- def range(cls, start: int, length: int) -> 'Sequence':
+ def range(cls, start: int, length: int) -> "Sequence":
return cls(int, range(start, length))
diff --git a/src/cpl_query/cpl-query.json b/src/cpl_query/cpl-query.json
index 655b7172..fa3f9e56 100644
--- a/src/cpl_query/cpl-query.json
+++ b/src/cpl_query/cpl-query.json
@@ -2,14 +2,14 @@
"ProjectSettings": {
"Name": "cpl-query",
"Version": {
- "Major": "2022",
- "Minor": "12",
- "Micro": "2.post1"
+ "Major": "2023",
+ "Minor": "2",
+ "Micro": "0"
},
"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",
+ "Description": "CPL Queries",
+ "LongDescription": "CPL Python integrated Queries",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2021 - 2023",
"CopyrightName": "sh-edraft.de",
@@ -37,7 +37,8 @@
"PackageData": {
"cpl_query": [
".cpl/*.py"
- ]},
+ ]
+ },
"ProjectReferences": []
}
}
\ No newline at end of file
diff --git a/src/cpl_query/enumerable/__init__.py b/src/cpl_query/enumerable/__init__.py
index 7387ab0a..4b41c7b4 100644
--- a/src/cpl_query/enumerable/__init__.py
+++ b/src/cpl_query/enumerable/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-query sh-edraft Common Python library Query
+cpl-query CPL Queries
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Python integrated Queries
+CPL Python integrated Queries
:copyright: (c) 2021 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_query.enumerable'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2021 - 2023 sh-edraft.de'
-__version__ = '2022.12.2.post1'
+__title__ = "cpl_query.enumerable"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2021 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -24,5 +24,5 @@ from collections import namedtuple
from .enumerable import Enumerable
from .enumerable_abc import EnumerableABC
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='2.post1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_query/enumerable/enumerable.py b/src/cpl_query/enumerable/enumerable.py
index 7b99518a..9c91d593 100644
--- a/src/cpl_query/enumerable/enumerable.py
+++ b/src/cpl_query/enumerable/enumerable.py
@@ -6,8 +6,7 @@ def _default_lambda(x: object):
class Enumerable(EnumerableABC):
- r"""Implementation of :class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`
- """
+ r"""Implementation of :class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`"""
def __init__(self, t: type = None, values: list = None):
EnumerableABC.__init__(self, t, values)
diff --git a/src/cpl_query/enumerable/enumerable_abc.py b/src/cpl_query/enumerable/enumerable_abc.py
index c222973d..b1c4960b 100644
--- a/src/cpl_query/enumerable/enumerable_abc.py
+++ b/src/cpl_query/enumerable/enumerable_abc.py
@@ -4,19 +4,18 @@ from cpl_query.base.queryable_abc import QueryableABC
class EnumerableABC(QueryableABC):
- r"""ABC to define functions on list
- """
+ r"""ABC to define functions on list"""
@abstractmethod
def __init__(self, t: type = None, values: list = None):
QueryableABC.__init__(self, t, values)
- def to_iterable(self) -> 'IterableABC':
+ def to_iterable(self) -> "IterableABC":
r"""Converts :class: `cpl_query.enumerable.enumerable_abc.EnumerableABC` to :class: `cpl_query.iterable.iterable_abc.IterableABC`
- Returns
- -------
+ Returns:
:class: `cpl_query.iterable.iterable_abc.IterableABC`
"""
from cpl_query.iterable.iterable import Iterable
+
return Iterable(self._type, self.to_list())
diff --git a/src/cpl_query/exceptions.py b/src/cpl_query/exceptions.py
index ee7d6710..39798541 100644
--- a/src/cpl_query/exceptions.py
+++ b/src/cpl_query/exceptions.py
@@ -3,37 +3,33 @@ from enum import Enum
# models
class ExceptionArgument(Enum):
- list = 'list'
- func = 'func'
- type = 'type'
- value = 'value'
- index = 'index'
+ list = "list"
+ func = "func"
+ type = "type"
+ value = "value"
+ index = "index"
# exceptions
class ArgumentNoneException(Exception):
- r"""Exception when argument is None
- """
+ r"""Exception when argument is None"""
def __init__(self, arg: ExceptionArgument):
- Exception.__init__(self, f'argument {arg} is None')
+ Exception.__init__(self, f"argument {arg} is None")
class IndexOutOfRangeException(Exception):
- r"""Exception when index is out of range
- """
+ r"""Exception when index is out of range"""
def __init__(self, err: str = None):
- Exception.__init__(self, f'List index out of range' if err is None else err)
+ Exception.__init__(self, f"List index out of range" if err is None else err)
class InvalidTypeException(Exception):
- r"""Exception when type is invalid
- """
+ r"""Exception when type is invalid"""
pass
class WrongTypeException(Exception):
- r"""Exception when type is unexpected
- """
+ r"""Exception when type is unexpected"""
pass
diff --git a/src/cpl_query/extension/__init__.py b/src/cpl_query/extension/__init__.py
index a08c06a4..83cf4f7b 100644
--- a/src/cpl_query/extension/__init__.py
+++ b/src/cpl_query/extension/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-query sh-edraft Common Python library Query
+cpl-query CPL Queries
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Python integrated Queries
+CPL Python integrated Queries
:copyright: (c) 2021 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_query.extension'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2021 - 2023 sh-edraft.de'
-__version__ = '2022.12.2.post1'
+__title__ = "cpl_query.extension"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2021 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -23,5 +23,5 @@ from collections import namedtuple
# imports:
from .list import List
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='2.post1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_query/extension/list.py b/src/cpl_query/extension/list.py
index 30722127..0f397acb 100644
--- a/src/cpl_query/extension/list.py
+++ b/src/cpl_query/extension/list.py
@@ -4,8 +4,7 @@ from cpl_query.iterable.iterable import Iterable
class List(Iterable):
- r"""Implementation of :class: `cpl_query.extension.iterable.Iterable`
- """
+ r"""Implementation of :class: `cpl_query.extension.iterable.Iterable`"""
def __init__(self, t: type = None, values: Iterator = None):
Iterable.__init__(self, t, values)
@@ -19,22 +18,22 @@ class List(Iterable):
def __delitem__(self, *args):
self._values.__delitem__(*args)
- def to_enumerable(self) -> 'EnumerableABC':
+ def to_enumerable(self) -> "EnumerableABC":
r"""Converts :class: `cpl_query.iterable.iterable_abc.IterableABC` to :class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`
- Returns
- -------
+ Returns:
:class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`
"""
from cpl_query.enumerable.enumerable import Enumerable
+
return Enumerable(self._type, self.to_list())
- def to_iterable(self) -> 'IterableABC':
+ def to_iterable(self) -> "IterableABC":
r"""Converts :class: `cpl_query.enumerable.enumerable_abc.EnumerableABC` to :class: `cpl_query.iterable.iterable_abc.IterableABC`
- Returns
- -------
+ Returns:
:class: `cpl_query.iterable.iterable_abc.IterableABC`
"""
from cpl_query.iterable.iterable import Iterable
+
return Iterable(self._type, self.to_list())
diff --git a/src/cpl_query/iterable/__init__.py b/src/cpl_query/iterable/__init__.py
index de80b4df..007eaaa1 100644
--- a/src/cpl_query/iterable/__init__.py
+++ b/src/cpl_query/iterable/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-query sh-edraft Common Python library Query
+cpl-query CPL Queries
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Python integrated Queries
+CPL Python integrated Queries
:copyright: (c) 2021 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_query.iterable'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2021 - 2023 sh-edraft.de'
-__version__ = '2022.12.2.post1'
+__title__ = "cpl_query.iterable"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2021 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -24,5 +24,5 @@ from collections import namedtuple
from .iterable_abc import IterableABC
from .iterable import Iterable
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='2.post1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_query/iterable/iterable.py b/src/cpl_query/iterable/iterable.py
index 07ec5b8d..e58666bd 100644
--- a/src/cpl_query/iterable/iterable.py
+++ b/src/cpl_query/iterable/iterable.py
@@ -8,6 +8,5 @@ def _default_lambda(x: object):
class Iterable(IterableABC):
-
def __init__(self, t: type = None, values: TIterable = None):
IterableABC.__init__(self, t, values)
diff --git a/src/cpl_query/iterable/iterable_abc.py b/src/cpl_query/iterable/iterable_abc.py
index 5640230b..e8bacf27 100644
--- a/src/cpl_query/iterable/iterable_abc.py
+++ b/src/cpl_query/iterable/iterable_abc.py
@@ -5,8 +5,7 @@ from cpl_query.base.queryable_abc import QueryableABC
class IterableABC(QueryableABC):
- r"""ABC to define functions on list
- """
+ r"""ABC to define functions on list"""
@abstractmethod
def __init__(self, t: type = None, values: Iterable = None):
@@ -20,18 +19,18 @@ class IterableABC(QueryableABC):
def add(self, _object: object):
r"""Adds element to list
- Parameter
- ---------
+
+ Parameter:
_object: :class:`object`
value
"""
self._check_type(_object)
self._values.append(_object)
- def extend(self, __iterable: Iterable) -> 'IterableABC':
+ def extend(self, __iterable: Iterable) -> "IterableABC":
r"""Adds elements of given list to list
- Parameter
- ---------
+
+ Parameter:
__iterable: :class: `cpl_query.extension.iterable.Iterable`
index
"""
@@ -42,8 +41,8 @@ class IterableABC(QueryableABC):
def remove(self, _object: object):
r"""Removes element from list
- Parameter
- ---------
+
+ Parameter:
_object: :class:`object`
value
"""
@@ -54,19 +53,19 @@ class IterableABC(QueryableABC):
def remove_at(self, _index: int):
r"""Removes element from list
- Parameter
- ---------
+
+ Parameter:
_object: :class:`object`
value
"""
self._values.pop(_index)
- def to_enumerable(self) -> 'EnumerableABC':
+ def to_enumerable(self) -> "EnumerableABC":
r"""Converts :class: `cpl_query.iterable.iterable_abc.IterableABC` to :class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`
- Returns
- -------
+ Returns:
:class: `cpl_query.enumerable.enumerable_abc.EnumerableABC`
"""
from cpl_query.enumerable.enumerable import Enumerable
+
return Enumerable(self._type, self.to_list())
diff --git a/src/cpl_translation/__init__.py b/src/cpl_translation/__init__.py
index 04defac8..4da3b7f8 100644
--- a/src/cpl_translation/__init__.py
+++ b/src/cpl_translation/__init__.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
"""
-cpl-translation sh-edraft Common Python library Translation
+cpl-translation CPL Translation
~~~~~~~~~~~~~~~~~~~
-sh-edraft Common Python library Python Translation
+CPL translation extension
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
-__title__ = 'cpl_translation'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
-__version__ = '2022.12.1'
+__title__ = "cpl_translation"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
+__version__ = "2023.2.0"
from collections import namedtuple
@@ -25,6 +25,7 @@ from .translate_pipe import TranslatePipe
from .translation_service import TranslationService
from .translation_service_abc import TranslationServiceABC
from .translation_settings import TranslationSettings
+
# build-ignore
@@ -39,16 +40,17 @@ def add_translation(self):
self.add_singleton(TranslationServiceABC, TranslationService)
self.add_transient(PipeABC, TranslatePipe)
except ImportError as e:
- Console.error('cpl-translation is not installed', str(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='12', micro='1')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2023", minor="2", micro="0")
diff --git a/src/cpl_translation/cpl-translation.json b/src/cpl_translation/cpl-translation.json
index d47513f0..d2a9dd9f 100644
--- a/src/cpl_translation/cpl-translation.json
+++ b/src/cpl_translation/cpl-translation.json
@@ -2,24 +2,24 @@
"ProjectSettings": {
"Name": "cpl-translation",
"Version": {
- "Major": "2022",
- "Minor": "12",
- "Micro": "1"
+ "Major": "2023",
+ "Minor": "2",
+ "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",
+ "Description": "CPL Translation",
+ "LongDescription": "CPL translation extension",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022 - 2023",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
- "cpl-core>=2022.12.1"
+ "cpl-core>=2023.2.0"
],
"DevDependencies": [
- "cpl-cli>=2022.12.1"
+ "cpl-cli>=2023.2.0"
],
"PythonVersion": ">=3.10",
"PythonPath": {},
@@ -41,7 +41,8 @@
"PackageData": {
"cpl_translation": [
".cpl/*.py"
- ]},
+ ]
+ },
"ProjectReferences": []
}
}
\ No newline at end of file
diff --git a/src/cpl_translation/translate_pipe.py b/src/cpl_translation/translate_pipe.py
index d520600f..cc1d79a7 100644
--- a/src/cpl_translation/translate_pipe.py
+++ b/src/cpl_translation/translate_pipe.py
@@ -4,7 +4,6 @@ from cpl_translation.translation_service_abc import TranslationServiceABC
class TranslatePipe(PipeABC):
-
def __init__(self, translation: TranslationServiceABC):
self._translation = translation
@@ -12,5 +11,5 @@ class TranslatePipe(PipeABC):
try:
return self._translation.translate(value)
except KeyError as e:
- Console.error(f'Translation {value} not found')
- return ''
+ Console.error(f"Translation {value} not found")
+ return ""
diff --git a/src/cpl_translation/translation_service.py b/src/cpl_translation/translation_service.py
index 83d58d4e..8b635da3 100644
--- a/src/cpl_translation/translation_service.py
+++ b/src/cpl_translation/translation_service.py
@@ -7,12 +7,11 @@ from cpl_translation.translation_settings import TranslationSettings
class TranslationService(TranslationServiceABC):
-
def __init__(self):
self._translation = {}
- self._language = ''
- self._default_language = ''
+ self._language = ""
+ self._default_language = ""
TranslationServiceABC.__init__(self)
@@ -30,11 +29,11 @@ class TranslationService(TranslationServiceABC):
self._language = lang
def load(self, lang: str):
- if not os.path.exists(f'translation/{lang}.json'):
+ if not os.path.exists(f"translation/{lang}.json"):
raise FileNotFoundError()
file_dict = {}
- with open(f'translation/{lang}.json', 'r', encoding='utf-8') as file:
+ with open(f"translation/{lang}.json", "r", encoding="utf-8") as file:
file_dict = json.load(file)
file.close()
@@ -42,7 +41,7 @@ class TranslationService(TranslationServiceABC):
def load_by_settings(self, settings: TranslationSettings):
if settings is None:
- raise Exception(f'{TranslationSettings.__name__} not loaded')
+ raise Exception(f"{TranslationSettings.__name__} not loaded")
self._language = settings.default_language
self._default_language = settings.default_language
@@ -51,9 +50,13 @@ class TranslationService(TranslationServiceABC):
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])
+ 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')
+ raise KeyError(f"Translation {key} not found")
return value
diff --git a/src/cpl_translation/translation_service_abc.py b/src/cpl_translation/translation_service_abc.py
index 5d70f181..91bfa122 100644
--- a/src/cpl_translation/translation_service_abc.py
+++ b/src/cpl_translation/translation_service_abc.py
@@ -4,21 +4,26 @@ from cpl_translation.translation_settings import TranslationSettings
class TranslationServiceABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
+ def set_default_lang(self, lang: str):
+ pass
@abstractmethod
- def set_default_lang(self, lang: str): pass
+ def set_lang(self, lang: str):
+ pass
@abstractmethod
- def set_lang(self, lang: str): pass
+ def load(self, lang: str):
+ pass
@abstractmethod
- def load(self, lang: str): pass
+ def load_by_settings(self, settings: TranslationSettings):
+ pass
@abstractmethod
- def load_by_settings(self, settings: TranslationSettings): pass
-
- @abstractmethod
- def translate(self, key: str) -> str: pass
+ def translate(self, key: str) -> str:
+ pass
diff --git a/src/cpl_translation/translation_settings.py b/src/cpl_translation/translation_settings.py
index 4a2d4c15..e7b17bd9 100644
--- a/src/cpl_translation/translation_settings.py
+++ b/src/cpl_translation/translation_settings.py
@@ -5,12 +5,11 @@ from cpl_core.console import Console
class TranslationSettings(ConfigurationModelABC):
-
def __init__(self):
ConfigurationModelABC.__init__(self)
self._languages = []
- self._default_lang = ''
+ self._default_lang = ""
@property
def languages(self) -> list[str]:
@@ -22,8 +21,8 @@ class TranslationSettings(ConfigurationModelABC):
def from_dict(self, settings: dict):
try:
- self._languages = settings['Languages']
- self._default_lang = settings['DefaultLanguage']
+ self._languages = settings["Languages"]
+ self._default_lang = settings["DefaultLanguage"]
except Exception as e:
- Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
+ Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
diff --git a/tests/custom/async/src/async/__init__.py b/tests/custom/async/src/async/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/async/src/async/__init__.py
+++ b/tests/custom/async/src/async/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/async/src/async/application.py b/tests/custom/async/src/async/application.py
index b2df0250..b8831dd6 100644
--- a/tests/custom/async/src/async/application.py
+++ b/tests/custom/async/src/async/application.py
@@ -5,7 +5,6 @@ from cpl_core.dependency_injection import ServiceProviderABC
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -13,4 +12,4 @@ class Application(ApplicationABC):
pass
async def main(self):
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
diff --git a/tests/custom/async/src/async/main.py b/tests/custom/async/src/async/main.py
index 0cde844e..9fad2348 100644
--- a/tests/custom/async/src/async/main.py
+++ b/tests/custom/async/src/async/main.py
@@ -12,6 +12,6 @@ async def main():
await app.run_async()
-if __name__ == '__main__':
+if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
diff --git a/tests/custom/async/src/async/startup.py b/tests/custom/async/src/async/startup.py
index dadaee3b..54e2bf28 100644
--- a/tests/custom/async/src/async/startup.py
+++ b/tests/custom/async/src/async/startup.py
@@ -5,12 +5,15 @@ from cpl_core.environment import ApplicationEnvironment
class Startup(StartupABC):
-
def __init__(self):
StartupABC.__init__(self)
- async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
+ async def configure_configuration(
+ self, configuration: ConfigurationABC, environment: ApplicationEnvironment
+ ) -> ConfigurationABC:
return configuration
- async def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
+ async def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironment
+ ) -> ServiceProviderABC:
return services.build_service_provider()
diff --git a/tests/custom/async/src/tests/__init__.py b/tests/custom/async/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/async/src/tests/__init__.py
+++ b/tests/custom/async/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/console/main.py b/tests/custom/console/main.py
index dc2fcb5b..1d4d9c07 100644
--- a/tests/custom/console/main.py
+++ b/tests/custom/console/main.py
@@ -3,26 +3,28 @@ from cpl_core.console import Console, ForegroundColorEnum
def test_spinner():
- Console.write_line('test1')
- Console.write_line('test2', 2)
- Console.write_line('test3', 2, 3)
- Console.write_line('test4', 2, 3, 4)
+ Console.write_line("test1")
+ Console.write_line("test2", 2)
+ Console.write_line("test3", 2, 3)
+ Console.write_line("test4", 2, 3, 4)
time.sleep(2)
- Console.write_line('test5')
+ Console.write_line("test5")
def test_console():
- Console.write_line('Hello World')
- Console.write('\nName: ')
- Console.write_line(' Hello', Console.read_line())
+ Console.write_line("Hello World")
+ Console.write("\nName: ")
+ Console.write_line(" Hello", Console.read_line())
Console.clear()
- Console.write_at(5, 5, 'at 5, 5')
- Console.write_at(10, 10, 'at 10, 10')
+ Console.write_at(5, 5, "at 5, 5")
+ Console.write_at(10, 10, "at 10, 10")
-if __name__ == '__main__':
- Console.write_line('Hello World\n')
- Console.spinner('Test:', test_spinner, spinner_foreground_color=ForegroundColorEnum.cyan, text_foreground_color='green')
+if __name__ == "__main__":
+ Console.write_line("Hello World\n")
+ Console.spinner(
+ "Test:", test_spinner, spinner_foreground_color=ForegroundColorEnum.cyan, text_foreground_color="green"
+ )
# opts = [
# 'Option 1',
# 'Option 2',
diff --git a/tests/custom/database/src/application.py b/tests/custom/database/src/application.py
index 1d4cc60d..df7a1628 100644
--- a/tests/custom/database/src/application.py
+++ b/tests/custom/database/src/application.py
@@ -10,7 +10,6 @@ from model.user_repo import UserRepo
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -20,19 +19,19 @@ class Application(ApplicationABC):
self._logger = self._services.get_service(LoggerABC)
def main(self):
- 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}')
+ 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}")
user_repo: UserRepo = self._services.get_service(UserRepoABC)
if len(user_repo.get_users()) == 0:
user_repo.add_test_user()
-
- Console.write_line('Users:')
+
+ Console.write_line("Users:")
for user in user_repo.get_users():
Console.write_line(user.UserId, user.Name, user.City)
- Console.write_line('Cities:')
+ Console.write_line("Cities:")
for city in user_repo.get_cities():
Console.write_line(city.CityId, city.Name, city.ZIP)
diff --git a/tests/custom/database/src/main.py b/tests/custom/database/src/main.py
index 4272c911..76de0f16 100644
--- a/tests/custom/database/src/main.py
+++ b/tests/custom/database/src/main.py
@@ -10,5 +10,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/custom/database/src/model/city_model.py b/tests/custom/database/src/model/city_model.py
index 912a77f7..3616f7e1 100644
--- a/tests/custom/database/src/model/city_model.py
+++ b/tests/custom/database/src/model/city_model.py
@@ -2,46 +2,53 @@ from cpl_core.database import TableABC
class CityModel(TableABC):
-
- def __init__(self, name: str, zip_code: str, id = 0):
+ def __init__(self, name: str, zip_code: str, id=0):
self.CityId = id
self.Name = name
self.ZIP = zip_code
-
+
@staticmethod
def get_create_string() -> str:
- return str(f"""
+ return str(
+ f"""
CREATE TABLE IF NOT EXISTS `City` (
`CityId` INT(30) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(64) NOT NULL,
`ZIP` VARCHAR(5) NOT NULL,
PRIMARY KEY(`CityId`)
);
- """)
-
+ """
+ )
+
@property
def insert_string(self) -> str:
- return str(f"""
+ return str(
+ f"""
INSERT INTO `City` (
`Name`, `ZIP`
) VALUES (
'{self.Name}',
'{self.ZIP}'
);
- """)
-
+ """
+ )
+
@property
def udpate_string(self) -> str:
- return str(f"""
+ return str(
+ f"""
UPDATE `City`
SET `Name` = '{self.Name}',
`ZIP` = '{self.ZIP}',
WHERE `CityId` = {self.Id};
- """)
-
+ """
+ )
+
@property
def delete_string(self) -> str:
- return str(f"""
+ return str(
+ f"""
DELETE FROM `City`
WHERE `CityId` = {self.Id};
- """)
+ """
+ )
diff --git a/tests/custom/database/src/model/db_context.py b/tests/custom/database/src/model/db_context.py
index d3600643..0d6fc017 100644
--- a/tests/custom/database/src/model/db_context.py
+++ b/tests/custom/database/src/model/db_context.py
@@ -3,6 +3,5 @@ from cpl_core.database.context import DatabaseContext
class DBContext(DatabaseContext):
-
def __init__(self, db_settings: DatabaseSettings):
DatabaseContext.__init__(self, db_settings)
diff --git a/tests/custom/database/src/model/user_model.py b/tests/custom/database/src/model/user_model.py
index 7cb992ba..3c28542d 100644
--- a/tests/custom/database/src/model/user_model.py
+++ b/tests/custom/database/src/model/user_model.py
@@ -4,8 +4,7 @@ from .city_model import CityModel
class UserModel(TableABC):
-
- def __init__(self, name: str, city: CityModel, id = 0):
+ def __init__(self, name: str, city: CityModel, id=0):
self.UserId = id
self.Name = name
self.CityId = city.CityId if city is not None else 0
@@ -13,7 +12,8 @@ class UserModel(TableABC):
@staticmethod
def get_create_string() -> str:
- return str(f"""
+ return str(
+ f"""
CREATE TABLE IF NOT EXISTS `User` (
`UserId` INT(30) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(64) NOT NULL,
@@ -21,30 +21,37 @@ class UserModel(TableABC):
FOREIGN KEY (`UserId`) REFERENCES City(`CityId`),
PRIMARY KEY(`UserId`)
);
- """)
+ """
+ )
@property
def insert_string(self) -> str:
- return str(f"""
+ return str(
+ f"""
INSERT INTO `User` (
`Name`
) VALUES (
'{self.Name}'
);
- """)
+ """
+ )
@property
def udpate_string(self) -> str:
- return str(f"""
+ return str(
+ f"""
UPDATE `User`
SET `Name` = '{self.Name}',
`CityId` = {self.CityId},
WHERE `UserId` = {self.UserId};
- """)
+ """
+ )
@property
def delete_string(self) -> str:
- return str(f"""
+ return str(
+ f"""
DELETE FROM `User`
WHERE `UserId` = {self.UserId};
- """)
+ """
+ )
diff --git a/tests/custom/database/src/model/user_repo.py b/tests/custom/database/src/model/user_repo.py
index 2f71bb11..8a05a0cd 100644
--- a/tests/custom/database/src/model/user_repo.py
+++ b/tests/custom/database/src/model/user_repo.py
@@ -7,36 +7,35 @@ from .user_repo_abc import UserRepoABC
class UserRepo(UserRepoABC):
-
def __init__(self, db_context: DatabaseContextABC):
UserRepoABC.__init__(self)
self._db_context: DatabaseContextABC = db_context
def add_test_user(self):
- city = CityModel('Haren', '49733')
- city2 = CityModel('Meppen', '49716')
+ city = CityModel("Haren", "49733")
+ city2 = CityModel("Meppen", "49716")
self._db_context.cursor.execute(city2.insert_string)
- user = UserModel('TestUser', city)
+ user = UserModel("TestUser", city)
self._db_context.cursor.execute(user.insert_string)
self._db_context.save_changes()
def get_users(self) -> list[UserModel]:
- users = []
- results = self._db_context.select('SELECT * FROM `User`')
+ users = []
+ results = self._db_context.select("SELECT * FROM `User`")
for result in results:
- users.append(UserModel(result[1], self.get_city_by_id(result[2]), id = result[0]))
+ users.append(UserModel(result[1], self.get_city_by_id(result[2]), id=result[0]))
return users
def get_cities(self) -> list[CityModel]:
- cities = []
- results = self._db_context.select('SELECT * FROM `City`')
+ cities = []
+ results = self._db_context.select("SELECT * FROM `City`")
for result in results:
- cities.append(CityModel(result[1], result[2], id = result[0]))
+ cities.append(CityModel(result[1], result[2], id=result[0]))
return cities
-
+
def get_city_by_id(self, id: int) -> CityModel:
if id is None:
return None
- result = self._db_context.select(f'SELECT * FROM `City` WHERE `Id` = {id}')
- return CityModel(result[1], result[2], id = result[0])
+ result = self._db_context.select(f"SELECT * FROM `City` WHERE `Id` = {id}")
+ return CityModel(result[1], result[2], id=result[0])
diff --git a/tests/custom/database/src/model/user_repo_abc.py b/tests/custom/database/src/model/user_repo_abc.py
index 9ffb7a38..0e4d3abe 100644
--- a/tests/custom/database/src/model/user_repo_abc.py
+++ b/tests/custom/database/src/model/user_repo_abc.py
@@ -5,15 +5,18 @@ from .user_model import UserModel
class UserRepoABC(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
@abstractmethod
- def __init__(self): pass
+ def get_users(self) -> list[UserModel]:
+ pass
@abstractmethod
- def get_users(self) -> list[UserModel]: pass
-
+ def get_cities(self) -> list[CityModel]:
+ pass
+
@abstractmethod
- def get_cities(self) -> list[CityModel]: pass
-
- @abstractmethod
- def get_city_by_id(self, id: int) -> CityModel: pass
+ def get_city_by_id(self, id: int) -> CityModel:
+ pass
diff --git a/tests/custom/database/src/startup.py b/tests/custom/database/src/startup.py
index 9ceecabf..0fa0daec 100644
--- a/tests/custom/database/src/startup.py
+++ b/tests/custom/database/src/startup.py
@@ -1,8 +1,7 @@
from cpl_core.application import StartupABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.database import DatabaseSettings
-from cpl_core.dependency_injection import (ServiceCollectionABC,
- ServiceProviderABC)
+from cpl_core.dependency_injection import ServiceCollectionABC, ServiceProviderABC
from cpl_core.environment import ApplicationEnvironmentABC
from cpl_core.logging import Logger, LoggerABC
@@ -12,25 +11,28 @@ from model.user_repo_abc import UserRepoABC
class Startup(StartupABC):
-
def __init__(self):
StartupABC.__init__(self)
-
+
self._configuration = None
- def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC) -> ConfigurationABC:
- configuration.add_environment_variables('PYTHON_')
- configuration.add_environment_variables('CPL_')
+ def configure_configuration(
+ self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC
+ ) -> ConfigurationABC:
+ configuration.add_environment_variables("PYTHON_")
+ configuration.add_environment_variables("CPL_")
configuration.parse_console_arguments()
- configuration.add_json_file(f'appsettings.json')
- configuration.add_json_file(f'appsettings.{configuration.environment.environment_name}.json')
- configuration.add_json_file(f'appsettings.{configuration.environment.host_name}.json', optional=True)
+ configuration.add_json_file(f"appsettings.json")
+ configuration.add_json_file(f"appsettings.{configuration.environment.environment_name}.json")
+ configuration.add_json_file(f"appsettings.{configuration.environment.host_name}.json", optional=True)
self._configuration = configuration
-
+
return configuration
- def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironmentABC) -> ServiceProviderABC:
+ def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironmentABC
+ ) -> ServiceProviderABC:
# Create and connect to database
db_settings: DatabaseSettings = self._configuration.get_configuration(DatabaseSettings)
services.add_db_context(DBContext, db_settings)
diff --git a/tests/custom/database/src/tests/__init__.py b/tests/custom/database/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/database/src/tests/__init__.py
+++ b/tests/custom/database/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/di/src/di/__init__.py b/tests/custom/di/src/di/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/di/src/di/__init__.py
+++ b/tests/custom/di/src/di/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/di/src/di/application.py b/tests/custom/di/src/di/application.py
index dd12be54..b30a2281 100644
--- a/tests/custom/di/src/di/application.py
+++ b/tests/custom/di/src/di/application.py
@@ -11,7 +11,6 @@ from di.tester import Tester
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -24,20 +23,20 @@ class Application(ApplicationABC):
def main(self):
with self._services.create_scope() as scope:
- Console.write_line('Scope1')
+ Console.write_line("Scope1")
ts: TestService = scope.service_provider.get_service(TestService)
ts.run()
dit: DITesterService = scope.service_provider.get_service(DITesterService)
dit.run()
with self._services.create_scope() as scope:
- Console.write_line('Scope2')
+ Console.write_line("Scope2")
ts: TestService = scope.service_provider.get_service(TestService)
ts.run()
dit: DITesterService = scope.service_provider.get_service(DITesterService)
dit.run()
- Console.write_line('Global')
+ Console.write_line("Global")
self._part_of_scoped()
StaticTest.test()
diff --git a/tests/custom/di/src/di/di_tester_service.py b/tests/custom/di/src/di/di_tester_service.py
index 3c4f9a5d..cfb60ea8 100644
--- a/tests/custom/di/src/di/di_tester_service.py
+++ b/tests/custom/di/src/di/di_tester_service.py
@@ -3,10 +3,9 @@ from di.test_service import TestService
class DITesterService:
-
def __init__(self, ts: TestService):
self._ts = ts
-
+
def run(self):
- Console.write_line('DIT: ')
+ Console.write_line("DIT: ")
self._ts.run()
diff --git a/tests/custom/di/src/di/main.py b/tests/custom/di/src/di/main.py
index 4289aee6..762040ed 100644
--- a/tests/custom/di/src/di/main.py
+++ b/tests/custom/di/src/di/main.py
@@ -10,5 +10,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/custom/di/src/di/startup.py b/tests/custom/di/src/di/startup.py
index cff3eac0..a6ca0b23 100644
--- a/tests/custom/di/src/di/startup.py
+++ b/tests/custom/di/src/di/startup.py
@@ -11,19 +11,22 @@ from di.tester import Tester
class Startup(StartupABC):
-
def __init__(self):
StartupABC.__init__(self)
- def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
+ def configure_configuration(
+ self, configuration: ConfigurationABC, environment: ApplicationEnvironment
+ ) -> ConfigurationABC:
return configuration
- def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
+ def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironment
+ ) -> ServiceProviderABC:
services.add_scoped(TestService)
services.add_scoped(DITesterService)
services.add_singleton(TestABC, Test1Service)
services.add_singleton(TestABC, Test2Service)
services.add_singleton(Tester)
-
+
return services.build_service_provider()
diff --git a/tests/custom/di/src/di/static_test.py b/tests/custom/di/src/di/static_test.py
index 8e500b0e..53154ab7 100644
--- a/tests/custom/di/src/di/static_test.py
+++ b/tests/custom/di/src/di/static_test.py
@@ -4,7 +4,6 @@ from di.test_service import TestService
class StaticTest:
-
@staticmethod
@ServiceProvider.inject
def test(services: ServiceProviderABC, config: ConfigurationABC, t1: TestService):
diff --git a/tests/custom/di/src/di/test1_service.py b/tests/custom/di/src/di/test1_service.py
index 93e39d8b..b768d2e3 100644
--- a/tests/custom/di/src/di/test1_service.py
+++ b/tests/custom/di/src/di/test1_service.py
@@ -5,9 +5,8 @@ from di.test_abc import TestABC
class Test1Service(TestABC):
-
def __init__(self):
TestABC.__init__(self, String.random_string(string.ascii_lowercase, 8))
def run(self):
- Console.write_line(f'Im {self._name}')
+ Console.write_line(f"Im {self._name}")
diff --git a/tests/custom/di/src/di/test2_service.py b/tests/custom/di/src/di/test2_service.py
index da27db89..d1b0c50b 100644
--- a/tests/custom/di/src/di/test2_service.py
+++ b/tests/custom/di/src/di/test2_service.py
@@ -5,9 +5,8 @@ from di.test_abc import TestABC
class Test2Service(TestABC):
-
def __init__(self):
TestABC.__init__(self, String.random_string(string.ascii_lowercase, 8))
def run(self):
- Console.write_line(f'Im {self._name}')
+ Console.write_line(f"Im {self._name}")
diff --git a/tests/custom/di/src/di/test_abc.py b/tests/custom/di/src/di/test_abc.py
index 92f1aa66..050576e0 100644
--- a/tests/custom/di/src/di/test_abc.py
+++ b/tests/custom/di/src/di/test_abc.py
@@ -2,9 +2,8 @@ from abc import ABC
class TestABC(ABC):
-
def __init__(self, name: str):
self._name = name
def __repr__(self):
- return f'<{type(self).__name__} {self._name}>'
+ return f"<{type(self).__name__} {self._name}>"
diff --git a/tests/custom/di/src/di/test_service.py b/tests/custom/di/src/di/test_service.py
index 895b658f..2c588536 100644
--- a/tests/custom/di/src/di/test_service.py
+++ b/tests/custom/di/src/di/test_service.py
@@ -5,9 +5,8 @@ from cpl_core.utils.string import String
class TestService:
-
def __init__(self):
self._name = String.random_string(string.ascii_lowercase, 8)
def run(self):
- Console.write_line(f'Im {self._name}')
+ Console.write_line(f"Im {self._name}")
diff --git a/tests/custom/di/src/di/tester.py b/tests/custom/di/src/di/tester.py
index a43097c0..a0d5200e 100644
--- a/tests/custom/di/src/di/tester.py
+++ b/tests/custom/di/src/di/tester.py
@@ -3,7 +3,6 @@ from di.test_abc import TestABC
class Tester:
-
def __init__(self, t1: TestABC, t2: TestABC, t3: list[TestABC]):
- Console.write_line('Tester:')
+ Console.write_line("Tester:")
Console.write_line(t1, t2, t3)
diff --git a/tests/custom/di/src/tests/__init__.py b/tests/custom/di/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/di/src/tests/__init__.py
+++ b/tests/custom/di/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/discord/src/discord_bot/__init__.py b/tests/custom/discord/src/discord_bot/__init__.py
index b91b4151..8326349e 100644
--- a/tests/custom/discord/src/discord_bot/__init__.py
+++ b/tests/custom/discord/src/discord_bot/__init__.py
@@ -11,16 +11,16 @@ discord-bot
"""
-__title__ = 'discord_bot'
-__author__ = ''
-__license__ = ''
-__copyright__ = 'Copyright (c) '
-__version__ = '0.0.0'
+__title__ = "discord_bot"
+__author__ = ""
+__license__ = ""
+__copyright__ = "Copyright (c) "
+__version__ = "0.0.0"
from collections import namedtuple
-# imports:
+# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='0', minor='0', micro='0')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="0", minor="0", micro="0")
diff --git a/tests/custom/discord/src/discord_bot/application.py b/tests/custom/discord/src/discord_bot/application.py
index 181ce934..206b19d7 100644
--- a/tests/custom/discord/src/discord_bot/application.py
+++ b/tests/custom/discord/src/discord_bot/application.py
@@ -10,7 +10,6 @@ from cpl_discord.service.discord_bot_service_abc import DiscordBotServiceABC
class Application(DiscordBotApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -23,18 +22,18 @@ class Application(DiscordBotApplicationABC):
async def main(self):
try:
- self._logger.debug(__name__, f'Starting...\n')
- self._logger.trace(__name__, f'Try to start {DiscordBotService.__name__}')
+ self._logger.debug(__name__, f"Starting...\n")
+ self._logger.trace(__name__, f"Try to start {DiscordBotService.__name__}")
await self._bot.start_async()
except Exception as e:
- self._logger.error(__name__, 'Start failed', e)
+ self._logger.error(__name__, "Start failed", e)
async def stop_async(self):
try:
- self._logger.trace(__name__, f'Try to stop {DiscordBotService.__name__}')
+ self._logger.trace(__name__, f"Try to stop {DiscordBotService.__name__}")
await self._bot.close()
- self._logger.trace(__name__, f'Stopped {DiscordBotService.__name__}')
+ self._logger.trace(__name__, f"Stopped {DiscordBotService.__name__}")
except Exception as e:
- self._logger.error(__name__, 'stop failed', e)
+ self._logger.error(__name__, "stop failed", e)
Console.write_line()
diff --git a/tests/custom/discord/src/discord_bot/main.py b/tests/custom/discord/src/discord_bot/main.py
index bb67168b..dd994d9a 100644
--- a/tests/custom/discord/src/discord_bot/main.py
+++ b/tests/custom/discord/src/discord_bot/main.py
@@ -8,7 +8,6 @@ from discord_bot.startup import Startup
class Program:
-
def __init__(self):
self._app: Optional[Application] = None
@@ -22,7 +21,7 @@ class Program:
await self._app.stop_async()
-if __name__ == '__main__':
+if __name__ == "__main__":
program = Program()
try:
asyncio.run(program.main())
diff --git a/tests/custom/discord/src/discord_bot/startup.py b/tests/custom/discord/src/discord_bot/startup.py
index 5108e27c..da90795b 100644
--- a/tests/custom/discord/src/discord_bot/startup.py
+++ b/tests/custom/discord/src/discord_bot/startup.py
@@ -12,18 +12,21 @@ from modules.hello_world.purge_command import PurgeCommand
class Startup(StartupABC):
-
def __init__(self):
StartupABC.__init__(self)
- def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
- configuration.add_json_file('appsettings.json', optional=False)
- configuration.add_environment_variables('CPL_')
- configuration.add_environment_variables('DISCORD_')
+ def configure_configuration(
+ self, configuration: ConfigurationABC, environment: ApplicationEnvironment
+ ) -> ConfigurationABC:
+ configuration.add_json_file("appsettings.json", optional=False)
+ configuration.add_environment_variables("CPL_")
+ configuration.add_environment_variables("DISCORD_")
return configuration
- def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
+ def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironment
+ ) -> ServiceProviderABC:
services.add_logging()
services.add_discord()
dc_collection = get_discord_collection(services)
diff --git a/tests/custom/discord/src/modules/hello_world/__init__.py b/tests/custom/discord/src/modules/hello_world/__init__.py
index c576f0a0..5394fcb8 100644
--- a/tests/custom/discord/src/modules/hello_world/__init__.py
+++ b/tests/custom/discord/src/modules/hello_world/__init__.py
@@ -11,16 +11,16 @@ discord-bot
"""
-__title__ = 'modules.hello_world'
-__author__ = ''
-__license__ = ''
-__copyright__ = 'Copyright (c) '
-__version__ = '0.0.0'
+__title__ = "modules.hello_world"
+__author__ = ""
+__license__ = ""
+__copyright__ = "Copyright (c) "
+__version__ = "0.0.0"
from collections import namedtuple
-# imports:
+# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='0', minor='0', micro='0')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="0", minor="0", micro="0")
diff --git a/tests/custom/discord/src/modules/hello_world/on_ready_event.py b/tests/custom/discord/src/modules/hello_world/on_ready_event.py
index d9a2fd5d..a694af46 100644
--- a/tests/custom/discord/src/modules/hello_world/on_ready_event.py
+++ b/tests/custom/discord/src/modules/hello_world/on_ready_event.py
@@ -6,32 +6,33 @@ from cpl_discord.service.discord_bot_service_abc import DiscordBotServiceABC
class OnReadyEvent(OnReadyABC):
-
def __init__(self, logger: LoggerABC, bot: DiscordBotServiceABC):
OnReadyABC.__init__(self)
self._logger = logger
self._bot = bot
def _log(self, _t: str, _o: object, _type: type = None):
- self._logger.debug(__name__, f'{_t} {_o} {_type}')
+ self._logger.debug(__name__, f"{_t} {_o} {_type}")
async def on_ready(self):
- self._logger.info(__name__, 'Hello World')
+ self._logger.info(__name__, "Hello World")
for g in self._bot.guilds:
- self._log('-Guild', g, type(g))
+ self._log("-Guild", g, type(g))
for r in g.roles:
- self._log('--Role', r, type(r))
+ self._log("--Role", r, type(r))
for rm in r.members:
- self._log('---Rolemember', rm, type(rm))
+ self._log("---Rolemember", rm, type(rm))
for m in g.members:
- self._log('--Member', m, type(m))
+ self._log("--Member", m, type(m))
for mr in m.roles:
- self._log('--Memberole', mr, type(mr))
+ self._log("--Memberole", mr, type(mr))
for rm in mr.members:
- self._log('---Rolemember', rm, type(rm))
+ self._log("---Rolemember", rm, type(rm))
select = self._bot.guilds.select(lambda guild: (guild.name, guild.id))
- self._logger.warn(__name__, f'Does cpl.query select work? {select}')
- select_many = self._bot.guilds.select_many(lambda guild: guild.roles).where(lambda role: role.name == "Tester").first()
- self._logger.warn(__name__, f'Does cpl.query select_many work? {select_many}')
+ self._logger.warn(__name__, f"Does cpl.query select work? {select}")
+ select_many = (
+ self._bot.guilds.select_many(lambda guild: guild.roles).where(lambda role: role.name == "Tester").first()
+ )
+ self._logger.warn(__name__, f"Does cpl.query select_many work? {select_many}")
diff --git a/tests/custom/discord/src/modules/hello_world/on_ready_test_event.py b/tests/custom/discord/src/modules/hello_world/on_ready_test_event.py
index 79893536..c189654c 100644
--- a/tests/custom/discord/src/modules/hello_world/on_ready_test_event.py
+++ b/tests/custom/discord/src/modules/hello_world/on_ready_test_event.py
@@ -3,10 +3,9 @@ from cpl_discord.events.on_ready_abc import OnReadyABC
class OnReadyTestEvent(OnReadyABC):
-
def __init__(self, logger: LoggerABC):
OnReadyABC.__init__(self)
self._logger = logger
async def on_ready(self):
- self._logger.info(__name__, 'Test second on ready')
+ self._logger.info(__name__, "Test second on ready")
diff --git a/tests/custom/discord/src/modules/hello_world/ping_command.py b/tests/custom/discord/src/modules/hello_world/ping_command.py
index 8d2468b7..326ccf2c 100644
--- a/tests/custom/discord/src/modules/hello_world/ping_command.py
+++ b/tests/custom/discord/src/modules/hello_world/ping_command.py
@@ -7,22 +7,21 @@ from cpl_discord.service.discord_bot_service_abc import DiscordBotServiceABC
class PingCommand(DiscordCommandABC):
-
def __init__(
- self,
- logger: LoggerABC,
- bot: DiscordBotServiceABC,
+ self,
+ logger: LoggerABC,
+ bot: DiscordBotServiceABC,
):
DiscordCommandABC.__init__(self)
self._logger = logger
self._bot = bot
- self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
+ self._logger.trace(__name__, f"Loaded command service: {type(self).__name__}")
@commands.hybrid_command()
async def ping(self, ctx: Context):
- self._logger.debug(__name__, f'Received command ping {ctx}')
- self._logger.info(__name__, f'Bot name {self._bot.user.name}')
- self._logger.trace(__name__, f'Finished ping command')
- await ctx.send('Pong')
+ self._logger.debug(__name__, f"Received command ping {ctx}")
+ self._logger.info(__name__, f"Bot name {self._bot.user.name}")
+ self._logger.trace(__name__, f"Finished ping command")
+ await ctx.send("Pong")
diff --git a/tests/custom/discord/src/modules/hello_world/purge_command.py b/tests/custom/discord/src/modules/hello_world/purge_command.py
index 037543f5..d3f612e7 100644
--- a/tests/custom/discord/src/modules/hello_world/purge_command.py
+++ b/tests/custom/discord/src/modules/hello_world/purge_command.py
@@ -7,25 +7,24 @@ from cpl_discord.service.discord_bot_service_abc import DiscordBotServiceABC
class PurgeCommand(DiscordCommandABC):
-
def __init__(
- self,
- logger: LoggerABC,
- bot: DiscordBotServiceABC,
+ self,
+ logger: LoggerABC,
+ bot: DiscordBotServiceABC,
):
DiscordCommandABC.__init__(self)
self._logger = logger
self._bot = bot
- self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
+ self._logger.trace(__name__, f"Loaded command service: {type(self).__name__}")
@commands.hybrid_command()
async def purge(self, ctx: Context):
- self._logger.debug(__name__, f'Received command ping {ctx}')
- self._logger.info(__name__, f'Bot name {self._bot.user.name}')
- self._logger.trace(__name__, f'Finished ping command')
+ self._logger.debug(__name__, f"Received command ping {ctx}")
+ self._logger.info(__name__, f"Bot name {self._bot.user.name}")
+ self._logger.trace(__name__, f"Finished ping command")
await ctx.channel.purge()
if ctx.interaction is None:
return
- await ctx.interaction.response.send_message('Purged this channel xD')
+ await ctx.interaction.response.send_message("Purged this channel xD")
diff --git a/tests/custom/discord/src/tests/__init__.py b/tests/custom/discord/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/discord/src/tests/__init__.py
+++ b/tests/custom/discord/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/general/.cpl/schematic_custom.py b/tests/custom/general/.cpl/schematic_custom.py
index dd951a69..4c747ab5 100644
--- a/tests/custom/general/.cpl/schematic_custom.py
+++ b/tests/custom/general/.cpl/schematic_custom.py
@@ -1,10 +1,7 @@
-
-
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
class Custom(GenerateSchematicABC):
-
def __init__(self, *args: str):
GenerateSchematicABC.__init__(self, *args)
@@ -20,8 +17,4 @@ class Custom(GenerateSchematicABC):
@classmethod
def register(cls):
- GenerateSchematicABC.register(
- cls,
- 'custom',
- ['cm', 'CM']
- )
+ GenerateSchematicABC.register(cls, "custom", ["cm", "CM"])
diff --git a/tests/custom/general/src/general/application.py b/tests/custom/general/src/general/application.py
index 0c6e1306..16ff983d 100644
--- a/tests/custom/general/src/general/application.py
+++ b/tests/custom/general/src/general/application.py
@@ -12,7 +12,6 @@ from test_service import TestService
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
self._logger: Optional[LoggerABC] = None
@@ -20,12 +19,12 @@ class Application(ApplicationABC):
def test_send_mail(self):
mail = EMail()
- mail.add_header('Mime-Version: 1.0')
- mail.add_header('Content-Type: text/plain; charset=utf-8')
- mail.add_header('Content-Transfer-Encoding: quoted-printable')
- mail.add_receiver('sven.heidemann@sh-edraft.de')
- mail.subject = f'Test - {self._configuration.environment.host_name}'
- mail.body = 'Dies ist ein Test :D'
+ mail.add_header("Mime-Version: 1.0")
+ mail.add_header("Content-Type: text/plain; charset=utf-8")
+ mail.add_header("Content-Transfer-Encoding: quoted-printable")
+ mail.add_receiver("sven.heidemann@sh-edraft.de")
+ mail.subject = f"Test - {self._configuration.environment.host_name}"
+ mail.body = "Dies ist ein Test :D"
self._mailer.send_mail(mail)
@staticmethod
@@ -39,23 +38,23 @@ class Application(ApplicationABC):
def main(self):
self._configuration.parse_console_arguments(self._services)
- if self._configuration.environment.application_name != '':
- self._logger.header(f'{self._configuration.environment.application_name}:')
- self._logger.debug(__name__, f'Args: {self._configuration.additional_arguments}')
- 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}')
- Console.spinner('Test', self._wait, 2, spinner_foreground_color='red')
+ if self._configuration.environment.application_name != "":
+ self._logger.header(f"{self._configuration.environment.application_name}:")
+ self._logger.debug(__name__, f"Args: {self._configuration.additional_arguments}")
+ 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}")
+ Console.spinner("Test", self._wait, 2, spinner_foreground_color="red")
test: TestService = self._services.get_service(TestService)
ip_pipe: IPAddressPipe = self._services.get_service(IPAddressPipe)
test.run()
test2: TestService = self._services.get_service(TestService)
ip_pipe2: IPAddressPipe = self._services.get_service(IPAddressPipe)
- Console.write_line(f'DI working: {test == test2 and ip_pipe != ip_pipe2}')
+ Console.write_line(f"DI working: {test == test2 and ip_pipe != ip_pipe2}")
Console.write_line(self._services.get_service(LoggerABC))
scope = self._services.create_scope()
- Console.write_line('scope', scope)
+ Console.write_line("scope", scope)
with self._services.create_scope() as s:
- Console.write_line('with scope', s)
+ Console.write_line("with scope", s)
self.test_send_mail()
diff --git a/tests/custom/general/src/general/arguments/__init__.py b/tests/custom/general/src/general/arguments/__init__.py
index a1515376..b3a4b225 100644
--- a/tests/custom/general/src/general/arguments/__init__.py
+++ b/tests/custom/general/src/general/arguments/__init__.py
@@ -11,16 +11,16 @@ sh-edraft Common Python library
"""
-__title__ = 'general.arguments'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
-__version__ = '2021.4.1'
+__title__ = "general.arguments"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2021 sh-edraft.de"
+__version__ = "2021.4.1"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2021', minor='04', micro='01')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2021", minor="04", micro="01")
diff --git a/tests/custom/general/src/general/arguments/generate_argument.py b/tests/custom/general/src/general/arguments/generate_argument.py
index 1114706b..2e23d017 100644
--- a/tests/custom/general/src/general/arguments/generate_argument.py
+++ b/tests/custom/general/src/general/arguments/generate_argument.py
@@ -4,12 +4,11 @@ from cpl_core.environment import ApplicationEnvironmentABC
class GenerateArgument(ArgumentExecutableABC):
-
def __init__(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
ArgumentExecutableABC.__init__(self)
self._config = config
self._env = env
def execute(self, args: list[str]):
- Console.error('Generate:')
+ Console.error("Generate:")
Console.write_line(args, self._env.environment_name)
diff --git a/tests/custom/general/src/general/arguments/install_argument.py b/tests/custom/general/src/general/arguments/install_argument.py
index b99c7bd3..5fc13c5a 100644
--- a/tests/custom/general/src/general/arguments/install_argument.py
+++ b/tests/custom/general/src/general/arguments/install_argument.py
@@ -3,9 +3,8 @@ from cpl_core.console import Console
class InstallArgument(ArgumentExecutableABC):
-
def __init__(self):
ArgumentExecutableABC.__init__(self)
def execute(self, args: list[str]):
- Console.write_line('Install:', args)
+ Console.write_line("Install:", args)
diff --git a/tests/custom/general/src/general/db/__init__.py b/tests/custom/general/src/general/db/__init__.py
index 099d021f..f5809455 100644
--- a/tests/custom/general/src/general/db/__init__.py
+++ b/tests/custom/general/src/general/db/__init__.py
@@ -11,16 +11,16 @@ sh-edraft Common Python library
"""
-__title__ = 'general.db'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
-__version__ = '2021.4.1'
+__title__ = "general.db"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2020 - 2021 sh-edraft.de"
+__version__ = "2021.4.1"
from collections import namedtuple
# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2021', minor='04', micro='01')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2021", minor="04", micro="01")
diff --git a/tests/custom/general/src/general/main.py b/tests/custom/general/src/general/main.py
index 369279de..5426023b 100644
--- a/tests/custom/general/src/general/main.py
+++ b/tests/custom/general/src/general/main.py
@@ -15,5 +15,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/custom/general/src/general/parameter_startup.py b/tests/custom/general/src/general/parameter_startup.py
index a8a7d08e..ddda6469 100644
--- a/tests/custom/general/src/general/parameter_startup.py
+++ b/tests/custom/general/src/general/parameter_startup.py
@@ -7,25 +7,32 @@ from cpl_core.environment import ApplicationEnvironmentABC
class ParameterStartup(StartupExtensionABC):
-
def __init__(self):
StartupExtensionABC.__init__(self)
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'generate', ['g', 'G'], GenerateArgument) \
- .add_console_argument(ArgumentTypeEnum.Variable, '', 'abc', ['a', 'A'], ' ') \
- .add_console_argument(ArgumentTypeEnum.Variable, '', 'class', ['c', 'C'], ' ') \
- .add_console_argument(ArgumentTypeEnum.Variable, '', 'enum', ['e', 'E'], ' ') \
- .add_console_argument(ArgumentTypeEnum.Variable, '', 'service', ['s', 'S'], ' ') \
- .add_console_argument(ArgumentTypeEnum.Variable, '', 'settings', ['st', 'ST'], ' ') \
- .add_console_argument(ArgumentTypeEnum.Variable, '', 'thread', ['t', 'T'], ' ') \
- .add_console_argument(ArgumentTypeEnum.Variable, '-', 'o', ['o', 'O'], '=') \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V'])
- config.create_console_argument(ArgumentTypeEnum.Executable, '', 'install', ['i', 'I'], InstallArgument) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
- .add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "generate", ["g", "G"], GenerateArgument
+ ).add_console_argument(ArgumentTypeEnum.Variable, "", "abc", ["a", "A"], " ").add_console_argument(
+ ArgumentTypeEnum.Variable, "", "class", ["c", "C"], " "
+ ).add_console_argument(
+ ArgumentTypeEnum.Variable, "", "enum", ["e", "E"], " "
+ ).add_console_argument(
+ ArgumentTypeEnum.Variable, "", "service", ["s", "S"], " "
+ ).add_console_argument(
+ ArgumentTypeEnum.Variable, "", "settings", ["st", "ST"], " "
+ ).add_console_argument(
+ ArgumentTypeEnum.Variable, "", "thread", ["t", "T"], " "
+ ).add_console_argument(
+ ArgumentTypeEnum.Variable, "-", "o", ["o", "O"], "="
+ ).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "virtual", ["v", "V"]
+ )
+ config.create_console_argument(
+ ArgumentTypeEnum.Executable, "", "install", ["i", "I"], InstallArgument
+ ).add_console_argument(ArgumentTypeEnum.Flag, "--", "virtual", ["v", "V"]).add_console_argument(
+ ArgumentTypeEnum.Flag, "--", "simulate", ["s", "S"]
+ )
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
- services \
- .add_transient(GenerateArgument) \
- .add_singleton(InstallArgument)
+ services.add_transient(GenerateArgument).add_singleton(InstallArgument)
diff --git a/tests/custom/general/src/general/startup.py b/tests/custom/general/src/general/startup.py
index e4b7d4f5..655c441c 100644
--- a/tests/custom/general/src/general/startup.py
+++ b/tests/custom/general/src/general/startup.py
@@ -9,16 +9,15 @@ from test_service import TestService
class Startup(StartupABC):
-
def __init__(self):
StartupABC.__init__(self)
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC) -> ConfigurationABC:
- config.add_environment_variables('PYTHON_')
- config.add_environment_variables('CPLT_')
- 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)
+ config.add_environment_variables("PYTHON_")
+ config.add_environment_variables("CPLT_")
+ 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)
return config
diff --git a/tests/custom/general/src/general/test_extension.py b/tests/custom/general/src/general/test_extension.py
index be766d33..48f783b6 100644
--- a/tests/custom/general/src/general/test_extension.py
+++ b/tests/custom/general/src/general/test_extension.py
@@ -5,9 +5,8 @@ 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')
+ Console.write_line("Hello World from App Extension")
diff --git a/tests/custom/general/src/general/test_service.py b/tests/custom/general/src/general/test_service.py
index 3274b8dc..4933a7d0 100644
--- a/tests/custom/general/src/general/test_service.py
+++ b/tests/custom/general/src/general/test_service.py
@@ -4,13 +4,11 @@ from cpl_core.pipes.ip_address_pipe import IPAddressPipe
class TestService:
-
def __init__(self, provider: ServiceProviderABC, ip_pipe: IPAddressPipe):
-
self._provider = provider
self._ip_pipe = ip_pipe
def run(self):
- Console.write_line('Hello World!', self._provider)
+ Console.write_line("Hello World!", self._provider)
ip = [192, 168, 178, 30]
Console.write_line(ip, self._ip_pipe.transform(ip))
diff --git a/tests/custom/general/src/general/test_startup_extension.py b/tests/custom/general/src/general/test_startup_extension.py
index 87b179ea..036cb77b 100644
--- a/tests/custom/general/src/general/test_startup_extension.py
+++ b/tests/custom/general/src/general/test_startup_extension.py
@@ -6,12 +6,11 @@ from cpl_core.environment import ApplicationEnvironmentABC
class TestStartupExtension(StartupExtensionABC):
-
def __init__(self):
StartupExtensionABC.__init__(self)
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
- Console.write_line('config')
+ Console.write_line("config")
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
- Console.write_line('services')
+ Console.write_line("services")
diff --git a/tests/custom/general/test/custom.py b/tests/custom/general/test/custom.py
index 16baa336..1a833fc1 100644
--- a/tests/custom/general/test/custom.py
+++ b/tests/custom/general/test/custom.py
@@ -1,4 +1,3 @@
class Custom:
-
def __init__(self):
- print('hello')
+ print("hello")
diff --git a/tests/custom/translation/src/tests/__init__.py b/tests/custom/translation/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/translation/src/tests/__init__.py
+++ b/tests/custom/translation/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/translation/src/translation/__init__.py b/tests/custom/translation/src/translation/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/custom/translation/src/translation/__init__.py
+++ b/tests/custom/translation/src/translation/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/custom/translation/src/translation/application.py b/tests/custom/translation/src/translation/application.py
index 6a5b699b..96a1b2e4 100644
--- a/tests/custom/translation/src/translation/application.py
+++ b/tests/custom/translation/src/translation/application.py
@@ -8,7 +8,6 @@ from cpl_translation.translation_settings import TranslationSettings
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -17,13 +16,13 @@ class Application(ApplicationABC):
self._translation_settings: TranslationSettings = config.get_configuration(TranslationSettings)
self._translation.load_by_settings(config.get_configuration(TranslationSettings))
- self._translation.set_default_lang('de')
+ 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'))
+ 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"))
diff --git a/tests/custom/translation/src/translation/main.py b/tests/custom/translation/src/translation/main.py
index 030d5485..661997cf 100644
--- a/tests/custom/translation/src/translation/main.py
+++ b/tests/custom/translation/src/translation/main.py
@@ -10,5 +10,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/custom/translation/src/translation/startup.py b/tests/custom/translation/src/translation/startup.py
index e5483338..0130cbcd 100644
--- a/tests/custom/translation/src/translation/startup.py
+++ b/tests/custom/translation/src/translation/startup.py
@@ -5,14 +5,17 @@ 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')
+ 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:
+ def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironment
+ ) -> ServiceProviderABC:
services.add_translation()
return services.build_service_provider()
diff --git a/tests/generated/simple-app/src/application.py b/tests/generated/simple-app/src/application.py
index 34a68c80..ccfe56a3 100644
--- a/tests/generated/simple-app/src/application.py
+++ b/tests/generated/simple-app/src/application.py
@@ -5,7 +5,6 @@ from cpl_core.dependency_injection import ServiceProviderABC
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -13,4 +12,4 @@ class Application(ApplicationABC):
pass
def main(self):
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
diff --git a/tests/generated/simple-app/src/main.py b/tests/generated/simple-app/src/main.py
index 8ebd74ef..a1158cd1 100644
--- a/tests/generated/simple-app/src/main.py
+++ b/tests/generated/simple-app/src/main.py
@@ -8,5 +8,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/simple-app/src/simple_app/__init__.py b/tests/generated/simple-app/src/simple_app/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-app/src/simple_app/__init__.py
+++ b/tests/generated/simple-app/src/simple_app/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/simple-app/src/simple_app/application.py b/tests/generated/simple-app/src/simple_app/application.py
index 34a68c80..ccfe56a3 100644
--- a/tests/generated/simple-app/src/simple_app/application.py
+++ b/tests/generated/simple-app/src/simple_app/application.py
@@ -5,7 +5,6 @@ from cpl_core.dependency_injection import ServiceProviderABC
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -13,4 +12,4 @@ class Application(ApplicationABC):
pass
def main(self):
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
diff --git a/tests/generated/simple-app/src/simple_app/main.py b/tests/generated/simple-app/src/simple_app/main.py
index a7c8142e..7d22bc5d 100644
--- a/tests/generated/simple-app/src/simple_app/main.py
+++ b/tests/generated/simple-app/src/simple_app/main.py
@@ -8,5 +8,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/simple-app/src/tests/__init__.py b/tests/generated/simple-app/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-app/src/tests/__init__.py
+++ b/tests/generated/simple-app/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/simple-console/src/main.py b/tests/generated/simple-console/src/main.py
index db8266cc..e5359a47 100644
--- a/tests/generated/simple-console/src/main.py
+++ b/tests/generated/simple-console/src/main.py
@@ -2,8 +2,8 @@ from cpl_core.console import Console
def main():
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/simple-console/src/simple_console/__init__.py b/tests/generated/simple-console/src/simple_console/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-console/src/simple_console/__init__.py
+++ b/tests/generated/simple-console/src/simple_console/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/simple-console/src/simple_console/main.py b/tests/generated/simple-console/src/simple_console/main.py
index db8266cc..e5359a47 100644
--- a/tests/generated/simple-console/src/simple_console/main.py
+++ b/tests/generated/simple-console/src/simple_console/main.py
@@ -2,8 +2,8 @@ from cpl_core.console import Console
def main():
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/simple-console/src/tests/__init__.py b/tests/generated/simple-console/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-console/src/tests/__init__.py
+++ b/tests/generated/simple-console/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/simple-di/src/main.py b/tests/generated/simple-di/src/main.py
index f716961c..9f3cfc98 100644
--- a/tests/generated/simple-di/src/main.py
+++ b/tests/generated/simple-di/src/main.py
@@ -16,8 +16,8 @@ def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
def main():
config = configure_configuration()
provider = configure_services(config)
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/simple-di/src/simple_di/__init__.py b/tests/generated/simple-di/src/simple_di/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-di/src/simple_di/__init__.py
+++ b/tests/generated/simple-di/src/simple_di/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/simple-di/src/simple_di/main.py b/tests/generated/simple-di/src/simple_di/main.py
index f716961c..9f3cfc98 100644
--- a/tests/generated/simple-di/src/simple_di/main.py
+++ b/tests/generated/simple-di/src/simple_di/main.py
@@ -16,8 +16,8 @@ def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
def main():
config = configure_configuration()
provider = configure_services(config)
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/simple-di/src/tests/__init__.py b/tests/generated/simple-di/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-di/src/tests/__init__.py
+++ b/tests/generated/simple-di/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py b/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py
+++ b/tests/generated/simple-startup-app/src/simple_startup_app/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/simple-startup-app/src/simple_startup_app/application.py b/tests/generated/simple-startup-app/src/simple_startup_app/application.py
index 34a68c80..ccfe56a3 100644
--- a/tests/generated/simple-startup-app/src/simple_startup_app/application.py
+++ b/tests/generated/simple-startup-app/src/simple_startup_app/application.py
@@ -5,7 +5,6 @@ from cpl_core.dependency_injection import ServiceProviderABC
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -13,4 +12,4 @@ class Application(ApplicationABC):
pass
def main(self):
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
diff --git a/tests/generated/simple-startup-app/src/simple_startup_app/main.py b/tests/generated/simple-startup-app/src/simple_startup_app/main.py
index 78bd9bb1..d51ee813 100644
--- a/tests/generated/simple-startup-app/src/simple_startup_app/main.py
+++ b/tests/generated/simple-startup-app/src/simple_startup_app/main.py
@@ -10,5 +10,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/simple-startup-app/src/simple_startup_app/startup.py b/tests/generated/simple-startup-app/src/simple_startup_app/startup.py
index c29f3e6b..d65707fa 100644
--- a/tests/generated/simple-startup-app/src/simple_startup_app/startup.py
+++ b/tests/generated/simple-startup-app/src/simple_startup_app/startup.py
@@ -4,7 +4,6 @@ from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionA
class Startup(StartupABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
StartupABC.__init__(self)
diff --git a/tests/generated/simple-startup-app/src/tests/__init__.py b/tests/generated/simple-startup-app/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/simple-startup-app/src/tests/__init__.py
+++ b/tests/generated/simple-startup-app/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tests/generated/startup-app/src/application.py b/tests/generated/startup-app/src/application.py
index 34a68c80..ccfe56a3 100644
--- a/tests/generated/startup-app/src/application.py
+++ b/tests/generated/startup-app/src/application.py
@@ -5,7 +5,6 @@ from cpl_core.dependency_injection import ServiceProviderABC
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -13,4 +12,4 @@ class Application(ApplicationABC):
pass
def main(self):
- Console.write_line('Hello World')
+ Console.write_line("Hello World")
diff --git a/tests/generated/startup-app/src/main.py b/tests/generated/startup-app/src/main.py
index 4272c911..76de0f16 100644
--- a/tests/generated/startup-app/src/main.py
+++ b/tests/generated/startup-app/src/main.py
@@ -10,5 +10,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tests/generated/startup-app/src/startup.py b/tests/generated/startup-app/src/startup.py
index acf50c86..d65707fa 100644
--- a/tests/generated/startup-app/src/startup.py
+++ b/tests/generated/startup-app/src/startup.py
@@ -4,7 +4,6 @@ from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionA
class Startup(StartupABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
StartupABC.__init__(self)
@@ -17,4 +16,3 @@ class Startup(StartupABC):
def configure_services(self) -> ServiceProviderABC:
return self._services.build_service_provider()
-
diff --git a/tests/generated/startup-app/src/tests/__init__.py b/tests/generated/startup-app/src/tests/__init__.py
index ad5eca30..52f86f25 100644
--- a/tests/generated/startup-app/src/tests/__init__.py
+++ b/tests/generated/startup-app/src/tests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/tools/set_pip_urls/__init__.py b/tools/set_pip_urls/__init__.py
index 95b27626..5c7b277e 100644
--- a/tools/set_pip_urls/__init__.py
+++ b/tools/set_pip_urls/__init__.py
@@ -11,16 +11,16 @@ CPL internal tool to set pip URL for CLI by environment
"""
-__title__ = 'set_pip_urls'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
-__version__ = '2022.12.0'
+__title__ = "set_pip_urls"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 sh-edraft.de"
+__version__ = "2022.12.0"
from collections import namedtuple
-# imports:
+# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='0')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2022", minor="12", micro="0")
diff --git a/tools/set_pip_urls/application.py b/tools/set_pip_urls/application.py
index edaacff2..5165965f 100644
--- a/tools/set_pip_urls/application.py
+++ b/tools/set_pip_urls/application.py
@@ -13,7 +13,6 @@ from set_pip_urls.pip_settings import PIPSettings
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -24,7 +23,7 @@ class Application(ApplicationABC):
def main(self):
if self._pip_settings is None:
- Console.error('appsettings.json not found')
+ Console.error("appsettings.json not found")
sys.exit()
url = None
@@ -36,13 +35,11 @@ class Application(ApplicationABC):
case EnvironmentNameEnum.development.value:
url = self._pip_settings.development
- cli_json = {
- "CLI": {
- "PipPath": url
- }
- }
- file = os.path.abspath(os.path.join(self._environment.working_directory, '../../src/cpl_cli', 'appsettings.json'))
- Console.write_line(f'Writing PipPath: {url} to {file}')
- with open(file, 'w') as f:
+ cli_json = {"CLI": {"PipPath": url}}
+ file = os.path.abspath(
+ os.path.join(self._environment.working_directory, "../../src/cpl_cli", "appsettings.json")
+ )
+ Console.write_line(f"Writing PipPath: {url} to {file}")
+ with open(file, "w") as f:
f.write(json.dumps(cli_json, indent=2))
f.close()
diff --git a/tools/set_pip_urls/main.py b/tools/set_pip_urls/main.py
index d57a6abb..15fb7659 100644
--- a/tools/set_pip_urls/main.py
+++ b/tools/set_pip_urls/main.py
@@ -10,5 +10,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tools/set_pip_urls/pip_settings.py b/tools/set_pip_urls/pip_settings.py
index ed1a6425..a89be92c 100644
--- a/tools/set_pip_urls/pip_settings.py
+++ b/tools/set_pip_urls/pip_settings.py
@@ -7,13 +7,12 @@ from cpl_core.console import Console
class PIPSettings(ConfigurationModelABC):
-
def __init__(self):
ConfigurationModelABC.__init__(self)
- self._production = ''
- self._staging = ''
- self._development = ''
+ self._production = ""
+ self._staging = ""
+ self._development = ""
@property
def production(self):
@@ -33,5 +32,5 @@ class PIPSettings(ConfigurationModelABC):
self._staging = settings[EnvironmentNameEnum.staging.value]
self._development = settings[EnvironmentNameEnum.development.value]
except Exception as e:
- Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings')
- Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
+ Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
+ Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
diff --git a/tools/set_pip_urls/startup.py b/tools/set_pip_urls/startup.py
index b8a52f78..470e8dab 100644
--- a/tools/set_pip_urls/startup.py
+++ b/tools/set_pip_urls/startup.py
@@ -5,14 +5,17 @@ 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_environment_variables('CPL_')
- configuration.add_json_file('appsettings.json', optional=False, output=False)
+ def configure_configuration(
+ self, configuration: ConfigurationABC, environment: ApplicationEnvironment
+ ) -> ConfigurationABC:
+ configuration.add_environment_variables("CPL_")
+ configuration.add_json_file("appsettings.json", optional=False, output=False)
return configuration
- def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
+ def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironment
+ ) -> ServiceProviderABC:
return services.build_service_provider()
diff --git a/tools/set_version/__init__.py b/tools/set_version/__init__.py
index 3604926a..81e446bc 100644
--- a/tools/set_version/__init__.py
+++ b/tools/set_version/__init__.py
@@ -11,16 +11,16 @@ CPL internal tool to set version from branch name
"""
-__title__ = 'set_version'
-__author__ = 'Sven Heidemann'
-__license__ = 'MIT'
-__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
-__version__ = '2022.12.0'
+__title__ = "set_version"
+__author__ = "Sven Heidemann"
+__license__ = "MIT"
+__copyright__ = "Copyright (c) 2022 sh-edraft.de"
+__version__ = "2022.12.0"
from collections import namedtuple
-# imports:
+# imports:
-VersionInfo = namedtuple('VersionInfo', 'major minor micro')
-version_info = VersionInfo(major='2022', minor='12', micro='0')
+VersionInfo = namedtuple("VersionInfo", "major minor micro")
+version_info = VersionInfo(major="2022", minor="12", micro="0")
diff --git a/tools/set_version/application.py b/tools/set_version/application.py
index c4cc9763..91bab130 100644
--- a/tools/set_version/application.py
+++ b/tools/set_version/application.py
@@ -16,7 +16,6 @@ from set_version.version_setter_service import VersionSetterService
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
@@ -30,15 +29,15 @@ class Application(ApplicationABC):
self._configuration.parse_console_arguments(self._services)
def main(self):
- Console.write_line('Set versions:')
+ Console.write_line("Set versions:")
args = self._configuration.additional_arguments
version = {}
branch = ""
suffix = ""
force = False
- if '--force' in args:
- args.remove('--force')
+ if "--force" in args:
+ args.remove("--force")
force = True
if len(args) > 1:
@@ -50,46 +49,50 @@ class Application(ApplicationABC):
try:
branch = self._git_service.get_active_branch_name()
- Console.write_line(f'Found branch: {branch}')
+ Console.write_line(f"Found branch: {branch}")
except Exception as e:
- Console.error('Branch not found', traceback.format_exc())
+ Console.error("Branch not found", traceback.format_exc())
return
try:
- if suffix != '':
- self._configuration.add_json_file(self._workspace.projects[self._workspace.default_project], optional=False, output=False)
+ if suffix != "":
+ self._configuration.add_json_file(
+ self._workspace.projects[self._workspace.default_project], optional=False, output=False
+ )
ps: ProjectSettings = self._configuration.get_configuration(ProjectSettings)
version[VersionSettingsNameEnum.major.value] = ps.version.major
version[VersionSettingsNameEnum.minor.value] = ps.version.minor
version[VersionSettingsNameEnum.micro.value] = suffix
- elif branch.startswith('#'):
- self._configuration.add_json_file(self._workspace.projects[self._workspace.default_project], optional=False, output=False)
+ elif branch.startswith("#"):
+ self._configuration.add_json_file(
+ self._workspace.projects[self._workspace.default_project], optional=False, output=False
+ )
ps: ProjectSettings = self._configuration.get_configuration(ProjectSettings)
version[VersionSettingsNameEnum.major.value] = ps.version.major
version[VersionSettingsNameEnum.minor.value] = ps.version.minor
version[VersionSettingsNameEnum.micro.value] = f'dev{branch.split("#")[1]}'
else:
- version[VersionSettingsNameEnum.major.value] = branch.split('.')[0]
- version[VersionSettingsNameEnum.minor.value] = branch.split('.')[1]
- if len(branch.split('.')) == 2:
- if suffix == '':
- suffix = '0'
- version[VersionSettingsNameEnum.micro.value] = f'{suffix}'
+ version[VersionSettingsNameEnum.major.value] = branch.split(".")[0]
+ version[VersionSettingsNameEnum.minor.value] = branch.split(".")[1]
+ if len(branch.split(".")) == 2:
+ if suffix == "":
+ suffix = "0"
+ version[VersionSettingsNameEnum.micro.value] = f"{suffix}"
else:
version[VersionSettingsNameEnum.micro.value] = f'{branch.split(".")[2]}{suffix}'
except Exception as e:
- Console.error(f'Branch {branch} does not contain valid version')
+ Console.error(f"Branch {branch} does not contain valid version")
return
diff_paths = []
for file in self._git_service.get_diff_files():
- if file.startswith('tools'):
+ if file.startswith("tools"):
continue
- if '/' in file:
- file = file.split('/')[1]
+ if "/" in file:
+ file = file.split("/")[1]
else:
file = os.path.basename(os.path.dirname(file))
@@ -106,12 +109,16 @@ class Application(ApplicationABC):
skipped.append(project)
continue
- Console.write_line(f'Set dependencies {self._version_pipe.transform(version)} for {project}')
- 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)
+ Console.write_line(f"Set dependencies {self._version_pipe.transform(version)} for {project}")
+ 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
+ )
- Console.write_line(f'Set version {self._version_pipe.transform(version)} for {project}')
+ Console.write_line(f"Set version {self._version_pipe.transform(version)} for {project}")
self._version_setter.set_version(self._workspace.projects[project], version)
except Exception as e:
- Console.error('Version could not be set', traceback.format_exc())
+ Console.error("Version could not be set", traceback.format_exc())
return
diff --git a/tools/set_version/git_service.py b/tools/set_version/git_service.py
index b3521bb8..3e942914 100644
--- a/tools/set_version/git_service.py
+++ b/tools/set_version/git_service.py
@@ -5,7 +5,6 @@ from git import Repo
class GitService:
-
def __init__(self, env: ApplicationEnvironmentABC):
self._env = env
self._repo = Repo(env.working_directory)
diff --git a/tools/set_version/main.py b/tools/set_version/main.py
index 71943f43..dfbecfda 100644
--- a/tools/set_version/main.py
+++ b/tools/set_version/main.py
@@ -10,5 +10,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/tools/set_version/startup.py b/tools/set_version/startup.py
index 609ef337..ce7fb47f 100644
--- a/tools/set_version/startup.py
+++ b/tools/set_version/startup.py
@@ -11,19 +11,22 @@ from set_version.version_setter_service import VersionSetterService
class Startup(StartupABC):
-
def __init__(self):
StartupABC.__init__(self)
- def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
- configuration.add_json_file('cpl-workspace.json', optional=True, output=False)
+ def configure_configuration(
+ self, configuration: ConfigurationABC, environment: ApplicationEnvironment
+ ) -> ConfigurationABC:
+ configuration.add_json_file("cpl-workspace.json", optional=True, output=False)
if configuration.get_configuration(WorkspaceSettings) is None:
- environment.set_working_directory(os.path.join(environment.working_directory, '../../'))
- configuration.add_json_file('cpl-workspace.json', optional=False, output=False)
+ environment.set_working_directory(os.path.join(environment.working_directory, "../../"))
+ configuration.add_json_file("cpl-workspace.json", optional=False, output=False)
return configuration
- def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
+ def configure_services(
+ self, services: ServiceCollectionABC, environment: ApplicationEnvironment
+ ) -> ServiceProviderABC:
services.add_pipes()
services.add_singleton(GitService)
services.add_transient(VersionSetterService)
diff --git a/tools/set_version/version_setter_service.py b/tools/set_version/version_setter_service.py
index d00a0c08..e1dfcf8a 100644
--- a/tools/set_version/version_setter_service.py
+++ b/tools/set_version/version_setter_service.py
@@ -7,13 +7,12 @@ from cpl_core.utils import String
class VersionSetterService:
-
def __init__(self, env: ApplicationEnvironmentABC):
self._env = env
def _read_file(self, file: str) -> dict:
project_json = {}
- with open(os.path.join(self._env.working_directory, file), 'r', encoding='utf-8') as f:
+ with open(os.path.join(self._env.working_directory, file), "r", encoding="utf-8") as f:
# load json
project_json = json.load(f)
f.close()
@@ -21,37 +20,43 @@ class VersionSetterService:
return project_json
def _write_file(self, file: str, project_json: dict):
- with open(os.path.join(self._env.working_directory, file), 'w', encoding='utf-8') as f:
+ with open(os.path.join(self._env.working_directory, file), "w", encoding="utf-8") as f:
f.write(json.dumps(project_json, indent=2))
f.close()
def set_version(self, file: str, version: dict):
project_json = self._read_file(file)
- project_json['ProjectSettings']['Version'] = version
+ project_json["ProjectSettings"]["Version"] = version
self._write_file(file, project_json)
def set_dependencies(self, file: str, version: dict, key: str, skipped=None):
project_json = self._read_file(file)
- if key not in project_json['ProjectSettings']:
- project_json['ProjectSettings'][key] = []
+ if key not in project_json["ProjectSettings"]:
+ project_json["ProjectSettings"][key] = []
- dependencies = project_json['ProjectSettings'][key]
+ dependencies = project_json["ProjectSettings"][key]
new_deps = []
for dependency in dependencies:
- if not dependency.startswith('cpl-'):
+ if not dependency.startswith("cpl-"):
new_deps.append(dependency)
continue
- dep_version = dependency.split('=')[1]
- dep_name = dependency.split('=')[0]
- if dep_name[len(dep_name)-1] not in ascii_letters:
- dep_name = dep_name[:len(dep_name)-1]
+ dep_version = dependency.split("=")[1]
+ dep_name = dependency.split("=")[0]
+ if dep_name[len(dep_name) - 1] not in ascii_letters:
+ dep_name = dep_name[: len(dep_name) - 1]
- if skipped is not None and (dep_name in skipped or String.convert_to_snake_case(dep_name) in skipped) or dep_version == '':
+ if (
+ skipped is not None
+ and (dep_name in skipped or String.convert_to_snake_case(dep_name) in skipped)
+ or dep_version == ""
+ ):
new_deps.append(dependency)
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'][key] = new_deps
+ project_json["ProjectSettings"][key] = new_deps
self._write_file(file, project_json)
diff --git a/unittests/unittests/__init__.py b/unittests/unittests/__init__.py
index ad5eca30..52f86f25 100644
--- a/unittests/unittests/__init__.py
+++ b/unittests/unittests/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/unittests/unittests/application.py b/unittests/unittests/application.py
index 0ba34799..9dfc29d5 100644
--- a/unittests/unittests/application.py
+++ b/unittests/unittests/application.py
@@ -9,7 +9,6 @@ from unittests_translation.translation_test_suite import TranslationTestSuite
class Application(ApplicationABC):
-
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
ApplicationABC.__init__(self, config, services)
diff --git a/unittests/unittests/main.py b/unittests/unittests/main.py
index 5fae2bbb..f9b59e72 100644
--- a/unittests/unittests/main.py
+++ b/unittests/unittests/main.py
@@ -7,5 +7,5 @@ def main():
app_builder.build().run()
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/unittests/unittests/unittests.json b/unittests/unittests/unittests.json
index 7d4a72ee..5dfe4196 100644
--- a/unittests/unittests/unittests.json
+++ b/unittests/unittests/unittests.json
@@ -2,8 +2,8 @@
"ProjectSettings": {
"Name": "unittests",
"Version": {
- "Major": "2022",
- "Minor": "12",
+ "Major": "2023",
+ "Minor": "2",
"Micro": "0"
},
"Author": "",
@@ -16,7 +16,7 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
- "cpl-core>=2022.12.0"
+ "cpl-core>=2023.2.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {},
diff --git a/unittests/unittests_cli/__init__.py b/unittests/unittests_cli/__init__.py
index ad5eca30..52f86f25 100644
--- a/unittests/unittests_cli/__init__.py
+++ b/unittests/unittests_cli/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/unittests/unittests_cli/abc/command_test_case.py b/unittests/unittests_cli/abc/command_test_case.py
index 100b4c89..754fa9dc 100644
--- a/unittests/unittests_cli/abc/command_test_case.py
+++ b/unittests/unittests_cli/abc/command_test_case.py
@@ -22,7 +22,7 @@ class CommandTestCase(unittest.TestCase):
os.makedirs(PLAYGROUND_PATH)
os.chdir(PLAYGROUND_PATH)
except Exception as e:
- print(f'Setup of {__name__} failed: {traceback.format_exc()}')
+ print(f"Setup of {__name__} failed: {traceback.format_exc()}")
def setUp(self):
os.chdir(PLAYGROUND_PATH)
@@ -35,4 +35,4 @@ class CommandTestCase(unittest.TestCase):
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()}')
+ print(f"Cleanup of {__name__} failed: {traceback.format_exc()}")
diff --git a/unittests/unittests_cli/add_test_case.py b/unittests/unittests_cli/add_test_case.py
index e78ade03..bfc2243d 100644
--- a/unittests/unittests_cli/add_test_case.py
+++ b/unittests/unittests_cli/add_test_case.py
@@ -8,15 +8,14 @@ from unittests_shared.cli_commands import CLICommands
class AddTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'add-test-project'
- self._target = 'add-test-library'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
+ self._source = "add-test-project"
+ self._target = "add-test-library"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
def _get_project_settings(self):
- with open(os.path.join(os.getcwd(), self._project_file), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), self._project_file), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -26,18 +25,18 @@ class AddTestCase(CommandTestCase):
def setUp(self):
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
- CLICommands.new('library', self._target, '--ab', '--s')
+ CLICommands.new("library", self._target, "--ab", "--s")
def test_add(self):
CLICommands.add(self._source, self._target)
settings = self._get_project_settings()
self.assertNotEqual(settings, {})
- self.assertIn('ProjectSettings', settings)
- self.assertIn('ProjectReferences', settings['BuildSettings'])
- self.assertIn('BuildSettings', settings)
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("ProjectReferences", settings["BuildSettings"])
+ self.assertIn("BuildSettings", settings)
self.assertIn(
- f'../{String.convert_to_snake_case(self._target)}/{self._target}.json',
- settings['BuildSettings']['ProjectReferences']
+ f"../{String.convert_to_snake_case(self._target)}/{self._target}.json",
+ settings["BuildSettings"]["ProjectReferences"],
)
diff --git a/unittests/unittests_cli/build_test_case.py b/unittests/unittests_cli/build_test_case.py
index a0117712..6da264f5 100644
--- a/unittests/unittests_cli/build_test_case.py
+++ b/unittests/unittests_cli/build_test_case.py
@@ -10,14 +10,13 @@ from unittests_shared.cli_commands import CLICommands
class BuildTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'build-test-source'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
+ self._source = "build-test-source"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
def _get_project_settings(self):
- with open(os.path.join(os.getcwd(), self._project_file), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), self._project_file), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -25,17 +24,17 @@ class BuildTestCase(CommandTestCase):
return project_json
def _save_project_settings(self, settings: dict):
- with open(os.path.join(os.getcwd(), self._project_file), 'w', encoding='utf-8') as project_file:
+ with open(os.path.join(os.getcwd(), self._project_file), "w", encoding="utf-8") as project_file:
project_file.write(json.dumps(settings, indent=2))
project_file.close()
def setUp(self):
if not os.path.exists(PLAYGROUND_PATH):
os.makedirs(PLAYGROUND_PATH)
-
+
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
def _are_dir_trees_equal(self, dir1, dir2):
@@ -51,7 +50,7 @@ class BuildTestCase(CommandTestCase):
@return: True if the directory trees are the same and
there were no errors while accessing the directories or files,
False otherwise.
- """
+ """
dirs_cmp = filecmp.dircmp(dir1, dir2)
if len(dirs_cmp.left_only) > 0 or len(dirs_cmp.right_only) > 0 or len(dirs_cmp.funny_files) > 0:
@@ -72,12 +71,16 @@ class BuildTestCase(CommandTestCase):
def test_build(self):
CLICommands.build()
- dist_path = './dist'
- full_dist_path = f'{dist_path}/{self._source}/build/{String.convert_to_snake_case(self._source)}'
+ dist_path = "./dist"
+ full_dist_path = f"{dist_path}/{self._source}/build/{String.convert_to_snake_case(self._source)}"
self.assertTrue(os.path.exists(dist_path))
self.assertTrue(os.path.exists(full_dist_path))
- self.assertFalse(self._are_dir_trees_equal(f'./src/{String.convert_to_snake_case(self._source)}', full_dist_path))
- with open(f'{full_dist_path}/{self._source}.json', 'w') as file:
+ self.assertFalse(
+ self._are_dir_trees_equal(f"./src/{String.convert_to_snake_case(self._source)}", full_dist_path)
+ )
+ with open(f"{full_dist_path}/{self._source}.json", "w") as file:
file.write(json.dumps(self._get_project_settings(), indent=2))
file.close()
- self.assertTrue(self._are_dir_trees_equal(f'./src/{String.convert_to_snake_case(self._source)}', full_dist_path))
+ self.assertTrue(
+ self._are_dir_trees_equal(f"./src/{String.convert_to_snake_case(self._source)}", full_dist_path)
+ )
diff --git a/unittests/unittests_cli/cli_test_suite.py b/unittests/unittests_cli/cli_test_suite.py
index 9ca8b469..2549a26f 100644
--- a/unittests/unittests_cli/cli_test_suite.py
+++ b/unittests/unittests_cli/cli_test_suite.py
@@ -21,7 +21,6 @@ from unittests_cli.version_test_case import VersionTestCase
class CLITestSuite(unittest.TestSuite):
-
def __init__(self):
unittest.TestSuite.__init__(self)
@@ -41,7 +40,7 @@ class CLITestSuite(unittest.TestSuite):
StartTestCase,
# workspace needed
AddTestCase,
- RemoveTestCase
+ RemoveTestCase,
]
if self._is_online:
@@ -60,7 +59,7 @@ class CLITestSuite(unittest.TestSuite):
os.makedirs(PLAYGROUND_PATH)
os.chdir(PLAYGROUND_PATH)
except Exception as e:
- print(f'Setup of {__name__} failed: {traceback.format_exc()}')
+ print(f"Setup of {__name__} failed: {traceback.format_exc()}")
def _cleanup(self):
try:
@@ -70,7 +69,7 @@ class CLITestSuite(unittest.TestSuite):
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()}')
+ print(f"Cleanup of {__name__} failed: {traceback.format_exc()}")
def run(self, *args):
self._setup()
diff --git a/unittests/unittests_cli/constants.py b/unittests/unittests_cli/constants.py
index c8318dab..cfd24779 100644
--- a/unittests/unittests_cli/constants.py
+++ b/unittests/unittests_cli/constants.py
@@ -1,9 +1,9 @@
import os
-base = ''
-if not os.getcwd().endswith('unittests'):
- base = '../'
+base = ""
+if not os.getcwd().endswith("unittests"):
+ base = "../"
-PLAYGROUND_PATH = os.path.abspath(os.path.join(os.getcwd(), f'{base}test_cli_playground'))
-TRANSLATION_PATH = os.path.abspath(os.path.join(os.getcwd(), f'{base}unittests_translation'))
-CLI_PATH = os.path.abspath(os.path.join(os.getcwd(), f'{base}../src/cpl_cli/main.py'))
+PLAYGROUND_PATH = os.path.abspath(os.path.join(os.getcwd(), f"{base}test_cli_playground"))
+TRANSLATION_PATH = os.path.abspath(os.path.join(os.getcwd(), f"{base}unittests_translation"))
+CLI_PATH = os.path.abspath(os.path.join(os.getcwd(), f"{base}../src/cpl_cli/main.py"))
diff --git a/unittests/unittests_cli/custom_test_case.py b/unittests/unittests_cli/custom_test_case.py
index 9088cc44..a6057c00 100644
--- a/unittests/unittests_cli/custom_test_case.py
+++ b/unittests/unittests_cli/custom_test_case.py
@@ -2,7 +2,6 @@ from unittests_cli.abc.command_test_case import CommandTestCase
class CustomTestCase(CommandTestCase):
-
def setUp(self):
pass
diff --git a/unittests/unittests_cli/generate_test_case.py b/unittests/unittests_cli/generate_test_case.py
index a87f1c7c..ac2a2c21 100644
--- a/unittests/unittests_cli/generate_test_case.py
+++ b/unittests/unittests_cli/generate_test_case.py
@@ -7,13 +7,13 @@ from unittests_shared.cli_commands import CLICommands
class GenerateTestCase(CommandTestCase):
- _project = 'test-console'
- _t_path = 'test'
+ _project = "test-console"
+ _t_path = "test"
@classmethod
def setUpClass(cls):
CommandTestCase.setUpClass()
- CLICommands.new('console', cls._project, '--ab', '--s', '--venv')
+ CLICommands.new("console", cls._project, "--ab", "--s", "--venv")
def setUp(self):
os.chdir(PLAYGROUND_PATH)
@@ -23,8 +23,8 @@ class GenerateTestCase(CommandTestCase):
expected_path = f'generated_file{"_on_ready" if schematic == "event" else ""}{suffix}.py'
if path is not None:
- file = f'{path}/{file}'
- expected_path = f'{path}/{expected_path}'
+ file = f"{path}/{file}"
+ expected_path = f"{path}/{expected_path}"
CLICommands.generate(schematic, file)
file_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, expected_path))
@@ -47,54 +47,54 @@ class GenerateTestCase(CommandTestCase):
self.assertTrue(os.path.exists(file_path))
def test_abc(self):
- self._test_file('abc', '_abc')
- self._test_file('abc', '_abc', path=self._t_path)
- self._test_file('abc', '_abc', path=f'{self._t_path}/{self._t_path}')
- self._test_file_with_project('abc', '_abc', path=self._project)
- os.chdir(f'src/{String.convert_to_snake_case(self._project)}')
- self._test_file_with_project('abc', '_abc', path='test', enter=False)
+ self._test_file("abc", "_abc")
+ self._test_file("abc", "_abc", path=self._t_path)
+ self._test_file("abc", "_abc", path=f"{self._t_path}/{self._t_path}")
+ self._test_file_with_project("abc", "_abc", path=self._project)
+ os.chdir(f"src/{String.convert_to_snake_case(self._project)}")
+ self._test_file_with_project("abc", "_abc", path="test", enter=False)
def test_class(self):
- self._test_file('class', '')
- self._test_file('class', '', path=self._t_path)
- self._test_file_with_project('class', '', path=self._project)
+ self._test_file("class", "")
+ self._test_file("class", "", path=self._t_path)
+ self._test_file_with_project("class", "", path=self._project)
def test_enum(self):
- self._test_file('enum', '_enum')
- self._test_file('enum', '_enum', path=self._t_path)
- self._test_file_with_project('enum', '_enum', path=self._project)
- os.chdir(f'src/{String.convert_to_snake_case(self._project)}')
- self._test_file_with_project('enum', '_enum', path='test', enter=False)
+ self._test_file("enum", "_enum")
+ self._test_file("enum", "_enum", path=self._t_path)
+ self._test_file_with_project("enum", "_enum", path=self._project)
+ os.chdir(f"src/{String.convert_to_snake_case(self._project)}")
+ self._test_file_with_project("enum", "_enum", path="test", enter=False)
def test_pipe(self):
- self._test_file('pipe', '_pipe')
- self._test_file('pipe', '_pipe', path=self._t_path)
- self._test_file_with_project('pipe', '_pipe', path=self._project)
+ self._test_file("pipe", "_pipe")
+ self._test_file("pipe", "_pipe", path=self._t_path)
+ self._test_file_with_project("pipe", "_pipe", path=self._project)
def test_service(self):
- self._test_file('service', '_service')
- self._test_file_with_project('service', '_service', path=self._project)
+ self._test_file("service", "_service")
+ self._test_file_with_project("service", "_service", path=self._project)
def test_settings(self):
- self._test_file('settings', '_settings')
- self._test_file_with_project('settings', '_settings', path=self._project)
+ self._test_file("settings", "_settings")
+ self._test_file_with_project("settings", "_settings", path=self._project)
def test_test_case(self):
- self._test_file('test-case', '_test_case')
- self._test_file_with_project('test-case', '_test_case', path=self._project)
+ self._test_file("test-case", "_test_case")
+ self._test_file_with_project("test-case", "_test_case", path=self._project)
def test_thread(self):
- self._test_file('thread', '_thread')
- self._test_file_with_project('thread', '_thread', path=self._project)
+ self._test_file("thread", "_thread")
+ self._test_file_with_project("thread", "_thread", path=self._project)
def test_validator(self):
- self._test_file('validator', '_validator')
- self._test_file_with_project('validator', '_validator', path=self._project)
+ self._test_file("validator", "_validator")
+ self._test_file_with_project("validator", "_validator", path=self._project)
def test_discord_command(self):
- self._test_file('command', '_command')
- self._test_file_with_project('command', '_command', path=self._project)
+ self._test_file("command", "_command")
+ self._test_file_with_project("command", "_command", path=self._project)
def test_discord_event(self):
- self._test_file('event', '_event')
- self._test_file_with_project('event', '_event', path=self._project)
+ self._test_file("event", "_event")
+ self._test_file_with_project("event", "_event", path=self._project)
diff --git a/unittests/unittests_cli/install_test_case.py b/unittests/unittests_cli/install_test_case.py
index 6f773886..b7adabdd 100644
--- a/unittests/unittests_cli/install_test_case.py
+++ b/unittests/unittests_cli/install_test_case.py
@@ -12,14 +12,13 @@ from unittests_shared.cli_commands import CLICommands
class InstallTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'install-test-source'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
+ self._source = "install-test-source"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
def _get_project_settings(self):
- with open(os.path.join(os.getcwd(), self._project_file), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), self._project_file), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -27,7 +26,7 @@ class InstallTestCase(CommandTestCase):
return project_json
def _save_project_settings(self, settings: dict):
- with open(os.path.join(os.getcwd(), self._project_file), 'w', encoding='utf-8') as project_file:
+ with open(os.path.join(os.getcwd(), self._project_file), "w", encoding="utf-8") as project_file:
project_file.write(json.dumps(settings, indent=2))
project_file.close()
@@ -37,94 +36,73 @@ class InstallTestCase(CommandTestCase):
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s', '--venv')
+ CLICommands.new("console", self._source, "--ab", "--s", "--venv")
os.chdir(os.path.join(os.getcwd(), self._source))
def _get_installed_packages(self) -> dict:
- reqs = subprocess.check_output([os.path.join(os.getcwd(), 'venv/bin/python'), '-m', 'pip', 'freeze'])
- return dict([tuple(r.decode().split('==')) for r in reqs.split()])
+ reqs = subprocess.check_output([os.path.join(os.getcwd(), "venv/bin/python"), "-m", "pip", "freeze"])
+ return dict([tuple(r.decode().split("==")) for r in reqs.split()])
def test_install_package(self):
- version = '1.7.3'
- package_name = 'discord.py'
- package = f'{package_name}=={version}'
+ version = "1.7.3"
+ package_name = "discord.py"
+ package = f"{package_name}=={version}"
CLICommands.install(package)
settings = self._get_project_settings()
- with self.subTest(msg='Project deps'):
+ with self.subTest(msg="Project deps"):
self.assertNotEqual(settings, {})
- self.assertIn('ProjectSettings', settings)
- self.assertIn('Dependencies', settings['ProjectSettings'])
- self.assertIn(
- package,
- settings['ProjectSettings']['Dependencies']
- )
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("Dependencies", settings["ProjectSettings"])
+ self.assertIn(package, settings["ProjectSettings"]["Dependencies"])
- with self.subTest(msg='PIP'):
+ with self.subTest(msg="PIP"):
packages = self._get_installed_packages()
self.assertIn(package_name, packages)
self.assertEqual(version, packages[package_name])
def test_dev_install_package(self):
- version = '1.7.3'
- package_name = 'discord.py'
- package = f'{package_name}=={version}'
+ version = "1.7.3"
+ package_name = "discord.py"
+ package = f"{package_name}=={version}"
CLICommands.install(package, is_dev=True)
settings = self._get_project_settings()
- with self.subTest(msg='Project deps'):
+ with self.subTest(msg="Project deps"):
self.assertNotEqual(settings, {})
- self.assertIn('ProjectSettings', settings)
- self.assertIn('Dependencies', settings['ProjectSettings'])
- self.assertIn('DevDependencies', settings['ProjectSettings'])
- self.assertNotIn(
- package,
- settings['ProjectSettings']['Dependencies']
- )
- self.assertIn(
- package,
- settings['ProjectSettings']['DevDependencies']
- )
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("Dependencies", settings["ProjectSettings"])
+ self.assertIn("DevDependencies", settings["ProjectSettings"])
+ self.assertNotIn(package, settings["ProjectSettings"]["Dependencies"])
+ self.assertIn(package, settings["ProjectSettings"]["DevDependencies"])
- with self.subTest(msg='PIP'):
+ with self.subTest(msg="PIP"):
packages = self._get_installed_packages()
self.assertIn(package_name, packages)
self.assertEqual(version, packages[package_name])
def _test_install_all(self):
- version = '1.7.3'
- package_name = 'discord.py'
- package = f'{package_name}=={version}'
+ version = "1.7.3"
+ package_name = "discord.py"
+ package = f"{package_name}=={version}"
settings = self._get_project_settings()
- self.assertIn('ProjectSettings', settings)
- self.assertIn('Dependencies', settings['ProjectSettings'])
- self.assertIn('DevDependencies', settings['ProjectSettings'])
- self.assertNotIn(
- package,
- settings['ProjectSettings']['Dependencies']
- )
- self.assertIn('DevDependencies', settings['ProjectSettings'])
- self.assertNotIn(
- package,
- settings['ProjectSettings']['Dependencies']
- )
- settings['ProjectSettings']['Dependencies'].append(package)
- settings['ProjectSettings']['DevDependencies'].append(package)
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("Dependencies", settings["ProjectSettings"])
+ self.assertIn("DevDependencies", settings["ProjectSettings"])
+ self.assertNotIn(package, settings["ProjectSettings"]["Dependencies"])
+ self.assertIn("DevDependencies", settings["ProjectSettings"])
+ self.assertNotIn(package, settings["ProjectSettings"]["Dependencies"])
+ settings["ProjectSettings"]["Dependencies"].append(package)
+ settings["ProjectSettings"]["DevDependencies"].append(package)
self._save_project_settings(settings)
CLICommands.install()
new_settings = self._get_project_settings()
self.assertEqual(settings, new_settings)
- self.assertIn('ProjectSettings', new_settings)
- self.assertIn('Dependencies', new_settings['ProjectSettings'])
- self.assertIn('DevDependencies', new_settings['ProjectSettings'])
- self.assertIn(
- package,
- new_settings['ProjectSettings']['Dependencies']
- )
- self.assertIn(
- package,
- new_settings['ProjectSettings']['DevDependencies']
- )
+ self.assertIn("ProjectSettings", new_settings)
+ self.assertIn("Dependencies", new_settings["ProjectSettings"])
+ self.assertIn("DevDependencies", new_settings["ProjectSettings"])
+ self.assertIn(package, new_settings["ProjectSettings"]["Dependencies"])
+ self.assertIn(package, new_settings["ProjectSettings"]["DevDependencies"])
packages = self._get_installed_packages()
self.assertIn(package_name, packages)
self.assertEqual(version, packages[package_name])
diff --git a/unittests/unittests_cli/new_test_case.py b/unittests/unittests_cli/new_test_case.py
index b744f012..758d0b81 100644
--- a/unittests/unittests_cli/new_test_case.py
+++ b/unittests/unittests_cli/new_test_case.py
@@ -9,7 +9,6 @@ from unittests_shared.cli_commands import CLICommands
class NewTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
@@ -18,61 +17,63 @@ class NewTestCase(CommandTestCase):
workspace_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, name))
self.assertTrue(os.path.exists(workspace_path))
if test_venv:
- with self.subTest(msg='Venv exists'):
- self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv')))
- self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv/bin')))
- self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv/bin/python')))
- self.assertTrue(os.path.islink(os.path.join(workspace_path, 'venv/bin/python')))
+ with self.subTest(msg="Venv exists"):
+ self.assertTrue(os.path.exists(os.path.join(workspace_path, "venv")))
+ self.assertTrue(os.path.exists(os.path.join(workspace_path, "venv/bin")))
+ self.assertTrue(os.path.exists(os.path.join(workspace_path, "venv/bin/python")))
+ self.assertTrue(os.path.islink(os.path.join(workspace_path, "venv/bin/python")))
- base = 'src'
- if '--base' in args and '/' in name:
- base = name.split('/')[0]
- name = name.replace(f'{name.split("/")[0]}/', '')
+ base = "src"
+ if "--base" in args and "/" in name:
+ base = name.split("/")[0]
+ name = name.replace(f'{name.split("/")[0]}/', "")
project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, name, base, String.convert_to_snake_case(name)))
if without_ws:
- project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, base, name, 'src/', String.convert_to_snake_case(name)))
+ project_path = os.path.abspath(
+ os.path.join(PLAYGROUND_PATH, base, name, "src/", String.convert_to_snake_case(name))
+ )
- with self.subTest(msg='Project json exists'):
+ with self.subTest(msg="Project json exists"):
self.assertTrue(os.path.exists(project_path))
- self.assertTrue(os.path.exists(os.path.join(project_path, f'{name}.json')))
+ self.assertTrue(os.path.exists(os.path.join(project_path, f"{name}.json")))
- if project_type == 'library':
- with self.subTest(msg='Library class1 exists'):
- self.assertTrue(os.path.exists(os.path.join(project_path, f'class1.py')))
+ if project_type == "library":
+ with self.subTest(msg="Library class1 exists"):
+ self.assertTrue(os.path.exists(os.path.join(project_path, f"class1.py")))
return
- with self.subTest(msg='Project main.py exists'):
- self.assertTrue(os.path.exists(os.path.join(project_path, f'main.py')))
+ with self.subTest(msg="Project main.py exists"):
+ self.assertTrue(os.path.exists(os.path.join(project_path, f"main.py")))
- with self.subTest(msg='Application base'):
- if '--ab' in args:
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'application.py')))
+ with self.subTest(msg="Application base"):
+ if "--ab" in args:
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"application.py")))
else:
- self.assertFalse(os.path.isfile(os.path.join(project_path, f'application.py')))
+ self.assertFalse(os.path.isfile(os.path.join(project_path, f"application.py")))
# s depends on ab
- with self.subTest(msg='Startup'):
- if '--ab' in args and '--s' in args:
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'startup.py')))
+ with self.subTest(msg="Startup"):
+ if "--ab" in args and "--s" in args:
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"startup.py")))
else:
- self.assertFalse(os.path.isfile(os.path.join(project_path, f'startup.py')))
+ self.assertFalse(os.path.isfile(os.path.join(project_path, f"startup.py")))
- with self.subTest(msg='Unittest'):
- if project_type == 'unittest':
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'test_case.py')))
+ with self.subTest(msg="Unittest"):
+ if project_type == "unittest":
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"test_case.py")))
else:
- self.assertFalse(os.path.isfile(os.path.join(project_path, f'test_case.py')))
+ self.assertFalse(os.path.isfile(os.path.join(project_path, f"test_case.py")))
- with self.subTest(msg='Discord'):
- if project_type == 'discord-bot':
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'events/__init__.py')))
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'events/on_ready_event.py')))
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'commands/__init__.py')))
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'commands/ping_command.py')))
+ with self.subTest(msg="Discord"):
+ if project_type == "discord-bot":
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"events/__init__.py")))
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"events/on_ready_event.py")))
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"commands/__init__.py")))
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"commands/ping_command.py")))
else:
- self.assertFalse(os.path.isfile(os.path.join(project_path, f'events/on_ready_event.py')))
- self.assertFalse(os.path.isfile(os.path.join(project_path, f'commands/ping_command.py')))
+ self.assertFalse(os.path.isfile(os.path.join(project_path, f"events/on_ready_event.py")))
+ self.assertFalse(os.path.isfile(os.path.join(project_path, f"commands/ping_command.py")))
def _test_sub_project(self, project_type: str, name: str, workspace_name: str, *args, test_venv=False):
os.chdir(os.path.abspath(os.path.join(os.getcwd(), workspace_name)))
@@ -80,91 +81,111 @@ class NewTestCase(CommandTestCase):
workspace_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, workspace_name))
self.assertTrue(os.path.exists(workspace_path))
if test_venv:
- self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv')))
- self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv/bin')))
- self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv/bin/python')))
- self.assertTrue(os.path.islink(os.path.join(workspace_path, 'venv/bin/python')))
+ self.assertTrue(os.path.exists(os.path.join(workspace_path, "venv")))
+ self.assertTrue(os.path.exists(os.path.join(workspace_path, "venv/bin")))
+ self.assertTrue(os.path.exists(os.path.join(workspace_path, "venv/bin/python")))
+ self.assertTrue(os.path.islink(os.path.join(workspace_path, "venv/bin/python")))
- base = 'src'
- if '--base' in args and '/' in name:
- base = name.split('/')[0]
- name = name.replace(f'{name.split("/")[0]}/', '')
+ base = "src"
+ if "--base" in args and "/" in name:
+ base = name.split("/")[0]
+ name = name.replace(f'{name.split("/")[0]}/', "")
- project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, workspace_name, base, String.convert_to_snake_case(name)))
+ project_path = os.path.abspath(
+ os.path.join(PLAYGROUND_PATH, workspace_name, base, String.convert_to_snake_case(name))
+ )
self.assertTrue(os.path.exists(project_path))
- self.assertTrue(os.path.join(project_path, f'{name}.json'))
+ self.assertTrue(os.path.join(project_path, f"{name}.json"))
- if project_type == 'discord-bot':
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'events/__init__.py')))
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'events/on_ready_event.py')))
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'commands/__init__.py')))
- self.assertTrue(os.path.isfile(os.path.join(project_path, f'commands/ping_command.py')))
+ if project_type == "discord-bot":
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"events/__init__.py")))
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"events/on_ready_event.py")))
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"commands/__init__.py")))
+ self.assertTrue(os.path.isfile(os.path.join(project_path, f"commands/ping_command.py")))
else:
- self.assertFalse(os.path.isfile(os.path.join(project_path, f'events/on_ready_event.py')))
- self.assertFalse(os.path.isfile(os.path.join(project_path, f'commands/ping_command.py')))
+ self.assertFalse(os.path.isfile(os.path.join(project_path, f"events/on_ready_event.py")))
+ self.assertFalse(os.path.isfile(os.path.join(project_path, f"commands/ping_command.py")))
def _test_sub_directory_project(self, project_type: str, directory: str, name: str, workspace_name: str, *args):
os.chdir(os.path.abspath(os.path.join(os.getcwd(), workspace_name)))
- CLICommands.new(project_type, f'{directory}/{name}', *args)
+ CLICommands.new(project_type, f"{directory}/{name}", *args)
workspace_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, workspace_name))
self.assertTrue(os.path.exists(workspace_path))
- project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, workspace_name, f'src/{directory}', String.convert_to_snake_case(name)))
+ project_path = os.path.abspath(
+ os.path.join(PLAYGROUND_PATH, workspace_name, f"src/{directory}", String.convert_to_snake_case(name))
+ )
self.assertTrue(os.path.exists(project_path))
- project_file = os.path.join(project_path, f'{name}.json')
+ project_file = os.path.join(project_path, f"{name}.json")
self.assertTrue(os.path.exists(project_file))
- with open(project_file, 'r', encoding='utf-8') as cfg:
+ with open(project_file, "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
- project_settings = project_json['ProjectSettings']
- build_settings = project_json['BuildSettings']
+ project_settings = project_json["ProjectSettings"]
+ build_settings = project_json["BuildSettings"]
- self.assertEqual(project_settings['Name'], name)
- self.assertEqual(build_settings['ProjectType'], 'library')
- self.assertEqual(build_settings['OutputPath'], '../../dist')
- self.assertEqual(build_settings['Main'], f'{String.convert_to_snake_case(name)}.main')
- self.assertEqual(build_settings['EntryPoint'], name)
+ self.assertEqual(project_settings["Name"], name)
+ self.assertEqual(build_settings["ProjectType"], "library")
+ self.assertEqual(build_settings["OutputPath"], "../../dist")
+ self.assertEqual(build_settings["Main"], f"{String.convert_to_snake_case(name)}.main")
+ self.assertEqual(build_settings["EntryPoint"], name)
def test_console(self):
- self._test_project('console', 'test-console', '--ab', '--s', '--venv', test_venv=True)
+ self._test_project("console", "test-console", "--ab", "--s", "--venv", test_venv=True)
def test_console_with_other_base(self):
- self._test_project('console', 'tools/test-console', '--ab', '--s', '--venv', '--base', test_venv=True, without_ws=True)
+ self._test_project(
+ "console", "tools/test-console", "--ab", "--s", "--venv", "--base", test_venv=True, without_ws=True
+ )
def test_console_without_s(self):
- self._test_project('console', 'test-console-without-s', '--ab')
+ self._test_project("console", "test-console-without-s", "--ab")
def test_console_without_ab(self):
- self._test_project('console', 'test-console-without-ab', '--sp')
+ self._test_project("console", "test-console-without-ab", "--sp")
def test_console_without_anything(self):
- self._test_project('console', 'test-console-without-anything', '--n')
+ self._test_project("console", "test-console-without-anything", "--n")
def test_console_sub(self):
- self._test_sub_project('console', 'test-sub-console', 'test-console', '--ab', '--s', '--sp', '--venv', test_venv=True)
+ self._test_sub_project(
+ "console", "test-sub-console", "test-console", "--ab", "--s", "--sp", "--venv", test_venv=True
+ )
def test_console_sub_with_other_base(self):
- self._test_sub_project('console', 'tools/test-sub-console', 'test-console', '--ab', '--s', '--sp', '--venv', '--base', test_venv=True)
+ self._test_sub_project(
+ "console",
+ "tools/test-sub-console",
+ "test-console",
+ "--ab",
+ "--s",
+ "--sp",
+ "--venv",
+ "--base",
+ test_venv=True,
+ )
def test_discord_bot(self):
- self._test_project('discord-bot', 'test-bot', '--ab', '--s', '--venv', test_venv=True)
+ self._test_project("discord-bot", "test-bot", "--ab", "--s", "--venv", test_venv=True)
def test_discord_bot_sub(self):
- self._test_sub_project('discord-bot', 'test-bot-sub', 'test-console', '--ab', '--s', '--venv', test_venv=True)
+ self._test_sub_project("discord-bot", "test-bot-sub", "test-console", "--ab", "--s", "--venv", test_venv=True)
def test_library(self):
- self._test_project('library', 'test-library', '--ab', '--s', '--sp')
+ self._test_project("library", "test-library", "--ab", "--s", "--sp")
def test_library_sub(self):
- self._test_sub_project('library', 'test-sub-library', 'test-console', '--ab', '--s', '--sp')
+ self._test_sub_project("library", "test-sub-library", "test-console", "--ab", "--s", "--sp")
def test_library_sub_directory(self):
- self._test_sub_directory_project('library', 'directory', 'test-sub-library', 'test-console', '--ab', '--s', '--sp')
+ self._test_sub_directory_project(
+ "library", "directory", "test-sub-library", "test-console", "--ab", "--s", "--sp"
+ )
def test_unittest(self):
- self._test_project('unittest', 'test-unittest', '--ab')
+ self._test_project("unittest", "test-unittest", "--ab")
def test_unittest_sub(self):
- self._test_sub_project('unittest', 'test-unittest', 'test-console', '--ab', '--s', '--sp')
+ self._test_sub_project("unittest", "test-unittest", "test-console", "--ab", "--s", "--sp")
diff --git a/unittests/unittests_cli/publish_test_case.py b/unittests/unittests_cli/publish_test_case.py
index 7877e633..f4a5a851 100644
--- a/unittests/unittests_cli/publish_test_case.py
+++ b/unittests/unittests_cli/publish_test_case.py
@@ -10,11 +10,10 @@ from unittests_shared.cli_commands import CLICommands
class PublishTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'publish-test-source'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
+ self._source = "publish-test-source"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
def setUp(self):
if not os.path.exists(PLAYGROUND_PATH):
@@ -22,7 +21,7 @@ class PublishTestCase(CommandTestCase):
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
def _are_dir_trees_equal(self, dir1, dir2):
@@ -38,7 +37,7 @@ class PublishTestCase(CommandTestCase):
@return: True if the directory trees are the same and
there were no errors while accessing the directories or files,
False otherwise.
- """
+ """
dirs_cmp = filecmp.dircmp(dir1, dir2)
if len(dirs_cmp.left_only) > 0 or len(dirs_cmp.right_only) > 0 or len(dirs_cmp.funny_files) > 0:
@@ -59,17 +58,28 @@ class PublishTestCase(CommandTestCase):
def test_publish(self):
CLICommands.publish()
- dist_path = './dist'
- setup_path = f'{dist_path}/{self._source}/publish/setup'
- full_dist_path = f'{dist_path}/{self._source}/publish/build/lib/{String.convert_to_snake_case(self._source)}'
+ dist_path = "./dist"
+ setup_path = f"{dist_path}/{self._source}/publish/setup"
+ full_dist_path = f"{dist_path}/{self._source}/publish/build/lib/{String.convert_to_snake_case(self._source)}"
self.assertTrue(os.path.exists(dist_path))
self.assertTrue(os.path.exists(setup_path))
- self.assertTrue(os.path.exists(os.path.join(setup_path, f'{self._source}-0.0.0.tar.gz')))
- self.assertTrue(os.path.exists(os.path.join(setup_path, f'{String.convert_to_snake_case(self._source)}-0.0.0-py3-none-any.whl')))
+ self.assertTrue(os.path.exists(os.path.join(setup_path, f"{self._source}-0.0.0.tar.gz")))
+ self.assertTrue(
+ os.path.exists(
+ os.path.join(setup_path, f"{String.convert_to_snake_case(self._source)}-0.0.0-py3-none-any.whl")
+ )
+ )
self.assertTrue(os.path.exists(full_dist_path))
- self.assertFalse(self._are_dir_trees_equal(f'./src/{String.convert_to_snake_case(self._source)}', full_dist_path))
+ self.assertFalse(
+ self._are_dir_trees_equal(f"./src/{String.convert_to_snake_case(self._source)}", full_dist_path)
+ )
- shutil.copyfile(os.path.join(os.getcwd(), self._project_file), f'{full_dist_path}/{self._source}.json')
- shutil.copyfile(os.path.join(os.getcwd(), os.path.dirname(self._project_file), 'appsettings.json'), f'{full_dist_path}/appsettings.json')
+ shutil.copyfile(os.path.join(os.getcwd(), self._project_file), f"{full_dist_path}/{self._source}.json")
+ shutil.copyfile(
+ os.path.join(os.getcwd(), os.path.dirname(self._project_file), "appsettings.json"),
+ f"{full_dist_path}/appsettings.json",
+ )
- self.assertTrue(self._are_dir_trees_equal(f'./src/{String.convert_to_snake_case(self._source)}', full_dist_path))
+ self.assertTrue(
+ self._are_dir_trees_equal(f"./src/{String.convert_to_snake_case(self._source)}", full_dist_path)
+ )
diff --git a/unittests/unittests_cli/remove_test_case.py b/unittests/unittests_cli/remove_test_case.py
index ac2732f3..50ed3a52 100644
--- a/unittests/unittests_cli/remove_test_case.py
+++ b/unittests/unittests_cli/remove_test_case.py
@@ -9,15 +9,14 @@ from unittests_shared.cli_commands import CLICommands
class RemoveTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'add-test-project'
- self._target = 'add-test-library'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
+ self._source = "add-test-project"
+ self._target = "add-test-library"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
def _get_project_settings(self):
- with open(os.path.join(os.getcwd(), self._project_file), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), self._project_file), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -27,25 +26,25 @@ class RemoveTestCase(CommandTestCase):
def setUp(self):
if not os.path.exists(PLAYGROUND_PATH):
os.makedirs(PLAYGROUND_PATH)
-
+
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
- CLICommands.new('console', self._target, '--ab', '--s')
+ CLICommands.new("console", self._target, "--ab", "--s")
CLICommands.add(self._source, self._target)
def test_remove(self):
CLICommands.remove(self._target)
- path = os.path.abspath(os.path.join(os.getcwd(), f'../{String.convert_to_snake_case(self._target)}'))
+ path = os.path.abspath(os.path.join(os.getcwd(), f"../{String.convert_to_snake_case(self._target)}"))
self.assertTrue(os.path.exists(os.getcwd()))
self.assertTrue(os.path.exists(os.path.join(os.getcwd(), self._project_file)))
self.assertFalse(os.path.exists(path))
settings = self._get_project_settings()
- self.assertIn('ProjectSettings', settings)
- self.assertIn('ProjectReferences', settings['BuildSettings'])
- self.assertIn('BuildSettings', settings)
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("ProjectReferences", settings["BuildSettings"])
+ self.assertIn("BuildSettings", settings)
self.assertNotIn(
- f'../{String.convert_to_snake_case(self._target)}/{self._target}.json',
- settings['BuildSettings']['ProjectReferences']
+ f"../{String.convert_to_snake_case(self._target)}/{self._target}.json",
+ settings["BuildSettings"]["ProjectReferences"],
)
diff --git a/unittests/unittests_cli/run_test_case.py b/unittests/unittests_cli/run_test_case.py
index a44ded36..7704548d 100644
--- a/unittests/unittests_cli/run_test_case.py
+++ b/unittests/unittests_cli/run_test_case.py
@@ -10,12 +10,11 @@ from unittests_shared.cli_commands import CLICommands
class RunTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'run-test'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
- self._application = f'src/{String.convert_to_snake_case(self._source)}/application.py'
+ self._source = "run-test"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
+ self._application = f"src/{String.convert_to_snake_case(self._source)}/application.py"
self._test_code = f"""
import json
import os
@@ -34,11 +33,11 @@ class RunTestCase(CommandTestCase):
"""
def _get_appsettings(self, is_dev=False):
- appsettings = f'dist/{self._source}/build/{String.convert_to_snake_case(self._source)}/appsettings.json'
+ appsettings = f"dist/{self._source}/build/{String.convert_to_snake_case(self._source)}/appsettings.json"
if is_dev:
- appsettings = f'src/{String.convert_to_snake_case(self._source)}/appsettings.json'
+ appsettings = f"src/{String.convert_to_snake_case(self._source)}/appsettings.json"
- with open(os.path.join(os.getcwd(), appsettings), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), appsettings), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -46,85 +45,73 @@ class RunTestCase(CommandTestCase):
return project_json
def _save_appsettings(self, settings: dict):
- with open(os.path.join(os.getcwd(), f'src/{String.convert_to_snake_case(self._source)}/appsettings.json'), 'w', encoding='utf-8') as project_file:
+ with open(
+ os.path.join(os.getcwd(), f"src/{String.convert_to_snake_case(self._source)}/appsettings.json"),
+ "w",
+ encoding="utf-8",
+ ) as project_file:
project_file.write(json.dumps(settings, indent=2))
project_file.close()
def setUp(self):
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
- settings = {'RunTest': {'WasStarted': 'False'}}
+ settings = {"RunTest": {"WasStarted": "False"}}
self._save_appsettings(settings)
- with open(os.path.join(os.getcwd(), self._application), 'a', encoding='utf-8') as file:
- file.write(f'\t\t{self._test_code}')
+ with open(os.path.join(os.getcwd(), self._application), "a", encoding="utf-8") as file:
+ file.write(f"\t\t{self._test_code}")
file.close()
def test_run(self):
CLICommands.run()
settings = self._get_appsettings()
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
- self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
self.assertNotEqual(
- os.path.join(os.getcwd(), f'src/{String.convert_to_snake_case(self._source)}'),
- settings['RunTest']['Path']
+ os.path.join(os.getcwd(), f"src/{String.convert_to_snake_case(self._source)}"), settings["RunTest"]["Path"]
)
self.assertEqual(
- os.path.join(os.getcwd(), f'dist/{self._source}/build/{String.convert_to_snake_case(self._source)}'),
- settings['RunTest']['Path']
+ os.path.join(os.getcwd(), f"dist/{self._source}/build/{String.convert_to_snake_case(self._source)}"),
+ settings["RunTest"]["Path"],
)
def test_run_by_project(self):
CLICommands.run(self._source)
settings = self._get_appsettings()
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
- self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
self.assertNotEqual(
- os.path.join(os.getcwd(), f'src/{String.convert_to_snake_case(self._source)}'),
- settings['RunTest']['Path']
+ os.path.join(os.getcwd(), f"src/{String.convert_to_snake_case(self._source)}"), settings["RunTest"]["Path"]
)
self.assertEqual(
- os.path.join(os.getcwd(), f'dist/{self._source}/build/{String.convert_to_snake_case(self._source)}'),
- settings['RunTest']['Path']
+ os.path.join(os.getcwd(), f"dist/{self._source}/build/{String.convert_to_snake_case(self._source)}"),
+ settings["RunTest"]["Path"],
)
def test_run_dev(self):
CLICommands.run(is_dev=True)
settings = self._get_appsettings(is_dev=True)
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
- self.assertEqual(
- os.path.join(os.getcwd(), f'src/{String.convert_to_snake_case(self._source)}'),
- settings['RunTest']['Path']
+ os.path.join(os.getcwd(), f"src/{String.convert_to_snake_case(self._source)}"), settings["RunTest"]["Path"]
)
def test_run_dev_by_project(self):
CLICommands.run(self._source, is_dev=True)
settings = self._get_appsettings(is_dev=True)
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
- self.assertEqual(
- os.path.join(os.getcwd(), f'src/{String.convert_to_snake_case(self._source)}'),
- settings['RunTest']['Path']
+ os.path.join(os.getcwd(), f"src/{String.convert_to_snake_case(self._source)}"), settings["RunTest"]["Path"]
)
diff --git a/unittests/unittests_cli/start_test_case.py b/unittests/unittests_cli/start_test_case.py
index 308450a5..3178bf42 100644
--- a/unittests/unittests_cli/start_test_case.py
+++ b/unittests/unittests_cli/start_test_case.py
@@ -12,13 +12,12 @@ from unittests_shared.cli_commands import CLICommands
class StartTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'start-test'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
- self._appsettings = f'src/{String.convert_to_snake_case(self._source)}/appsettings.json'
- self._application = f'src/{String.convert_to_snake_case(self._source)}/application.py'
+ self._source = "start-test"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
+ self._appsettings = f"src/{String.convert_to_snake_case(self._source)}/appsettings.json"
+ self._application = f"src/{String.convert_to_snake_case(self._source)}/application.py"
self._test_code = f"""
import json
import os
@@ -40,11 +39,11 @@ class StartTestCase(CommandTestCase):
"""
def _get_appsettings(self, is_dev=False):
- appsettings = f'dist/{self._source}/build/{String.convert_to_snake_case(self._source)}/appsettings.json'
+ appsettings = f"dist/{self._source}/build/{String.convert_to_snake_case(self._source)}/appsettings.json"
if is_dev:
- appsettings = f'src/{String.convert_to_snake_case(self._source)}/appsettings.json'
+ appsettings = f"src/{String.convert_to_snake_case(self._source)}/appsettings.json"
- with open(os.path.join(os.getcwd(), appsettings), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), appsettings), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -52,7 +51,11 @@ class StartTestCase(CommandTestCase):
return project_json
def _save_appsettings(self, settings: dict):
- with open(os.path.join(os.getcwd(), f'src/{String.convert_to_snake_case(self._source)}/appsettings.json'), 'w', encoding='utf-8') as project_file:
+ with open(
+ os.path.join(os.getcwd(), f"src/{String.convert_to_snake_case(self._source)}/appsettings.json"),
+ "w",
+ encoding="utf-8",
+ ) as project_file:
project_file.write(json.dumps(settings, indent=2))
project_file.close()
@@ -62,12 +65,12 @@ class StartTestCase(CommandTestCase):
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
- settings = {'RunTest': {'WasStarted': 'False', 'WasRestarted': 'False'}}
+ settings = {"RunTest": {"WasStarted": "False", "WasRestarted": "False"}}
self._save_appsettings(settings)
- with open(os.path.join(os.getcwd(), self._application), 'a', encoding='utf-8') as file:
- file.write(f'\t\t{self._test_code}')
+ with open(os.path.join(os.getcwd(), self._application), "a", encoding="utf-8") as file:
+ file.write(f"\t\t{self._test_code}")
file.close()
def test_start(self):
@@ -76,32 +79,23 @@ class StartTestCase(CommandTestCase):
time.sleep(5)
settings = self._get_appsettings()
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
- self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
- with open(os.path.join(os.getcwd(), self._application), 'a', encoding='utf-8') as file:
- file.write(f'# trigger restart (comment generated by unittest)')
+ with open(os.path.join(os.getcwd(), self._application), "a", encoding="utf-8") as file:
+ file.write(f"# trigger restart (comment generated by unittest)")
file.close()
time.sleep(5)
settings = self._get_appsettings()
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
- self.assertIn('WasRestarted', settings['RunTest'])
- self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
- self.assertEqual(
- 'True',
- settings['RunTest']['WasRestarted']
- )
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertIn("WasRestarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
+ self.assertEqual("True", settings["RunTest"]["WasRestarted"])
def test_start_dev(self):
thread = StartTestThread(is_dev=True)
@@ -109,29 +103,20 @@ class StartTestCase(CommandTestCase):
time.sleep(1)
settings = self._get_appsettings()
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
- self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
- with open(os.path.join(os.getcwd(), self._application), 'a', encoding='utf-8') as file:
- file.write(f'# trigger restart (comment generated by unittest)')
+ with open(os.path.join(os.getcwd(), self._application), "a", encoding="utf-8") as file:
+ file.write(f"# trigger restart (comment generated by unittest)")
file.close()
time.sleep(1)
settings = self._get_appsettings(is_dev=True)
self.assertNotEqual(settings, {})
- self.assertIn('RunTest', settings)
- self.assertIn('WasStarted', settings['RunTest'])
- self.assertIn('WasRestarted', settings['RunTest'])
- self.assertEqual(
- 'True',
- settings['RunTest']['WasStarted']
- )
- self.assertEqual(
- 'True',
- settings['RunTest']['WasRestarted']
- )
+ self.assertIn("RunTest", settings)
+ self.assertIn("WasStarted", settings["RunTest"])
+ self.assertIn("WasRestarted", settings["RunTest"])
+ self.assertEqual("True", settings["RunTest"]["WasStarted"])
+ self.assertEqual("True", settings["RunTest"]["WasRestarted"])
diff --git a/unittests/unittests_cli/threads/start_test_thread.py b/unittests/unittests_cli/threads/start_test_thread.py
index e6884ed9..833fb5b3 100644
--- a/unittests/unittests_cli/threads/start_test_thread.py
+++ b/unittests/unittests_cli/threads/start_test_thread.py
@@ -4,7 +4,6 @@ from unittests_shared.cli_commands import CLICommands
class StartTestThread(threading.Thread):
-
def __init__(self, is_dev=False):
threading.Thread.__init__(self, daemon=True)
self._is_dev = is_dev
diff --git a/unittests/unittests_cli/uninstall_test_case.py b/unittests/unittests_cli/uninstall_test_case.py
index b61dfafa..542faecd 100644
--- a/unittests/unittests_cli/uninstall_test_case.py
+++ b/unittests/unittests_cli/uninstall_test_case.py
@@ -12,17 +12,16 @@ from unittests_shared.cli_commands import CLICommands
class UninstallTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'uninstall-test-source'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
- self._version = '1.7.3'
- self._package_name = 'discord.py'
- self._package = f'{self._package_name}=={self._version}'
+ self._source = "uninstall-test-source"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
+ self._version = "1.7.3"
+ self._package_name = "discord.py"
+ self._package = f"{self._package_name}=={self._version}"
def _get_project_settings(self):
- with open(os.path.join(os.getcwd(), self._project_file), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), self._project_file), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -35,28 +34,22 @@ class UninstallTestCase(CommandTestCase):
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
def _get_installed_packages(self) -> dict:
- reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
- return dict([tuple(r.decode().split('==')) for r in reqs.split()])
+ reqs = subprocess.check_output([sys.executable, "-m", "pip", "freeze"])
+ return dict([tuple(r.decode().split("==")) for r in reqs.split()])
def test_uninstall(self):
CLICommands.install(self._package)
CLICommands.uninstall(self._package)
settings = self._get_project_settings()
self.assertNotEqual(settings, {})
- self.assertIn('ProjectSettings', settings)
- self.assertIn('Dependencies', settings['ProjectSettings'])
- self.assertNotIn(
- self._package,
- settings['ProjectSettings']['Dependencies']
- )
- self.assertNotIn(
- self._package,
- settings['ProjectSettings']['DevDependencies']
- )
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("Dependencies", settings["ProjectSettings"])
+ self.assertNotIn(self._package, settings["ProjectSettings"]["Dependencies"])
+ self.assertNotIn(self._package, settings["ProjectSettings"]["DevDependencies"])
packages = self._get_installed_packages()
self.assertNotIn(self._package_name, packages)
@@ -65,16 +58,10 @@ class UninstallTestCase(CommandTestCase):
CLICommands.uninstall(self._package, is_dev=True)
settings = self._get_project_settings()
self.assertNotEqual(settings, {})
- self.assertIn('ProjectSettings', settings)
- self.assertIn('Dependencies', settings['ProjectSettings'])
- self.assertIn('DevDependencies', settings['ProjectSettings'])
- self.assertNotIn(
- self._package,
- settings['ProjectSettings']['Dependencies']
- )
- self.assertNotIn(
- self._package,
- settings['ProjectSettings']['DevDependencies']
- )
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("Dependencies", settings["ProjectSettings"])
+ self.assertIn("DevDependencies", settings["ProjectSettings"])
+ self.assertNotIn(self._package, settings["ProjectSettings"]["Dependencies"])
+ self.assertNotIn(self._package, settings["ProjectSettings"]["DevDependencies"])
packages = self._get_installed_packages()
self.assertNotIn(self._package_name, packages)
diff --git a/unittests/unittests_cli/unittests_cli.json b/unittests/unittests_cli/unittests_cli.json
index b25c355a..0fb66aa3 100644
--- a/unittests/unittests_cli/unittests_cli.json
+++ b/unittests/unittests_cli/unittests_cli.json
@@ -2,8 +2,8 @@
"ProjectSettings": {
"Name": "unittest_cli",
"Version": {
- "Major": "2022",
- "Minor": "12",
+ "Major": "2023",
+ "Minor": "2",
"Micro": "0"
},
"Author": "",
@@ -16,8 +16,8 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
- "cpl-core>=2022.12.0",
- "cpl-cli>=2022.12.0"
+ "cpl-core>=2023.2.0",
+ "cpl-cli>=2023.2.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {},
diff --git a/unittests/unittests_cli/update_test_case.py b/unittests/unittests_cli/update_test_case.py
index b6e40243..c1279306 100644
--- a/unittests/unittests_cli/update_test_case.py
+++ b/unittests/unittests_cli/update_test_case.py
@@ -12,32 +12,31 @@ from unittests_shared.cli_commands import CLICommands
class UpdateTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
- self._source = 'install-test-source'
- self._project_file = f'src/{String.convert_to_snake_case(self._source)}/{self._source}.json'
+ self._source = "install-test-source"
+ self._project_file = f"src/{String.convert_to_snake_case(self._source)}/{self._source}.json"
- self._old_version = '1.7.1'
- self._old_package_name = 'discord.py'
- self._old_package = f'{self._old_package_name}=={self._old_version}'
+ self._old_version = "1.7.1"
+ self._old_package_name = "discord.py"
+ self._old_package = f"{self._old_package_name}=={self._old_version}"
# todo: better way to do shit required
- self._new_version = '2.1.0'
- self._new_package_name = 'discord.py'
- self._new_package = f'{self._new_package_name}=={self._new_version}'
+ self._new_version = "2.1.0"
+ self._new_package_name = "discord.py"
+ self._new_package = f"{self._new_package_name}=={self._new_version}"
def setUp(self):
CLICommands.uninstall(self._old_package)
CLICommands.uninstall(self._new_package)
os.chdir(PLAYGROUND_PATH)
# create projects
- CLICommands.new('console', self._source, '--ab', '--s')
+ CLICommands.new("console", self._source, "--ab", "--s")
os.chdir(os.path.join(os.getcwd(), self._source))
CLICommands.install(self._old_package)
def _get_project_settings(self):
- with open(os.path.join(os.getcwd(), self._project_file), 'r', encoding='utf-8') as cfg:
+ with open(os.path.join(os.getcwd(), self._project_file), "r", encoding="utf-8") as cfg:
# load json
project_json = json.load(cfg)
cfg.close()
@@ -45,23 +44,20 @@ class UpdateTestCase(CommandTestCase):
return project_json
def _save_project_settings(self, settings: dict):
- with open(os.path.join(os.getcwd(), self._project_file), 'w', encoding='utf-8') as project_file:
+ with open(os.path.join(os.getcwd(), self._project_file), "w", encoding="utf-8") as project_file:
project_file.write(json.dumps(settings, indent=2))
project_file.close()
def _get_installed_packages(self) -> dict:
- reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
- return dict([tuple(r.decode().split('==')) for r in reqs.split()])
+ reqs = subprocess.check_output([sys.executable, "-m", "pip", "freeze"])
+ return dict([tuple(r.decode().split("==")) for r in reqs.split()])
def test_install_package(self):
settings = self._get_project_settings()
self.assertNotEqual(settings, {})
- self.assertIn('ProjectSettings', settings)
- self.assertIn('Dependencies', settings['ProjectSettings'])
- self.assertIn(
- self._old_package,
- settings['ProjectSettings']['Dependencies']
- )
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("Dependencies", settings["ProjectSettings"])
+ self.assertIn(self._old_package, settings["ProjectSettings"]["Dependencies"])
packages = self._get_installed_packages()
self.assertIn(self._old_package_name, packages)
self.assertEqual(self._old_version, packages[self._old_package_name])
@@ -70,12 +66,9 @@ class UpdateTestCase(CommandTestCase):
settings = self._get_project_settings()
self.assertNotEqual(settings, {})
- self.assertIn('ProjectSettings', settings)
- self.assertIn('Dependencies', settings['ProjectSettings'])
- self.assertIn(
- self._new_package,
- settings['ProjectSettings']['Dependencies']
- )
+ self.assertIn("ProjectSettings", settings)
+ self.assertIn("Dependencies", settings["ProjectSettings"])
+ self.assertIn(self._new_package, settings["ProjectSettings"]["Dependencies"])
packages = self._get_installed_packages()
self.assertIn(self._new_package_name, packages)
self.assertEqual(self._new_version, packages[self._new_package_name])
diff --git a/unittests/unittests_cli/version_test_case.py b/unittests/unittests_cli/version_test_case.py
index 3ba980ff..868c6b6d 100644
--- a/unittests/unittests_cli/version_test_case.py
+++ b/unittests/unittests_cli/version_test_case.py
@@ -17,7 +17,6 @@ from unittests_shared.cli_commands import CLICommands
class VersionTestCase(CommandTestCase):
-
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
self._block_banner = ""
@@ -33,21 +32,21 @@ class VersionTestCase(CommandTestCase):
def _get_version_output(self, version: str):
index = 0
- for line in version.split('\n'):
+ for line in version.split("\n"):
if line == "":
continue
if index <= 5:
- self._block_banner += f'{line}\n'
+ self._block_banner += f"{line}\n"
if 7 <= index <= 9:
- self._block_version += f'{line}\n'
+ self._block_version += f"{line}\n"
if 10 <= index <= 16:
- self._block_cpl_packages += f'{line}\n'
+ self._block_cpl_packages += f"{line}\n"
if index >= 18:
- self._block_packages += f'{line}\n'
+ self._block_packages += f"{line}\n"
index += 1
@@ -56,7 +55,7 @@ class VersionTestCase(CommandTestCase):
cpl_packages = []
dependencies = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)
for p in dependencies:
- if str(p).startswith('cpl-'):
+ if str(p).startswith("cpl-"):
cpl_packages.append([p, dependencies[p]])
continue
@@ -64,32 +63,34 @@ class VersionTestCase(CommandTestCase):
version = CLICommands.version()
self._get_version_output(version)
- reference_banner = colored(text2art(self._name), ForegroundColorEnum.yellow.value).split('\n')
- reference_banner = "\n".join(reference_banner[:len(reference_banner) - 1]) + '\n'
+ reference_banner = colored(text2art(self._name), ForegroundColorEnum.yellow.value).split("\n")
+ reference_banner = "\n".join(reference_banner[: len(reference_banner) - 1]) + "\n"
- with self.subTest(msg='Block banner'):
+ with self.subTest(msg="Block banner"):
self.assertEqual(reference_banner, self._block_banner)
reference_version = [
colored(f'{colored("Common Python library CLI: ")}{colored(cpl_cli.__version__)}'),
- colored(f'{colored("Python: ")}{colored(f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")}'),
- colored(f'OS: {colored(f"{platform.system()} {platform.processor()}")}') + '\n'
+ colored(
+ f'{colored("Python: ")}{colored(f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")}'
+ ),
+ colored(f'OS: {colored(f"{platform.system()} {platform.processor()}")}') + "\n",
]
- with self.subTest(msg='Block version'):
- self.assertEqual('\n'.join(reference_version), self._block_version)
+ with self.subTest(msg="Block version"):
+ self.assertEqual("\n".join(reference_version), self._block_version)
reference_cpl_packages = [
- colored(colored(f'CPL packages:')),
- colored(f'{tabulate(cpl_packages, headers=["Name", "Version"])}') + '\n'
+ colored(colored(f"CPL packages:")),
+ colored(f'{tabulate(cpl_packages, headers=["Name", "Version"])}') + "\n",
]
- with self.subTest(msg='Block cpl packages'):
- self.assertEqual('\n'.join(reference_cpl_packages), self._block_cpl_packages)
+ with self.subTest(msg="Block cpl packages"):
+ self.assertEqual("\n".join(reference_cpl_packages), self._block_cpl_packages)
reference_packages = [
- colored(colored(f'Python packages:')),
+ colored(colored(f"Python packages:")),
colored(f'{tabulate(packages, headers=["Name", "Version"])}'),
- '\x1b[0m\x1b[0m\n\x1b[0m\x1b[0m\n\x1b[0m\x1b[0m\n' # fix colored codes
+ "\x1b[0m\x1b[0m\n\x1b[0m\x1b[0m\n\x1b[0m\x1b[0m\n", # fix colored codes
]
self.maxDiff = None
- with self.subTest(msg='Block packages'):
- ref_packages = '\n'.join(reference_packages)
+ with self.subTest(msg="Block packages"):
+ ref_packages = "\n".join(reference_packages)
self.assertEqual(ref_packages, self._block_packages)
diff --git a/unittests/unittests_core/__init__.py b/unittests/unittests_core/__init__.py
index ad5eca30..52f86f25 100644
--- a/unittests/unittests_core/__init__.py
+++ b/unittests/unittests_core/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/unittests/unittests_core/unittests_core.json b/unittests/unittests_core/unittests_core.json
index 882abcc0..86b29361 100644
--- a/unittests/unittests_core/unittests_core.json
+++ b/unittests/unittests_core/unittests_core.json
@@ -2,8 +2,8 @@
"ProjectSettings": {
"Name": "unittest_core",
"Version": {
- "Major": "2022",
- "Minor": "12",
+ "Major": "2023",
+ "Minor": "2",
"Micro": "0"
},
"Author": "",
@@ -16,7 +16,7 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
- "cpl-core>=2022.12.0"
+ "cpl-core>=2023.2.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {},
diff --git a/unittests/unittests_query/__init__.py b/unittests/unittests_query/__init__.py
index ad5eca30..52f86f25 100644
--- a/unittests/unittests_query/__init__.py
+++ b/unittests/unittests_query/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/unittests/unittests_query/enumerable_query_test_case.py b/unittests/unittests_query/enumerable_query_test_case.py
index 89db64d1..59352bf1 100644
--- a/unittests/unittests_query/enumerable_query_test_case.py
+++ b/unittests/unittests_query/enumerable_query_test_case.py
@@ -9,32 +9,18 @@ from unittests_query.models import User, Address
class EnumerableQueryTestCase(unittest.TestCase):
-
def setUp(self) -> None:
users = []
for i in range(0, 100):
- users.append(User(
- String.random_string(string.ascii_letters, 8).lower(),
- Address(
- String.random_string(string.ascii_letters, 10).lower(),
- randint(1, 10)
+ users.append(
+ User(
+ String.random_string(string.ascii_letters, 8).lower(),
+ Address(String.random_string(string.ascii_letters, 10).lower(), randint(1, 10)),
)
- ))
+ )
- self._t_user = User(
- 'Test user',
- Address(
- 'teststr.',
- 15
- )
- )
- self._t_user2 = User(
- 'Test user',
- Address(
- 'teststr.',
- 14
- )
- )
+ self._t_user = User("Test user", Address("teststr.", 15))
+ self._t_user2 = User("Test user", Address("teststr.", 14))
users.append(self._t_user)
users.append(self._t_user2)
@@ -76,7 +62,7 @@ class EnumerableQueryTestCase(unittest.TestCase):
self.assertEqual(avg, res)
def invalid():
- tests = Enumerable(str, ['hello', 'world'])
+ tests = Enumerable(str, ["hello", "world"])
e_res = tests.average()
self.assertRaises(InvalidTypeException, invalid)
@@ -172,10 +158,7 @@ class EnumerableQueryTestCase(unittest.TestCase):
def test_for_each(self):
users = []
- self._tests.for_each(lambda user: (
- users.append(user)
- )
- )
+ self._tests.for_each(lambda user: (users.append(user)))
self.assertEqual(len(users), len(self._tests))
@@ -187,7 +170,7 @@ class EnumerableQueryTestCase(unittest.TestCase):
self.assertEqual(99, tests.max())
def invalid():
- tests = Enumerable(str, ['hello', 'world'])
+ tests = Enumerable(str, ["hello", "world"])
e_res = tests.average()
self.assertRaises(InvalidTypeException, invalid)
@@ -200,7 +183,7 @@ class EnumerableQueryTestCase(unittest.TestCase):
self.assertEqual(0, tests.min())
def invalid():
- tests = Enumerable(str, ['hello', 'world'])
+ tests = Enumerable(str, ["hello", "world"])
e_res = tests.average()
self.assertRaises(InvalidTypeException, invalid)
@@ -238,7 +221,11 @@ class EnumerableQueryTestCase(unittest.TestCase):
self.assertEqual(res, s_res)
def test_then_by_descending(self):
- res = self._tests.order_by_descending(lambda user: user.address.street).then_by_descending(lambda user: user.address.nr).to_list()
+ res = (
+ self._tests.order_by_descending(lambda user: user.address.street)
+ .then_by_descending(lambda user: user.address.nr)
+ .to_list()
+ )
s_res = self._tests.to_list()
s_res.sort(key=lambda user: (user.address.street, user.address.nr), reverse=True)
@@ -268,7 +255,10 @@ class EnumerableQueryTestCase(unittest.TestCase):
selected_range = range_list.select(lambda x: [x, x])
self.assertEqual(selected_range.to_list(), [[x, x] for x in range(0, 100)])
- self.assertEqual(selected_range.select_many(lambda x: x).to_list(), [_x for _l in [2 * [x] for x in range(0, 100)] for _x in _l])
+ self.assertEqual(
+ selected_range.select_many(lambda x: x).to_list(),
+ [_x for _l in [2 * [x] for x in range(0, 100)] for _x in _l],
+ )
class TestClass:
def __init__(self, i, is_sub=False):
@@ -323,7 +313,7 @@ class EnumerableQueryTestCase(unittest.TestCase):
self.assertEqual(0, tests.min())
def invalid():
- tests2 = Enumerable(str, ['hello', 'world'])
+ tests2 = Enumerable(str, ["hello", "world"])
e_res = tests2.average()
self.assertRaises(InvalidTypeException, invalid)
diff --git a/unittests/unittests_query/enumerable_test_case.py b/unittests/unittests_query/enumerable_test_case.py
index 2f7c5a73..bff17ee5 100644
--- a/unittests/unittests_query/enumerable_test_case.py
+++ b/unittests/unittests_query/enumerable_test_case.py
@@ -4,13 +4,12 @@ from cpl_query.enumerable.enumerable import Enumerable
class EnumerableTestCase(unittest.TestCase):
-
def setUp(self) -> None:
self._list = Enumerable(int, list(range(1, 4)))
def test_append(self):
self.assertEqual(self._list.to_list(), [1, 2, 3])
- self.assertRaises(Exception, lambda v: self._list.add(v), '3')
+ self.assertRaises(Exception, lambda v: self._list.add(v), "3")
def test_default(self):
self.assertEqual(Enumerable.empty().to_list(), [])
diff --git a/unittests/unittests_query/iterable_query_test_case.py b/unittests/unittests_query/iterable_query_test_case.py
index 0e64ecbb..2b44c25e 100644
--- a/unittests/unittests_query/iterable_query_test_case.py
+++ b/unittests/unittests_query/iterable_query_test_case.py
@@ -10,23 +10,10 @@ from unittests_query.models import User, Address
class IterableQueryTestCase(unittest.TestCase):
-
def setUp(self) -> None:
self._tests = List(User)
- self._t_user = User(
- 'Test user',
- Address(
- 'teststr.',
- 15
- )
- )
- self._t_user2 = User(
- 'Test user',
- Address(
- 'teststr.',
- 14
- )
- )
+ self._t_user = User("Test user", Address("teststr.", 15))
+ self._t_user2 = User("Test user", Address("teststr.", 14))
self._generate_test_data()
@@ -34,10 +21,7 @@ class IterableQueryTestCase(unittest.TestCase):
for i in range(0, 100):
user = User(
String.random_string(string.ascii_letters, 8).lower(),
- Address(
- String.random_string(string.ascii_letters, 10).lower(),
- randint(1, 10)
- )
+ Address(String.random_string(string.ascii_letters, 10).lower(), randint(1, 10)),
)
self._tests.append(user)
@@ -80,7 +64,7 @@ class IterableQueryTestCase(unittest.TestCase):
self.assertEqual(avg, res)
def invalid():
- tests = List(str, ['hello', 'world'])
+ tests = List(str, ["hello", "world"])
e_res = tests.average()
self.assertRaises(InvalidTypeException, invalid)
@@ -204,10 +188,7 @@ class IterableQueryTestCase(unittest.TestCase):
def test_for_each(self):
users = []
- self._tests.for_each(lambda user: (
- users.append(user)
- )
- )
+ self._tests.for_each(lambda user: (users.append(user)))
self.assertEqual(len(users), len(self._tests))
@@ -219,7 +200,7 @@ class IterableQueryTestCase(unittest.TestCase):
self.assertEqual(99, tests.max())
def invalid():
- tests = List(str, ['hello', 'world'])
+ tests = List(str, ["hello", "world"])
e_res = tests.average()
self.assertRaises(InvalidTypeException, invalid)
@@ -232,7 +213,7 @@ class IterableQueryTestCase(unittest.TestCase):
self.assertEqual(0, tests.min())
def invalid():
- tests = List(str, ['hello', 'world'])
+ tests = List(str, ["hello", "world"])
e_res = tests.average()
self.assertRaises(InvalidTypeException, invalid)
@@ -270,7 +251,11 @@ class IterableQueryTestCase(unittest.TestCase):
self.assertEqual(res, s_res)
def test_then_by_descending(self):
- res = self._tests.order_by_descending(lambda user: user.address.street).then_by_descending(lambda user: user.address.nr).to_list()
+ res = (
+ self._tests.order_by_descending(lambda user: user.address.street)
+ .then_by_descending(lambda user: user.address.nr)
+ .to_list()
+ )
s_res = self._tests.to_list()
s_res.sort(key=lambda user: (user.address.street, user.address.nr), reverse=True)
@@ -300,7 +285,10 @@ class IterableQueryTestCase(unittest.TestCase):
selected_range = range_list.select(lambda x: [x, x])
self.assertEqual(selected_range.to_list(), [[x, x] for x in range(0, 100)])
- self.assertEqual(selected_range.select_many(lambda x: x).to_list(), [_x for _l in [2 * [x] for x in range(0, 100)] for _x in _l])
+ self.assertEqual(
+ selected_range.select_many(lambda x: x).to_list(),
+ [_x for _l in [2 * [x] for x in range(0, 100)] for _x in _l],
+ )
class TestClass:
def __init__(self, i, is_sub=False):
@@ -342,7 +330,7 @@ class IterableQueryTestCase(unittest.TestCase):
self.assertEqual(skipped.to_list(), self._tests[:-5])
self.assertEqual(skipped.last(), self._tests[:-5][len(self._tests[:-5]) - 1])
- def test_sum(self) -> List['int']:
+ def test_sum(self) -> List["int"]:
res = self._tests.sum(lambda u: u.address.nr)
s_res = 0
@@ -355,7 +343,7 @@ class IterableQueryTestCase(unittest.TestCase):
self.assertEqual(0, tests.min())
def invalid():
- tests2 = List(str, ['hello', 'world'])
+ tests2 = List(str, ["hello", "world"])
e_res = tests2.average()
self.assertRaises(InvalidTypeException, invalid)
diff --git a/unittests/unittests_query/iterable_test_case.py b/unittests/unittests_query/iterable_test_case.py
index 0185ec92..a1f55d43 100644
--- a/unittests/unittests_query/iterable_test_case.py
+++ b/unittests/unittests_query/iterable_test_case.py
@@ -4,7 +4,6 @@ from cpl_query.extension.list import List
class IterableTestCase(unittest.TestCase):
-
def setUp(self) -> None:
self._list = List(int)
@@ -18,7 +17,7 @@ class IterableTestCase(unittest.TestCase):
self._list.append(3)
self.assertEqual(self._list.to_list(), [1, 2, 3])
- self.assertRaises(Exception, lambda v: self._list.append(v), '3')
+ self.assertRaises(Exception, lambda v: self._list.append(v), "3")
def test_assign(self):
self._list.append(1)
@@ -32,4 +31,4 @@ class IterableTestCase(unittest.TestCase):
del self._list[3]
self.assertEqual(self._list.to_list(), [1, 2, 3])
- self.assertRaises(Exception, lambda v: self._list.append(v), '3')
+ self.assertRaises(Exception, lambda v: self._list.append(v), "3")
diff --git a/unittests/unittests_query/models.py b/unittests/unittests_query/models.py
index 54c9522c..88f534c5 100644
--- a/unittests/unittests_query/models.py
+++ b/unittests/unittests_query/models.py
@@ -1,18 +1,16 @@
class User:
-
def __init__(self, name, address):
self.name = name
self.address = address
def __repr__(self):
- return f'<{type(self).__name__} {self.name} {self.address}>'
+ return f"<{type(self).__name__} {self.name} {self.address}>"
class Address:
-
def __init__(self, street, nr):
self.street = street
self.nr = nr
def __repr__(self):
- return f'<{type(self).__name__} {self.street} {self.nr}>'
+ return f"<{type(self).__name__} {self.street} {self.nr}>"
diff --git a/unittests/unittests_query/performance_test_case.py b/unittests/unittests_query/performance_test_case.py
index 69c2776a..98128ac1 100644
--- a/unittests/unittests_query/performance_test_case.py
+++ b/unittests/unittests_query/performance_test_case.py
@@ -10,7 +10,6 @@ COUNT = 50
class PerformanceTestCase(unittest.TestCase):
-
def setUp(self):
i = 0
self.values = []
@@ -23,10 +22,10 @@ class PerformanceTestCase(unittest.TestCase):
iterable = timeit.timeit(lambda: Iterable.range(0, VALUES), number=COUNT)
enumerable = timeit.timeit(lambda: Enumerable.range(0, VALUES), number=COUNT)
- print('Range')
- print(f'd: {default}s')
- print(f'i: {iterable}s')
- print(f'e: {enumerable}s')
+ print("Range")
+ print(f"d: {default}s")
+ print(f"i: {iterable}s")
+ print(f"e: {enumerable}s")
self.assertAlmostEqual(round(default, 3), round(enumerable, 3))
self.assertAlmostEqual(round(default, 3), round(iterable, 3))
@@ -36,17 +35,16 @@ class PerformanceTestCase(unittest.TestCase):
iterable = timeit.timeit(lambda: Iterable.range(0, VALUES).where(lambda x: x == 50).single(), number=COUNT)
enumerable = timeit.timeit(lambda: Enumerable.range(0, VALUES).where(lambda x: x == 50).single(), number=COUNT)
- print('Where single')
- print(f'd: {default}s')
- print(f'i: {iterable}s')
- print(f'e: {enumerable}s')
+ print("Where single")
+ print(f"d: {default}s")
+ print(f"i: {iterable}s")
+ print(f"e: {enumerable}s")
self.assertLess(default, enumerable)
self.assertLess(default, iterable)
def test_where_single_complex(self):
class TestModel:
-
def __init__(self, v, tm=None):
self.value = v
self.tm = tm
@@ -56,13 +54,17 @@ class PerformanceTestCase(unittest.TestCase):
values.append(TestModel(i, TestModel(i + 1)))
default = timeit.timeit(lambda: [x for x in values if x.tm.value == 50], number=COUNT)
- iterable = timeit.timeit(lambda: Iterable(TestModel, values).where(lambda x: x.tm.value == 50).single(), number=COUNT)
- enumerable = timeit.timeit(lambda: Enumerable(TestModel, values).where(lambda x: x.tm.value == 50).single(), number=COUNT)
+ iterable = timeit.timeit(
+ lambda: Iterable(TestModel, values).where(lambda x: x.tm.value == 50).single(), number=COUNT
+ )
+ enumerable = timeit.timeit(
+ lambda: Enumerable(TestModel, values).where(lambda x: x.tm.value == 50).single(), number=COUNT
+ )
- print('Complex where single')
- print(f'd: {default}s')
- print(f'i: {iterable}s')
- print(f'e: {enumerable}s')
+ print("Complex where single")
+ print(f"d: {default}s")
+ print(f"i: {iterable}s")
+ print(f"e: {enumerable}s")
self.assertLess(default, enumerable)
self.assertLess(default, iterable)
diff --git a/unittests/unittests_query/query_test_suite.py b/unittests/unittests_query/query_test_suite.py
index c8b0d7c1..1878092c 100644
--- a/unittests/unittests_query/query_test_suite.py
+++ b/unittests/unittests_query/query_test_suite.py
@@ -8,7 +8,6 @@ from unittests_query.sequence_test_case import SequenceTestCase
class QueryTestSuite(unittest.TestSuite):
-
def __init__(self):
unittest.TestSuite.__init__(self)
diff --git a/unittests/unittests_query/sequence_test_case.py b/unittests/unittests_query/sequence_test_case.py
index 2398e2a9..a4da3c08 100644
--- a/unittests/unittests_query/sequence_test_case.py
+++ b/unittests/unittests_query/sequence_test_case.py
@@ -6,7 +6,6 @@ from cpl_query.iterable import Iterable
class SequenceTestCase(unittest.TestCase):
-
def test_to_list(self):
_list = List().extend(range(0, 100))
enumerable = Enumerable.range(0, 100)
diff --git a/unittests/unittests_query/unittests_query.json b/unittests/unittests_query/unittests_query.json
index 78ed0d58..5763ae5d 100644
--- a/unittests/unittests_query/unittests_query.json
+++ b/unittests/unittests_query/unittests_query.json
@@ -2,9 +2,9 @@
"ProjectSettings": {
"Name": "unittest_query",
"Version": {
- "Major": "2022",
- "Minor": "12",
- "Micro": "dev134"
+ "Major": "2023",
+ "Minor": "2",
+ "Micro": "0"
},
"Author": "",
"AuthorEmail": "",
@@ -16,8 +16,8 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
- "cpl-core>=2022.12.0",
- "cpl-query>=2022.12.dev134"
+ "cpl-core>=2023.2.0",
+ "cpl-query>=2023.2.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {},
diff --git a/unittests/unittests_shared/__init__.py b/unittests/unittests_shared/__init__.py
index ad5eca30..52f86f25 100644
--- a/unittests/unittests_shared/__init__.py
+++ b/unittests/unittests_shared/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/unittests/unittests_shared/cli_commands.py b/unittests/unittests_shared/cli_commands.py
index ad7c39ce..021a86ac 100644
--- a/unittests/unittests_shared/cli_commands.py
+++ b/unittests/unittests_shared/cli_commands.py
@@ -6,27 +6,28 @@ from unittests_cli.constants import CLI_PATH
class CLICommands:
-
@staticmethod
def _run(cmd: str, *args, output=False):
env_vars = os.environ
- env_vars['CPL_IS_UNITTEST'] = 'NO' if output else 'YES'
+ env_vars["CPL_IS_UNITTEST"] = "NO" if output else "YES"
- command = ['python', CLI_PATH, cmd]
+ command = ["python", CLI_PATH, cmd]
for arg in args:
command.append(arg)
if output:
subprocess.run(command, env=env_vars)
else:
- subprocess.run(command, env=env_vars, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
+ subprocess.run(
+ command, env=env_vars, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL
+ )
@staticmethod
def _run_with_output(cmd: str, *args) -> str:
env_vars = os.environ
- env_vars['CPL_IS_UNITTEST'] = 'NO'
+ env_vars["CPL_IS_UNITTEST"] = "NO"
- command = ['python', CLI_PATH, cmd]
+ command = ["python", CLI_PATH, cmd]
for arg in args:
command.append(arg)
@@ -34,63 +35,63 @@ class CLICommands:
@classmethod
def add(cls, source: str, target: str, output=False):
- cls._run('add', source, target, output=output)
+ cls._run("add", source, target, output=output)
@classmethod
def build(cls, output=False):
- cls._run('build', output=output)
+ cls._run("build", output=output)
@classmethod
def generate(cls, schematic: str, name: str, output=False):
- cls._run('generate', schematic, name, output=output)
+ cls._run("generate", schematic, name, output=output)
@classmethod
def install(cls, package: str = None, is_dev=False, output=False):
if package is None:
- cls._run('install', output=output)
+ cls._run("install", output=output)
return
- cls._run('install', package, '--dev' if is_dev else '', output=output)
+ cls._run("install", package, "--dev" if is_dev else "", output=output)
@classmethod
def new(cls, project_type: str, name: str, *args, output=False):
- cls._run('new', project_type, name, *args, output=output)
+ cls._run("new", project_type, name, *args, output=output)
@classmethod
def publish(cls, output=False):
- cls._run('publish', output=output)
+ cls._run("publish", output=output)
@classmethod
def remove(cls, project: str, output=False):
- cls._run('remove', project, output=output)
+ cls._run("remove", project, output=output)
@classmethod
def run(cls, project: str = None, is_dev=False, output=False):
args = []
if is_dev:
- args.append('--dev')
+ args.append("--dev")
if project is None:
- cls._run('run', *args, output=output)
+ cls._run("run", *args, output=output)
return
- cls._run('run', project, *args, output=output)
+ cls._run("run", project, *args, output=output)
@classmethod
def start(cls, is_dev=False, output=False):
args = []
if is_dev:
- args.append('--dev')
+ args.append("--dev")
- cls._run('start', *args, output=output)
+ cls._run("start", *args, output=output)
@classmethod
def uninstall(cls, package: str, is_dev=False, output=False):
- cls._run('uninstall', package, '--dev' if is_dev else '', output=output)
+ cls._run("uninstall", package, "--dev" if is_dev else "", output=output)
@classmethod
def update(cls, output=False):
- cls._run('update', output=output)
+ cls._run("update", output=output)
@classmethod
def version(cls) -> str:
- return cls._run_with_output('version')
+ return cls._run_with_output("version")
diff --git a/unittests/unittests_shared/unittests_shared.json b/unittests/unittests_shared/unittests_shared.json
index a7789f4b..249c1d7e 100644
--- a/unittests/unittests_shared/unittests_shared.json
+++ b/unittests/unittests_shared/unittests_shared.json
@@ -2,8 +2,8 @@
"ProjectSettings": {
"Name": "unittest_shared",
"Version": {
- "Major": "2022",
- "Minor": "12",
+ "Major": "2023",
+ "Minor": "2",
"Micro": "0"
},
"Author": "",
@@ -16,7 +16,7 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
- "cpl-core>=2022.12.0"
+ "cpl-core>=2023.2.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {},
diff --git a/unittests/unittests_translation/__init__.py b/unittests/unittests_translation/__init__.py
index ad5eca30..52f86f25 100644
--- a/unittests/unittests_translation/__init__.py
+++ b/unittests/unittests_translation/__init__.py
@@ -1 +1 @@
-# imports:
+# imports:
diff --git a/unittests/unittests_translation/translation_test_case.py b/unittests/unittests_translation/translation_test_case.py
index f7546ea6..a0fcc236 100644
--- a/unittests/unittests_translation/translation_test_case.py
+++ b/unittests/unittests_translation/translation_test_case.py
@@ -7,7 +7,6 @@ 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
@@ -17,51 +16,45 @@ class TranslationTestCase(unittest.TestCase):
os.chdir(os.path.abspath(TRANSLATION_PATH))
self._translation = TranslationService()
settings = TranslationSettings()
- settings.from_dict({
- "Languages": [
- "de",
- "en"
- ],
- "DefaultLanguage": "en"
- })
+ settings.from_dict({"Languages": ["de", "en"], "DefaultLanguage": "en"})
self._translation.load_by_settings(settings)
- self._translation.set_default_lang('de')
+ 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'))
+ 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._translation.translate("main.text.hallo_welt")
self.assertTrue(type(ctx.exception) == KeyError)
- self.assertIn('Translation main.text.hallo_welt not found', str(ctx.exception))
+ self.assertIn("Translation main.text.hallo_welt not found", str(ctx.exception))
with self.assertRaises(FileNotFoundError) as ctx:
- self._translation.load('DE')
+ self._translation.load("DE")
self.assertTrue(type(ctx.exception) == FileNotFoundError)
with self.assertRaises(KeyError) as ctx:
- self._translation.set_lang('DE')
+ self._translation.set_lang("DE")
self.assertTrue(type(ctx.exception) == KeyError)
with self.assertRaises(KeyError) as ctx:
- self._translation.set_default_lang('DE')
+ 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'))
+ 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._translation.translate("main.text.hallo_welt")
self.assertTrue(type(ctx.exception) == KeyError)
- self.assertIn('Translation main.text.hallo_welt not found', str(ctx.exception))
+ self.assertIn("Translation main.text.hallo_welt not found", str(ctx.exception))
diff --git a/unittests/unittests_translation/translation_test_suite.py b/unittests/unittests_translation/translation_test_suite.py
index f0d5a3da..34403837 100644
--- a/unittests/unittests_translation/translation_test_suite.py
+++ b/unittests/unittests_translation/translation_test_suite.py
@@ -6,7 +6,6 @@ from unittests_translation.translation_test_case import TranslationTestCase
class TranslationTestSuite(unittest.TestSuite):
-
def __init__(self):
unittest.TestSuite.__init__(self)
@@ -14,9 +13,7 @@ class TranslationTestSuite(unittest.TestSuite):
self._result: Optional[TestResult] = None
self._is_online = True
- active_tests = [
- TranslationTestCase
- ]
+ active_tests = [TranslationTestCase]
for test in active_tests:
self.addTests(loader.loadTestsFromTestCase(test))
diff --git a/unittests/unittests_translation/unittests_translation.json b/unittests/unittests_translation/unittests_translation.json
index 8fdfacba..7449b8e5 100644
--- a/unittests/unittests_translation/unittests_translation.json
+++ b/unittests/unittests_translation/unittests_translation.json
@@ -2,8 +2,8 @@
"ProjectSettings": {
"Name": "unittests_translation",
"Version": {
- "Major": "2022",
- "Minor": "12",
+ "Major": "2023",
+ "Minor": "2",
"Micro": "0"
},
"Author": "",
@@ -16,11 +16,11 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
- "cpl-core>=2022.12.0",
- "cpl-translation>=2022.12.0"
+ "cpl-core>=2023.2.0",
+ "cpl-translation>=2023.2.0"
],
"DevDependencies": [
- "cpl-cli>=2022.12.0"
+ "cpl-cli>=2023.2.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {},
diff --git a/docs/build/html/cpl_core.application.html b/docs/build/html/cpl_core.application.html
index 5cacb515..780b7ae1 100644
--- a/docs/build/html/cpl_core.application.html
+++ b/docs/build/html/cpl_core.application.html
@@ -4,7 +4,7 @@
-