Skip to content

Commit 5320813

Browse files
committed
fix formatting
1 parent 18e80d6 commit 5320813

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

rabbitmq_amqp_python_client/asyncio/connection.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import logging
35
from typing import Callable, Optional, Union
@@ -52,14 +54,14 @@ def __init__(
5254
self._async_publishers: list[AsyncPublisher] = []
5355
self._async_consumers: list[AsyncConsumer] = []
5456
self._async_managements: list[AsyncManagement] = []
55-
self._remove_callback = None
57+
self._remove_callback: Optional[Callable[[AsyncConnection], None]] = None
5658

5759
async def dial(self) -> None:
5860
async with self._connection_lock:
5961
await self._event_loop.run_in_executor(None, self._connection.dial)
6062

6163
def _set_remove_callback(
62-
self, callback: Optional[Callable[["AsyncConnection"], None]]
64+
self, callback: Optional[Callable[[AsyncConnection], None]]
6365
) -> None:
6466
self._remove_callback = callback
6567

@@ -181,7 +183,7 @@ async def consumer(
181183
async_consumer = AsyncConsumer(
182184
self._connection._conn,
183185
destination,
184-
message_handler, # type: ignore
186+
message_handler, # pyright: ignore[reportArgumentType]
185187
consumer_options,
186188
credit,
187189
loop=self._event_loop,
@@ -202,7 +204,7 @@ async def refresh_token(self, token: str) -> None:
202204
token,
203205
)
204206

205-
async def __aenter__(self) -> "AsyncConnection":
207+
async def __aenter__(self) -> AsyncConnection:
206208
await self.dial()
207209
return self
208210

rabbitmq_amqp_python_client/asyncio/consumer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import logging
35
from types import TracebackType
@@ -31,7 +33,7 @@ def __init__(
3133
self._connection_lock = connection_lock or asyncio.Lock()
3234

3335
def _set_remove_callback(
34-
self, callback: Optional[Callable[["AsyncConsumer"], None]]
36+
self, callback: Optional[Callable[[AsyncConsumer], None]]
3537
) -> None:
3638
self._remove_callback = callback
3739

@@ -62,7 +64,7 @@ async def stop(self) -> None:
6264
async with self._connection_lock:
6365
await self._event_loop.run_in_executor(None, self._consumer.stop)
6466

65-
async def __aenter__(self) -> "AsyncConsumer":
67+
async def __aenter__(self) -> AsyncConsumer:
6668
return self
6769

6870
async def __aexit__(

rabbitmq_amqp_python_client/asyncio/enviroment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import logging
35
from typing import Optional, Union
@@ -86,7 +88,7 @@ async def close(self) -> None:
8688
async def connections(self) -> list[AsyncConnection]:
8789
return self._connections
8890

89-
async def __aenter__(self) -> "AsyncEnvironment":
91+
async def __aenter__(self) -> AsyncEnvironment:
9092
return self
9193

9294
async def __aexit__(

rabbitmq_amqp_python_client/asyncio/management.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import logging
35
from typing import Any, Callable, Optional, Union
@@ -36,7 +38,7 @@ def __init__(
3638
self._connection_lock = connection_lock or asyncio.Lock()
3739

3840
def _set_remove_callback(
39-
self, callback: Optional[Callable[["AsyncManagement"], None]]
41+
self, callback: Optional[Callable[[AsyncManagement], None]]
4042
) -> None:
4143
self._remove_callback = callback
4244

@@ -168,7 +170,7 @@ async def refresh_token(self, token: str) -> None:
168170
token,
169171
)
170172

171-
async def __aenter__(self) -> "AsyncManagement":
173+
async def __aenter__(self) -> AsyncManagement:
172174
await self.open()
173175
return self
174176

rabbitmq_amqp_python_client/asyncio/publisher.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(
2525
self._publisher = Publisher(conn, addr)
2626
self._loop = loop
2727
self._connection_lock = connection_lock or asyncio.Lock()
28-
self._remove_callback = None
28+
self._remove_callback: Optional[Callable[["AsyncPublisher"], None]] = None
2929

3030
def _set_remove_callback(
3131
self, callback: Optional[Callable[["AsyncPublisher"], None]]
@@ -41,7 +41,7 @@ async def publish(self, message: Message) -> Delivery:
4141
async def close(self) -> None:
4242
if not self.is_open:
4343
return
44-
44+
4545
try:
4646
async with self._connection_lock:
4747
await self._event_loop.run_in_executor(None, self._publisher.close)
@@ -69,7 +69,6 @@ def _event_loop(self) -> asyncio.AbstractEventLoop:
6969

7070
@property
7171
def is_open(self) -> bool:
72-
print( self._publisher.is_open )
7372
return self._publisher.is_open
7473

7574
@property

0 commit comments

Comments
 (0)