Added PyCharm support (fixed typing and so on)

This commit is contained in:
Sven Heidemann 2022-01-08 19:02:50 +01:00
parent 7f3541c5c8
commit 291d9ad6d6
21 changed files with 678 additions and 53 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

554
.idea/dbnavigator.xml Normal file
View File

@ -0,0 +1,554 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DataEditorManager">
<record-view-column-sorting-type value="BY_INDEX" />
<value-preview-text-wrapping value="true" />
<value-preview-pinned value="false" />
</component>
<component name="DBNavigator.Project.DataExportManager">
<export-instructions>
<create-header value="true" />
<friendly-headers value="false" />
<quote-values-containing-separator value="true" />
<quote-all-values value="false" />
<value-separator value="" />
<file-name value="" />
<file-location value="" />
<scope value="GLOBAL" />
<destination value="FILE" />
<format value="EXCEL" />
<charset value="UTF-8" />
</export-instructions>
</component>
<component name="DBNavigator.Project.DatabaseBrowserManager">
<autoscroll-to-editor value="false" />
<autoscroll-from-editor value="true" />
<show-object-properties value="true" />
<loaded-nodes>
<connection connection-id="2ef03054-1c7c-417b-8fd7-6575cb0b9dd6">
<schema name="sh_gismo_dev" object-types="table, view, procedure, function" />
</connection>
</loaded-nodes>
</component>
<component name="DBNavigator.Project.DatabaseConsoleManager">
<connection id="2ef03054-1c7c-417b-8fd7-6575cb0b9dd6">
<console name="localhost" type="STANDARD" schema="mysql" session="Main" />
</connection>
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.DatabaseSessionManager">
<connection id="2ef03054-1c7c-417b-8fd7-6575cb0b9dd6" />
</component>
<component name="DBNavigator.Project.EditorStateManager">
<last-used-providers />
</component>
<component name="DBNavigator.Project.ExecutionManager">
<retain-sticky-names value="false" />
</component>
<component name="DBNavigator.Project.MethodExecutionManager">
<method-browser />
<execution-history>
<group-entries value="true" />
<execution-inputs />
</execution-history>
<argument-values-cache />
</component>
<component name="DBNavigator.Project.ObjectDependencyManager">
<last-used-dependency-type value="INCOMING" />
</component>
<component name="DBNavigator.Project.ObjectQuickFilterManager">
<last-used-operator value="EQUAL" />
<filters />
</component>
<component name="DBNavigator.Project.ParserDiagnosticsManager">
<diagnostics-history />
</component>
<component name="DBNavigator.Project.ScriptExecutionManager" clear-outputs="true">
<recently-used-interfaces />
</component>
<component name="DBNavigator.Project.Settings">
<connections>
<connection id="2ef03054-1c7c-417b-8fd7-6575cb0b9dd6" active="true">
<database>
<name value="localhost" />
<description value="" />
<database-type value="MYSQL" />
<config-type value="BASIC" />
<database-version value="8.0" />
<driver-source value="BUILTIN" />
<driver-library value="" />
<driver value="" />
<url-type value="DATABASE" />
<host value="localhost" />
<port value="3306" />
<database value="mysql" />
<type value="USER_PASSWORD" />
<user value="root" />
<deprecated-pwd value="cm9vdA==" />
</database>
<properties>
<auto-commit value="false" />
</properties>
<ssh-settings>
<active value="false" />
<proxy-host value="" />
<proxy-port value="22" />
<proxy-user value="" />
<deprecated-proxy-pwd value="" />
<auth-type value="PASSWORD" />
<key-file value="" />
<key-passphrase value="" />
</ssh-settings>
<ssl-settings>
<active value="false" />
<certificate-authority-file value="" />
<client-certificate-file value="" />
<client-key-file value="" />
</ssl-settings>
<details>
<charset value="UTF-8" />
<session-management value="true" />
<ddl-file-binding value="true" />
<database-logging value="false" />
<connect-automatically value="true" />
<restore-workspace value="true" />
<restore-workspace-deep value="true" />
<environment-type value="default" />
<connectivity-timeout value="5" />
<idle-time-to-disconnect value="30" />
<idle-time-to-disconnect-pool value="5" />
<credential-expiry-time value="10" />
<max-connection-pool-size value="7" />
<alternative-statement-delimiter value="" />
</details>
<object-filters hide-empty-schemas="false" hide-pseudo-columns="false">
<object-type-filter use-master-settings="true">
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
<object-name-filters />
</object-filters>
</connection>
</connections>
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="true" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<tracking-columns>
<columnNames value="" />
<visible value="true" />
<editable value="false" />
</tracking-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="JSON" enabled="true" />
<content-type name="JSON5" enabled="true" />
<content-type name="YAML" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
<debugger>
<debugger-type value="JDBC" />
<use-generic-runners value="true" />
</debugger>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
<component name="DBNavigator.Project.StatementExecutionManager">
<execution-variables />
</component>
</project>

View File

@ -0,0 +1,25 @@
<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="5">
<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" />
<item index="4" class="java.lang.String" itemvalue="requests" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="requests" />
</list>
</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>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (sh_gismo)" 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_gismo.iml" filepath="$PROJECT_DIR$/.idea/sh_gismo.iml" />
</modules>
</component>
</project>

14
.idea/sh_gismo.iml Normal file
View File

@ -0,0 +1,14 @@
<?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$/venv" />
<excludeFolder url="file://$MODULE_DIR$/src/gismo/logs" />
<excludeFolder url="file://$MODULE_DIR$/.vscode" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

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>

View File

@ -19,7 +19,7 @@ class Main:
app_builder.use_extension(DatabaseExtension) app_builder.use_extension(DatabaseExtension)
app_builder.use_extension(BootLogExtension) app_builder.use_extension(BootLogExtension)
app_builder.use_startup(Startup) app_builder.use_startup(Startup)
self._gismo: Gismo = await app_builder.build_async() self._gismo = await app_builder.build_async()
await self._gismo.run_async() await self._gismo.run_async()
async def stop(self): async def stop(self):

View File

@ -63,7 +63,7 @@ class Startup(StartupABC):
configuration.add_json_file(f'config/appsettings.{environment.environment_name}.json', optional=True) configuration.add_json_file(f'config/appsettings.{environment.environment_name}.json', optional=True)
configuration.add_json_file(f'config/appsettings.{environment.host_name}.json', optional=True) configuration.add_json_file(f'config/appsettings.{environment.host_name}.json', optional=True)
configuration.add_configuration('Startup_StartTime', self._start_time) configuration.add_configuration('Startup_StartTime', str(self._start_time))
self._config = configuration self._config = configuration
return configuration return configuration
@ -107,7 +107,7 @@ class Startup(StartupABC):
provider: ServiceProviderABC = services.build_service_provider() provider: ServiceProviderABC = services.build_service_provider()
startup_init_time = round((datetime.now() - self._config.get_configuration('Startup_StartTime')).total_seconds(), 2) startup_init_time = round((datetime.now() - self._config.get_configuration('Startup_StartTime')).total_seconds(), 2)
self._config.add_configuration('Startup_InitTime', startup_init_time) self._config.add_configuration('Startup_InitTime', str(startup_init_time))
logger: LoggerABC = provider.get_service(LoggerABC) logger: LoggerABC = provider.get_service(LoggerABC)
logger.debug(__name__, f'Startup Init time: {startup_init_time}s') logger.debug(__name__, f'Startup Init time: {startup_init_time}s')

View File

@ -70,7 +70,7 @@ class MessageService(MessageServiceABC):
self._db.save_changes() self._db.save_changes()
self._logger.info(__name__, f'Sent message to user {receiver.id}') self._logger.info(__name__, f'Sent message to user {receiver.id}')
async def send_ctx_msg(self, ctx: Context, message: Union[str, discord.File]): async def send_ctx_msg(self, ctx: Context, message: str, file: discord.File = None):
if ctx is None: if ctx is None:
self._logger.warn(__name__, 'Message context is empty') self._logger.warn(__name__, 'Message context is empty')
self._logger.debug(__name__, f'Message: {message}') self._logger.debug(__name__, f'Message: {message}')

View File

@ -9,7 +9,7 @@ from cpl_core.dependency_injection import ServiceProviderABC
from cpl_core.environment import ApplicationEnvironmentABC from cpl_core.environment import ApplicationEnvironmentABC
from cpl_core.logging import LoggerABC from cpl_core.logging import LoggerABC
from cpl_core.utils import String from cpl_core.utils import String
from cpl_query.extension import List from cpl_query.extension import List, OrderedIterableABC
from discord.ext import commands from discord.ext import commands
from gismo_core.abc.events.on_bulk_message_delete_abc import OnBulkMessageDeleteABC from gismo_core.abc.events.on_bulk_message_delete_abc import OnBulkMessageDeleteABC
from gismo_core.abc.events.on_connect_abc import OnConnectABC from gismo_core.abc.events.on_connect_abc import OnConnectABC
@ -72,7 +72,7 @@ class ModuleService(ModuleServiceABC, commands.Cog, metaclass=CommandsMeta):
self._modules: List[ModuleABC] = List() self._modules: List[ModuleABC] = List()
self._modules.extend(ModuleABC.__subclasses__()) self._modules.extend(ModuleABC.__subclasses__())
def _get_modules(self, t: type) -> List[ModuleABC]: def _get_modules(self, t: type) -> OrderedIterableABC:
module_types = self._modules.where(lambda m: issubclass(m, t)) module_types = self._modules.where(lambda m: issubclass(m, t))
modules = List(t) modules = List(t)
for module_type in module_types: for module_type in module_types:
@ -81,14 +81,14 @@ class ModuleService(ModuleServiceABC, commands.Cog, metaclass=CommandsMeta):
self._logger.warn(__name__, f'Module {module_type} not found in services!') self._logger.warn(__name__, f'Module {module_type} not found in services!')
break break
if (module.settings_type is not None): if module.settings_type is not None:
with open(f'config/{String.convert_to_snake_case(type(module).__name__).lower()}.json', encoding='utf-8') as cfg: with open(f'config/{String.convert_to_snake_case(type(module).__name__).lower()}.json', encoding='utf-8') as cfg:
json_cfg = json.load(cfg) json_cfg = json.load(cfg)
for id in json_cfg: for index in json_cfg:
settings: ConfigurationModelABC = module.settings_type() settings: ConfigurationModelABC = module.settings_type()
settings.from_dict(json_cfg[id]) settings.from_dict(json_cfg[index])
self._config.add_configuration(f'{type(module).__name__}_{id}', settings) self._config.add_configuration(f'{type(module).__name__}_{index}', settings)
self._logger.debug(__name__, f'Added config: {type(module).__name__}_{id}') self._logger.debug(__name__, f'Added config: {type(module).__name__}_{index}')
modules.append(module) modules.append(module)

View File

@ -14,7 +14,7 @@ class ClientRepositoryABC(ABC):
def get_clients(self) -> List[Client]: pass def get_clients(self) -> List[Client]: pass
@abstractmethod @abstractmethod
def get_client_by_id(self, id: int) -> Client: pass def get_client_by_id(self, client_id: int) -> Client: pass
@abstractmethod @abstractmethod
def get_client_by_discord_id(self, discord_id: int) -> Client: pass def get_client_by_discord_id(self, discord_id: int) -> Client: pass
@ -38,16 +38,16 @@ class ClientRepositoryABC(ABC):
def delete_client(self, client: Client): pass def delete_client(self, client: Client): pass
@abstractmethod @abstractmethod
def apppend_sent_message_count(self, id: int, server_id: int, value: int): pass def append_sent_message_count(self, client_id: int, server_id: int, value: int): pass
@abstractmethod @abstractmethod
def apppend_received_message_count(self, id: int, server_id: int, value: int): pass def append_received_message_count(self, client_id: int, server_id: int, value: int): pass
@abstractmethod @abstractmethod
def apppend_deleted_message_count(self, id: int, server_id: int, value: int): pass def append_deleted_message_count(self, client_id: int, server_id: int, value: int): pass
@abstractmethod @abstractmethod
def apppend_received_command_count(self, id: int, server_id: int, value: int): pass def append_received_command_count(self, client_id: int, server_id: int, value: int): pass
@abstractmethod @abstractmethod
def apppend_moved_users_count(self, id: int, server_id: int, value: int): pass def append_moved_users_count(self, client_id: int, server_id: int, value: int): pass

