From cee726e8b0f2e14f201d2fb05b815f0e10ddcc59 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 8 Dec 2022 13:47:30 -0500 Subject: [PATCH] pyl passes --- flask-bpmn/src/flask_bpmn/models/db.py | 4 +- .../bin/import_tickets_for_command_line.py | 1 + .../bin/spiffworkflow-realm.json | 2 +- spiffworkflow-backend/conftest.py | 4 +- .../src/spiffworkflow_backend/__init__.py | 6 +- .../config/terraform_deployed_environment.py | 11 +- .../helpers/db_helper.py | 2 +- .../models/active_task.py | 4 +- .../models/active_task_user.py | 2 +- .../src/spiffworkflow_backend/models/group.py | 4 +- .../models/message_correlation.py | 4 +- .../message_correlation_message_instance.py | 2 +- .../models/message_correlation_property.py | 1 - .../models/message_instance.py | 4 +- .../message_triggerable_process_model.py | 1 - .../models/permission_assignment.py | 4 +- .../models/permission_target.py | 4 +- .../spiffworkflow_backend/models/principal.py | 2 +- .../models/process_instance.py | 4 +- .../models/process_instance_metadata.py | 2 +- .../models/process_instance_report.py | 4 +- .../models/refresh_token.py | 2 +- .../models/secret_model.py | 2 +- .../models/spec_reference.py | 2 +- .../models/spiff_logging.py | 3 +- .../models/spiff_step_details.py | 4 +- .../src/spiffworkflow_backend/models/user.py | 6 +- .../models/user_group_assignment.py | 1 - .../routes/process_api_blueprint.py | 5 +- .../src/spiffworkflow_backend/routes/user.py | 2 +- .../routes/user_blueprint.py | 4 +- .../scripts/get_localtime.py | 2 +- .../scripts/save_process_instance_metadata.py | 1 - .../spiffworkflow_backend/scripts/script.py | 3 +- .../services/acceptance_test_fixtures.py | 2 +- .../services/authentication_service.py | 4 +- .../services/authorization_service.py | 4 +- .../services/data_setup_service.py | 3 +- .../services/error_handling_service.py | 5 +- .../services/file_system_service.py | 2 +- .../services/group_service.py | 3 +- .../services/logging_service.py | 2 +- .../services/message_service.py | 2 +- .../services/process_instance_processor.py | 122 +++++++++--------- .../services/process_instance_service.py | 4 +- .../services/process_model_service.py | 3 +- .../services/secret_service.py | 3 +- .../services/spec_file_service.py | 2 +- .../services/user_service.py | 4 +- .../helpers/base_test.py | 4 +- .../integration/test_process_api.py | 2 +- .../integration/test_secret_service.py | 2 +- .../scripts/test_get_group_members.py | 3 +- .../unit/test_message_instance.py | 3 +- .../unit/test_permission_target.py | 3 +- .../unit/test_permissions.py | 3 +- .../unit/test_process_model.py | 3 +- .../unit/test_restricted_script_engine.py | 3 +- .../unit/test_spec_file_service.py | 2 +- .../unit/test_spiff_logging.py | 2 +- 60 files changed, 152 insertions(+), 152 deletions(-) diff --git a/flask-bpmn/src/flask_bpmn/models/db.py b/flask-bpmn/src/flask_bpmn/models/db.py index a288e6fda..643e1a85d 100644 --- a/flask-bpmn/src/flask_bpmn/models/db.py +++ b/flask-bpmn/src/flask_bpmn/models/db.py @@ -8,8 +8,8 @@ from typing import Any from flask_migrate import Migrate # type: ignore from flask_sqlalchemy import SQLAlchemy # type: ignore from sqlalchemy import event # type: ignore -from sqlalchemy.engine.base import Connection -from sqlalchemy.orm.mapper import Mapper +from sqlalchemy.engine.base import Connection # type: ignore +from sqlalchemy.orm.mapper import Mapper # type: ignore db = SQLAlchemy() migrate = Migrate() diff --git a/spiffworkflow-backend/bin/import_tickets_for_command_line.py b/spiffworkflow-backend/bin/import_tickets_for_command_line.py index a993a3d30..e193b5990 100644 --- a/spiffworkflow-backend/bin/import_tickets_for_command_line.py +++ b/spiffworkflow-backend/bin/import_tickets_for_command_line.py @@ -1,5 +1,6 @@ """Grabs tickets from csv and makes process instances.""" import csv + from flask_bpmn.models.db import db from spiffworkflow_backend import get_hacked_up_app_for_script diff --git a/spiffworkflow-backend/bin/spiffworkflow-realm.json b/spiffworkflow-backend/bin/spiffworkflow-realm.json index 8abb6cbc3..a30f53c14 100644 --- a/spiffworkflow-backend/bin/spiffworkflow-realm.json +++ b/spiffworkflow-backend/bin/spiffworkflow-realm.json @@ -2868,4 +2868,4 @@ "clientPolicies" : { "policies" : [ ] } -} \ No newline at end of file +} diff --git a/spiffworkflow-backend/conftest.py b/spiffworkflow-backend/conftest.py index 2ded9053b..c3af94332 100644 --- a/spiffworkflow-backend/conftest.py +++ b/spiffworkflow-backend/conftest.py @@ -1,12 +1,12 @@ """Conftest.""" import os import shutil -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel import pytest from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db +from flask_bpmn.models.db import SpiffworkflowBaseDBModel from tests.spiffworkflow_backend.helpers.base_test import BaseTest from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py index e894f2f98..9599116a2 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py @@ -1,8 +1,5 @@ """__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 from typing import Any import connexion # type: ignore @@ -12,6 +9,9 @@ import sqlalchemy from apscheduler.schedulers.background import BackgroundScheduler # type: ignore from apscheduler.schedulers.base import BaseScheduler # type: ignore from flask.json.provider import DefaultJSONProvider +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 from flask_mail import Mail # type: ignore from werkzeug.exceptions import NotFound diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py index 7b6769ccf..458e541cb 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/terraform_deployed_environment.py @@ -8,7 +8,8 @@ GIT_COMMIT_ON_SAVE = True GIT_COMMIT_USERNAME = environment_identifier_for_this_config_file_only GIT_COMMIT_EMAIL = f"{environment_identifier_for_this_config_file_only}@example.com" SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get( - "SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME", default="terraform_deployed_environment.yml" + "SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME", + default="terraform_deployed_environment.yml", ) RUN_BACKGROUND_SCHEDULER = ( @@ -16,6 +17,10 @@ RUN_BACKGROUND_SCHEDULER = ( ) OPEN_ID_SERVER_URL = f"https://keycloak.{environment_identifier_for_this_config_file_only}.spiffworkflow.org/realms/spiffworkflow" -SPIFFWORKFLOW_FRONTEND_URL = f"https://{environment_identifier_for_this_config_file_only}.spiffworkflow.org" -SPIFFWORKFLOW_BACKEND_URL = f"https://api.{environment_identifier_for_this_config_file_only}.spiffworkflow.org" +SPIFFWORKFLOW_FRONTEND_URL = ( + f"https://{environment_identifier_for_this_config_file_only}.spiffworkflow.org" +) +SPIFFWORKFLOW_BACKEND_URL = ( + f"https://api.{environment_identifier_for_this_config_file_only}.spiffworkflow.org" +) CONNECTOR_PROXY_URL = f"https://connector-proxy.{environment_identifier_for_this_config_file_only}.spiffworkflow.org" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/helpers/db_helper.py b/spiffworkflow-backend/src/spiffworkflow_backend/helpers/db_helper.py index 2ceea1f44..45cd38f7a 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/helpers/db_helper.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/helpers/db_helper.py @@ -1,8 +1,8 @@ """Db_helper.""" import time -from flask_bpmn.models.db import db import sqlalchemy +from flask_bpmn.models.db import db def try_to_connect(start_time: float) -> None: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py index cf08394f4..ea9e10552 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py @@ -2,10 +2,10 @@ from __future__ import annotations from dataclasses import dataclass -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import TYPE_CHECKING +from flask_bpmn.models.db import db +from flask_bpmn.models.db import SpiffworkflowBaseDBModel from sqlalchemy import ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.orm import RelationshipProperty diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py index a14c08ce4..f194c38e4 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py @@ -2,9 +2,9 @@ from __future__ import annotations from dataclasses import dataclass + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from spiffworkflow_backend.models.active_task import ActiveTaskModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/group.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/group.py index b6db3cf34..3b7edd6ce 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/group.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/group.py @@ -1,10 +1,10 @@ """Group.""" from __future__ import annotations -from flask_bpmn.models.db import db -from flask_bpmn.models.group import FlaskBpmnGroupModel from typing import TYPE_CHECKING +from flask_bpmn.models.db import db +from flask_bpmn.models.group import FlaskBpmnGroupModel from sqlalchemy.orm import relationship if TYPE_CHECKING: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py index 65937a4fc..08bc1cb12 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py @@ -1,9 +1,9 @@ """Message_correlation.""" from dataclasses import dataclass -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import TYPE_CHECKING +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/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py index dbbddb44f..320dfba3e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py @@ -1,8 +1,8 @@ """Message_correlation_message_instance.""" from dataclasses import dataclass + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py index c0c06925f..b84b7140c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py @@ -1,7 +1,6 @@ """Message_correlation_property.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from spiffworkflow_backend.models.message_model import MessageModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py index 745d2c2d6..2559a6352 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py @@ -1,12 +1,12 @@ """Message_instance.""" import enum from dataclasses import dataclass -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import Any from typing import Optional from typing import TYPE_CHECKING +from flask_bpmn.models.db import db +from flask_bpmn.models.db import SpiffworkflowBaseDBModel from sqlalchemy import ForeignKey from sqlalchemy.event import listens_for from sqlalchemy.orm import relationship diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py index 29b742f7d..cc8834654 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py @@ -1,7 +1,6 @@ """Message_correlation_property.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from spiffworkflow_backend.models.message_model import MessageModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py index 8aa2b5ade..63295f74e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py @@ -1,9 +1,9 @@ """PermissionAssignment.""" import enum -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import Any +from flask_bpmn.models.db import db +from flask_bpmn.models.db import SpiffworkflowBaseDBModel from sqlalchemy import ForeignKey from sqlalchemy.orm import validates diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_target.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_target.py index 3b4a10553..53334baf0 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_target.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_target.py @@ -1,10 +1,10 @@ """PermissionTarget.""" import re from dataclasses import dataclass -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 sqlalchemy.orm import validates diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py index 1c267052d..c7efa8609 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py @@ -1,8 +1,8 @@ """Principal.""" from dataclasses import dataclass + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.schema import CheckConstraint diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py index c2b003104..e6a5f6849 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py @@ -1,12 +1,12 @@ """Process_instance.""" from __future__ import annotations -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import Any from typing import cast 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/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_metadata.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_metadata.py index e34a56491..c9003594b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_metadata.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_metadata.py @@ -1,8 +1,8 @@ """Spiff_step_details.""" from dataclasses import dataclass + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from sqlalchemy import ForeignKey from spiffworkflow_backend.models.process_instance import ProcessInstanceModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py index c6da687e0..1f22a3830 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py @@ -2,13 +2,13 @@ from __future__ import annotations from dataclasses import dataclass -from flask_bpmn.models.db import db -from flask_bpmn.models.db import SpiffworkflowBaseDBModel from typing import Any from typing import cast from typing import Optional from typing import TypedDict +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/spiffworkflow-backend/src/spiffworkflow_backend/models/refresh_token.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/refresh_token.py index c5684f25a..2e96b7f05 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/refresh_token.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/refresh_token.py @@ -1,8 +1,8 @@ """Refresh_token.""" from dataclasses import dataclass + 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/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py index 1bb634cec..92fd470a3 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py @@ -1,8 +1,8 @@ """Secret_model.""" from dataclasses import dataclass + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from marshmallow import Schema from sqlalchemy import ForeignKey diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/spec_reference.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/spec_reference.py index ce083a483..1e85f7229 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/spec_reference.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/spec_reference.py @@ -1,8 +1,8 @@ """Message_model.""" from dataclasses import dataclass + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel - from flask_marshmallow import Schema # type: ignore from marshmallow import INCLUDE from sqlalchemy import UniqueConstraint diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_logging.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_logging.py index e27daeb64..b0b908877 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_logging.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_logging.py @@ -1,8 +1,9 @@ """Spiff_logging.""" from dataclasses import dataclass +from typing import Optional + from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from typing import Optional @dataclass diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py index 62dcd5957..91d70116a 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py @@ -1,9 +1,9 @@ """Spiff_step_details.""" from dataclasses import dataclass -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 sqlalchemy import ForeignKey from sqlalchemy.orm import deferred diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py index cdd2379b7..b8c83d0f7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py @@ -1,14 +1,14 @@ """User.""" from __future__ import annotations -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 Any 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 from sqlalchemy.orm import validates diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/user_group_assignment.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/user_group_assignment.py index 548a280b9..fa5b620c8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/user_group_assignment.py +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index a241661ab..ef194b81a 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -4,8 +4,6 @@ import random import re import string import uuid -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Any from typing import Dict from typing import Optional @@ -24,6 +22,8 @@ from flask import make_response from flask import redirect from flask import request from flask.wrappers import Response +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from lxml import etree # type: ignore from lxml.builder import ElementMaker # type: ignore from SpiffWorkflow.task import Task as SpiffTask # type: ignore @@ -33,7 +33,6 @@ from sqlalchemy import asc from sqlalchemy import desc from sqlalchemy import func from sqlalchemy.orm import aliased -from sqlalchemy.orm import joinedload from sqlalchemy.orm import selectinload from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py index f18dff3b3..2bbbc1374 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py @@ -2,7 +2,6 @@ import ast import base64 import json -from flask_bpmn.api.api_error import ApiError from typing import Any from typing import Dict from typing import Optional @@ -13,6 +12,7 @@ from flask import current_app from flask import g from flask import redirect from flask import request +from flask_bpmn.api.api_error import ApiError from werkzeug.wrappers import Response from spiffworkflow_backend.models.user import UserModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user_blueprint.py index d1dea8c8e..29bbddcd1 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user_blueprint.py +++ b/spiffworkflow-backend/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/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py index c6680c9dd..689b86d8c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py @@ -1,9 +1,9 @@ """Get_localtime.""" from datetime import datetime -from flask_bpmn.api.api_error import ApiError from typing import Any import pytz +from flask_bpmn.api.api_error import ApiError from spiffworkflow_backend.models.script_attributes_context import ( ScriptAttributesContext, diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/save_process_instance_metadata.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/save_process_instance_metadata.py index 2f3f5eac7..d9c1959aa 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/save_process_instance_metadata.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/save_process_instance_metadata.py @@ -2,7 +2,6 @@ from typing import Any from flask_bpmn.models.db import db -from typing import Any from spiffworkflow_backend.models.process_instance_metadata import ( ProcessInstanceMetadataModel, diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py index 00f8de792..b744694a2 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py @@ -5,10 +5,11 @@ import importlib import os import pkgutil from abc import abstractmethod -from flask_bpmn.api.api_error import ApiError from typing import Any from typing import Callable +from flask_bpmn.api.api_error import ApiError + from spiffworkflow_backend.models.script_attributes_context import ( ScriptAttributesContext, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py index 81cb2b3fa..81488910e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py @@ -1,8 +1,8 @@ """Acceptance_test_fixtures.""" import time -from flask_bpmn.models.db import db from flask import current_app +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from spiffworkflow_backend.models.process_instance import ProcessInstanceModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py index 4981c3156..f4bd357b1 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py @@ -3,14 +3,14 @@ import base64 import enum import json import time -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Optional import jwt import requests from flask import current_app from flask import redirect +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from werkzeug.wrappers import Response from spiffworkflow_backend.models.refresh_token import RefreshTokenModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py index 5b0d0573b..bde408308 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py @@ -1,8 +1,6 @@ """Authorization_service.""" import inspect import re -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Optional from typing import Union @@ -12,6 +10,8 @@ from flask import current_app from flask import g from flask import request from flask import scaffold +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from SpiffWorkflow.task import Task as SpiffTask # type: ignore from sqlalchemy import or_ from sqlalchemy import text diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py index b0179079e..c9c0647ed 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py @@ -1,7 +1,6 @@ """Data_setup_service.""" -from flask_bpmn.models.db import db - from flask import current_app +from flask_bpmn.models.db import db from spiffworkflow_backend.services.process_model_service import ProcessModelService from spiffworkflow_backend.services.spec_file_service import SpecFileService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py index a5be1b8e3..1e8b38f2d 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py @@ -1,10 +1,11 @@ """Error_handling_service.""" -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Any from typing import List from typing import Union +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db + from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus from spiffworkflow_backend.services.email_service import EmailService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py index 29f118b63..5812748c7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py @@ -1,12 +1,12 @@ """File_system_service.""" import os from datetime import datetime -from flask_bpmn.api.api_error import ApiError from typing import List from typing import Optional 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/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py index edc0e69a4..aa560009e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py @@ -1,7 +1,8 @@ """Group_service.""" -from flask_bpmn.models.db import db from typing import Optional +from flask_bpmn.models.db import db + from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.services.user_service import UserService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py index fe56e104f..dd34cb3fd 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py @@ -2,12 +2,12 @@ import json import logging import re -from flask_bpmn.models.db import db from typing import Any from typing import Optional from flask import g from flask.app import Flask +from flask_bpmn.models.db import db from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py index 8e8f7a728..cfb42c836 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py @@ -1,8 +1,8 @@ """Message_service.""" -from flask_bpmn.models.db import db from typing import Any from typing import Optional +from flask_bpmn.models.db import db from sqlalchemy import and_ from sqlalchemy import or_ from sqlalchemy import select diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index e833d8af1..ffe69fd72 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -8,8 +8,6 @@ import re import time from datetime import datetime from datetime import timedelta -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Any from typing import Callable from typing import Dict @@ -23,6 +21,8 @@ from typing import Union import dateparser import pytz 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 RestrictedPython import safe_globals # type: ignore from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore @@ -192,11 +192,11 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore return self._evaluate(expression, task.data, task, external_methods) def _evaluate( - self, - expression: str, - context: Dict[str, Union[Box, str]], - task: Optional[SpiffTask] = None, - external_methods: Optional[Dict[str, Any]] = None, + self, + expression: str, + context: Dict[str, Union[Box, str]], + task: Optional[SpiffTask] = None, + external_methods: Optional[Dict[str, Any]] = None, ) -> Any: """_evaluate.""" methods = self.__get_augment_methods(task) @@ -220,7 +220,7 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore ) from exception def execute( - self, task: SpiffTask, script: str, external_methods: Any = None + self, task: SpiffTask, script: str, external_methods: Any = None ) -> None: """Execute.""" try: @@ -234,10 +234,10 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore raise WorkflowTaskExecException(task, f" {script}, {e}", e) from e def call_service( - self, - operation_name: str, - operation_params: Dict[str, Any], - task_data: Dict[str, Any], + self, + operation_name: str, + operation_params: Dict[str, Any], + task_data: Dict[str, Any], ) -> Any: """CallService.""" return ServiceTaskDelegate.call_connector( @@ -284,7 +284,7 @@ class ProcessInstanceProcessor: # * get_spec, which returns a spec and any subprocesses (as IdToBpmnProcessSpecMapping dict) # * __get_bpmn_process_instance, which takes spec and subprocesses and instantiates and returns a BpmnWorkflow def __init__( - self, process_instance_model: ProcessInstanceModel, validate_only: bool = False + self, process_instance_model: ProcessInstanceModel, validate_only: bool = False ) -> None: """Create a Workflow Processor based on the serialized information available in the process_instance model.""" tld = current_app.config["THREAD_LOCAL_DATA"] @@ -311,7 +311,7 @@ class ProcessInstanceProcessor: ) else: bpmn_json_length = len(process_instance_model.bpmn_json.encode("utf-8")) - megabyte = float(1024 ** 2) + megabyte = float(1024**2) json_size = bpmn_json_length / megabyte if json_size > 1: wf_json = json.loads(process_instance_model.bpmn_json) @@ -325,22 +325,22 @@ class ProcessInstanceProcessor: len(json.dumps(test_spec).encode("utf-8")) / megabyte ) message = ( - "Workflow " - + process_instance_model.process_model_identifier - + f" JSON Size is over 1MB:{json_size:.2f} MB" + "Workflow " + + process_instance_model.process_model_identifier + + f" JSON Size is over 1MB:{json_size:.2f} MB" ) message += f"\n Task Size: {task_size}" message += f"\n Spec Size: {spec_size}" current_app.logger.warning(message) def check_sub_specs( - test_spec: dict, indent: int = 0, show_all: bool = False + test_spec: dict, indent: int = 0, show_all: bool = False ) -> None: """Check_sub_specs.""" for my_spec_name in test_spec["task_specs"]: my_spec = test_spec["task_specs"][my_spec_name] my_spec_size = ( - len(json.dumps(my_spec).encode("utf-8")) / megabyte + len(json.dumps(my_spec).encode("utf-8")) / megabyte ) if my_spec_size > 0.1 or show_all: current_app.logger.warning( @@ -376,13 +376,13 @@ class ProcessInstanceProcessor: raise ApiError( error_code="unexpected_process_instance_structure", message="Failed to deserialize process_instance" - " '%s' due to a mis-placed or missing task '%s'" - % (self.process_model_identifier, str(ke)), + " '%s' due to a mis-placed or missing task '%s'" + % (self.process_model_identifier, str(ke)), ) from ke @classmethod def get_process_model_and_subprocesses( - cls, process_model_identifier: str + cls, process_model_identifier: str ) -> Tuple[BpmnProcessSpec, IdToBpmnProcessSpecMapping]: """Get_process_model_and_subprocesses.""" process_model_info = ProcessModelService.get_process_model( @@ -400,7 +400,7 @@ class ProcessInstanceProcessor: @classmethod def get_bpmn_process_instance_from_process_model( - cls, process_model_identifier: str + cls, process_model_identifier: str ) -> BpmnWorkflow: """Get_all_bpmn_process_identifiers_for_process_model.""" (bpmn_process_spec, subprocesses) = cls.get_process_model_and_subprocesses( @@ -425,7 +425,7 @@ class ProcessInstanceProcessor: return current_user def add_user_info_to_process_instance( - self, bpmn_process_instance: BpmnWorkflow + self, bpmn_process_instance: BpmnWorkflow ) -> None: """Add_user_info_to_process_instance.""" current_user = self.current_user() @@ -438,8 +438,8 @@ class ProcessInstanceProcessor: @staticmethod def get_bpmn_process_instance_from_workflow_spec( - spec: BpmnProcessSpec, - subprocesses: Optional[IdToBpmnProcessSpecMapping] = None, + spec: BpmnProcessSpec, + subprocesses: Optional[IdToBpmnProcessSpecMapping] = None, ) -> BpmnWorkflow: """Get_bpmn_process_instance_from_workflow_spec.""" return BpmnWorkflow( @@ -450,10 +450,10 @@ class ProcessInstanceProcessor: @staticmethod def __get_bpmn_process_instance( - process_instance_model: ProcessInstanceModel, - spec: Optional[BpmnProcessSpec] = None, - validate_only: bool = False, - subprocesses: Optional[IdToBpmnProcessSpecMapping] = None, + process_instance_model: ProcessInstanceModel, + spec: Optional[BpmnProcessSpec] = None, + validate_only: bool = False, + subprocesses: Optional[IdToBpmnProcessSpecMapping] = None, ) -> BpmnWorkflow: """__get_bpmn_process_instance.""" if process_instance_model.bpmn_json: @@ -496,14 +496,14 @@ class ProcessInstanceProcessor: self.save() def raise_if_no_potential_owners( - self, potential_owner_ids: list[int], message: str + self, potential_owner_ids: list[int], message: str ) -> None: """Raise_if_no_potential_owners.""" if not potential_owner_ids: raise (NoPotentialOwnersForTaskError(message)) def get_potential_owner_ids_from_task( - self, task: SpiffTask + self, task: SpiffTask ) -> PotentialOwnerIdList: """Get_potential_owner_ids_from_task.""" task_spec = task.task_spec @@ -598,7 +598,7 @@ class ProcessInstanceProcessor: if path_segment in data_for_key: data_for_key = data_for_key[path_segment] else: - data_for_key = None + data_for_key = None # type: ignore break if data_for_key is not None: @@ -712,7 +712,7 @@ class ProcessInstanceProcessor: @staticmethod def backfill_missing_spec_reference_records( - bpmn_process_identifier: str, + bpmn_process_identifier: str, ) -> Optional[str]: """Backfill_missing_spec_reference_records.""" process_models = ProcessModelService.get_process_models(recursive=True) @@ -733,7 +733,7 @@ class ProcessInstanceProcessor: @staticmethod def bpmn_file_full_path_from_bpmn_process_identifier( - bpmn_process_identifier: str, + bpmn_process_identifier: str, ) -> str: """Bpmn_file_full_path_from_bpmn_process_identifier.""" if bpmn_process_identifier is None: @@ -743,8 +743,8 @@ class ProcessInstanceProcessor: spec_reference = ( SpecReferenceCache.query.filter_by(identifier=bpmn_process_identifier) - .filter_by(type="process") - .first() + .filter_by(type="process") + .first() ) bpmn_file_full_path = None if spec_reference is None: @@ -763,15 +763,15 @@ class ProcessInstanceProcessor: ApiError( error_code="could_not_find_bpmn_process_identifier", message="Could not find the the given bpmn process identifier from any sources: %s" - % bpmn_process_identifier, + % bpmn_process_identifier, ) ) return os.path.abspath(bpmn_file_full_path) @staticmethod def update_spiff_parser_with_all_process_dependency_files( - parser: BpmnDmnParser, - processed_identifiers: Optional[set[str]] = None, + parser: BpmnDmnParser, + processed_identifiers: Optional[set[str]] = None, ) -> None: """Update_spiff_parser_with_all_process_dependency_files.""" if processed_identifiers is None: @@ -809,7 +809,7 @@ class ProcessInstanceProcessor: @staticmethod def get_spec( - files: List[File], process_model_info: ProcessModelInfo + files: List[File], process_model_info: ProcessModelInfo ) -> Tuple[BpmnProcessSpec, IdToBpmnProcessSpecMapping]: """Returns a SpiffWorkflow specification for the given process_instance spec, using the files provided.""" parser = ProcessInstanceProcessor.get_parser() @@ -823,14 +823,14 @@ class ProcessInstanceProcessor: dmn: etree.Element = etree.fromstring(data) parser.add_dmn_xml(dmn, filename=file.name) if ( - process_model_info.primary_process_id is None - or process_model_info.primary_process_id == "" + process_model_info.primary_process_id is None + or process_model_info.primary_process_id == "" ): raise ( ApiError( error_code="no_primary_bpmn_error", message="There is no primary BPMN process id defined for process_model %s" - % process_model_info.id, + % process_model_info.id, ) ) ProcessInstanceProcessor.update_spiff_parser_with_all_process_dependency_files( @@ -848,7 +848,7 @@ class ProcessInstanceProcessor: raise ApiError( error_code="process_instance_validation_error", message="Failed to parse the Workflow Specification. " - + "Error is '%s.'" % str(ve), + + "Error is '%s.'" % str(ve), file_name=ve.filename, task_id=ve.id, tag=ve.tag, @@ -895,12 +895,12 @@ class ProcessInstanceProcessor: message_correlations = [] for ( - message_correlation_key, - message_correlation_properties, + message_correlation_key, + message_correlation_properties, ) in bpmn_message.correlations.items(): for ( - message_correlation_property_identifier, - message_correlation_property_value, + message_correlation_property_identifier, + message_correlation_property_value, ) in message_correlation_properties.items(): message_correlation_property = ( MessageCorrelationPropertyModel.query.filter_by( @@ -992,7 +992,7 @@ class ProcessInstanceProcessor: db.session.add(message_instance) for ( - spiff_correlation_property + spiff_correlation_property ) in waiting_task.task_spec.event_definition.correlation_properties: # NOTE: we may have to cycle through keys here # not sure yet if it's valid for a property to be associated with multiple keys @@ -1002,9 +1002,9 @@ class ProcessInstanceProcessor: process_instance_id=self.process_instance_model.id, name=correlation_key_name, ) - .join(MessageCorrelationPropertyModel) - .filter_by(identifier=spiff_correlation_property.name) - .first() + .join(MessageCorrelationPropertyModel) + .filter_by(identifier=spiff_correlation_property.name) + .first() ) message_correlation_message_instance = ( MessageCorrelationMessageInstanceModel( @@ -1108,12 +1108,12 @@ class ProcessInstanceProcessor: endtasks = [] if self.bpmn_process_instance.is_completed(): for task in SpiffTask.Iterator( - self.bpmn_process_instance.task_tree, TaskState.ANY_MASK + self.bpmn_process_instance.task_tree, TaskState.ANY_MASK ): # Assure that we find the end event for this process_instance, and not for any sub-process_instances. if ( - isinstance(task.task_spec, EndEvent) - and task.workflow == self.bpmn_process_instance + isinstance(task.task_spec, EndEvent) + and task.workflow == self.bpmn_process_instance ): endtasks.append(task) if len(endtasks) > 0: @@ -1149,8 +1149,8 @@ class ProcessInstanceProcessor: return task for task in ready_tasks: if ( - self.bpmn_process_instance.last_task - and task.parent == last_user_task.parent + self.bpmn_process_instance.last_task + and task.parent == last_user_task.parent ): return task @@ -1160,7 +1160,7 @@ class ProcessInstanceProcessor: # and return that next_task = None for task in SpiffTask.Iterator( - self.bpmn_process_instance.task_tree, TaskState.NOT_FINISHED_MASK + self.bpmn_process_instance.task_tree, TaskState.NOT_FINISHED_MASK ): next_task = task return next_task @@ -1244,7 +1244,7 @@ class ProcessInstanceProcessor: t for t in all_tasks if not self.bpmn_process_instance._is_engine_task(t.task_spec) - and t.state in [TaskState.COMPLETED, TaskState.CANCELLED] + and t.state in [TaskState.COMPLETED, TaskState.CANCELLED] ] def get_all_waiting_tasks(self) -> list[SpiffTask]: @@ -1259,7 +1259,7 @@ class ProcessInstanceProcessor: @classmethod def get_task_by_bpmn_identifier( - cls, bpmn_task_identifier: str, bpmn_process_instance: BpmnWorkflow + cls, bpmn_task_identifier: str, bpmn_process_instance: BpmnWorkflow ) -> Optional[SpiffTask]: """Get_task_by_id.""" all_tasks = bpmn_process_instance.get_tasks(TaskState.ANY_MASK) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py index 826019a97..46bd252b9 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -1,11 +1,11 @@ """Process_instance_service.""" import time -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Any 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 SpiffWorkflow.task import Task as SpiffTask # type: ignore from spiffworkflow_backend.models.active_task import ActiveTaskModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index 9a88cb56a..f009af688 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -2,13 +2,14 @@ import json import os import shutil -from flask_bpmn.api.api_error import ApiError from glob import glob from typing import Any from typing import List from typing import Optional from typing import TypeVar +from flask_bpmn.api.api_error import ApiError + from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( ProcessEntityNotFoundError, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py index 2362a1a5d..e4dee4913 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py @@ -1,7 +1,8 @@ """Secret_service.""" +from typing import Optional + from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db -from typing import Optional from spiffworkflow_backend.models.secret_model import SecretModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py index 8057a7e14..c69f41c30 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py @@ -2,10 +2,10 @@ import os import shutil from datetime import datetime -from flask_bpmn.models.db import db from typing import List from typing import Optional +from flask_bpmn.models.db import db from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore from spiffworkflow_backend.models.file import File diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py index 009d0531b..0e8e65c2c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py @@ -1,11 +1,11 @@ """User_service.""" -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Any from typing import Optional from flask import current_app from flask import g +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from spiffworkflow_backend.models.active_task import ActiveTaskModel from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py index f3746e1fc..48982fc60 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py @@ -3,14 +3,14 @@ import io import json import os import time -from flask_bpmn.api.api_error import ApiError -from flask_bpmn.models.db import db from typing import Any from typing import Dict from typing import Optional from flask import current_app from flask.testing import FlaskClient +from flask_bpmn.api.api_error import ApiError +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.test_data import load_test_spec from werkzeug.test import TestResponse # type: ignore diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index 9a87dea88..9d719a233 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -3,12 +3,12 @@ import io import json import os import time -from flask_bpmn.models.db import db from typing import Any import pytest from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py index 9d064173f..c71f67f23 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py @@ -1,11 +1,11 @@ """Test_secret_service.""" import json -from flask_bpmn.api.api_error import ApiError from typing import Optional import pytest from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.api.api_error import ApiError from tests.spiffworkflow_backend.helpers.base_test import BaseTest from werkzeug.test import TestResponse # type: ignore diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py index a2e9f5ef8..8a6046b5b 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py @@ -1,8 +1,7 @@ """Test_get_localtime.""" -from flask_bpmn.models.db import db - from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py index a28034144..2c091eeb1 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py @@ -1,9 +1,8 @@ """Test_message_instance.""" -from flask_bpmn.models.db import db - import pytest from flask import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from spiffworkflow_backend.models.message_instance import MessageInstanceModel diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py index f0f693f09..567681428 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py @@ -1,8 +1,7 @@ """Process Model.""" -from flask_bpmn.models.db import db - import pytest from flask.app import Flask +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from spiffworkflow_backend.models.permission_target import ( diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py index 92f5c5002..b66f32370 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py @@ -1,8 +1,7 @@ """Test Permissions.""" -from flask_bpmn.models.db import db - from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py index 087eee63f..9eb6901b9 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py @@ -1,8 +1,7 @@ """Process Model.""" -from flask_bpmn.models.db import db - from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py index ae77a1fc6..d31ea424f 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py @@ -1,9 +1,8 @@ """Test_various_bpmn_constructs.""" -from flask_bpmn.api.api_error import ApiError - import pytest from flask.app import Flask from flask.testing import FlaskClient +from flask_bpmn.api.api_error import ApiError from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py index 5d67d2b22..3cc353b52 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py @@ -1,10 +1,10 @@ """Test_message_service.""" import os -from flask_bpmn.models.db import db import pytest from flask import Flask from flask.testing import FlaskClient +from flask_bpmn.models.db import db from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py index 15a892c06..d8680b719 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py @@ -1,8 +1,8 @@ """Process Model.""" from decimal import Decimal -from flask_bpmn.models.db import db from flask.app import Flask +from flask_bpmn.models.db import db from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec