Skip to content

Commit 9da3bc6

Browse files
committed
Change required return type in callbacks from None to Any
1 parent 8ef1f88 commit 9da3bc6

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

stompman/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import asyncio
22
import inspect
3-
from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine
3+
from collections.abc import AsyncGenerator, Awaitable, Callable
44
from contextlib import AsyncExitStack, asynccontextmanager
55
from dataclasses import dataclass, field
66
from functools import partial
77
from ssl import SSLContext
88
from types import TracebackType
9-
from typing import ClassVar, Literal, Self
9+
from typing import Any, ClassVar, Literal, Self
1010

1111
from stompman.config import ConnectionParameters, Heartbeat
1212
from stompman.connection import AbstractConnection, Connection
@@ -30,8 +30,8 @@ class Client:
3030
PROTOCOL_VERSION: ClassVar = "1.2" # https://stomp.github.io/stomp-specification-1.2.html
3131

3232
servers: list[ConnectionParameters] = field(kw_only=False)
33-
on_error_frame: Callable[[ErrorFrame], None] | None = None
34-
on_heartbeat: Callable[[], None] | Callable[[], Awaitable[None]] | None = None
33+
on_error_frame: Callable[[ErrorFrame], Any] | None = None
34+
on_heartbeat: Callable[[], Any] | Callable[[], Awaitable[Any]] | None = None
3535

3636
heartbeat: Heartbeat = field(default=Heartbeat(1000, 1000))
3737
ssl: Literal[True] | SSLContext | None = None
@@ -146,11 +146,11 @@ async def begin(self) -> AsyncGenerator[Transaction, None]:
146146
async def subscribe(
147147
self,
148148
destination: str,
149-
handler: Callable[[MessageFrame], Coroutine[None, None, None]],
149+
handler: Callable[[MessageFrame], Awaitable[Any]],
150150
*,
151151
ack: AckMode = "client-individual",
152152
headers: dict[str, str] | None = None,
153-
on_suppressed_exception: Callable[[Exception, MessageFrame], None],
153+
on_suppressed_exception: Callable[[Exception, MessageFrame], Any],
154154
suppressed_exception_classes: tuple[type[Exception], ...] = (Exception,),
155155
) -> "Subscription":
156156
subscription = Subscription(

stompman/connection_lifespan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from collections.abc import Callable
33
from contextlib import suppress
44
from dataclasses import dataclass
5-
from typing import Protocol
5+
from typing import Any, Protocol
66
from uuid import uuid4
77

88
from stompman.config import ConnectionParameters, Heartbeat
@@ -37,7 +37,7 @@ class ConnectionLifespan(AbstractConnectionLifespan):
3737
disconnect_confirmation_timeout: int
3838
active_subscriptions: ActiveSubscriptions
3939
active_transactions: ActiveTransactions
40-
set_heartbeat_interval: Callable[[float], None]
40+
set_heartbeat_interval: Callable[[float], Any]
4141

4242
async def _establish_connection(self) -> StompProtocolConnectionIssue | None:
4343
await self.connection.write_frame(

stompman/subscription.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from collections.abc import Callable, Coroutine
1+
from collections.abc import Awaitable, Callable
22
from dataclasses import dataclass, field
3+
from typing import Any
34
from uuid import uuid4
45

56
from stompman.connection import AbstractConnection
@@ -21,9 +22,9 @@ class Subscription:
2122
id: str = field(default_factory=lambda: _make_subscription_id(), init=False) # noqa: PLW0108
2223
destination: str
2324
headers: dict[str, str] | None
24-
handler: Callable[[MessageFrame], Coroutine[None, None, None]]
25+
handler: Callable[[MessageFrame], Awaitable[Any]]
2526
ack: AckMode
26-
on_suppressed_exception: Callable[[Exception, MessageFrame], None]
27+
on_suppressed_exception: Callable[[Exception, MessageFrame], Any]
2728
suppressed_exception_classes: tuple[type[Exception], ...]
2829
_connection_manager: ConnectionManager
2930
_active_subscriptions: ActiveSubscriptions

0 commit comments

Comments
 (0)