Skip to content

Commit dedc0dd

Browse files
committed
Fix typing in client connection initialization.
1 parent 9c87d43 commit dedc0dd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/websockets/legacy/client.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Any,
1212
AsyncIterator,
1313
Callable,
14+
Coroutine,
1415
Generator,
1516
List,
1617
Optional,
@@ -543,7 +544,16 @@ def __init__(
543544
self.logger = logger
544545

545546
# This is a coroutine function.
546-
self._create_connection = create_connection
547+
self._create_connection = cast(
548+
functools.partial[
549+
Coroutine[
550+
Any,
551+
Any,
552+
Tuple[asyncio.BaseTransport, WebSocketClientProtocol],
553+
]
554+
],
555+
create_connection,
556+
)
547557
self._uri = uri
548558
self._wsuri = wsuri
549559

@@ -652,7 +662,6 @@ async def __await_impl_timeout__(self) -> WebSocketClientProtocol:
652662
async def __await_impl__(self) -> WebSocketClientProtocol:
653663
for redirects in range(self.MAX_REDIRECTS_ALLOWED):
654664
transport, protocol = await self._create_connection()
655-
protocol = cast(WebSocketClientProtocol, protocol)
656665

657666
try:
658667
await protocol.handshake(

0 commit comments

Comments
 (0)