fix mypy typing stuff. w/ jasquat

This commit is contained in:
burnettk 2022-11-15 10:28:18 -05:00
parent fbc15c97fe
commit 4e8f8c5524
4 changed files with 13 additions and 18 deletions

View File

@ -3,7 +3,7 @@ from dataclasses import dataclass
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from flask_marshmallow import Schema
from flask_marshmallow import Schema # type: ignore
from marshmallow import INCLUDE
@ -48,7 +48,7 @@ class SpecReferenceCache(SpiffworkflowBaseDBModel):
is_primary = db.Column(db.Boolean())
@classmethod
def from_spec_reference(cls, ref):
def from_spec_reference(cls, ref: SpecReference) -> "SpecReferenceCache":
"""From_spec_reference."""
return cls(
identifier=ref.identifier,
@ -63,7 +63,7 @@ class SpecReferenceCache(SpiffworkflowBaseDBModel):
)
class SpecReferenceSchema(Schema):
class SpecReferenceSchema(Schema): # type: ignore
"""FileSchema."""
class Meta:

View File

@ -339,9 +339,12 @@ def process_model_list(
return Response(json.dumps(response_json), status=200, mimetype="application/json")
def process_list() -> any:
"""Returns a list of all known processes - this includes processes that are not the
primary process - helpful for finding possible call activities."""
def process_list() -> Any:
"""Returns a list of all known processes.
This includes processes that are not the
primary process - helpful for finding possible call activities.
"""
references = SpecReferenceCache.query.filter_by(type="process")
return SpecReferenceSchema(many=True).dump(references)

View File

@ -61,13 +61,6 @@ class SpecFileService(FileSystemService):
ref_map[ref.identifier] = ref
return ref_map
@staticmethod
def get_references(process_models: List[ProcessModelInfo]) -> list[SpecReference]:
"""Returns all references -- process_ids, and decision ids, across all process models provided."""
references = []
for process_model in process_models:
references.extend(SpecFileService.get_references_for_process(process_model))
@staticmethod
def get_references_for_process(
process_model_info: ProcessModelInfo,

View File

@ -446,9 +446,8 @@ class TestProcessApi(BaseTest):
client: FlaskClient,
with_db_and_bpmn_file_cleanup: None,
with_super_admin_user: UserModel,
):
) -> None:
"""It should be possible to get a list of all processes known to the system."""
load_test_spec(
"test_group_one/simple_form",
process_model_source_directory="simple_form",
@ -480,9 +479,9 @@ class TestProcessApi(BaseTest):
)
assert simple_form["display_name"] == "Process With Form"
assert simple_form["process_model_id"] == "test_group_one/simple_form"
assert simple_form["has_lanes"] == False
assert simple_form["is_executable"] == True
assert simple_form["is_primary"] == True
assert simple_form["has_lanes"] is False
assert simple_form["is_executable"] is True
assert simple_form["is_primary"] is True
def test_process_group_add(
self,