From b798ea4e455c33295f7c1e285280dca1fdf2e6f1 Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 24 Jun 2022 17:22:02 -0400 Subject: [PATCH] precommit is passing w/ burnettk --- .../routes/process_api_blueprint.py | 19 +++++++++---------- .../services/process_model_service.py | 4 +++- .../integration/test_process_api.py | 8 +++++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/spiffworkflow_backend/routes/process_api_blueprint.py b/src/spiffworkflow_backend/routes/process_api_blueprint.py index ef913535..2c4f0634 100644 --- a/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -2,7 +2,6 @@ import json from typing import Any from typing import Dict -from typing import List from typing import Optional from typing import Union @@ -13,7 +12,6 @@ from flask import g from flask import Response from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db -from werkzeug.datastructures import FileStorage from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( ProcessEntityNotFoundError, @@ -164,9 +162,7 @@ def process_model_update( return ProcessModelInfoSchema().dump(process_model) -def process_model_show( - process_group_id: str, process_model_id: str -) -> Any: +def process_model_show(process_group_id: str, process_model_id: str) -> Any: """Process_model_show.""" process_model = get_process_model(process_model_id, process_group_id) files = sorted(SpecFileService.get_files(process_model)) @@ -199,9 +195,7 @@ def process_model_list( return Response(json.dumps(response_json), status=200, mimetype="application/json") -def get_file( - process_group_id: str, process_model_id: str, file_name: str -) -> Any: +def get_file(process_group_id: str, process_model_id: str, file_name: str) -> Any: """Get_file.""" process_model = get_process_model(process_model_id, process_group_id) files = SpecFileService.get_files(process_model, file_name) @@ -337,7 +331,10 @@ def process_instance_list( ) # this can never happen. obviously the class has the columns it defines. this is just to appease mypy. - if ProcessInstanceModel.start_in_seconds is None or ProcessInstanceModel.end_in_seconds is None: + if ( + ProcessInstanceModel.start_in_seconds is None + or ProcessInstanceModel.end_in_seconds is None + ): raise ( ApiError( code="unexpected_condition", @@ -378,7 +375,9 @@ def process_instance_list( return Response(json.dumps(response_json), status=200, mimetype="application/json") -def process_instance_delete(_process_group_id: str, _process_model_id: str, process_instance_id: int) -> flask.wrappers.Response: +def process_instance_delete( + _process_group_id: str, _process_model_id: str, process_instance_id: int +) -> flask.wrappers.Response: """Create_process_instance.""" process_instance = ProcessInstanceModel.query.filter_by( id=process_instance_id diff --git a/src/spiffworkflow_backend/services/process_model_service.py b/src/spiffworkflow_backend/services/process_model_service.py index 0df69347..1c7f4cb0 100644 --- a/src/spiffworkflow_backend/services/process_model_service.py +++ b/src/spiffworkflow_backend/services/process_model_service.py @@ -187,7 +187,9 @@ class ProcessModelService(FileSystemService): if item.is_dir() and item.name == process_group_id: return self.__scan_process_group(item) - raise ProcessEntityNotFoundError("process_group_not_found", f"Process Group Id: {process_group_id}") + raise ProcessEntityNotFoundError( + "process_group_not_found", f"Process Group Id: {process_group_id}" + ) def add_process_group(self, process_group: ProcessGroup) -> ProcessGroup: """Add_process_group.""" diff --git a/tests/spiffworkflow_backend/integration/test_process_api.py b/tests/spiffworkflow_backend/integration/test_process_api.py index 4137b0ae..bbd32218 100644 --- a/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/tests/spiffworkflow_backend/integration/test_process_api.py @@ -2,9 +2,9 @@ import io import json import time -from typing import Any, Dict +from typing import Any +from typing import Dict from typing import Optional -from typing import Union import pytest from flask.app import Flask @@ -1006,7 +1006,9 @@ def create_spec_file( return file -def create_process_group(client: FlaskClient, user: Any, process_group_id: str, display_name: str = "") -> str: +def create_process_group( + client: FlaskClient, user: Any, process_group_id: str, display_name: str = "" +) -> str: """Create_process_group.""" process_group = ProcessGroup( id=process_group_id, display_name=display_name, display_order=0, admin=False