View File

@ -11,7 +11,6 @@ class DBContext(DatabaseContext):
DatabaseContext.__init__(self) DatabaseContext.__init__(self)
def connect(self, database_settings: DatabaseSettings): def connect(self, database_settings: DatabaseSettings):
try: try:
self._logger.debug(__name__, "Connecting to database") self._logger.debug(__name__, "Connecting to database")

View File

@ -3,6 +3,7 @@ from cpl_core.logging import LoggerABC
from gismo_data.abc.migration_abc import MigrationABC from gismo_data.abc.migration_abc import MigrationABC
from gismo_data.db_context import DBContext from gismo_data.db_context import DBContext
class Migration_0_3(MigrationABC): class Migration_0_3(MigrationABC):
def __init__(self, logger: LoggerABC, db: DBContext): def __init__(self, logger: LoggerABC, db: DBContext):

View File

@ -3,6 +3,7 @@ from cpl_core.logging import LoggerABC
from gismo_data.abc.migration_abc import MigrationABC from gismo_data.abc.migration_abc import MigrationABC
from gismo_data.db_context import DBContext from gismo_data.db_context import DBContext
class Migration_0_3_1(MigrationABC): class Migration_0_3_1(MigrationABC):
def __init__(self, logger: LoggerABC, db: DBContext): def __init__(self, logger: LoggerABC, db: DBContext):

View File

