From 421a6440c77e6c0b719a97e51f520c90ddd9730b Mon Sep 17 00:00:00 2001 From: Elizabeth Esswein Date: Tue, 20 Dec 2022 11:05:46 -0500 Subject: [PATCH] fix lint errors --- .../routes/process_api_blueprint.py | 2 ++ .../services/process_instance_processor.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) 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 3e83cb38..d01468e8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -2290,6 +2290,7 @@ def send_bpmn_event( process_instance_id: str, body: Dict, ) -> Response: + """Send a bpmn event to a workflow""" process_instance = ProcessInstanceModel.query.filter( ProcessInstanceModel.id == int(process_instance_id) ).first() @@ -2314,6 +2315,7 @@ def mark_task_complete( task_id: str, body: Dict, ) -> Response: + """Mark a task complete without executing it""" process_instance = ProcessInstanceModel.query.filter( ProcessInstanceModel.id == int(process_instance_id) ).first() 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 ea7100f2..301461b7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -44,11 +44,9 @@ from SpiffWorkflow.spiff.serializer.task_spec_converters import ( CallActivityTaskConverter, ) from SpiffWorkflow.spiff.serializer.task_spec_converters import EndEventConverter -from SpiffWorkflow.spiff.serializer.task_spec_converters import ( - IntermediateCatchEventConverter, - IntermediateThrowEventConverter, - EventBasedGatewayConverter, -) +from SpiffWorkflow.spiff.serializer.task_spec_converters import EventBasedGatewayConverter +from SpiffWorkflow.spiff.serializer.task_spec_converters import IntermediateCatchEventConverter +from SpiffWorkflow.spiff.serializer.task_spec_converters import IntermediateThrowEventConverter from SpiffWorkflow.spiff.serializer.task_spec_converters import ManualTaskConverter from SpiffWorkflow.spiff.serializer.task_spec_converters import NoneTaskConverter from SpiffWorkflow.spiff.serializer.task_spec_converters import ReceiveTaskConverter @@ -64,7 +62,6 @@ from SpiffWorkflow.spiff.serializer.task_spec_converters import UserTaskConverte from SpiffWorkflow.task import Task as SpiffTask # type: ignore from SpiffWorkflow.task import TaskState from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore - from spiffworkflow_backend.models.file import File from spiffworkflow_backend.models.file import FileType from spiffworkflow_backend.models.group import GroupModel @@ -708,11 +705,13 @@ class ProcessInstanceProcessor: db.session.commit() def serialize_task_spec(self, task_spec: SpiffTask) -> Any: + """Get a serialized version of a task spec""" # The task spec is NOT actually a SpiffTask, it is the task spec attached to a SpiffTask # Not sure why mypy accepts this but whatever. return self._serializer.spec_converter.convert(task_spec) def send_bpmn_event(self, event_data: dict[str, Any]) -> None: + """Send an event to the workflow""" payload = event_data.pop("payload", None) event_definition = self._event_serializer.restore(event_data) if payload is not None: @@ -724,6 +723,7 @@ class ProcessInstanceProcessor: self.do_engine_steps(save=True) def mark_task_complete(self, task_id: str) -> None: + """Mark the task complete without executing it""" spiff_task = self.bpmn_process_instance.get_task(UUID(task_id)) spiff_task._set_state(TaskState.COMPLETED) self.bpmn_process_instance.last_task = spiff_task