some more type fixes w/ burnettk

This commit is contained in:
jasquat 2022-06-21 16:50:13 -04:00
parent 1bc2ca6179
commit 0c52a516a7
15 changed files with 52 additions and 51 deletions

10
poetry.lock generated
View File

@ -611,7 +611,7 @@ description = "Flask Bpmn"
category = "main"
optional = false
python-versions = "^3.7"
develop = false
develop = true
[package.dependencies]
click = "^8.0.1"
@ -629,10 +629,8 @@ spiffworkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "ma
werkzeug = "*"
[package.source]
type = "git"
url = "https://github.com/sartography/flask-bpmn"
reference = "main"
resolved_reference = "46542df4958f5457280a7de19177af2c3e652771"
type = "directory"
url = "../flask-bpmn"
[[package]]
name = "flask-cors"
@ -2056,7 +2054,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "3b904d4d870e7e1350000302779598858703ed9011b45681a649772603ec484d"
content-hash = "15f411e02a398487612fbb12e260b1ec384fd23397002479b1b4683da574de66"
[metadata.files]
alabaster = [

View File

@ -30,9 +30,9 @@ werkzeug = "*"
spiffworkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "main"}
sentry-sdk = "0.14.4"
sphinx-autoapi = "^1.8.4"
# flask-bpmn = {develop = true, path = "/home/jason/projects/github/sartography/flask-bpmn"}
flask-bpmn = {develop = true, path = "/home/jason/projects/github/sartography/flask-bpmn"}
# flask-bpmn = {develop = true, path = "/Users/kevin/projects/github/sartography/flask-bpmn"}
flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"}
# flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"}
mysql-connector-python = "^8.0.29"
pytest-flask = "^1.2.0"
pytest-flask-sqlalchemy = "^1.1.0"

View File

