Skip to content

Commit f566e7e

Browse files
mgradalskaKarolJagodzinski
authored andcommitted
fix: update websockets
1 parent 3a725f5 commit f566e7e

File tree

21 files changed

+140
-138
lines changed

21 files changed

+140
-138
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,5 @@ dmypy.json
130130

131131
# System files
132132
.DS_Store
133+
134+
.idea

ariadne_codegen/client_generators/dependencies/async_base_client.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
)
22-
from websockets.client import (
22+
from websockets import (
2323
connect as ws_connect,
2424
)
2525
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs):
3535
raise NotImplementedError("Subscriptions require 'websockets' package.")
3636
yield
3737

38-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
38+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3939
Data = Any # type: ignore[misc,assignment,unused-ignore]
4040
Origin = Any # type: ignore[misc,assignment,unused-ignore]
4141

@@ -304,7 +304,7 @@ async def _execute_json(
304304
**merged_kwargs,
305305
)
306306

307-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
307+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
308308
payload: Dict[str, Any] = {
309309
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
310310
}
@@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
314314

315315
async def _send_subscribe(
316316
self,
317-
websocket: WebSocketClientProtocol,
317+
websocket: ClientConnection,
318318
operation_id: str,
319319
query: str,
320320
operation_name: Optional[str] = None,
@@ -334,7 +334,7 @@ async def _send_subscribe(
334334
async def _handle_ws_message(
335335
self,
336336
message: Data,
337-
websocket: WebSocketClientProtocol,
337+
websocket: ClientConnection,
338338
expected_type: Optional[GraphQLTransportWSMessageType] = None,
339339
) -> Optional[Dict[str, Any]]:
340340
try:

ariadne_codegen/client_generators/dependencies/async_base_client_open_telemetry.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
)
2828

2929
try:
30-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
31-
WebSocketClientProtocol,
30+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
31+
ClientConnection,
3232
)
33-
from websockets.client import (
33+
from websockets import (
3434
connect as ws_connect,
3535
)
3636
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -46,7 +46,7 @@ async def ws_connect(*args, **kwargs):
4646
raise NotImplementedError("Subscriptions require 'websockets' package.")
4747
yield
4848

49-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
49+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
5050
Data = Any # type: ignore[misc,assignment,unused-ignore]
5151
Origin = Any # type: ignore[misc,assignment,unused-ignore]
5252

@@ -394,7 +394,7 @@ async def _execute_ws(
394394
if data:
395395
yield data
396396

397-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
397+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
398398
payload: Dict[str, Any] = {
399399
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
400400
}
@@ -404,7 +404,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
404404

405405
async def _send_subscribe(
406406
self,
407-
websocket: WebSocketClientProtocol,
407+
websocket: ClientConnection,
408408
operation_id: str,
409409
query: str,
410410
operation_name: Optional[str] = None,
@@ -424,7 +424,7 @@ async def _send_subscribe(
424424
async def _handle_ws_message(
425425
self,
426426
message: Data,
427-
websocket: WebSocketClientProtocol,
427+
websocket: ClientConnection,
428428
expected_type: Optional[GraphQLTransportWSMessageType] = None,
429429
) -> Optional[Dict[str, Any]]:
430430
try:
@@ -603,7 +603,7 @@ async def _execute_ws_with_telemetry(
603603
yield data
604604

605605
async def _send_connection_init_with_telemetry(
606-
self, root_span: Span, websocket: WebSocketClientProtocol
606+
self, root_span: Span, websocket: ClientConnection
607607
) -> None:
608608
with self.tracer.start_as_current_span( # type: ignore
609609
"connection init", context=set_span_in_context(root_span)
@@ -622,7 +622,7 @@ async def _send_connection_init_with_telemetry(
622622
async def _send_subscribe_with_telemetry(
623623
self,
624624
root_span: Span,
625-
websocket: WebSocketClientProtocol,
625+
websocket: ClientConnection,
626626
operation_id: str,
627627
query: str,
628628
operation_name: Optional[str] = None,
@@ -654,7 +654,7 @@ async def _handle_ws_message_with_telemetry(
654654
self,
655655
root_span: Span,
656656
message: Data,
657-
websocket: WebSocketClientProtocol,
657+
websocket: ClientConnection,
658658
expected_type: Optional[GraphQLTransportWSMessageType] = None,
659659
) -> Optional[Dict[str, Any]]:
660660
with self.tracer.start_as_current_span( # type: ignore

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ test = [
4646
"pytest-mock",
4747
"requests-toolbelt",
4848
"types-toml",
49-
"websockets~=11.0",
49+
"websockets>=14.2",
5050
"opentelemetry-api",
5151
]
5252
types = ["mypy>=1.0.0"]
53-
subscriptions = ["websockets~=11.0"]
53+
subscriptions = ["websockets>=14.2"]
5454
opentelemetry = ["opentelemetry-api"]
5555

5656
[project.scripts]

tests/main/clients/client_forward_refs/expected_client/async_base_client.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
)
22-
from websockets.client import (
22+
from websockets import (
2323
connect as ws_connect,
2424
)
2525
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs):
3535
raise NotImplementedError("Subscriptions require 'websockets' package.")
3636
yield
3737

38-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
38+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3939
Data = Any # type: ignore[misc,assignment,unused-ignore]
4040
Origin = Any # type: ignore[misc,assignment,unused-ignore]
4141

@@ -304,7 +304,7 @@ async def _execute_json(
304304
**merged_kwargs,
305305
)
306306

307-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
307+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
308308
payload: Dict[str, Any] = {
309309
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
310310
}
@@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
314314

315315
async def _send_subscribe(
316316
self,
317-
websocket: WebSocketClientProtocol,
317+
websocket: ClientConnection,
318318
operation_id: str,
319319
query: str,
320320
operation_name: Optional[str] = None,
@@ -334,7 +334,7 @@ async def _send_subscribe(
334334
async def _handle_ws_message(
335335
self,
336336
message: Data,
337-
websocket: WebSocketClientProtocol,
337+
websocket: ClientConnection,
338338
expected_type: Optional[GraphQLTransportWSMessageType] = None,
339339
) -> Optional[Dict[str, Any]]:
340340
try:

tests/main/clients/client_forward_refs_shorter_results/expected_client/async_base_client.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
)
22-
from websockets.client import (
22+
from websockets import (
2323
connect as ws_connect,
2424
)
2525
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs):
3535
raise NotImplementedError("Subscriptions require 'websockets' package.")
3636
yield
3737

38-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
38+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3939
Data = Any # type: ignore[misc,assignment,unused-ignore]
4040
Origin = Any # type: ignore[misc,assignment,unused-ignore]
4141

@@ -304,7 +304,7 @@ async def _execute_json(
304304
**merged_kwargs,
305305
)
306306

307-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
307+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
308308
payload: Dict[str, Any] = {
309309
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
310310
}
@@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
314314

315315
async def _send_subscribe(
316316
self,
317-
websocket: WebSocketClientProtocol,
317+
websocket: ClientConnection,
318318
operation_id: str,
319319
query: str,
320320
operation_name: Optional[str] = None,
@@ -334,7 +334,7 @@ async def _send_subscribe(
334334
async def _handle_ws_message(
335335
self,
336336
message: Data,
337-
websocket: WebSocketClientProtocol,
337+
websocket: ClientConnection,
338338
expected_type: Optional[GraphQLTransportWSMessageType] = None,
339339
) -> Optional[Dict[str, Any]]:
340340
try:

tests/main/clients/custom_config_file/expected_client/async_base_client.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
)
22-
from websockets.client import (
22+
from websockets import (
2323
connect as ws_connect,
2424
)
2525
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs):
3535
raise NotImplementedError("Subscriptions require 'websockets' package.")
3636
yield
3737

38-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
38+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3939
Data = Any # type: ignore[misc,assignment,unused-ignore]
4040
Origin = Any # type: ignore[misc,assignment,unused-ignore]
4141

@@ -304,7 +304,7 @@ async def _execute_json(
304304
**merged_kwargs,
305305
)
306306

307-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
307+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
308308
payload: Dict[str, Any] = {
309309
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
310310
}
@@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
314314

315315
async def _send_subscribe(
316316
self,
317-
websocket: WebSocketClientProtocol,
317+
websocket: ClientConnection,
318318
operation_id: str,
319319
query: str,
320320
operation_name: Optional[str] = None,
@@ -334,7 +334,7 @@ async def _send_subscribe(
334334
async def _handle_ws_message(
335335
self,
336336
message: Data,
337-
websocket: WebSocketClientProtocol,
337+
websocket: ClientConnection,
338338
expected_type: Optional[GraphQLTransportWSMessageType] = None,
339339
) -> Optional[Dict[str, Any]]:
340340
try:

tests/main/clients/custom_files_names/expected_client/async_base_client.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
)
22-
from websockets.client import (
22+
from websockets import (
2323
connect as ws_connect,
2424
)
2525
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs):
3535
raise NotImplementedError("Subscriptions require 'websockets' package.")
3636
yield
3737

38-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
38+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3939
Data = Any # type: ignore[misc,assignment,unused-ignore]
4040
Origin = Any # type: ignore[misc,assignment,unused-ignore]
4141

@@ -304,7 +304,7 @@ async def _execute_json(
304304
**merged_kwargs,
305305
)
306306

307-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
307+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
308308
payload: Dict[str, Any] = {
309309
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
310310
}
@@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
314314

315315
async def _send_subscribe(
316316
self,
317-
websocket: WebSocketClientProtocol,
317+
websocket: ClientConnection,
318318
operation_id: str,
319319
query: str,
320320
operation_name: Optional[str] = None,
@@ -334,7 +334,7 @@ async def _send_subscribe(
334334
async def _handle_ws_message(
335335
self,
336336
message: Data,
337-
websocket: WebSocketClientProtocol,
337+
websocket: ClientConnection,
338338
expected_type: Optional[GraphQLTransportWSMessageType] = None,
339339
) -> Optional[Dict[str, Any]]:
340340
try:

tests/main/clients/custom_query_builder/expected_client/async_base_client.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
)
1717

1818
try:
19-
from websockets.client import ( # type: ignore[import-not-found,unused-ignore]
20-
WebSocketClientProtocol,
19+
from websockets import ( # type: ignore[import-not-found,unused-ignore]
20+
ClientConnection,
2121
)
22-
from websockets.client import (
22+
from websockets import (
2323
connect as ws_connect,
2424
)
2525
from websockets.typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs):
3535
raise NotImplementedError("Subscriptions require 'websockets' package.")
3636
yield
3737

38-
WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
38+
ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
3939
Data = Any # type: ignore[misc,assignment,unused-ignore]
4040
Origin = Any # type: ignore[misc,assignment,unused-ignore]
4141

@@ -304,7 +304,7 @@ async def _execute_json(
304304
**merged_kwargs,
305305
)
306306

307-
async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None:
307+
async def _send_connection_init(self, websocket: ClientConnection) -> None:
308308
payload: Dict[str, Any] = {
309309
"type": GraphQLTransportWSMessageType.CONNECTION_INIT.value
310310
}
@@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
314314

315315
async def _send_subscribe(
316316
self,
317-
websocket: WebSocketClientProtocol,
317+
websocket: ClientConnection,
318318
operation_id: str,
319319
query: str,
320320
operation_name: Optional[str] = None,
@@ -334,7 +334,7 @@ async def _send_subscribe(
334334
async def _handle_ws_message(
335335
self,
336336
message: Data,
337-
websocket: WebSocketClientProtocol,
337+
websocket: ClientConnection,
338338
expected_type: Optional[GraphQLTransportWSMessageType] = None,
339339
) -> Optional[Dict[str, Any]]:
340340
try:

0 commit comments

Comments
 (0)