Skip to content

Commit e2585c2

Browse files
committed
Remove Generic to fix UP046 warning
1 parent e18d559 commit e2585c2

3 files changed

Lines changed: 5 additions & 13 deletions

File tree

src/isar/models/events.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from collections import deque
22
from queue import Empty, Full, Queue, ShutDown
33
from threading import Lock
4-
from typing import Generic, TypeVar
54

65
from isar.apis.models.models import (
76
ControlMissionResponse,
@@ -17,11 +16,6 @@
1716
from robot_interface.models.mission.task import InspectionTask
1817
from robot_interface.telemetry.mqtt_client import MQTTQueueType
1918

20-
T = TypeVar("T")
21-
T1 = TypeVar("T1")
22-
T2 = TypeVar("T2")
23-
24-
2519
InspectionQueueTuple = tuple[Inspection, Mission]
2620

2721

@@ -33,7 +27,7 @@ def __str__(self) -> str:
3327
AbortedMission = Mission
3428

3529

36-
class Event(Queue[T]):
30+
class Event[T](Queue[T]):
3731
def __init__(self, name: str) -> None:
3832
super().__init__(maxsize=1)
3933
self.name = name
@@ -105,7 +99,7 @@ def __init__(self) -> None:
10599
self.state: Event[States] = Event("state")
106100

107101

108-
class APIEvent(Generic[T1, T2]):
102+
class APIEvent[T1, T2]:
109103
"""
110104
Creates request and response event. The events are defined such that the request is from
111105
api to state machine while the response is from state machine to api.

src/isar/state_machine/state.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@
44
from collections.abc import Callable
55
from copy import deepcopy
66
from dataclasses import dataclass
7-
from typing import Any, Generic, TypeVar
7+
from typing import Any, TypeVar
88

99
from isar.config.settings import settings
1010
from isar.models.events import EmptyMessage, Event, Events
1111
from isar.state_machine.states_enum import States
1212

13-
T = TypeVar("T")
14-
1513
T_state_co = TypeVar("T_state_co", bound="State", covariant=True)
1614
Transition = Callable[[Events], T_state_co]
1715

1816

1917
@dataclass
20-
class EventHandlerMapping(Generic[T]):
18+
class EventHandlerMapping[T]:
2119
name: str
2220
event: Event[T]
2321
handler: Callable[[T], Transition | None]

src/isar/storage/storage_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LocalStoragePath(BaseModel):
2121
TPath = TypeVar("TPath", BlobStoragePath, LocalStoragePath)
2222

2323

24-
class StoragePaths(BaseModel, Generic[TPath]):
24+
class StoragePaths(BaseModel, Generic[TPath]): # noqa: UP046
2525
data_path: TPath
2626
metadata_path: TPath
2727

0 commit comments

Comments
 (0)