diff --git a/.gitignore b/.gitignore index 935d371f..1e31f337 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,5 @@ dmypy.json # System files .DS_Store + +.idea diff --git a/ariadne_codegen/client_generators/dependencies/async_base_client.py b/ariadne_codegen/client_generators/dependencies/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/ariadne_codegen/client_generators/dependencies/async_base_client.py +++ b/ariadne_codegen/client_generators/dependencies/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/ariadne_codegen/client_generators/dependencies/async_base_client_open_telemetry.py b/ariadne_codegen/client_generators/dependencies/async_base_client_open_telemetry.py index 1127dffb..600c34b1 100644 --- a/ariadne_codegen/client_generators/dependencies/async_base_client_open_telemetry.py +++ b/ariadne_codegen/client_generators/dependencies/async_base_client_open_telemetry.py @@ -27,10 +27,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -46,7 +46,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -394,7 +394,7 @@ async def _execute_ws( if data: yield data - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -404,7 +404,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -424,7 +424,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: @@ -603,7 +603,7 @@ async def _execute_ws_with_telemetry( yield data async def _send_connection_init_with_telemetry( - self, root_span: Span, websocket: WebSocketClientProtocol + self, root_span: Span, websocket: ClientConnection ) -> None: with self.tracer.start_as_current_span( # type: ignore "connection init", context=set_span_in_context(root_span) @@ -622,7 +622,7 @@ async def _send_connection_init_with_telemetry( async def _send_subscribe_with_telemetry( self, root_span: Span, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -654,7 +654,7 @@ async def _handle_ws_message_with_telemetry( self, root_span: Span, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: with self.tracer.start_as_current_span( # type: ignore diff --git a/pyproject.toml b/pyproject.toml index f7ee3020..201ae278 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,11 +46,11 @@ test = [ "pytest-mock", "requests-toolbelt", "types-toml", - "websockets~=11.0", + "websockets>=14.2", "opentelemetry-api", ] types = ["mypy>=1.0.0"] -subscriptions = ["websockets~=11.0"] +subscriptions = ["websockets>=14.2"] opentelemetry = ["opentelemetry-api"] [project.scripts] diff --git a/tests/main/clients/client_forward_refs/expected_client/async_base_client.py b/tests/main/clients/client_forward_refs/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/client_forward_refs/expected_client/async_base_client.py +++ b/tests/main/clients/client_forward_refs/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/client_forward_refs_shorter_results/expected_client/async_base_client.py b/tests/main/clients/client_forward_refs_shorter_results/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/client_forward_refs_shorter_results/expected_client/async_base_client.py +++ b/tests/main/clients/client_forward_refs_shorter_results/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/custom_config_file/expected_client/async_base_client.py b/tests/main/clients/custom_config_file/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/custom_config_file/expected_client/async_base_client.py +++ b/tests/main/clients/custom_config_file/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/custom_files_names/expected_client/async_base_client.py b/tests/main/clients/custom_files_names/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/custom_files_names/expected_client/async_base_client.py +++ b/tests/main/clients/custom_files_names/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/custom_query_builder/expected_client/async_base_client.py b/tests/main/clients/custom_query_builder/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/custom_query_builder/expected_client/async_base_client.py +++ b/tests/main/clients/custom_query_builder/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/custom_scalars/expected_client/async_base_client.py b/tests/main/clients/custom_scalars/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/custom_scalars/expected_client/async_base_client.py +++ b/tests/main/clients/custom_scalars/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/example/expected_client/async_base_client.py b/tests/main/clients/example/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/example/expected_client/async_base_client.py +++ b/tests/main/clients/example/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/extended_models/expected_client/async_base_client.py b/tests/main/clients/extended_models/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/extended_models/expected_client/async_base_client.py +++ b/tests/main/clients/extended_models/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/fragments_on_abstract_types/expected_client/async_base_client.py b/tests/main/clients/fragments_on_abstract_types/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/fragments_on_abstract_types/expected_client/async_base_client.py +++ b/tests/main/clients/fragments_on_abstract_types/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/inline_fragments/expected_client/async_base_client.py b/tests/main/clients/inline_fragments/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/inline_fragments/expected_client/async_base_client.py +++ b/tests/main/clients/inline_fragments/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/interface_as_fragment/expected_client/async_base_client.py b/tests/main/clients/interface_as_fragment/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/interface_as_fragment/expected_client/async_base_client.py +++ b/tests/main/clients/interface_as_fragment/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/multiple_fragments/expected_client/async_base_client.py b/tests/main/clients/multiple_fragments/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/multiple_fragments/expected_client/async_base_client.py +++ b/tests/main/clients/multiple_fragments/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/only_used_inputs_and_enums/expected_client/async_base_client.py b/tests/main/clients/only_used_inputs_and_enums/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/only_used_inputs_and_enums/expected_client/async_base_client.py +++ b/tests/main/clients/only_used_inputs_and_enums/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/operations/expected_client/async_base_client.py b/tests/main/clients/operations/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/operations/expected_client/async_base_client.py +++ b/tests/main/clients/operations/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/remote_schema/expected_client/async_base_client.py b/tests/main/clients/remote_schema/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/remote_schema/expected_client/async_base_client.py +++ b/tests/main/clients/remote_schema/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/clients/shorter_results/expected_client/async_base_client.py b/tests/main/clients/shorter_results/expected_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/clients/shorter_results/expected_client/async_base_client.py +++ b/tests/main/clients/shorter_results/expected_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: diff --git a/tests/main/custom_operation_builder/graphql_client/async_base_client.py b/tests/main/custom_operation_builder/graphql_client/async_base_client.py index 2695a9ee..f9f57627 100644 --- a/tests/main/custom_operation_builder/graphql_client/async_base_client.py +++ b/tests/main/custom_operation_builder/graphql_client/async_base_client.py @@ -16,10 +16,10 @@ ) try: - from websockets.client import ( # type: ignore[import-not-found,unused-ignore] - WebSocketClientProtocol, + from websockets import ( # type: ignore[import-not-found,unused-ignore] + ClientConnection, ) - from websockets.client import ( + from websockets import ( connect as ws_connect, ) from websockets.typing import ( # type: ignore[import-not-found,unused-ignore] @@ -35,7 +35,7 @@ async def ws_connect(*args, **kwargs): raise NotImplementedError("Subscriptions require 'websockets' package.") yield - WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore] + ClientConnection = Any # type: ignore[misc,assignment,unused-ignore] Data = Any # type: ignore[misc,assignment,unused-ignore] Origin = Any # type: ignore[misc,assignment,unused-ignore] @@ -304,7 +304,7 @@ async def _execute_json( **merged_kwargs, ) - async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> None: + async def _send_connection_init(self, websocket: ClientConnection) -> None: payload: Dict[str, Any] = { "type": GraphQLTransportWSMessageType.CONNECTION_INIT.value } @@ -314,7 +314,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non async def _send_subscribe( self, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, operation_id: str, query: str, operation_name: Optional[str] = None, @@ -334,7 +334,7 @@ async def _send_subscribe( async def _handle_ws_message( self, message: Data, - websocket: WebSocketClientProtocol, + websocket: ClientConnection, expected_type: Optional[GraphQLTransportWSMessageType] = None, ) -> Optional[Dict[str, Any]]: try: