Skip to content

Commit 65c93e8

Browse files
author
Jens Kürten
committed
fix pre-commit
1 parent e2681e2 commit 65c93e8

File tree

12 files changed

+71
-79
lines changed

12 files changed

+71
-79
lines changed

csfunctions/actions/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Annotated, Union
1+
from typing import Annotated
22

33
from pydantic import Field
44

@@ -7,7 +7,7 @@
77
from .dummy import DummyAction
88
from .start_workflow import StartWorkflowAction
99

10-
ActionUnion = Union[AbortAndShowErrorAction, DummyAction, StartWorkflowAction]
10+
ActionUnion = AbortAndShowErrorAction | DummyAction | StartWorkflowAction
1111
Action = Annotated[ActionUnion, Field(discriminator="name")]
1212

1313
__all__ = [

csfunctions/actions/start_workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Literal, Optional
1+
from typing import Literal
22

33
from pydantic import BaseModel, Field
44

@@ -14,7 +14,7 @@ class Subject(BaseModel):
1414

1515
class TaskConfiguration(BaseModel):
1616
task_id: str = Field(..., description="Identifier for the task")
17-
responsible: Optional[Subject] = Field(default=None, description="Responsible subject for the task")
17+
responsible: Subject | None = Field(default=None, description="Responsible subject for the task")
1818
recipients: list[Subject] = Field(
1919
default_factory=list,
2020
description="List of recipients for the task (only used by information tasks)",

csfunctions/events/__init__.py

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Annotated, Union
1+
from typing import Annotated
22

33
from pydantic import Field
44

@@ -25,46 +25,44 @@
2525
from .workflow_task_trigger import WorkflowTaskTriggerEvent, WorkflowTaskTriggerEventData
2626

2727
Event = Annotated[
28-
Union[
29-
DocumentReleasedEvent,
30-
DocumentReleaseCheckEvent,
31-
DocumentFieldCalculationEvent,
32-
PartReleasedEvent,
33-
PartReleaseCheckEvent,
34-
PartFieldCalculationEvent,
35-
FieldValueCalculationEvent,
36-
DummyEvent,
37-
EngineeringChangeReleasedEvent,
38-
EngineeringChangeReleaseCheckEvent,
39-
EngineeringChangeStatusChangedEvent,
40-
EngineeringChangeStatusChangeCheckEvent,
41-
WorkflowTaskTriggerEvent,
42-
DocumentCreateCheckEvent,
43-
DocumentModifyCheckEvent,
44-
PartCreateCheckEvent,
45-
PartModifyCheckEvent,
46-
],
28+
DocumentReleasedEvent
29+
| DocumentReleaseCheckEvent
30+
| DocumentFieldCalculationEvent
31+
| PartReleasedEvent
32+
| PartReleaseCheckEvent
33+
| PartFieldCalculationEvent
34+
| FieldValueCalculationEvent
35+
| DummyEvent
36+
| EngineeringChangeReleasedEvent
37+
| EngineeringChangeReleaseCheckEvent
38+
| EngineeringChangeStatusChangedEvent
39+
| EngineeringChangeStatusChangeCheckEvent
40+
| WorkflowTaskTriggerEvent
41+
| DocumentCreateCheckEvent
42+
| DocumentModifyCheckEvent
43+
| PartCreateCheckEvent
44+
| PartModifyCheckEvent,
4745
Field(discriminator="name"),
4846
]
49-
EventData = Union[
50-
DocumentReleasedData,
51-
DocumentReleaseCheckData,
52-
DocumentFieldCalculationData,
53-
PartReleasedData,
54-
PartReleaseCheckData,
55-
PartFieldCalculationData,
56-
FieldValueCalculationData,
57-
DummyEventData,
58-
EngineeringChangeReleasedData,
59-
EngineeringChangeReleaseCheckData,
60-
EngineeringChangeStatusChangedData,
61-
EngineeringChangeStatusChangeCheckData,
62-
WorkflowTaskTriggerEventData,
63-
DocumentCreateCheckData,
64-
DocumentModifyCheckData,
65-
PartCreateCheckData,
66-
PartModifyCheckData,
67-
]
47+
EventData = (
48+
DocumentReleasedData
49+
| DocumentReleaseCheckData
50+
| DocumentFieldCalculationData
51+
| PartReleasedData
52+
| PartReleaseCheckData
53+
| PartFieldCalculationData
54+
| FieldValueCalculationData
55+
| DummyEventData
56+
| EngineeringChangeReleasedData
57+
| EngineeringChangeReleaseCheckData
58+
| EngineeringChangeStatusChangedData
59+
| EngineeringChangeStatusChangeCheckData
60+
| WorkflowTaskTriggerEventData
61+
| DocumentCreateCheckData
62+
| DocumentModifyCheckData
63+
| PartCreateCheckData
64+
| PartModifyCheckData
65+
)
6866

6967
__all__ = [
7068
"DocumentReleasedEvent",

csfunctions/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import os
44
import sys
55
import traceback
6+
from collections.abc import Callable
67
from functools import lru_cache
78
from importlib import import_module
8-
from typing import Callable
99

1010
import yaml
1111

csfunctions/metadata.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from datetime import datetime
2-
from typing import Optional
32

43
from pydantic import AnyHttpUrl, BaseModel, Field
54

@@ -13,6 +12,6 @@ class MetaData(BaseModel):
1312
request_datetime: datetime = Field(..., description="Time when the request was started.")
1413
transaction_id: str = Field(..., description="Unique identifier of the transaction.")
1514
instance_url: AnyHttpUrl = Field(..., description="URL to the instance where the webhook was triggered.")
16-
db_service_url: Optional[AnyHttpUrl] = Field(
15+
db_service_url: AnyHttpUrl | None = Field(
1716
None, description="URL to the DB Access Service responsible for the instance."
1817
)

csfunctions/objects/__init__.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Annotated, Union
1+
from typing import Annotated
22

33
from pydantic import Field
44

@@ -13,19 +13,17 @@
1313
from .workflow import Workflow
1414

1515
Object = Annotated[
16-
Union[
17-
Document,
18-
CADDocument,
19-
Part,
20-
File,
21-
EngineeringChange,
22-
Material,
23-
BOMItem,
24-
ObjectPropertyValue,
25-
Briefcase,
26-
Workflow,
27-
Person,
28-
],
16+
Document
17+
| CADDocument
18+
| Part
19+
| File
20+
| EngineeringChange
21+
| Material
22+
| BOMItem
23+
| ObjectPropertyValue
24+
| Briefcase
25+
| Workflow
26+
| Person,
2927
Field(discriminator="object_type"),
3028
]
3129

csfunctions/objects/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from collections.abc import Hashable
12
from enum import Enum
2-
from typing import TYPE_CHECKING, Hashable
3+
from typing import TYPE_CHECKING
34

45
from pydantic import BaseModel, ConfigDict
56

csfunctions/objects/part.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import date, datetime
2-
from typing import TYPE_CHECKING, Literal, Optional
2+
from typing import TYPE_CHECKING, Literal
33

44
from pydantic import Field
55

@@ -35,7 +35,7 @@ class Part(BaseObject):
3535
ce_valid_to: date | datetime | None = Field(None, description="Effective to")
3636
mengeneinheit_name_de: str | None = Field(None, description="Quantity Unit")
3737
mengeneinheit_name_en: str | None = Field(None, description="Quantity Unit")
38-
st_gewicht: Optional[float] = Field(None, description="Weight (kg)")
38+
st_gewicht: float | None = Field(None, description="Weight (kg)")
3939
material_object_id: str | None = Field(None, description="Material ID")
4040
surface_name_en: str | None = Field(None, description="Surface")
4141
surface_name_de: str | None = Field(None, description="Surface")

csfunctions/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from enum import Enum
2-
from typing import Annotated, Literal, Union
2+
from typing import Annotated, Literal
33
from uuid import uuid4
44

55
from pydantic import BaseModel, Field
@@ -74,5 +74,5 @@ def __init__(
7474
trace: str = Field(..., description="trace to the error")
7575

7676

77-
ResponseUnion = Union[WorkloadResponse, DataResponse, ErrorResponse]
77+
ResponseUnion = WorkloadResponse | DataResponse | ErrorResponse
7878
Response = Annotated[ResponseUnion, Field(discriminator="response_type")]

csfunctions/service/base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Optional
2-
31
import requests
42

53
from csfunctions.metadata import MetaData
@@ -39,7 +37,7 @@ def __init__(self, metadata: MetaData):
3937
self.metadata = metadata
4038

4139
def request(
42-
self, endpoint: str, method: str = "GET", params: Optional[dict] = None, json: Optional[dict] = None
40+
self, endpoint: str, method: str = "GET", params: dict | None = None, json: dict | None = None
4341
) -> dict | list:
4442
"""
4543
Make a request to the access service.

0 commit comments

Comments
 (0)