@ -2,7 +2,7 @@
autoflake8 will remove these lines without the noqa comment
"""
from flask_bpmn.models.db import add_listeners # type: ignore
from flask_bpmn.models.db import add_listeners
from spiffworkflow_backend.models.data_store import DataStoreModel # noqa: F401
from spiffworkflow_backend.models.file import FileModel # noqa: F401

View File

@ -25,7 +25,7 @@ class Permission(enum.Enum):
view_instance = 3
class PermissionAssignmentModel(SpiffworkflowBaseDBModel): # type: ignore
class PermissionAssignmentModel(SpiffworkflowBaseDBModel):
"""PermissionAssignmentModel."""
__tablename__ = "permission_assignment"

View File

@ -9,7 +9,7 @@ from sqlalchemy.schema import CheckConstraint
# from spiffworkflow_backend.models.process_model import ProcessModel
class PermissionTargetModel(SpiffworkflowBaseDBModel): # type: ignore
class PermissionTargetModel(SpiffworkflowBaseDBModel):
"""PermissionTargetModel."""
__tablename__ = "permission_target"

View File

@ -8,7 +8,7 @@ from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user import UserModel
class PrincipalModel(SpiffworkflowBaseDBModel): # type: ignore
class PrincipalModel(SpiffworkflowBaseDBModel):
"""PrincipalModel."""
__tablename__ = "principal"

View File

@ -73,7 +73,7 @@ class ProcessInstanceStatus(enum.Enum):
erroring = "erroring"
class ProcessInstanceModel(SpiffworkflowBaseDBModel): # type: ignore
class ProcessInstanceModel(SpiffworkflowBaseDBModel):
"""ProcessInstanceModel."""
__tablename__ = "process_instance"

View File

@ -8,7 +8,7 @@ from sqlalchemy.orm import relationship
from spiffworkflow_backend.models.user import UserModel
class ProcessInstanceReportModel(SpiffworkflowBaseDBModel): # type: ignore
class ProcessInstanceReportModel(SpiffworkflowBaseDBModel):
"""ProcessInstanceReportModel."""
__tablename__ = "process_instance_report"

View File

@ -9,6 +9,8 @@ import marshmallow
from marshmallow import post_load
from marshmallow import Schema
from spiffworkflow_backend.models.file import File
@dataclass(order=True)
class ProcessModelInfo:
@ -28,7 +30,7 @@ class ProcessModelInfo:
process_group_id: Optional[str] = ""
display_order: Optional[int] = 0
is_review: Optional[bool] = False
files: Optional[list[str]] = field(default_factory=list)
files: Optional[list[File]] = field(default_factory=list)
def __post_init__(self) -> None:
"""__post_init__."""
@ -63,7 +65,7 @@ class ProcessModelInfoSchema(Schema):
is_review = marshmallow.fields.Boolean(allow_none=True)
process_group_id = marshmallow.fields.String(allow_none=True)
libraries = marshmallow.fields.List(marshmallow.fields.String(), allow_none=True)
files = marshmallow.fields.List(marshmallow.fields.Nested("FileSchema"))
# files = marshmallow.fields.List(marshmallow.fields.Nested("FileSchema"))
@post_load
def make_spec(

View File

@ -84,20 +84,20 @@ class Task:
def __init__(
self,
id,
name,
title,
type,
state,
lane,
form,
documentation,
data,
multi_instance_type,
multi_instance_count,
multi_instance_index,
process_name,
properties,
id: str,
name: str,
title: str,
type: str,
state: str,
lane: str,
form: str,
documentation: str,
data: str,
multi_instance_type: str,
multi_instance_count: str,
multi_instance_index: str,
process_name: str,
properties: str,
):
"""__init__."""
self.id = id
@ -122,14 +122,14 @@ class Task:
self.properties = properties # Arbitrary extension properties from BPMN editor.
@classmethod
def valid_property_names(cls):
def valid_property_names(cls) -> list[str]:
"""Valid_property_names."""
return [
value for name, value in vars(cls).items() if name.startswith("FIELD_PROP")
]
@classmethod
def valid_field_types(cls):
def valid_field_types(cls) -> list[str]:
"""Valid_field_types."""
return [
value for name, value in vars(cls).items() if name.startswith("FIELD_TYPE")
@ -197,11 +197,11 @@ class FormFieldSchema(Schema):
)
class FormSchema(Schema):
"""FormSchema."""
key = marshmallow.fields.String(required=True, allow_none=False)
fields = marshmallow.fields.List(marshmallow.fields.Nested(FormFieldSchema))
# class FormSchema(Schema):
# """FormSchema."""
#
# key = marshmallow.fields.String(required=True, allow_none=False)
# fields = marshmallow.fields.List(marshmallow.fields.Nested(FormFieldSchema))
class TaskSchema(Schema):
@ -229,12 +229,13 @@ class TaskSchema(Schema):
multi_instance_type = EnumField(MultiInstanceType)
documentation = marshmallow.fields.String(required=False, allow_none=True)
form = marshmallow.fields.Nested(FormSchema, required=False, allow_none=True)
# form = marshmallow.fields.Nested(FormSchema, required=False, allow_none=True)
title = marshmallow.fields.String(required=False, allow_none=True)
process_name = marshmallow.fields.String(required=False, allow_none=True)
lane = marshmallow.fields.String(required=False, allow_none=True)
@marshmallow.post_load
def make_task(self, data, **kwargs):
"""Make_task."""
return Task(**data)
# TODO: implement
# @marshmallow.post_load
# def make_task(self, data: list[str], **_):
# """Make_task."""
# return Task(**data)

View File

@ -14,7 +14,7 @@ from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user_group_assignment import UserGroupAssignmentModel
class UserModel(SpiffworkflowBaseDBModel): # type: ignore
class UserModel(SpiffworkflowBaseDBModel):
"""UserModel."""
__tablename__ = "user"

View File

@ -5,7 +5,7 @@ from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
class UserGroupAssignmentModel(SpiffworkflowBaseDBModel): # type: ignore
class UserGroupAssignmentModel(SpiffworkflowBaseDBModel):
"""UserGroupAssignmentModel."""
__tablename__ = "user_group_assignment"
@ -15,5 +15,5 @@ class UserGroupAssignmentModel(SpiffworkflowBaseDBModel): # type: ignore
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(ForeignKey("user.id"), nullable=False)
group_id = db.Column(ForeignKey("group.id"), nullable=False)
group = relationship("GroupModel", overlaps="groups,user_group_assignments,users")
user = relationship("UserModel", overlaps="groups,user_group_assignments,users")
group = relationship("GroupModel", overlaps="groups,user_group_assignments,users") # type: ignore
user = relationship("UserModel", overlaps="groups,user_group_assignments,users") # type: ignore

View File

@ -15,11 +15,11 @@ from SpiffWorkflow import Task as SpiffTask # type: ignore
from SpiffWorkflow import TaskState
from SpiffWorkflow import WorkflowException
from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore
from SpiffWorkflow.bpmn.PythonScriptEngine import Box
from SpiffWorkflow.bpmn.PythonScriptEngine import Box # type: ignore
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine
from SpiffWorkflow.bpmn.serializer import BpmnWorkflowSerializer # type: ignore
from SpiffWorkflow.bpmn.serializer.BpmnSerializer import BpmnSerializer # type: ignore
from SpiffWorkflow.bpmn.specs.BpmnProcessSpec import BpmnProcessSpec
from SpiffWorkflow.bpmn.specs.BpmnProcessSpec import BpmnProcessSpec # type: ignore
from SpiffWorkflow.bpmn.specs.events import CancelEventDefinition # type: ignore
from SpiffWorkflow.bpmn.specs.events import EndEvent
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow # type: ignore
@ -30,7 +30,7 @@ from SpiffWorkflow.dmn.serializer import BusinessRuleTaskConverter # type: igno
from SpiffWorkflow.exceptions import WorkflowTaskExecException # type: ignore
from SpiffWorkflow.serializer.exceptions import MissingSpecError # type: ignore
from SpiffWorkflow.specs import WorkflowSpec # type: ignore
from SpiffWorkflow.task import Task
from SpiffWorkflow.task import Task # type: ignore
from spiffworkflow_backend.models.file import File
from spiffworkflow_backend.models.file import FileType

View File

@ -10,7 +10,7 @@ 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
from SpiffWorkflow.task import Task
from SpiffWorkflow.task import Task # type: ignore
from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore
from spiffworkflow_backend.models.process_instance import ProcessInstanceApi

View File

@ -8,7 +8,7 @@ from typing import Union
from flask_bpmn.api.api_error import ApiError
from lxml import etree # type: ignore
from lxml.etree import _Element
from lxml.etree import _Element # type: ignore
from lxml.etree import Element as EtreeElement
from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore