Skip to content

Commit 774d329

Browse files
Don't use python 3.12 features
1 parent bd3d2c6 commit 774d329

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fishjam/agent/agent.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import functools
77
from contextlib import suppress
88
from types import TracebackType
9-
from typing import Any, Callable
9+
from typing import Any, Callable, TypeAlias, TypeVar
1010

1111
import betterproto
1212
from websockets import ClientConnection, CloseCode, ConnectionClosed
@@ -20,7 +20,9 @@
2020
AgentResponseTrackData,
2121
)
2222

23-
type TrackDataHandler = Callable[[AgentResponseTrackData], None]
23+
TrackDataHandler: TypeAlias = Callable[[AgentResponseTrackData], None]
24+
25+
TrackDataHandlerT = TypeVar("TrackDataHandlerT", bound=TrackDataHandler)
2426

2527

2628
def _close_ok(e: ConnectionClosed):
@@ -53,7 +55,7 @@ def _(_content: AgentResponseTrackData):
5355

5456
self._dispatch_handler = _message_handler
5557

56-
def on_track_data[Handler: TrackDataHandler](self, handler: Handler) -> Handler:
58+
def on_track_data(self, handler: TrackDataHandlerT) -> TrackDataHandlerT:
5759
"""
5860
Decorator used for defining a handler for track data messages from Fishjam.
5961
"""

0 commit comments

Comments
 (0)