Merge pull request '2020.12' (#10) from 2020.12 into master

Reviewed-on: sh-edraft.de/sh_common_py_lib#10
This commit is contained in:
Sven Heidemann 2021-02-04 10:37:05 +01:00
commit a7c2946ba5
158 changed files with 5932 additions and 1 deletions

4
.gitignore vendored
View File

@ -9,7 +9,6 @@ __pycache__/
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
@ -129,3 +128,6 @@ dmypy.json
# Pyre type checker
.pyre/
# IDE
.vscode/

View File

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="sven" />
</component>

View File

@ -0,0 +1,17 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="termcolor" />
<item index="1" class="java.lang.String" itemvalue="discord" />
<item index="2" class="java.lang.String" itemvalue="mysql-connector" />
<item index="3" class="java.lang.String" itemvalue="flask" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectPlainTextFileTypeManager">
<file url="file://$PROJECT_DIR$/publish_templates/all_template.txt" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/sh_common_py_lib.iml" filepath="$PROJECT_DIR$/.idea/sh_common_py_lib.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
<excludeFolder url="file://$MODULE_DIR$/src/tests/logs" />
<excludeFolder url="file://$MODULE_DIR$/src/tests_dev/logs" />
<excludeFolder url="file://$MODULE_DIR$/src/sh_edraft.egg-info" />
<excludeFolder url="file://$MODULE_DIR$/src/dist" />
<excludeFolder url="file://$MODULE_DIR$/src/build" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/src/tests/old" />
<excludeFolder url="file://$MODULE_DIR$/.vscode" />
<excludeFolder url="file://$MODULE_DIR$/build_test" />
</content>
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
<changelist name="Uncommitted_changes_before_Update_at_26_11_2020_10_36_[Default_Changelist]" date="1606383362450" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_26_11_2020_10_36_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 26.11.2020 10:36 [Default Changelist]" />
</changelist>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

868
.idea/workspace.xml Normal file
View File

@ -0,0 +1,868 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Removed unused packages">
<change afterPath="$PROJECT_DIR$/src/tests/publish_test/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/tests/publish_test/publisher_test.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/tests/setup.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/sh_common_py_lib.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sh_common_py_lib.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/build/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/build/app.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/publish/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/publish/app.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/base/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/base/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/base/publisher_base.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/base/publisher_base.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/publish_settings_model.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/publish_settings_model.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/publish_settings_name.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/publish_settings_name.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/template.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/template.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/template_enum.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/template_enum.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/publisher.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/publisher.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/appsettings.edrafts-lapi.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/appsettings.edrafts-lapi.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/appsettings.edrafts-pc.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/appsettings.edrafts-pc.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/build.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/build.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/service_test/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/service_test/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/time_test/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/time_test/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/utils_test/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/utils_test/__init__.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
<option value="Python Unit Test" />
</list>
</option>
</component>
<component name="Git.Pull.Settings">
<option name="BRANCH" value="2020.12.6" />
</component>
<component name="Git.Rebase.Settings">
<option name="NEW_BASE" value="2020.12" />
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="2020.12" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="RESET_MODE" value="HARD" />
<option name="UPDATE_TYPE" value="REBASE" />
</component>
<component name="ProjectId" id="1kYeNqJzjIXigSYYCzg4D16FL1E" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/tests" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/tests" />
<recent name="$PROJECT_DIR$/src/tests_dev" />
<recent name="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/database" />
<recent name="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/publish" />
<recent name="$PROJECT_DIR$/src" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/tests" />
<recent name="$PROJECT_DIR$/src/tests/publish_test" />
<recent name="$PROJECT_DIR$/src/tests/old" />
<recent name="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/build" />
<recent name="$PROJECT_DIR$/src" />
</key>
</component>
<component name="RunManager" selected="Python tests.Unittests">
<configuration name="cli build" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="build test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli database migration" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="db mig add InitialMigration" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli database update" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="database update" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli help" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="help" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new app" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new app ./Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new base" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new app ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new class" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new class ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new configmodel" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new configmodel ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new enum" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new enum ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new service" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new service ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli publish" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="publish" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli version" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="version" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="CPL_NAME" value="CPL_Dev_Test" />
<env name="PYTHON_ENVIRONMENT" value="development" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/tests_dev/main.py" />
<option name="PARAMETERS" value="--customer=sh-edraft.de" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="Unittests" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="CPL_ENVIRONMENT" value="testing" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_pattern" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;discover -s $PROJECT_DIR$/src/tests -p \u0027*_test.py\u0027&quot;" />
<option name="_new_target" value="&quot;&quot;" />
<option name="_new_targetType" value="&quot;CUSTOM&quot;" />
<method v="2" />
</configuration>
<configuration name="Unittests" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="CPL_ENVIRONMENT" value="testing" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_pattern" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;discover -s $PROJECT_DIR$/src/tests -p \u0027*_test.py\u0027&quot;" />
<option name="_new_target" value="&quot;&quot;" />
<option name="_new_targetType" value="&quot;CUSTOM&quot;" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Python.cli build" />
<item itemvalue="Python.cli database migration" />
<item itemvalue="Python.cli database update" />
<item itemvalue="Python.cli help" />
<item itemvalue="Python.cli new app" />
<item itemvalue="Python.cli new base" />
<item itemvalue="Python.cli new class" />
<item itemvalue="Python.cli new configmodel" />
<item itemvalue="Python.cli new enum" />
<item itemvalue="Python.cli new service" />
<item itemvalue="Python.cli publish" />
<item itemvalue="Python.cli version" />
<item itemvalue="Python.cli" />
<item itemvalue="Python.main" />
<item itemvalue="Python tests.Unittests" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python tests.Unittests" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="" />
<created>1605881914521</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1605881914521</updated>
</task>
<task id="LOCAL-00031" summary="Improved database module structure">
<created>1607285697331</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1607285697331</updated>
</task>
<task id="LOCAL-00032" summary="Improved database module structure">
<created>1607620265254</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1607620265254</updated>
</task>
<task id="LOCAL-00033" summary="Changed DatabaseConnection">
<created>1607712129507</created>
<option name="number" value="00033" />
<option name="presentableId" value="LOCAL-00033" />
<option name="project" value="LOCAL" />
<updated>1607712129507</updated>
</task>
<task id="LOCAL-00034" summary="Improved session reference">
<created>1607971885250</created>
<option name="number" value="00034" />
<option name="presentableId" value="LOCAL-00034" />
<option name="project" value="LOCAL" />
<updated>1607971885250</updated>
</task>
<task id="LOCAL-00035" summary="Added console module">
<created>1607976456889</created>
<option name="number" value="00035" />
<option name="presentableId" value="LOCAL-00035" />
<option name="project" value="LOCAL" />
<updated>1607976456889</updated>
</task>
<task id="LOCAL-00036" summary="Added console module">
<created>1607976626173</created>
<option name="number" value="00036" />
<option name="presentableId" value="LOCAL-00036" />
<option name="project" value="LOCAL" />
<updated>1607976626173</updated>
</task>
<task id="LOCAL-00037" summary="Improved console">
<created>1608037411172</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1608037411172</updated>
</task>
<task id="LOCAL-00038" summary="Improved console">
<created>1608047595029</created>
<option name="number" value="00038" />
<option name="presentableId" value="LOCAL-00038" />
<option name="project" value="LOCAL" />
<updated>1608047595029</updated>
</task>
<task id="LOCAL-00039" summary="Improved ApplicationHost">
<created>1608047655667</created>
<option name="number" value="00039" />
<option name="presentableId" value="LOCAL-00039" />
<option name="project" value="LOCAL" />
<updated>1608047655667</updated>
</task>
<task id="LOCAL-00040" summary="Improved publisher">
<created>1608048544558</created>
<option name="number" value="00040" />
<option name="presentableId" value="LOCAL-00040" />
<option name="project" value="LOCAL" />
<updated>1608048544558</updated>
</task>
<task id="LOCAL-00041" summary="Improved publisher">
<created>1608049672925</created>
<option name="number" value="00041" />
<option name="presentableId" value="LOCAL-00041" />
<option name="project" value="LOCAL" />
<updated>1608049672925</updated>
</task>
<task id="LOCAL-00042" summary="Published for 2020.12.9">
<created>1608049772153</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1608049772153</updated>
</task>
<task id="LOCAL-00043" summary="Publish improvements for pip install">
<created>1608059323858</created>
<option name="number" value="00043" />
<option name="presentableId" value="LOCAL-00043" />
<option name="project" value="LOCAL" />
<updated>1608059323858</updated>
</task>
<task id="LOCAL-00044" summary="Improved setup.py">
<created>1608059501153</created>
<option name="number" value="00044" />
<option name="presentableId" value="LOCAL-00044" />
<option name="project" value="LOCAL" />
<updated>1608059501153</updated>
</task>
<task id="LOCAL-00045" summary="Added first cli commands">
<created>1608066984496</created>
<option name="number" value="00045" />
<option name="presentableId" value="LOCAL-00045" />
<option name="project" value="LOCAL" />
<updated>1608066984496</updated>
</task>
<task id="LOCAL-00046" summary="Bugfixes and improved setup logic">
<created>1608070231599</created>
<option name="number" value="00046" />
<option name="presentableId" value="LOCAL-00046" />
<option name="project" value="LOCAL" />
<updated>1608070231599</updated>
</task>
<task id="LOCAL-00047" summary="Improved cli">
<created>1608122289003</created>
<option name="number" value="00047" />
<option name="presentableId" value="LOCAL-00047" />
<option name="project" value="LOCAL" />
<updated>1608122289003</updated>
</task>
<task id="LOCAL-00048" summary="Added version command to cli">
<created>1608125743068</created>
<option name="number" value="00048" />
<option name="presentableId" value="LOCAL-00048" />
<option name="project" value="LOCAL" />
<updated>1608125743068</updated>
</task>
<task id="LOCAL-00049" summary="Improved version command &amp; improved help command">
<created>1608127752645</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1608127752645</updated>
</task>
<task id="LOCAL-00050" summary="Improved cli error handling">
<created>1608127998033</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1608127998034</updated>
</task>
<task id="LOCAL-00051" summary="Removed module template">
<created>1608128026922</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1608128026922</updated>
</task>
<task id="LOCAL-00052" summary="Added build command to cli">
<created>1608133651981</created>
<option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" />
<updated>1608133651982</updated>
</task>
<task id="LOCAL-00053" summary="Improved publish process">
<created>1608136663213</created>
<option name="number" value="00053" />
<option name="presentableId" value="LOCAL-00053" />
<option name="project" value="LOCAL" />
<updated>1608136663213</updated>
</task>
<task id="LOCAL-00054" summary="Improved publish process">
<created>1608137669182</created>
<option name="number" value="00054" />
<option name="presentableId" value="LOCAL-00054" />
<option name="project" value="LOCAL" />
<updated>1608137669182</updated>
</task>
<task id="LOCAL-00055" summary="Added publish command to cli">
<created>1608138851088</created>
<option name="number" value="00055" />
<option name="presentableId" value="LOCAL-00055" />
<option name="project" value="LOCAL" />
<updated>1608138851088</updated>
</task>
<task id="LOCAL-00056" summary="Added imports to cli module">
<created>1608138986801</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1608138986801</updated>
</task>
<task id="LOCAL-00057" summary="Improved help command">
<created>1608139067953</created>
<option name="number" value="00057" />
<option name="presentableId" value="LOCAL-00057" />
<option name="project" value="LOCAL" />
<updated>1608139067953</updated>
</task>
<task id="LOCAL-00058" summary="Changed deps">
<created>1608139239527</created>
<option name="number" value="00058" />
<option name="presentableId" value="LOCAL-00058" />
<option name="project" value="LOCAL" />
<updated>1608139239527</updated>
</task>
<task id="LOCAL-00059" summary="Bugfixes">
<created>1608139414722</created>
<option name="number" value="00059" />
<option name="presentableId" value="LOCAL-00059" />
<option name="project" value="LOCAL" />
<updated>1608139414722</updated>
</task>
<task id="LOCAL-00060" summary="Bugfixes">
<created>1608139502304</created>
<option name="number" value="00060" />
<option name="presentableId" value="LOCAL-00060" />
<option name="project" value="LOCAL" />
<updated>1608139502304</updated>
</task>
<task id="LOCAL-00061" summary="Removed publisher.py">
<created>1608139612476</created>
<option name="number" value="00061" />
<option name="presentableId" value="LOCAL-00061" />
<option name="project" value="LOCAL" />
<updated>1608139612476</updated>
</task>
<task id="LOCAL-00062" summary="Added first steps of database command">
<created>1608383809354</created>
<option name="number" value="00062" />
<option name="presentableId" value="LOCAL-00062" />
<option name="project" value="LOCAL" />
<updated>1608383809355</updated>
</task>
<task id="LOCAL-00063" summary="Improved error handling">
<created>1608383870849</created>
<option name="number" value="00063" />
<option name="presentableId" value="LOCAL-00063" />
<option name="project" value="LOCAL" />
<updated>1608383870849</updated>
</task>
<task id="LOCAL-00064" summary="Improved service providing">
<created>1608472168532</created>
<option name="number" value="00064" />
<option name="presentableId" value="LOCAL-00064" />
<option name="project" value="LOCAL" />
<updated>1608472168532</updated>
</task>
<task id="LOCAL-00065" summary="Added email client">
<created>1608472183294</created>
<option name="number" value="00065" />
<option name="presentableId" value="LOCAL-00065" />
<option name="project" value="LOCAL" />
<updated>1608472183294</updated>
</task>
<task id="LOCAL-00066" summary="Published">
<created>1608474022759</created>
<option name="number" value="00066" />
<option name="presentableId" value="LOCAL-00066" />
<option name="project" value="LOCAL" />
<updated>1608474022759</updated>
</task>
<task id="LOCAL-00067" summary="Improved publisher">
<created>1608474032244</created>
<option name="number" value="00067" />
<option name="presentableId" value="LOCAL-00067" />
<option name="project" value="LOCAL" />
<updated>1608474032244</updated>
</task>
<task id="LOCAL-00068" summary="Added imports">
<created>1608474289859</created>
<option name="number" value="00068" />
<option name="presentableId" value="LOCAL-00068" />
<option name="project" value="LOCAL" />
<updated>1608474289859</updated>
</task>
<task id="LOCAL-00069" summary="Removed build form gitignore, added build command">
<created>1608813096023</created>
<option name="number" value="00069" />
<option name="presentableId" value="LOCAL-00069" />
<option name="project" value="LOCAL" />
<updated>1608813096023</updated>
</task>
<task id="LOCAL-00070" summary="Added init file for build command package">
<created>1608813152266</created>
<option name="number" value="00070" />
<option name="presentableId" value="LOCAL-00070" />
<option name="project" value="LOCAL" />
<updated>1608813152266</updated>
</task>
<task id="LOCAL-00071" summary="Added pycharm files to gitignore">
<created>1608822597300</created>
<option name="number" value="00071" />
<option name="presentableId" value="LOCAL-00071" />
<option name="project" value="LOCAL" />
<updated>1608822597311</updated>
</task>
<task id="LOCAL-00072" summary="Added more development tests">
<created>1608823061488</created>
<option name="number" value="00072" />
<option name="presentableId" value="LOCAL-00072" />
<option name="project" value="LOCAL" />
<updated>1608823061489</updated>
</task>
<task id="LOCAL-00073" summary="Added new tester and CredentialManager TestCase">
<created>1608894745271</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1608894745274</updated>
</task>
<task id="LOCAL-00074" summary="Bugfix">
<created>1608896199033</created>
<option name="number" value="00074" />
<option name="presentableId" value="LOCAL-00074" />
<option name="project" value="LOCAL" />
<updated>1608896199034</updated>
</task>
<task id="LOCAL-00075" summary="Added TimeFormatSettings Test">
<created>1608896235005</created>
<option name="number" value="00075" />
<option name="presentableId" value="LOCAL-00075" />
<option name="project" value="LOCAL" />
<updated>1608896235006</updated>
</task>
<task id="LOCAL-00076" summary="Bugfixes">
<created>1608901608928</created>
<option name="number" value="00076" />
<option name="presentableId" value="LOCAL-00076" />
<option name="project" value="LOCAL" />
<updated>1608901608930</updated>
</task>
<task id="LOCAL-00077" summary="Improved tests">
<created>1608921175852</created>
<option name="number" value="00077" />
<option name="presentableId" value="LOCAL-00077" />
<option name="project" value="LOCAL" />
<updated>1608921175853</updated>
</task>
<task id="LOCAL-00078" summary="Bugfixes and improved tests">
<created>1608986131753</created>
<option name="number" value="00078" />
<option name="presentableId" value="LOCAL-00078" />
<option name="project" value="LOCAL" />
<updated>1608986131755</updated>
</task>
<task id="LOCAL-00079" summary="Removed unused packages">
<created>1611431001647</created>
<option name="number" value="00079" />
<option name="presentableId" value="LOCAL-00079" />
<option name="project" value="LOCAL" />
<updated>1611431001649</updated>
</task>
<option name="localTasksCounter" value="80" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Added build command to cli" />
<MESSAGE value="Improved publish process" />
<MESSAGE value="Added publish command to cli" />
<MESSAGE value="Added imports to cli module" />
<MESSAGE value="Improved help command" />
<MESSAGE value="Changed deps" />
<MESSAGE value="Removed publisher.py" />
<MESSAGE value="Added first steps of database command" />
<MESSAGE value="Improved error handling" />
<MESSAGE value="Improved service providing" />
<MESSAGE value="Added email client" />
<MESSAGE value="Published" />
<MESSAGE value="Improved publisher" />
<MESSAGE value="Added imports" />
<MESSAGE value="Removed build form gitignore, added build command" />
<MESSAGE value="Added init file for build command package" />
<MESSAGE value="Added pycharm files to gitignore" />
<MESSAGE value="Added more development tests" />
<MESSAGE value="Added new tester and CredentialManager TestCase" />
<MESSAGE value="Bugfix" />
<MESSAGE value="Added TimeFormatSettings Test" />
<MESSAGE value="Bugfixes" />
<MESSAGE value="Improved tests" />
<MESSAGE value="Bugfixes and improved tests" />
<MESSAGE value="Removed unused packages" />
<option name="LAST_COMMIT_MESSAGE" value="Removed unused packages" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/src/tests/publish_test/publisher_test.py</url>
<line>50</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

9
docs/cli.md Normal file
View File

@ -0,0 +1,9 @@
prefix: cpl
commands:
new:
app
base
class
configmodel
enum
service

2
docs/install.md Normal file
View File

@ -0,0 +1,2 @@
python setup.py install # for install
python setup.py sdist bdist_wheel # for build

10
docs/structure.md Normal file
View File

@ -0,0 +1,10 @@
- sh_edraft
- common # Contains Interfaces and models for the hole library
- interface
- model
- configuration # Contains classes for app configuration by JSON, ENV vars and arguments
- discord # Contains classes for better use of discord.py
- logging # Contains classes for logging
- mailing # Contains classes for mailing
- messenger # Contains classes for sh_messenger_server client
- service # Contains classes to provide and use the services defined in this library

2
docs/todo.md Normal file
View File

@ -0,0 +1,2 @@
- create logger
- use logger in publisher

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
$Name $Description
~~~~~~~~~~~~~~~~~~~
$LongDescription
:copyright: (c) $CopyrightDate $CopyrightName
:license: $LicenseName$LicenseDescription
"""
__title__ = '$Title'
__author__ = '$Author'
__license__ = '$LicenseName'
__copyright__ = 'Copyright (c) $CopyrightDate $CopyrightName'
__version__ = '$Version'
from collections import namedtuple
$Imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=$Major, minor=$Minor, micro=$Micro)

29
requirements.txt Normal file
View File

@ -0,0 +1,29 @@
aiohttp==3.6.3
async-timeout==3.0.1
attrs==20.3.0
certifi==2020.11.8
chardet==3.0.4
click==7.1.2
dateutils==0.6.12
discord==1.0.1
discord.py==1.5.1
Flask==1.1.2
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
keyboard==0.13.5
MarkupSafe==1.1.1
multidict==4.7.6
mysql-connector==2.2.9
overloading==0.5.0
python-dateutil==2.8.1
pytz==2020.4
six==1.15.0
SQLAlchemy==1.3.20
termcolor==1.1.0
urllib3==1.26.2
Werkzeug==1.0.1
yarl==1.5.1
setuptools~=49.2.1
pyfiglet~=0.8.post1
tabulate~=0.8.7

2
src/MANIFEST.in Normal file
View File

@ -0,0 +1,2 @@
include ../ README
recursive-include sh_edraft *.txt

66
src/build.json Normal file
View File

@ -0,0 +1,66 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "../build/logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "INFO",
"FileLogLevel": "TRACE"
},
"PublishSettings": {
"SourcePath": "./",
"DistPath": "../build/dist",
"Templates": [
{
"TemplatePath": "../publish_templates/all_template.txt",
"Name": "all",
"Description": "",
"LongDescription": "",
"CopyrightDate": "2020",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": ", see LICENSE for more details.",
"Title": "",
"Author": "Sven Heidemann",
"Version": {
"Major": 2020,
"Minor": 12,
"Micro": 10
}
},
{
"TemplatePath": "../publish_templates/all_template.txt",
"Name": "sh_edraft",
"Description": "common python library",
"LongDescription": "Library to share common classes and models used at sh-edraft.de",
"CopyrightDate": "2020",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": ", see LICENSE for more details.",
"Title": "",
"Author": "Sven Heidemann",
"Version": {
"Major": 2020,
"Minor": 12,
"Micro": 10
}
}
],
"IncludedFiles": [
"./MANIFEST.in",
"../LICENSE",
"../README.md",
"../requirements.txt",
"sh_edraft/cli/cpl_cli/templates"
],
"ExcludedFiles": [
"./tests",
"./tests_dev"
],
"TemplateEnding": "_template.txt"
}
}

29
src/setup.py Normal file
View File

@ -0,0 +1,29 @@
import setuptools
setuptools.setup(
name='sh_edraft',
version='2020.0.1',
packages=setuptools.find_packages(exclude=["tests*"]),
url='https://www.sh-edraft.de',
license='MIT',
author='Sven Heidemann',
author_email='edraft.sh@gmail.com',
include_package_data=True,
description='sh-edraft python common lib',
python_requires='>=3.8',
install_requires=[
'discord.py',
'flask',
'mysql-connector',
'SQLAlchemy',
'termcolor',
'pyfiglet',
'tabulate',
'smtplib'
],
entry_points={
'console_scripts': [
'cpl = sh_edraft.cli.cpl_cli.cli:main'
]
}
)

25
src/sh_edraft/__init__.py Normal file
View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_edraft common python library
~~~~~~~~~~~~~~~~~~~
Library to share common classes and models used at sh-edraft.de
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli.command
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli.command'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli.command.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli.command.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
from .command_base import CommandBase
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,15 @@
from abc import ABC, abstractmethod
class CommandBase(ABC):
@abstractmethod
def __init__(self):
self._aliases: list[str] = []
@property
def aliases(self):
return self._aliases
@abstractmethod
def run(self, args: list[str]): pass

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli.cpl_cli
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli.cpl_cli'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
from .cli import CLI
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,42 @@
import sys
import traceback
from sh_edraft.cli.cpl_cli.commands.build.build import Build
from sh_edraft.cli.cpl_cli.commands.help import Help
from sh_edraft.cli.cpl_cli.commands.new import New
from sh_edraft.cli.cpl_cli.commands.publish.publish import Publish
from sh_edraft.cli.cpl_cli.commands.version import Version
from sh_edraft.cli.interpreter.interpreter import Interpreter
from sh_edraft.console.console import Console
class CLI:
def __init__(self):
self._interpreter = Interpreter()
def setup(self):
self._interpreter.add_command(Build())
self._interpreter.add_command(Help())
self._interpreter.add_command(New())
self._interpreter.add_command(Publish())
self._interpreter.add_command(Version())
def main(self):
string = ' '.join(sys.argv[1:])
try:
self._interpreter.interpret(string)
except Exception as e:
tb = traceback.format_exc()
Console.error(str(e), tb)
Console.error('Run \'cpl help\'')
def main():
cli = CLI()
cli.setup()
cli.main()
if __name__ == '__main__':
main()

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli.cpl_cli.commands
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli.cpl_cli.commands'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
from .version import Version
from .help import Help
from .new import New
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli.cpl_cli.commands.build
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli.cpl_cli.commands.build'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
from .app import BuildApp
from .build import Build
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,47 @@
from typing import Optional
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
from sh_edraft.hosting.application_host import ApplicationHost
from sh_edraft.hosting.base.application_base import ApplicationBase
from sh_edraft.logging.logger import Logger
from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.publish.publisher import Publisher
from sh_edraft.publish.base.publisher_base import PublisherBase
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase
class BuildApp(ApplicationBase):
def __init__(self):
ApplicationBase.__init__(self)
self._app_host: Optional[ApplicationHost] = None
self._services: Optional[ServiceProviderBase] = None
self._configuration: Optional[ConfigurationBase] = None
self._logger: Optional[LoggerBase] = None
self._publisher: Optional[PublisherBase] = None
def create_application_host(self):
self._app_host = ApplicationHost()
self._configuration = self._app_host.configuration
self._services = self._app_host.services
def create_configuration(self):
self._configuration.add_json_file(f'build.json')
def create_services(self):
# Add and create logger
self._services.add_singleton(LoggerBase, Logger)
self._logger = self._services.get_service(LoggerBase)
# Add and create publisher
self._services.add_singleton(PublisherBase, Publisher)
self._publisher: Publisher = self._services.get_service(PublisherBase)
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._publisher.create()
self._publisher.build()

View File

@ -0,0 +1,23 @@
from sh_edraft.cli.command.base.command_base import CommandBase
from sh_edraft.cli.cpl_cli.commands.build.app import BuildApp
from sh_edraft.console.console import Console
class Build(CommandBase):
def __init__(self):
CommandBase.__init__(self)
self._app = BuildApp()
self._aliases.append('-b')
self._aliases.append('-B')
def run(self, args: list[str]):
if len(args) > 0:
Console.error(f'Invalid arguments {args}')
Console.error('Run \'cpl help\'')
self._app.create_application_host()
self._app.create_configuration()
self._app.create_services()
self._app.main()

View File

@ -0,0 +1,27 @@
from sh_edraft.cli.command.base.command_base import CommandBase
from sh_edraft.console.console import Console
class Help(CommandBase):
def __init__(self):
CommandBase.__init__(self)
self._aliases.append('-h')
self._aliases.append('-H')
def run(self, args: list[str]):
Console.write_line('Available Commands:')
commands = [
['build (-b|-B)', 'Prepares files for publishing into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.'],
['help (-h|-H)', 'Lists available commands and their short descriptions.'],
['new', 'Creates a new file or package.'],
['publish (-p|-P)', 'Prepares files for publishing into an output directory named dist/ at the given output path and executes setup.py. Must be executed from within a workspace directory.'],
['version (-v|-V)', 'Outputs CPL CLI version.']
]
for name, description in commands:
Console.set_foreground_color('blue')
Console.write(f'\n\t{name} ')
Console.set_foreground_color('default')
Console.write(f'{description}')
Console.write('\n')

View File

@ -0,0 +1,97 @@
import os
from sh_edraft.cli.command.base.command_base import CommandBase
from sh_edraft.console.console import Console
class New(CommandBase):
def __init__(self):
CommandBase.__init__(self)
def run(self, args: list[str]):
rel_path = f'{os.path.dirname(__file__)}/../'
if len(args) == 0:
Console.error(f'Expected arguments {args}')
Console.error('Run \'cpl help\'')
return
elif len(args) != 2:
Console.error(f'Invalid arguments {args}')
Console.error('Run \'cpl help\'')
return
if not os.path.isdir(f'{rel_path}/templates/{args[0]}'):
Console.error(f'Unexpected argument {args[0]}')
Console.error('Run \'cpl help\'')
sub_args = args[1:]
if len(sub_args) != 1:
Console.error(f'Unexpected argument {sub_args[1]}')
Console.error('Run \'cpl help\'')
if not (sub_args[0].startswith('.') or sub_args[0].startswith('/')):
full_path = f'./{sub_args[0]}'
else:
full_path = sub_args[0]
name = os.path.basename(full_path)
path = os.path.dirname(full_path)
if args[0] in ['base', 'class', 'configmodel', 'enum', 'service']:
if not os.path.isdir(path):
os.makedirs(path)
else:
if not os.path.isdir(full_path):
os.makedirs(full_path)
for r, d, f in os.walk(f'{rel_path}/templates/{args[0]}'):
for file in f:
template_content = ''
with open(f'{r}/{file}') as template:
template_content = template.read()
template.close()
file = file.replace('txt', 'py')
if args[0] in ['base', 'class', 'configmodel', 'enum', 'service']:
suffix = None
if args[0] == 'base':
suffix = 'base'
elif args[0] == 'configmodel':
suffix = 'settings'
elif args[0] == 'service':
suffix = 'service'
if suffix is not None:
file_path = f'{path}/{name}_{suffix}.py'
else:
file_path = f'{path}/{name}.py'
else:
file_path = f'{full_path}/{file}'
with open(file_path, 'w+') as pyfile:
if name[0].islower():
name = f'{name[0].upper()}{name[1:]}'
if args[0] == 'base':
template_content = template_content.replace('$Name', f'{name}Base')
pyfile.write(template_content)
elif args[0] == 'configmodel':
template_content = template_content.replace('$Name', f'{name}Settings')
pyfile.write(template_content)
elif args[0] == 'service':
template_content = template_content.replace('$Name', f'{name}Service')
template_content = template_content.replace('$Base', f'{name}Base')
pyfile.write(template_content)
else:
template_content = template_content.replace('$Name', name)
pyfile.write(template_content)
pyfile.close()

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli.cpl_cli.commands.publish
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli.cpl_cli.commands.publish'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
from .app import PublishApp
from .publish import Publish
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,48 @@
from typing import Optional
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
from sh_edraft.hosting.application_host import ApplicationHost
from sh_edraft.hosting.base.application_base import ApplicationBase
from sh_edraft.logging.logger import Logger
from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.publish.publisher import Publisher
from sh_edraft.publish.base.publisher_base import PublisherBase
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase
class PublishApp(ApplicationBase):
def __init__(self):
ApplicationBase.__init__(self)
self._app_host: Optional[ApplicationHost] = None
self._services: Optional[ServiceProviderBase] = None
self._configuration: Optional[ConfigurationBase] = None
self._logger: Optional[LoggerBase] = None
self._publisher: Optional[PublisherBase] = None
def create_application_host(self):
self._app_host = ApplicationHost()
self._configuration = self._app_host.configuration
self._services = self._app_host.services
def create_configuration(self):
self._configuration.add_json_file(f'build.json')
def create_services(self):
# Add and create logger
self._services.add_singleton(LoggerBase, Logger)
self._logger = self._services.get_service(LoggerBase)
# Add and create publisher
self._services.add_singleton(PublisherBase, Publisher)
self._publisher: Publisher = self._services.get_service(PublisherBase)
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._publisher.create()
self._publisher.build()
self._publisher.publish()

View File

@ -0,0 +1,23 @@
from sh_edraft.cli.command.base.command_base import CommandBase
from sh_edraft.cli.cpl_cli.commands.publish.app import PublishApp
from sh_edraft.console.console import Console
class Publish(CommandBase):
def __init__(self):
CommandBase.__init__(self)
self._app = PublishApp()
self._aliases.append('-p')
self._aliases.append('-P')
def run(self, args: list[str]):
if len(args) > 0:
Console.error(f'Invalid arguments {args}')
Console.error('Run \'cpl help\'')
self._app.create_application_host()
self._app.create_configuration()
self._app.create_services()
self._app.main()

View File

@ -0,0 +1,42 @@
import pkgutil
import sys
import platform
import pkg_resources
import sh_edraft
from sh_edraft import cli
from sh_edraft.cli.command.base.command_base import CommandBase
from sh_edraft.console.console import Console
class Version(CommandBase):
def __init__(self):
CommandBase.__init__(self)
self._aliases.append('-v')
self._aliases.append('-V')
def run(self, args: list[str]):
Console.set_foreground_color('yellow')
Console.banner('CPL CLI')
Console.set_foreground_color('default')
Console.write_line(f'Common Python Library CLI: {cli.__version__}')
Console.write_line(f'Python: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')
Console.write_line(f'OS: {platform.system()} {platform.processor()}')
Console.write_line('CPL:')
packages = []
for importer, modname, is_pkg in pkgutil.iter_modules(sh_edraft.__path__):
module = importer.find_module(modname).load_module(modname)
packages.append([f'{modname}', module.__version__])
Console.table(['Name', 'Version'], packages)
Console.write_line('\nPython Packages:')
packages = []
deps = dict(tuple(str(ws).split()) for ws in pkg_resources.working_set)
for p in deps:
packages.append([p, deps[p]])
Console.table(['Name', 'Version'], packages)

View File

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

View File

@ -0,0 +1,22 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "build/logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "INFO",
"FileLogLevel": "INFO"
},
"PublishSettings": {
"SourcePath": "./",
"DistPath": "build/dist",
"Templates": [],
"IncludedFiles": [],
"ExcludedFiles": [],
"TemplateEnding": "_template.txt"
}
}

View File

@ -0,0 +1,8 @@
from program import Program
if __name__ == '__main__':
program = Program()
program.create_application_host()
program.create_configuration()
program.create_services()
program.main()

View File

@ -0,0 +1,43 @@
from typing import Optional
from sh_edraft.configuration.base import ConfigurationBase
from sh_edraft.hosting import ApplicationHost
from sh_edraft.hosting.base import ApplicationBase
from sh_edraft.logging import Logger
from sh_edraft.logging.base import LoggerBase
from sh_edraft.service.providing.base import ServiceProviderBase
class Program(ApplicationBase):
def __init__(self):
ApplicationBase.__init__(self)
self._app_host: Optional[ApplicationHost] = None
self._services: Optional[ServiceProviderBase] = None
self._configuration: Optional[ConfigurationBase] = None
self._logger: Optional[LoggerBase] = None
def create_application_host(self):
self._app_host = ApplicationHost()
self._configuration = self._app_host.configuration
self._services = self._app_host.services
def create_configuration(self):
self._configuration.add_environment_variables('PYTHON_')
self._configuration.add_environment_variables('CPL_')
self._configuration.add_argument_variables()
self._configuration.add_json_file(f'appsettings.json')
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.environment_name}.json', optional=True)
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.host_name}.json', optional=True)
def create_services(self):
# Add and create logger
self._services.add_singleton(LoggerBase, Logger)
self._logger = self._services.get_service(LoggerBase)
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}')

View File

@ -0,0 +1,10 @@
from abc import ABC, abstractmethod
class $Name(ABC):
@abstractmethod
def __init__(self): pass
@abstractmethod
def create(self): pass

View File

@ -0,0 +1,4 @@
class $Name:
def __init__(self):
pass

View File

@ -0,0 +1,20 @@
import traceback
from sh_edraft.configuration.base import ConfigurationModelBase
from sh_edraft.console import Console
from sh_edraft.console.model import ForegroundColor
class $Name(ConfigurationModelBase):
def __init__(self):
ConfigurationModelBase.__init__(self)
def from_dict(self, settings: dict):
try:
pass
except Exception as e:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColor.default)

View File

@ -0,0 +1,6 @@
from enum import Enum
class $Name(Enum):
pass

View File

@ -0,0 +1,6 @@
class $Name($Base):
def __init__(self):
TestBase.__init__(self)
self.create()

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.cli.interpreter
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.cli.interpreter'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
from .interpreter import Interpreter
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

View File

@ -0,0 +1,33 @@
from sh_edraft.cli.command.base.command_base import CommandBase
from sh_edraft.console.console import Console
class Interpreter:
def __init__(self):
self._commands: list[CommandBase] = []
def add_command(self, command: CommandBase):
self._commands.append(command)
def remove_command(self, command: CommandBase):
self._commands.remove(command)
def interpret(self, input_string: str):
input_list = input_string.split(' ')
command = input_list[0]
if command is None or command == '':
Console.error(f'Expected command')
Console.error('Run \'cpl help\'')
return
args = input_list[1:] if len(input_list) > 1 else []
cmd = next(
(cmd for cmd in self._commands if type(cmd).__name__.lower() == command or command in cmd.aliases),
None)
if cmd is not None:
cmd.run(args)
else:
Console.error(f'Unexpected command {command}')
Console.error('Run \'cpl help\'')

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.coding
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.coding'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.coding.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.coding.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .version import Version
from .version_enum import VersionEnum
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,46 @@
from typing import Optional
from sh_edraft.coding.model.version_enum import VersionEnum
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
class Version(ConfigurationModelBase):
def __init__(
self,
major: int = None,
minor: int = None,
micro: float = None
):
ConfigurationModelBase.__init__(self)
self._major: Optional[int] = major
self._minor: Optional[int] = minor
self._micro: Optional[int] = micro
@property
def major(self) -> int:
return self._major
@property
def minor(self) -> int:
return self._minor
@property
def micro(self) -> float:
return self._micro
def to_str(self) -> str:
return f'{self._major}.{self._minor}.{self._micro}'
def from_dict(self, settings: dict):
self._major = int(settings[VersionEnum.Major.value])
self._minor = int(settings[VersionEnum.Minor.value])
self._micro = int(settings[VersionEnum.Micro.value])
def to_dict(self) -> dict:
return {
VersionEnum.Major.value: self._major,
VersionEnum.Minor.value: self._minor,
VersionEnum.Micro.value: self._micro
}

View File

@ -0,0 +1,8 @@
from enum import Enum
class VersionEnum(Enum):
Major = 'Major'
Minor = 'Minor'
Micro = 'Micro'

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.configuration
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .configuration import Configuration
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.configuration.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.configuration.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .configuration_base import ConfigurationBase
from .configuration_model_base import ConfigurationModelBase
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,34 @@
from abc import abstractmethod, ABC
from collections import Callable
from typing import Type
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
from sh_edraft.environment.base.environment_base import EnvironmentBase
class ConfigurationBase(ABC):
@abstractmethod
def __init__(self): pass
@property
@abstractmethod
def environment(self) -> EnvironmentBase: pass
@abstractmethod
def add_environment_variables(self, prefix: str): pass
@abstractmethod
def add_argument_variables(self): pass
@abstractmethod
def add_json_file(self, name: str, optional: bool = None): pass
@abstractmethod
def add_configuration(self, key_type: type, value: object): pass
@abstractmethod
def get_configuration(self, search_type: Type[ConfigurationModelBase]) -> Callable[ConfigurationModelBase]: pass
@abstractmethod
def create(self): pass

View File

@ -0,0 +1,10 @@
from abc import ABC, abstractmethod
class ConfigurationModelBase(ABC):
@abstractmethod
def __init__(self): pass
@abstractmethod
def from_dict(self, settings: dict): pass

View File

@ -0,0 +1,121 @@
import json
import os
import sys
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
from sh_edraft.configuration.model.configuration_variable_name import ConfigurationVariableName
from sh_edraft.environment.base.environment_base import EnvironmentBase
from sh_edraft.environment.hosting_environment import HostingEnvironment
from sh_edraft.environment.model.environment_name import EnvironmentName
from sh_edraft.console.console import Console
from sh_edraft.console.model import ForegroundColor
class Configuration(ConfigurationBase):
def __init__(self):
ConfigurationBase.__init__(self)
self._hosting_environment = HostingEnvironment()
self._config: dict[type, ConfigurationModelBase] = {}
@property
def environment(self) -> EnvironmentBase:
return self._hosting_environment
@staticmethod
def _print_info(name: str, message: str):
Console.set_foreground_color(ForegroundColor.green)
Console.write_line(f'[{name}] {message}')
Console.set_foreground_color(ForegroundColor.default)
@staticmethod
def _print_warn(name: str, message: str):
Console.set_foreground_color(ForegroundColor.yellow)
Console.write_line(f'[{name}] {message}')
Console.set_foreground_color(ForegroundColor.default)
@staticmethod
def _print_error(name: str, message: str):
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(f'[{name}] {message}')
Console.set_foreground_color(ForegroundColor.default)
def _set_variable(self, name: str, value: str):
if name == ConfigurationVariableName.environment.value:
self._hosting_environment.environment_name = EnvironmentName(value)
elif name == ConfigurationVariableName.name.value:
self._hosting_environment.application_name = value
elif name == ConfigurationVariableName.customer.value:
self._hosting_environment.customer = value
def add_environment_variables(self, prefix: str):
for variable in ConfigurationVariableName.to_list():
var_name = f'{prefix}{variable}'
if var_name in [key.upper() for key in os.environ.keys()]:
self._set_variable(variable, os.environ[var_name])
def add_argument_variables(self):
for arg in sys.argv[1:]:
try:
argument = arg.split('--')[1].split('=')[0].upper()
value = arg.split('=')[1]
if argument not in ConfigurationVariableName.to_list():
raise Exception(f'Invalid argument name: {argument}')
self._set_variable(argument, value)
except Exception as e:
self._print_error(__name__, f'Invalid argument: {arg} -> {e}')
exit()
def add_json_file(self, name: str, optional: bool = None):
if self._hosting_environment.content_root_path.endswith('/') and not name.startswith('/'):
file_path = f'{self._hosting_environment.content_root_path}{name}'
else:
file_path = f'{self._hosting_environment.content_root_path}/{name}'
if not os.path.isfile(file_path):
if not optional:
self._print_error(__name__, f'File not found: {file_path}')
exit()
self._print_warn(__name__, f'Not Loaded config file: {file_path}')
return None
config_from_file = self._load_json_file(file_path)
for sub in ConfigurationModelBase.__subclasses__():
for key, value in config_from_file.items():
if sub.__name__ == key:
configuration = sub()
configuration.from_dict(value)
self.add_configuration(sub, configuration)
def _load_json_file(self, file: str) -> dict:
try:
# open config file, create if not exists
with open(file, encoding='utf-8') as cfg:
# load json
json_cfg = json.load(cfg)
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}')
return {}
def add_configuration(self, key_type: type, value: ConfigurationModelBase):
self._config[key_type] = value
def get_configuration(self, search_type: type) -> ConfigurationModelBase:
if search_type not in self._config:
raise Exception(f'Config model by type {search_type} not found')
for config_model in self._config:
if config_model == search_type:
return self._config[config_model]
def create(self):
pass

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.configuration.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.configuration.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .configuration_variable_name import ConfigurationVariableName
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,12 @@
from enum import Enum
class ConfigurationVariableName(Enum):
environment = 'ENVIRONMENT'
name = 'NAME'
customer = 'CUSTOMER'
@staticmethod
def to_list():
return [var.value for var in ConfigurationVariableName]

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.console
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.console'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .console import Console
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,205 @@
import os
from typing import Union, Optional
import pyfiglet
from tabulate import tabulate
from termcolor import colored
from sh_edraft.console.model.background_color import BackgroundColor
from sh_edraft.console.model.foreground_color import ForegroundColor
class Console:
_is_first_write = True
_background_color: BackgroundColor = BackgroundColor.default
_foreground_color: ForegroundColor = ForegroundColor.default
_x: Optional[int] = None
_y: Optional[int] = None
_disabled: bool = False
"""
Properties
"""
@classmethod
@property
def background_color(cls) -> str:
return str(cls._background_color.value)
@classmethod
@property
def foreground_color(cls) -> str:
return str(cls._foreground_color.value)
"""
Settings
"""
@classmethod
def set_background_color(cls, color: Union[BackgroundColor, str]):
if type(color) is str:
cls._background_color = BackgroundColor[color]
else:
cls._background_color = color
@classmethod
def set_foreground_color(cls, color: Union[ForegroundColor, str]):
if type(color) is str:
cls._foreground_color = ForegroundColor[color]
else:
cls._foreground_color = color
@classmethod
def reset_cursor_position(cls):
cls._x = None
cls._y = None
@classmethod
def set_cursor_position(cls, x: int, y: int):
cls._x = x
cls._y = y
"""
Useful protected methods
"""
@classmethod
def _output(cls, string: str, x: int = None, y: int = None, end='\n'):
if cls._is_first_write:
cls._is_first_write = False
args = []
colored_args = []
if x is not None and y is not None:
args.append(f'\033[{x};{y}H')
elif cls._x is not None and cls._y is not None:
args.append(f'\033[{cls._x};{cls._y}H')
colored_args.append(string)
if cls._foreground_color != ForegroundColor.default and cls._background_color == BackgroundColor.default:
colored_args.append(cls._foreground_color.value)
elif cls._foreground_color == ForegroundColor.default and cls._background_color != BackgroundColor.default:
colored_args.append(cls._background_color.value)
elif cls._foreground_color != ForegroundColor.default and cls._background_color != BackgroundColor.default:
colored_args.append(cls._foreground_color.value)
colored_args.append(cls._background_color.value)
args.append(colored(*colored_args))
print(*args, end=end)
"""
Useful public methods
"""
@classmethod
def banner(cls, string: str):
if cls._disabled:
return
ascii_banner = pyfiglet.figlet_format(string)
cls.write_line(ascii_banner)
@classmethod
def clear(cls):
os.system('cls' if os.name == 'nt' else 'clear')
@classmethod
def close(cls):
if cls._disabled:
return
Console.reset()
Console.write('\n\n\nPress any key to continue...')
Console.read_line()
exit()
@classmethod
def disable(cls):
cls._disabled = True
@classmethod
def error(cls, string: str, tb: str = None):
if cls._disabled:
return
cls.set_foreground_color('red')
if tb is not None:
cls.write_line(f'{string} -> {tb}')
else:
cls.write_line(string)
cls.set_foreground_color('default')
@classmethod
def enable(cls):
cls._disabled = False
@classmethod
def read(cls, output: str = None) -> str:
if output is not None:
cls.write(output)
return input()[0]
@classmethod
def read_line(cls, output: str = None) -> str:
if cls._disabled:
return ''
if output is not None:
cls.write(output)
return input()
@classmethod
def reset(cls):
cls._background_color = BackgroundColor.default
cls._foreground_color = ForegroundColor.default
@classmethod
def table(cls, header: list[str], values: list[list[str]]):
if cls._disabled:
return
table = tabulate(values, headers=header)
Console.write_line(table)
Console.write('\n')
@classmethod
def write(cls, *args):
if cls._disabled:
return
string = ' '.join(map(str, args))
cls._output(string, end='')
@classmethod
def write_at(cls, x: int, y: int, *args):
if cls._disabled:
return
string = ' '.join(map(str, args))
cls._output(string, x, y, end='')
@classmethod
def write_line(cls, *args):
if cls._disabled:
return
string = ' '.join(map(str, args))
if not cls._is_first_write:
cls._output('')
cls._output(string, end='')
@classmethod
def write_line_at(cls, x: int, y: int, *args):
if cls._disabled:
return
string = ' '.join(map(str, args))
if not cls._is_first_write:
cls._output('', end='')
cls._output(string, x, y, end='')

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.console.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.console.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .background_color import BackgroundColor
from .foreground_color import ForegroundColor
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,14 @@
from enum import Enum
class BackgroundColor(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'

View File

@ -0,0 +1,14 @@
from enum import Enum
class ForegroundColor(Enum):
default = 'default'
grey = 'grey'
red = 'red'
green = 'green'
yellow = 'yellow'
blue = 'blue'
magenta = 'magenta'
cyan = 'cyan'
white = 'white'

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.database
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.database'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.database.connection
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.database.connection'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .database_connection import DatabaseConnection
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.database.connection.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.database.connection.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .database_connection_base import DatabaseConnectionBase
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,21 @@
from abc import abstractmethod, ABC
from sqlalchemy import engine
from sqlalchemy.orm import Session
class DatabaseConnectionBase(ABC):
@abstractmethod
def __init__(self): pass
@property
@abstractmethod
def engine(self) -> engine: pass
@property
@abstractmethod
def session(self) -> Session: pass
@abstractmethod
def connect(self, connection_string: str): pass

View File

@ -0,0 +1,56 @@
from typing import Optional
from sqlalchemy import engine, create_engine
from sqlalchemy.orm import Session, sessionmaker
from sh_edraft.database.connection.base.database_connection_base import DatabaseConnectionBase
from sh_edraft.database.model.database_settings import DatabaseSettings
from sh_edraft.console.console import Console
from sh_edraft.console.model.foreground_color import ForegroundColor
class DatabaseConnection(DatabaseConnectionBase):
def __init__(self, database_settings: DatabaseSettings):
DatabaseConnectionBase.__init__(self)
self._db_settings = database_settings
self._engine: Optional[engine] = None
self._session: Optional[Session] = None
self._credentials: Optional[str] = None
@property
def engine(self) -> engine:
return self._engine
@property
def session(self) -> Session:
return self._session
def connect(self, connection_string: str):
try:
self._engine = create_engine(connection_string)
if self._db_settings.encoding is not None:
self._engine.encoding = self._db_settings.encoding
if self._db_settings.case_sensitive is not None:
self._engine.case_sensitive = self._db_settings.case_sensitive
if self._db_settings.echo is not None:
self._engine.echo = self._db_settings.echo
self._engine.connect()
db_session = sessionmaker(bind=self._engine)
self._session = db_session()
Console.set_foreground_color(ForegroundColor.green)
Console.write_line(f'[{__name__}] Connected to database')
Console.set_foreground_color(ForegroundColor.default)
except Exception as e:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(f'[{__name__}] Database connection failed -> {e}')
Console.set_foreground_color(ForegroundColor.default)
exit()

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.database.context
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.database.context'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .database_context import DatabaseContext
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.database.context.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.database.context.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .database_context_base import DatabaseContextBase
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,27 @@
from abc import abstractmethod
from sqlalchemy import engine
from sqlalchemy.orm import Session
from sh_edraft.service.base.service_base import ServiceBase
class DatabaseContextBase(ServiceBase):
@abstractmethod
def __init__(self):
ServiceBase.__init__(self)
@property
@abstractmethod
def engine(self) -> engine: pass
@property
@abstractmethod
def session(self) -> Session: pass
@abstractmethod
def connect(self, connection_string: str): pass
@abstractmethod
def _create_tables(self): pass

View File

@ -0,0 +1,50 @@
from sqlalchemy import engine, Table
from sqlalchemy.orm import Session
from sh_edraft.database.connection.database_connection import DatabaseConnection
from sh_edraft.database.connection.base.database_connection_base import DatabaseConnectionBase
from sh_edraft.database.context.base.database_context_base import DatabaseContextBase
from sh_edraft.database.model.dbmodel import DBModel
from sh_edraft.database.model.database_settings import DatabaseSettings
from sh_edraft.console.console import Console
from sh_edraft.console.model.foreground_color import ForegroundColor
class DatabaseContext(DatabaseContextBase):
def __init__(self, database_settings: DatabaseSettings):
DatabaseContextBase.__init__(self)
self._db: DatabaseConnectionBase = DatabaseConnection(database_settings)
self._tables: list[Table] = []
@property
def engine(self) -> engine:
return self._db.engine
@property
def session(self) -> Session:
return self._db.session
def create(self):
pass
def connect(self, connection_string: str):
self._db.connect(connection_string)
self._create_tables()
def _create_tables(self):
try:
for subclass in DBModel.__subclasses__():
self._tables.append(subclass.__table__)
DBModel.metadata.drop_all(self._db.engine, self._tables)
DBModel.metadata.create_all(self._db.engine, self._tables, checkfirst=True)
Console.set_foreground_color(ForegroundColor.green)
Console.write_line(f'[{__name__}] Created tables')
Console.set_foreground_color(ForegroundColor.default)
except Exception as e:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(f'[{__name__}] Creating tables failed -> {e}')
Console.set_foreground_color(ForegroundColor.default)
exit()

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.database.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.database.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .database_settings import DatabaseSettings
from .database_settings_name import DatabaseSettingsName
from .dbmodel import DBModel
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,78 @@
import traceback
from typing import Optional
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
from sh_edraft.database.model.database_settings_name import DatabaseSettingsName
from sh_edraft.console.console import Console
from sh_edraft.console.model.foreground_color import ForegroundColor
class DatabaseSettings(ConfigurationModelBase):
def __init__(self):
ConfigurationModelBase.__init__(self)
self._connection_string: Optional[str] = None
self._credentials: Optional[str] = None
self._encoding: Optional[str] = None
self._case_sensitive: Optional[bool] = None
self._echo: Optional[bool] = None
@property
def connection_string(self) -> str:
return self._connection_string
@connection_string.setter
def connection_string(self, connection_string: str):
self._connection_string = connection_string
@property
def credentials(self) -> str:
return self._credentials
@credentials.setter
def credentials(self, credentials: str):
self._credentials = credentials
@property
def encoding(self) -> str:
return self._encoding
@encoding.setter
def encoding(self, encoding: str) -> None:
self._encoding = encoding
@property
def case_sensitive(self) -> bool:
return self._case_sensitive
@case_sensitive.setter
def case_sensitive(self, case_sensitive: bool) -> None:
self._case_sensitive = case_sensitive
@property
def echo(self) -> bool:
return self._echo
@echo.setter
def echo(self, echo: bool) -> None:
self._echo = echo
def from_dict(self, settings: dict):
try:
self._connection_string = settings[DatabaseSettingsName.connection_string.value]
self._credentials = settings[DatabaseSettingsName.credentials.value]
if DatabaseSettingsName.encoding.value in settings:
self._encoding = settings[DatabaseSettingsName.encoding.value]
if DatabaseSettingsName.case_sensitive.value in settings:
self._case_sensitive = bool(settings[DatabaseSettingsName.case_sensitive.value])
if DatabaseSettingsName.echo.value in settings:
self._echo = bool(settings[DatabaseSettingsName.echo.value])
except Exception as e:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColor.default)

View File

@ -0,0 +1,10 @@
from enum import Enum
class DatabaseSettingsName(Enum):
connection_string = 'ConnectionString'
credentials = 'Credentials'
encoding = 'Encoding'
case_sensitive = 'CaseSensitive'
echo = 'Echo'

View File

@ -0,0 +1,3 @@
from sqlalchemy.ext.declarative import declarative_base
DBModel: declarative_base = declarative_base()

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.environment
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.environment'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .hosting_environment import HostingEnvironment
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.environment.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.environment.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .environment_base import EnvironmentBase
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,43 @@
from abc import ABC, abstractmethod
class EnvironmentBase(ABC):
@abstractmethod
def __init__(self): pass
@property
@abstractmethod
def environment_name(self) -> str: pass
@environment_name.setter
@abstractmethod
def environment_name(self, environment_name: str): pass
@property
@abstractmethod
def application_name(self) -> str: pass
@application_name.setter
@abstractmethod
def application_name(self, application_name: str): pass
@property
@abstractmethod
def customer(self) -> str: pass
@customer.setter
@abstractmethod
def customer(self, customer: str): pass
@property
@abstractmethod
def content_root_path(self) -> str: pass
@content_root_path.setter
@abstractmethod
def content_root_path(self, content_root_path: str): pass
@property
@abstractmethod
def host_name(self) -> str: pass

View File

@ -0,0 +1,52 @@
from socket import gethostname
from typing import Optional
from sh_edraft.environment.base.environment_base import EnvironmentBase
from sh_edraft.environment.model.environment_name import EnvironmentName
class HostingEnvironment(EnvironmentBase):
def __init__(self, name: EnvironmentName = EnvironmentName.production, crp: str = './'):
EnvironmentBase.__init__(self)
self._environment_name: Optional[EnvironmentName] = name
self._app_name: Optional[str] = None
self._customer: Optional[str] = None
self._content_root_path: Optional[str] = crp
@property
def environment_name(self) -> str:
return str(self._environment_name.value)
@environment_name.setter
def environment_name(self, environment_name: str):
self._environment_name = EnvironmentName(environment_name)
@property
def application_name(self) -> str:
return self._app_name if self._app_name is not None else ''
@application_name.setter
def application_name(self, application_name: str):
self._app_name = application_name
@property
def customer(self) -> str:
return self._customer if self._customer is not None else ''
@customer.setter
def customer(self, customer: str):
self._customer = customer
@property
def content_root_path(self) -> str:
return self._content_root_path
@content_root_path.setter
def content_root_path(self, content_root_path: str):
self._content_root_path = content_root_path
@property
def host_name(self):
return gethostname()

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.environment.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.environment.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .environment_name import EnvironmentName
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,9 @@
from enum import Enum
class EnvironmentName(Enum):
production = 'production'
staging = 'staging'
testing = 'testing'
development = 'development'

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.hosting
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.hosting'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .application_host import ApplicationHost
from .application_runtime import ApplicationRuntime
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,46 @@
import atexit
from datetime import datetime
from sh_edraft.configuration.configuration import Configuration
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
from sh_edraft.hosting.base.application_runtime_base import ApplicationRuntimeBase
from sh_edraft.hosting.application_runtime import ApplicationRuntime
from sh_edraft.hosting.base.application_host_base import ApplicationHostBase
from sh_edraft.service.providing.service_provider import ServiceProvider
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase
from sh_edraft.console.console import Console
class ApplicationHost(ApplicationHostBase):
def __init__(self):
ApplicationHostBase.__init__(self)
# Init
self._config = Configuration()
self._app_runtime = ApplicationRuntime(self._config)
self._services = ServiceProvider(self._app_runtime)
# Create
self._config.create()
self._services.create()
# Set vars
self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now()
atexit.register(Console.close)
@property
def configuration(self) -> ConfigurationBase:
return self._config
@property
def application_runtime(self) -> ApplicationRuntimeBase:
return self._app_runtime
@property
def services(self) -> ServiceProviderBase:
return self._services
def create(self): pass

View File

@ -0,0 +1,38 @@
from datetime import datetime
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
from sh_edraft.hosting.base.application_runtime_base import ApplicationRuntimeBase
class ApplicationRuntime(ApplicationRuntimeBase):
def __init__(self, config: ConfigurationBase):
ApplicationRuntimeBase.__init__(self)
self._app_configuration = config
self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now()
@property
def configuration(self) -> ConfigurationBase:
return self._app_configuration
@property
def start_time(self) -> datetime:
return self._start_time
@start_time.setter
def start_time(self, start_time: datetime):
self._start_time = start_time
@property
def end_time(self) -> datetime:
return self._end_time
@end_time.setter
def end_time(self, end_time: datetime):
self._end_time = end_time
@property
def date_time_now(self) -> datetime:
return datetime.now()

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.hosting.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.hosting.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .application_base import ApplicationBase
from .application_host_base import ApplicationHostBase
from .application_runtime_base import ApplicationRuntimeBase
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,19 @@
from abc import ABC, abstractmethod
class ApplicationBase(ABC):
@abstractmethod
def __init__(self): pass
@abstractmethod
def create_application_host(self): pass
@abstractmethod
def create_configuration(self): pass
@abstractmethod
def create_services(self): pass
@abstractmethod
def main(self): pass

View File

@ -0,0 +1,26 @@
from abc import ABC, abstractmethod
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
from sh_edraft.hosting.base.application_runtime_base import ApplicationRuntimeBase
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase
class ApplicationHostBase(ABC):
@abstractmethod
def __init__(self): pass
@property
@abstractmethod
def configuration(self) -> ConfigurationBase: pass
@property
@abstractmethod
def application_runtime(self) -> ApplicationRuntimeBase: pass
@property
@abstractmethod
def services(self) -> ServiceProviderBase: pass
@abstractmethod
def create(self): pass

View File

@ -0,0 +1,34 @@
from abc import ABC, abstractmethod
from datetime import datetime
from sh_edraft.configuration.base.configuration_base import ConfigurationBase
class ApplicationRuntimeBase(ABC):
@abstractmethod
def __init__(self): pass
@property
@abstractmethod
def configuration(self) -> ConfigurationBase: pass
@property
@abstractmethod
def start_time(self) -> datetime: pass
@start_time.setter
@abstractmethod
def start_time(self, start_time: datetime): pass
@property
@abstractmethod
def end_time(self): pass
@end_time.setter
@abstractmethod
def end_time(self, end_time: datetime): pass
@property
@abstractmethod
def date_time_now(self) -> datetime: pass

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.hosting.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.hosting.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.logging
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.logging'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .logger import Logger
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.logging.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.logging.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .logger_base import LoggerBase
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,31 @@
from abc import abstractmethod
from sh_edraft.service.base.service_base import ServiceBase
class LoggerBase(ServiceBase):
@abstractmethod
def __init__(self):
ServiceBase.__init__(self)
@abstractmethod
def header(self, string: str): pass
@abstractmethod
def trace(self, name: str, message: str): pass
@abstractmethod
def debug(self, name: str, message: str): pass
@abstractmethod
def info(self, name: str, message: str): pass
@abstractmethod
def warn(self, name: str, message: str): pass
@abstractmethod
def error(self, name: str, message: str, ex: Exception = None): pass
@abstractmethod
def fatal(self, name: str, message: str, ex: Exception = None): pass

View File

@ -0,0 +1,195 @@
import datetime
import os
import traceback
from string import Template
from sh_edraft.hosting.base.application_runtime_base import ApplicationRuntimeBase
from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.logging.model.logging_settings import LoggingSettings
from sh_edraft.logging.model.logging_level import LoggingLevel
from sh_edraft.time.model.time_format_settings import TimeFormatSettings
from sh_edraft.console.console import Console
from sh_edraft.console.model.foreground_color import ForegroundColor
class Logger(LoggerBase):
def __init__(self, logging_settings: LoggingSettings, time_format: TimeFormatSettings, app_runtime: ApplicationRuntimeBase):
LoggerBase.__init__(self)
self._app_runtime = app_runtime
self._log_settings: LoggingSettings = logging_settings
self._time_format_settings: TimeFormatSettings = time_format
self._log = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
self._path = self._log_settings.path
self._level = self._log_settings.level
self._console = self._log_settings.console
self.create()
def _get_datetime_now(self) -> str:
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)
def _get_date(self) -> str:
try:
return datetime.datetime.now().strftime(self._time_format_settings.date_format)
except Exception as e:
self.error(__name__, 'Cannot get date', ex=e)
def create(self) -> None:
""" path """
try:
# check if log file path exists
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)
""" create new log file """
try:
# open log file, create if not exists
path = f'{self._path}{self._log}'
f = open(path, "w+")
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)
def _append_log(self, string):
try:
# open log file and append always
if not os.path.isdir(self._path):
self._fatal_console(__name__, 'Log directory not found')
with open(self._path + self._log, "a+", encoding="utf-8") as f:
f.write(string + '\n')
f.close()
except Exception as e:
self._fatal_console(__name__, f'Cannot append log file, message: {string}', ex=e)
def _get_string(self, name: str, level: LoggingLevel, message: str) -> str:
log_level = level.name
return f'<{self._get_datetime_now()}> [ {log_level} ] [ {name} ]: {message}'
def header(self, string: str):
# append log and print message
self._append_log(string)
Console.set_foreground_color(ForegroundColor.default)
Console.write_line(string)
Console.set_foreground_color(ForegroundColor.default)
def trace(self, name: str, message: str):
output = self._get_string(name, LoggingLevel.TRACE, message)
# check if message can be written to log
if self._level.value >= LoggingLevel.TRACE.value:
self._append_log(output)
# check if message can be shown in console
if self._console.value >= LoggingLevel.TRACE.value:
Console.set_foreground_color(ForegroundColor.green)
Console.write_line(output)
Console.set_foreground_color(ForegroundColor.default)
def debug(self, name: str, message: str):
output = self._get_string(name, LoggingLevel.DEBUG, message)
# check if message can be written to log
if self._level.value >= LoggingLevel.DEBUG.value:
self._append_log(output)
# check if message can be shown in console
if self._console.value >= LoggingLevel.DEBUG.value:
Console.set_foreground_color(ForegroundColor.green)
Console.write_line(output)
Console.set_foreground_color(ForegroundColor.default)
def info(self, name: str, message: str):
output = self._get_string(name, LoggingLevel.INFO, message)
# check if message can be written to log
if self._level.value >= LoggingLevel.INFO.value:
self._append_log(output)
# check if message can be shown in console
if self._console.value >= LoggingLevel.INFO.value:
Console.set_foreground_color(ForegroundColor.green)
Console.write_line(output)
Console.set_foreground_color(ForegroundColor.default)
def warn(self, name: str, message: str):
output = self._get_string(name, LoggingLevel.WARN, message)
# check if message can be written to log
if self._level.value >= LoggingLevel.WARN.value:
self._append_log(output)
# check if message can be shown in console
if self._console.value >= LoggingLevel.WARN.value:
Console.set_foreground_color(ForegroundColor.yellow)
Console.write_line(output)
Console.set_foreground_color(ForegroundColor.default)
def error(self, name: str, message: str, ex: Exception = None):
output = ''
if ex is not None:
tb = traceback.format_exc()
self.error(name, message)
output = self._get_string(name, LoggingLevel.ERROR, f'{ex} -> {tb}')
else:
output = self._get_string(name, LoggingLevel.ERROR, message)
# check if message can be written to log
if self._level.value >= LoggingLevel.ERROR.value:
self._append_log(output)
# check if message can be shown in console
if self._console.value >= LoggingLevel.ERROR.value:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(output)
Console.set_foreground_color(ForegroundColor.default)
def fatal(self, name: str, message: str, ex: Exception = None):
output = ''
if ex is not None:
tb = traceback.format_exc()
self.error(name, message)
output = self._get_string(name, LoggingLevel.FATAL, f'{ex} -> {tb}')
else:
output = self._get_string(name, LoggingLevel.FATAL, message)
# check if message can be written to log
if self._level.value >= LoggingLevel.FATAL.value:
self._append_log(output)
# check if message can be shown in console
if self._console.value >= LoggingLevel.FATAL.value:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(output)
Console.set_foreground_color(ForegroundColor.default)
exit()
def _fatal_console(self, name: str, message: str, ex: Exception = None):
output = ''
if ex is not None:
tb = traceback.format_exc()
self.error(name, message)
output = self._get_string(name, LoggingLevel.ERROR, f'{ex} -> {tb}')
else:
output = self._get_string(name, LoggingLevel.ERROR, message)
# check if message can be shown in console
if self._console.value >= LoggingLevel.FATAL.value:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(output)
Console.set_foreground_color(ForegroundColor.default)
exit()

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.logging.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.logging.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .logging_level import LoggingLevel
from .logging_settings import LoggingSettings
from .logging_settings_name import LoggingSettingsName
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -0,0 +1,12 @@
from enum import Enum
class LoggingLevel(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

View File

@ -0,0 +1,62 @@
import traceback
from typing import Optional
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
from sh_edraft.logging.model.logging_settings_name import LoggingSettingsName
from sh_edraft.logging.model.logging_level import LoggingLevel
from sh_edraft.console.console import Console
from sh_edraft.console.model.foreground_color import ForegroundColor
class LoggingSettings(ConfigurationModelBase):
def __init__(self):
ConfigurationModelBase.__init__(self)
self._path: Optional[str] = None
self._filename: Optional[str] = None
self._console: Optional[LoggingLevel] = None
self._level: Optional[LoggingLevel] = None
@property
def path(self) -> str:
return self._path
@path.setter
def path(self, path: str) -> None:
self._path = path
@property
def filename(self) -> str:
return self._filename
@filename.setter
def filename(self, filename: str) -> None:
self._filename = filename
@property
def console(self) -> LoggingLevel:
return self._console
@console.setter
def console(self, console: LoggingLevel) -> None:
self._console = console
@property
def level(self) -> LoggingLevel:
return self._level
@level.setter
def level(self, level: LoggingLevel) -> None:
self._level = level
def from_dict(self, settings: dict):
try:
self._path = settings[LoggingSettingsName.path.value]
self._filename = settings[LoggingSettingsName.filename.value]
self._console = LoggingLevel[settings[LoggingSettingsName.console_level.value]]
self._level = LoggingLevel[settings[LoggingSettingsName.file_level.value]]
except Exception as e:
Console.set_foreground_color(ForegroundColor.red)
Console.write_line(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings')
Console.write_line(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
Console.set_foreground_color(ForegroundColor.default)

View File

@ -0,0 +1,9 @@
from enum import Enum
class LoggingSettingsName(Enum):
path = 'Path'
filename = 'Filename'
console_level = 'ConsoleLogLevel'
file_level = 'FileLogLevel'

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.mailing
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.mailing'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.10'
from collections import namedtuple
# imports:
from .email_client import EMailClient
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=10)

Some files were not shown because too many files have changed in this diff Show More