From 5100b4040558a429634b03b86a0487a2e5b09991 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 21 Jun 2022 14:52:01 -0400 Subject: [PATCH] precommit is passing w/ burnettk --- bin/import_tickets_for_command_line.py | 1 + bin/import_tickets_for_script_task.py | 1 + src/spiffworkflow_backend/__init__.py | 6 +++--- src/spiffworkflow_backend/models/data_store.py | 1 - src/spiffworkflow_backend/models/file.py | 4 ++-- src/spiffworkflow_backend/models/group.py | 1 - src/spiffworkflow_backend/models/permission_assignment.py | 2 +- src/spiffworkflow_backend/models/permission_target.py | 1 - src/spiffworkflow_backend/models/principal.py | 1 - src/spiffworkflow_backend/models/process_instance.py | 4 ++-- src/spiffworkflow_backend/models/process_instance_report.py | 1 - src/spiffworkflow_backend/models/task_event.py | 2 +- src/spiffworkflow_backend/models/user.py | 6 +++--- src/spiffworkflow_backend/models/user_group_assignment.py | 1 - .../routes/admin_blueprint/admin_blueprint.py | 2 +- src/spiffworkflow_backend/routes/process_api_blueprint.py | 4 ++-- src/spiffworkflow_backend/routes/user.py | 3 +-- src/spiffworkflow_backend/routes/user_blueprint.py | 4 ++-- src/spiffworkflow_backend/scripts/script.py | 1 + src/spiffworkflow_backend/services/file_system_service.py | 2 +- .../services/process_instance_processor.py | 4 ++-- .../services/process_instance_service.py | 2 +- src/spiffworkflow_backend/services/process_model_service.py | 3 ++- src/spiffworkflow_backend/services/spec_file_service.py | 2 +- src/spiffworkflow_backend/services/user_service.py | 3 +-- src/spiffworkflow_backend/spiff_workflow_connector.py | 2 +- tests/spiffworkflow_backend/helpers/test_data.py | 2 +- tests/spiffworkflow_backend/integration/test_process_api.py | 2 +- tests/spiffworkflow_backend/unit/test_permissions.py | 3 +-- 29 files changed, 33 insertions(+), 38 deletions(-) diff --git a/bin/import_tickets_for_command_line.py b/bin/import_tickets_for_command_line.py index 19fa4116..bc71878d 100644 --- a/bin/import_tickets_for_command_line.py +++ b/bin/import_tickets_for_command_line.py @@ -1,6 +1,7 @@ """Grabs tickets from csv and makes process instances.""" import csv import os + from flask_bpmn.models.db import db from spiffworkflow_backend import create_app diff --git a/bin/import_tickets_for_script_task.py b/bin/import_tickets_for_script_task.py index 7365c6bf..249c631e 100644 --- a/bin/import_tickets_for_script_task.py +++ b/bin/import_tickets_for_script_task.py @@ -1,5 +1,6 @@ """Import tickets, for use in script task.""" import csv + from flask_bpmn.models.db import db from spiffworkflow_backend.models.process_instance import ProcessInstanceModel diff --git a/src/spiffworkflow_backend/__init__.py b/src/spiffworkflow_backend/__init__.py index 417f02f3..b297abfb 100644 --- a/src/spiffworkflow_backend/__init__.py +++ b/src/spiffworkflow_backend/__init__.py @@ -1,11 +1,11 @@ """__init__.""" import os -from flask_bpmn.api.api_error import api_error_blueprint -from flask_bpmn.models.db import db -from flask_bpmn.models.db import migrate import connexion # type: ignore import flask.app +from flask_bpmn.api.api_error import api_error_blueprint +from flask_bpmn.models.db import db +from flask_bpmn.models.db import migrate from flask_cors import CORS # type: ignore import spiffworkflow_backend.load_database_models # noqa: F401 diff --git a/src/spiffworkflow_backend/models/data_store.py b/src/spiffworkflow_backend/models/data_store.py index f4e349de..2ae9ae79 100644 --- a/src/spiffworkflow_backend/models/data_store.py +++ b/src/spiffworkflow_backend/models/data_store.py @@ -1,7 +1,6 @@ """Data_store.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from flask_marshmallow.sqla import SQLAlchemyAutoSchema # type: ignore diff --git a/src/spiffworkflow_backend/models/file.py b/src/spiffworkflow_backend/models/file.py index 955f88f7..ab8087e4 100644 --- a/src/spiffworkflow_backend/models/file.py +++ b/src/spiffworkflow_backend/models/file.py @@ -2,10 +2,10 @@ import enum from dataclasses import dataclass from dataclasses import field -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import Optional +from flask_bpmn.models.db import db +from flask_bpmn.models.db import SpiffworkflowBaseDBModel from marshmallow import INCLUDE from marshmallow import Schema from sqlalchemy.orm import deferred diff --git a/src/spiffworkflow_backend/models/group.py b/src/spiffworkflow_backend/models/group.py index 56a3d3e8..5547f429 100644 --- a/src/spiffworkflow_backend/models/group.py +++ b/src/spiffworkflow_backend/models/group.py @@ -1,7 +1,6 @@ """Group.""" from flask_bpmn.models.db import db from flask_bpmn.models.group import FlaskBpmnGroupModel - from sqlalchemy.orm import relationship diff --git a/src/spiffworkflow_backend/models/permission_assignment.py b/src/spiffworkflow_backend/models/permission_assignment.py index 8362001f..da88fd3e 100644 --- a/src/spiffworkflow_backend/models/permission_assignment.py +++ b/src/spiffworkflow_backend/models/permission_assignment.py @@ -1,8 +1,8 @@ """PermissionAssignment.""" import enum + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import Enum from sqlalchemy import ForeignKey diff --git a/src/spiffworkflow_backend/models/permission_target.py b/src/spiffworkflow_backend/models/permission_target.py index ec5ccc5b..54af35aa 100644 --- a/src/spiffworkflow_backend/models/permission_target.py +++ b/src/spiffworkflow_backend/models/permission_target.py @@ -1,7 +1,6 @@ """PermissionTarget.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy.schema import CheckConstraint # from sqlalchemy import ForeignKey # type: ignore diff --git a/src/spiffworkflow_backend/models/principal.py b/src/spiffworkflow_backend/models/principal.py index 4a38e84c..3c392800 100644 --- a/src/spiffworkflow_backend/models/principal.py +++ b/src/spiffworkflow_backend/models/principal.py @@ -1,7 +1,6 @@ """Principal.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from sqlalchemy.schema import CheckConstraint diff --git a/src/spiffworkflow_backend/models/process_instance.py b/src/spiffworkflow_backend/models/process_instance.py index 6cd5c397..ef766607 100644 --- a/src/spiffworkflow_backend/models/process_instance.py +++ b/src/spiffworkflow_backend/models/process_instance.py @@ -1,9 +1,9 @@ """Process_instance.""" import enum -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel import marshmallow +from flask_bpmn.models.db import db +from flask_bpmn.models.db import SpiffworkflowBaseDBModel from marshmallow import INCLUDE from marshmallow import Schema from marshmallow_enum import EnumField # type: ignore diff --git a/src/spiffworkflow_backend/models/process_instance_report.py b/src/spiffworkflow_backend/models/process_instance_report.py index 78db7304..89229f44 100644 --- a/src/spiffworkflow_backend/models/process_instance_report.py +++ b/src/spiffworkflow_backend/models/process_instance_report.py @@ -1,7 +1,6 @@ """Process_instance.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from sqlalchemy.orm import deferred from sqlalchemy.orm import relationship diff --git a/src/spiffworkflow_backend/models/task_event.py b/src/spiffworkflow_backend/models/task_event.py index f8fee994..d99e407c 100644 --- a/src/spiffworkflow_backend/models/task_event.py +++ b/src/spiffworkflow_backend/models/task_event.py @@ -2,9 +2,9 @@ from __future__ import annotations import enum + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from marshmallow import fields from marshmallow import INCLUDE from marshmallow import Schema diff --git a/src/spiffworkflow_backend/models/user.py b/src/spiffworkflow_backend/models/user.py index f7698637..369c40e2 100644 --- a/src/spiffworkflow_backend/models/user.py +++ b/src/spiffworkflow_backend/models/user.py @@ -1,12 +1,12 @@ """User.""" -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import Optional import jwt import marshmallow from flask import current_app +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db +from flask_bpmn.models.db import SpiffworkflowBaseDBModel from marshmallow import Schema from sqlalchemy.orm import relationship diff --git a/src/spiffworkflow_backend/models/user_group_assignment.py b/src/spiffworkflow_backend/models/user_group_assignment.py index 21f7b3ac..bb8db765 100644 --- a/src/spiffworkflow_backend/models/user_group_assignment.py +++ b/src/spiffworkflow_backend/models/user_group_assignment.py @@ -1,7 +1,6 @@ """UserGroupAssignment.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from sqlalchemy.orm import relationship diff --git a/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py b/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py index 555d3f01..e85f1e87 100644 --- a/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py +++ b/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py @@ -1,5 +1,4 @@ """APIs for dealing with process groups, process models, and process instances.""" -from flask_bpmn.models.db import db from typing import Any from flask import Blueprint @@ -9,6 +8,7 @@ from flask import redirect from flask import render_template from flask import request from flask import url_for +from flask_bpmn.models.db import db from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( diff --git a/src/spiffworkflow_backend/routes/process_api_blueprint.py b/src/spiffworkflow_backend/routes/process_api_blueprint.py index b01ad43f..3035d657 100644 --- a/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1,12 +1,12 @@ """APIs for dealing with process groups, process models, and process instances.""" import json -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db import connexion # type: ignore from flask import Blueprint from flask import g from flask import Response +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from spiffworkflow_backend.models.file import FileSchema from spiffworkflow_backend.models.file import FileType diff --git a/src/spiffworkflow_backend/routes/user.py b/src/spiffworkflow_backend/routes/user.py index f66469e7..c7eea67e 100644 --- a/src/spiffworkflow_backend/routes/user.py +++ b/src/spiffworkflow_backend/routes/user.py @@ -1,8 +1,7 @@ """User.""" -from flask_bpmn.api.api_error import ApiError - from flask import current_app from flask import g +from flask_bpmn.api.api_error import ApiError from spiffworkflow_backend.models.user import UserModel diff --git a/src/spiffworkflow_backend/routes/user_blueprint.py b/src/spiffworkflow_backend/routes/user_blueprint.py index 27e160e5..2555c5c7 100644 --- a/src/spiffworkflow_backend/routes/user_blueprint.py +++ b/src/spiffworkflow_backend/routes/user_blueprint.py @@ -1,7 +1,5 @@ """Main.""" import json -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Any from typing import Final @@ -9,6 +7,8 @@ import flask.wrappers from flask import Blueprint from flask import request from flask import Response +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from sqlalchemy.exc import IntegrityError from spiffworkflow_backend.models.group import GroupModel diff --git a/src/spiffworkflow_backend/scripts/script.py b/src/spiffworkflow_backend/scripts/script.py index 1d26b2ac..113516bc 100644 --- a/src/spiffworkflow_backend/scripts/script.py +++ b/src/spiffworkflow_backend/scripts/script.py @@ -2,6 +2,7 @@ import importlib import os import pkgutil + from flask_bpmn.api.api_error import ApiError diff --git a/src/spiffworkflow_backend/services/file_system_service.py b/src/spiffworkflow_backend/services/file_system_service.py index ca377a71..86ac3fb1 100644 --- a/src/spiffworkflow_backend/services/file_system_service.py +++ b/src/spiffworkflow_backend/services/file_system_service.py @@ -1,11 +1,11 @@ """File_system_service.""" import os from datetime import datetime -from flask_bpmn.api.api_error import ApiError from typing import List import pytz from flask import current_app +from flask_bpmn.api.api_error import ApiError from spiffworkflow_backend.models.file import CONTENT_TYPES from spiffworkflow_backend.models.file import File diff --git a/src/spiffworkflow_backend/services/process_instance_processor.py b/src/spiffworkflow_backend/services/process_instance_processor.py index d52d7a1e..00fd3f7b 100644 --- a/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/src/spiffworkflow_backend/services/process_instance_processor.py @@ -1,11 +1,11 @@ """Process_instance_processor.""" import json import time -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import List from flask import current_app +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from lxml import etree # type: ignore from SpiffWorkflow import Task as SpiffTask # type: ignore from SpiffWorkflow import TaskState diff --git a/src/spiffworkflow_backend/services/process_instance_service.py b/src/spiffworkflow_backend/services/process_instance_service.py index dd34086b..3a8136cc 100644 --- a/src/spiffworkflow_backend/services/process_instance_service.py +++ b/src/spiffworkflow_backend/services/process_instance_service.py @@ -1,9 +1,9 @@ """Process_instance_service.""" import time -from flask_bpmn.models.db import db from typing import List from flask import current_app +from flask_bpmn.models.db import db from SpiffWorkflow import NavItem # type: ignore from SpiffWorkflow.bpmn.specs.ManualTask import ManualTask # type: ignore from SpiffWorkflow.bpmn.specs.UserTask import UserTask # type: ignore diff --git a/src/spiffworkflow_backend/services/process_model_service.py b/src/spiffworkflow_backend/services/process_model_service.py index 83f2a048..aa971e87 100644 --- a/src/spiffworkflow_backend/services/process_model_service.py +++ b/src/spiffworkflow_backend/services/process_model_service.py @@ -2,9 +2,10 @@ import json import os import shutil -from flask_bpmn.api.api_error import ApiError from typing import List +from flask_bpmn.api.api_error import ApiError + from spiffworkflow_backend.models.process_group import ProcessGroup from spiffworkflow_backend.models.process_group import ProcessGroupSchema from spiffworkflow_backend.models.process_instance import ProcessInstanceModel diff --git a/src/spiffworkflow_backend/services/spec_file_service.py b/src/spiffworkflow_backend/services/spec_file_service.py index 5da17289..f96fb11c 100644 --- a/src/spiffworkflow_backend/services/spec_file_service.py +++ b/src/spiffworkflow_backend/services/spec_file_service.py @@ -2,10 +2,10 @@ import os import shutil from datetime import datetime -from flask_bpmn.api.api_error import ApiError from typing import List from typing import Union +from flask_bpmn.api.api_error import ApiError from lxml import etree # type: ignore from lxml.etree import Element as EtreeElement # type: ignore from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore diff --git a/src/spiffworkflow_backend/services/user_service.py b/src/spiffworkflow_backend/services/user_service.py index d8105c0e..5c903943 100644 --- a/src/spiffworkflow_backend/services/user_service.py +++ b/src/spiffworkflow_backend/services/user_service.py @@ -1,9 +1,8 @@ """User_service.""" +from flask import g from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db -from flask import g - from spiffworkflow_backend.models.user import AdminSessionModel from spiffworkflow_backend.models.user import UserModel diff --git a/src/spiffworkflow_backend/spiff_workflow_connector.py b/src/spiffworkflow_backend/spiff_workflow_connector.py index c896bf81..c267f6fa 100755 --- a/src/spiffworkflow_backend/spiff_workflow_connector.py +++ b/src/spiffworkflow_backend/spiff_workflow_connector.py @@ -1,11 +1,11 @@ """Spiff Workflow Connector.""" -from flask_bpmn.models.db import db from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Union +from flask_bpmn.models.db import db from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer # type: ignore from SpiffWorkflow.bpmn.specs.events.event_types import CatchingEvent # type: ignore from SpiffWorkflow.bpmn.specs.events.event_types import ThrowingEvent diff --git a/tests/spiffworkflow_backend/helpers/test_data.py b/tests/spiffworkflow_backend/helpers/test_data.py index 3360d27c..7cf8b48c 100644 --- a/tests/spiffworkflow_backend/helpers/test_data.py +++ b/tests/spiffworkflow_backend/helpers/test_data.py @@ -1,10 +1,10 @@ """User.""" -from flask_bpmn.models.db import db from typing import Any from typing import Dict from typing import Optional from flask.app import Flask +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.example_data import ExampleDataLoader from spiffworkflow_backend.models.process_group import ProcessGroup diff --git a/tests/spiffworkflow_backend/integration/test_process_api.py b/tests/spiffworkflow_backend/integration/test_process_api.py index 08e1b8a1..c1a711fa 100644 --- a/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/tests/spiffworkflow_backend/integration/test_process_api.py @@ -3,7 +3,6 @@ import io import json import os import shutil -from flask_bpmn.models.db import db from typing import Dict from typing import Iterator from typing import Optional @@ -12,6 +11,7 @@ from typing import Union import pytest from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.test_data import find_or_create_user from tests.spiffworkflow_backend.helpers.test_data import load_test_spec from tests.spiffworkflow_backend.helpers.test_data import logged_in_headers diff --git a/tests/spiffworkflow_backend/unit/test_permissions.py b/tests/spiffworkflow_backend/unit/test_permissions.py index 32a878ea..6ea6ebd6 100644 --- a/tests/spiffworkflow_backend/unit/test_permissions.py +++ b/tests/spiffworkflow_backend/unit/test_permissions.py @@ -1,7 +1,6 @@ """Test Permissions.""" -from flask_bpmn.models.db import db - from flask.app import Flask +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.test_data import find_or_create_user from spiffworkflow_backend.models.principal import PrincipalModel