Fix some type annotations
This commit is contained in:
parent
570c09bca2
commit
2e20dbb0fe
@ -1,8 +1,10 @@
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
from documents.classifier import DocumentClassifier
|
from documents.classifier import DocumentClassifier
|
||||||
|
from documents.data_models import ConsumableDocument
|
||||||
from documents.data_models import DocumentSource
|
from documents.data_models import DocumentSource
|
||||||
from documents.models import Correspondent
|
from documents.models import Correspondent
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
@ -238,7 +240,7 @@ def _split_match(matching_model):
|
|||||||
|
|
||||||
|
|
||||||
def document_matches_workflow(
|
def document_matches_workflow(
|
||||||
document, # ConsumableDocument | Document
|
document: Union[ConsumableDocument, Document],
|
||||||
workflow: Workflow,
|
workflow: Workflow,
|
||||||
trigger_type: WorkflowTrigger.WorkflowTriggerType,
|
trigger_type: WorkflowTrigger.WorkflowTriggerType,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -3,7 +3,6 @@ import math
|
|||||||
import re
|
import re
|
||||||
import zoneinfo
|
import zoneinfo
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import magic
|
import magic
|
||||||
from celery import states
|
from celery import states
|
||||||
@ -1451,7 +1450,7 @@ class WorkflowSerializer(serializers.ModelSerializer):
|
|||||||
if action.workflows.all().count() == 0:
|
if action.workflows.all().count() == 0:
|
||||||
action.delete()
|
action.delete()
|
||||||
|
|
||||||
def create(self, validated_data: Any) -> Workflow:
|
def create(self, validated_data) -> Workflow:
|
||||||
if "triggers" in validated_data:
|
if "triggers" in validated_data:
|
||||||
triggers = validated_data.pop("triggers")
|
triggers = validated_data.pop("triggers")
|
||||||
|
|
||||||
@ -1464,7 +1463,7 @@ class WorkflowSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def update(self, instance: Any, validated_data: Any) -> Workflow:
|
def update(self, instance: Workflow, validated_data) -> Workflow:
|
||||||
if "triggers" in validated_data:
|
if "triggers" in validated_data:
|
||||||
triggers = validated_data.pop("triggers")
|
triggers = validated_data.pop("triggers")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user