diff --git a/stompman/client.py b/stompman/client.py index f9c77f51..f9f2f904 100644 --- a/stompman/client.py +++ b/stompman/client.py @@ -1,8 +1,9 @@ import asyncio -from collections.abc import AsyncGenerator, Callable, Coroutine +from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine from contextlib import AsyncExitStack, asynccontextmanager from dataclasses import dataclass, field from functools import partial +import inspect from ssl import SSLContext from types import TracebackType from typing import ClassVar, Literal, Self @@ -144,7 +145,7 @@ async def subscribe( ack: AckMode = "client-individual", headers: dict[str, str] | None = None, on_suppressed_exception: Callable[[Exception, MessageFrame], None], - supressed_exception_classes: tuple[type[Exception], ...] = (Exception,), + suppressed_exception_classes: tuple[type[Exception], ...] = (Exception,), ) -> "Subscription": subscription = Subscription( destination=destination, @@ -152,7 +153,7 @@ async def subscribe( headers=headers, ack=ack, on_suppressed_exception=on_suppressed_exception, - supressed_exception_classes=supressed_exception_classes, + suppressed_exception_classes=suppressed_exception_classes, _connection_manager=self._connection_manager, _active_subscriptions=self._active_subscriptions, ) diff --git a/stompman/connection.py b/stompman/connection.py index 46f77933..cef86289 100644 --- a/stompman/connection.py +++ b/stompman/connection.py @@ -88,7 +88,7 @@ async def write_frame(self, frame: AnyClientFrame) -> None: async def _read_non_empty_bytes(self, max_chunk_size: int) -> bytes: while ( # noqa: ASYNC110 chunk := await self.reader.read(max_chunk_size) - ) == b"": # pragma: no cover (it defenitely happens) + ) == b"": # pragma: no cover (it definitely happens) await asyncio.sleep(0) return chunk diff --git a/stompman/subscription.py b/stompman/subscription.py index 5a41639f..c6b3efbc 100644 --- a/stompman/subscription.py +++ b/stompman/subscription.py @@ -24,7 +24,7 @@ class Subscription: handler: Callable[[MessageFrame], Coroutine[None, None, None]] ack: AckMode on_suppressed_exception: Callable[[Exception, MessageFrame], None] - supressed_exception_classes: tuple[type[Exception], ...] + suppressed_exception_classes: tuple[type[Exception], ...] _connection_manager: ConnectionManager _active_subscriptions: ActiveSubscriptions @@ -48,7 +48,7 @@ async def unsubscribe(self) -> None: async def _run_handler(self, *, frame: MessageFrame) -> None: try: await self.handler(frame) - except self.supressed_exception_classes as exception: + except self.suppressed_exception_classes as exception: if self._should_handle_ack_nack and self.id in self._active_subscriptions: await self._connection_manager.maybe_write_frame( NackFrame( diff --git a/stompman/transaction.py b/stompman/transaction.py index dd7417ef..3a8bd748 100644 --- a/stompman/transaction.py +++ b/stompman/transaction.py @@ -29,8 +29,8 @@ async def __aexit__( await self._connection_manager.maybe_write_frame(AbortFrame(headers={"transaction": self.id})) self._active_transactions.remove(self) else: - commited = await self._connection_manager.maybe_write_frame(CommitFrame(headers={"transaction": self.id})) - if commited: + committed = await self._connection_manager.maybe_write_frame(CommitFrame(headers={"transaction": self.id})) + if committed: self._active_transactions.remove(self) async def send( diff --git a/tests/test_subscription.py b/tests/test_subscription.py index d8fb74ef..0867557a 100644 --- a/tests/test_subscription.py +++ b/tests/test_subscription.py @@ -38,7 +38,7 @@ @pytest.mark.parametrize("ack", get_args(AckMode)) -async def test_client_subscribtions_lifespan_resubscribe(ack: AckMode, faker: faker.Faker) -> None: +async def test_client_subscriptions_lifespan_resubscribe(ack: AckMode, faker: faker.Faker) -> None: connection_class, collected_frames = create_spying_connection(*get_read_frames_with_lifespan([CONNECTED_FRAME], [])) client = EnrichedClient(connection_class=connection_class) sub_destination, message_destination, message_body = faker.pystr(), faker.pystr(), faker.binary(length=10) @@ -78,7 +78,7 @@ async def test_client_subscribtions_lifespan_resubscribe(ack: AckMode, faker: fa ) -async def test_client_subscribtions_lifespan_no_active_subs_in_aexit( +async def test_client_subscriptions_lifespan_no_active_subs_in_aexit( monkeypatch: pytest.MonkeyPatch, faker: faker.Faker ) -> None: monkeypatch.setattr( @@ -109,7 +109,7 @@ async def test_client_subscribtions_lifespan_no_active_subs_in_aexit( @pytest.mark.parametrize("direct_error", [True, False]) -async def test_client_subscribtions_lifespan_with_active_subs_in_aexit( +async def test_client_subscriptions_lifespan_with_active_subs_in_aexit( monkeypatch: pytest.MonkeyPatch, faker: faker.Faker, *,