@ -37,9 +37,9 @@ class ClientRepositoryService(ClientRepositoryABC):
return clients return clients
def get_client_by_id(self, id: int) -> Client: def get_client_by_id(self, client_id: int) -> Client:
self._logger.trace(__name__, f'Send SQL command: {Client.get_select_by_id_string(id)}') self._logger.trace(__name__, f'Send SQL command: {Client.get_select_by_id_string(client_id)}')
result = self._context.select(Client.get_select_by_id_string(id)) result = self._context.select(Client.get_select_by_id_string(client_id))
return Client( return Client(
result[1], result[1],
result[2], result[2],
@ -147,27 +147,27 @@ class ClientRepositoryService(ClientRepositoryABC):
return client return client
def apppend_sent_message_count(self, id: int, server_id: int, value: int): def append_sent_message_count(self, client_id: int, server_id: int, value: int):
client = self._get_client_and_server(id, server_id) client = self._get_client_and_server(client_id, server_id)
client.sent_message_count += value client.sent_message_count += value
self.update_client(client) self.update_client(client)
def apppend_received_message_count(self, id: int, server_id: int, value: int): def append_received_message_count(self, client_id: int, server_id: int, value: int):
client = self._get_client_and_server(id, server_id) client = self._get_client_and_server(client_id, server_id)
client.received_message_count += value client.received_message_count += value
self.update_client(client) self.update_client(client)
def apppend_deleted_message_count(self, id: int, server_id: int, value: int): def append_deleted_message_count(self, client_id: int, server_id: int, value: int):
client = self._get_client_and_server(id, server_id) client = self._get_client_and_server(client_id, server_id)
client.deleted_message_count += value client.deleted_message_count += value
self.update_client(client) self.update_client(client)
def apppend_received_command_count(self, id: int, server_id: int, value: int): def append_received_command_count(self, client_id: int, server_id: int, value: int):
client = self._get_client_and_server(id, server_id) client = self._get_client_and_server(client_id, server_id)
client.received_command_count += value client.received_command_count += value
self.update_client(client) self.update_client(client)
def apppend_moved_users_count(self, id: int, server_id: int, value: int): def append_moved_users_count(self, client_id: int, server_id: int, value: int):
client = self._get_client_and_server(id, server_id) client = self._get_client_and_server(client_id, server_id)
client.moved_users_count += value client.moved_users_count += value
self.update_client(client) self.update_client(client)

View File

@ -27,7 +27,7 @@ class KnownUserRepositoryService(KnownUserRepositoryABC):
users.append(KnownUser( users.append(KnownUser(
result[1], result[1],
result[2], result[2],
self._servers.get_server_by_id(result[3]), result[3],
id=result[0] id=result[0]
)) ))
@ -39,7 +39,7 @@ class KnownUserRepositoryService(KnownUserRepositoryABC):
return KnownUser( return KnownUser(
result[1], result[1],
result[2], result[2],
self._servers.get_server_by_id(result[3]), result[3],
id=result[0] id=result[0]
) )
@ -49,7 +49,7 @@ class KnownUserRepositoryService(KnownUserRepositoryABC):
return KnownUser( return KnownUser(
result[1], result[1],
result[2], result[2],
self._servers.get_server_by_id(result[3]), result[3],
id=result[0] id=result[0]
) )

View File

@ -1,3 +1,5 @@
from typing import Type
from cpl_core.database.context import DatabaseContextABC from cpl_core.database.context import DatabaseContextABC
from cpl_core.dependency_injection import ServiceProviderABC from cpl_core.dependency_injection import ServiceProviderABC
from cpl_core.logging import LoggerABC from cpl_core.logging import LoggerABC
@ -15,7 +17,7 @@ class MigrationService:
self._db = db self._db = db
self._cursor = db.cursor self._cursor = db.cursor
self._migrations: list[MigrationABC] = MigrationABC.__subclasses__() self._migrations: list[Type[MigrationABC]] = MigrationABC.__subclasses__()
def migrate(self): def migrate(self):
self._logger.info(__name__, f"Running Migrations") self._logger.info(__name__, f"Running Migrations")
@ -28,8 +30,8 @@ class MigrationService:
if result: if result:
# there is a table named "tableName" # there is a table named "tableName"
self._logger.trace(__name__, f"Running SQL Command: {MigrationHistory.get_select_by_id_string(migration_id)}") self._logger.trace(__name__, f"Running SQL Command: {MigrationHistory.get_select_by_id_string(migration_id)}")
migration_from_db: MigrationHistory = self._db.select(MigrationHistory.get_select_by_id_string(migration_id)) migration_from_db = self._db.select(MigrationHistory.get_select_by_id_string(migration_id))
self._logger.trace(__name__, migration_from_db) self._logger.trace(__name__, str(migration_from_db))
if migration_from_db is not None and len(migration_from_db) > 0: if migration_from_db is not None and len(migration_from_db) > 0:
continue continue

View File

@ -27,9 +27,9 @@ class ServerRepositoryService(ServerRepositoryABC):
return servers return servers
def get_server_by_id(self, id: int) -> Server: def get_server_by_id(self, server_id: int) -> Server:
self._logger.trace(__name__, f'Send SQL command: {Server.get_select_by_id_string(id)}') self._logger.trace(__name__, f'Send SQL command: {Server.get_select_by_id_string(server_id)}')
result = self._context.select(Server.get_select_by_id_string(id))[0] result = self._context.select(Server.get_select_by_id_string(server_id))[0]
return Server( return Server(
result[1], result[1],
id=result[0] id=result[0]

View File

@ -56,6 +56,8 @@ class UserRepositoryService(UserRepositoryABC):
id=result[0] id=result[0]
)) ))
return users
def get_user_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> User: def get_user_by_discord_id_and_server_id(self, discord_id: int, server_id: int) -> User:
self._logger.trace(__name__, f'Send SQL command: {User.get_select_by_discord_id_and_server_id_string(discord_id, server_id)}') self._logger.trace(__name__, f'Send SQL command: {User.get_select_by_discord_id_and_server_id_string(discord_id, server_id)}')
result = self._context.select(User.get_select_by_discord_id_and_server_id_string(discord_id, server_id))[0] result = self._context.select(User.get_select_by_discord_id_and_server_id_string(discord_id, server_id))[0]
@ -78,9 +80,9 @@ class UserRepositoryService(UserRepositoryABC):
return User( return User(
result[1], result[1],
result[2], result[2],
result[3],
result[4],
self._servers.get_server_by_id(result[3]), self._servers.get_server_by_id(result[3]),
result[4],
result[5],
id=result[0] id=result[0]
) )