strawberry-graphql 0.248.0__py3-none-any.whl → 0.248.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -111,15 +111,17 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
111
111
  await self.send_json_to(
112
112
  ConnectionInitMessage(payload=self.connection_params).as_dict()
113
113
  )
114
- response = await self.receive_json_from()
115
- assert response == ConnectionAckMessage().as_dict()
114
+ graphql_transport_ws_response = await self.receive_json_from()
115
+ assert graphql_transport_ws_response == ConnectionAckMessage().as_dict()
116
116
  else:
117
117
  assert res == (True, GRAPHQL_WS_PROTOCOL)
118
118
  await self.send_json_to(
119
119
  GraphQLWSConnectionInitMessage({"type": "connection_init"})
120
120
  )
121
- response: GraphQLWSConnectionAckMessage = await self.receive_json_from()
122
- assert response["type"] == "connection_ack"
121
+ graphql_ws_response: GraphQLWSConnectionAckMessage = (
122
+ await self.receive_json_from()
123
+ )
124
+ assert graphql_ws_response["type"] == "connection_ack"
123
125
 
124
126
  # Actual `ExecutionResult`` objects are not available client-side, since they
125
127
  # get transformed into `FormattedExecutionResult` on the wire, but we attempt
@@ -4,7 +4,7 @@ import functools
4
4
  import importlib
5
5
  import inspect
6
6
  from pathlib import Path # noqa: TCH003
7
- from typing import List, Optional, Type
7
+ from typing import List, Optional, Type, Union, cast
8
8
 
9
9
  import rich
10
10
  import typer
@@ -61,7 +61,9 @@ def _import_plugin(plugin: str) -> Optional[Type[QueryCodegenPlugin]]:
61
61
 
62
62
 
63
63
  @functools.lru_cache
64
- def _load_plugin(plugin_path: str) -> Type[QueryCodegenPlugin]:
64
+ def _load_plugin(
65
+ plugin_path: str,
66
+ ) -> Union[Type[QueryCodegenPlugin], Type[ConsolePlugin]]:
65
67
  # try to import plugin_name from current folder
66
68
  # then try to import from strawberry.codegen.plugins
67
69
 
@@ -77,7 +79,9 @@ def _load_plugin(plugin_path: str) -> Type[QueryCodegenPlugin]:
77
79
  return plugin
78
80
 
79
81
 
80
- def _load_plugins(plugin_ids: List[str], query: Path) -> List[QueryCodegenPlugin]:
82
+ def _load_plugins(
83
+ plugin_ids: List[str], query: Path
84
+ ) -> List[Union[QueryCodegenPlugin, ConsolePlugin]]:
81
85
  plugins = []
82
86
  for ptype_id in plugin_ids:
83
87
  ptype = _load_plugin(ptype_id)
@@ -127,11 +131,11 @@ def codegen(
127
131
 
128
132
  console_plugin_type = _load_plugin(cli_plugin) if cli_plugin else ConsolePlugin
129
133
  console_plugin = console_plugin_type(output_dir)
134
+ assert isinstance(console_plugin, ConsolePlugin)
130
135
  console_plugin.before_any_start()
131
136
 
132
137
  for q in query:
133
- plugins = _load_plugins(selected_plugins, q)
134
- console_plugin.query = q # update the query in the console plugin.
138
+ plugins = cast(List[QueryCodegenPlugin], _load_plugins(selected_plugins, q))
135
139
 
136
140
  code_generator = QueryCodegen(
137
141
  schema_symbol, plugins=plugins, console_plugin=console_plugin
@@ -105,7 +105,7 @@ def _build_dataclass_creation_fields(
105
105
 
106
106
  return DataclassCreationFields(
107
107
  name=field.name,
108
- field_type=field_type,
108
+ field_type=field_type, # type: ignore
109
109
  field=strawberry_field,
110
110
  )
111
111
 
@@ -198,7 +198,7 @@ def type(
198
198
  all_model_fields = [
199
199
  DataclassCreationFields(
200
200
  name=field.name,
201
- field_type=field.type,
201
+ field_type=field.type, # type: ignore
202
202
  field=field,
203
203
  )
204
204
  for field in extra_fields + private_fields
@@ -169,16 +169,17 @@ class BaseGraphQLWSHandler:
169
169
  await self.websocket.send_json(error_message)
170
170
  else:
171
171
  self.subscriptions[operation_id] = agen_or_err
172
+
172
173
  async for result in agen_or_err:
173
174
  await self.send_data(result, operation_id)
174
- complete_message: CompleteMessage = {
175
- "type": "complete",
176
- "id": operation_id,
177
- }
178
- await self.websocket.send_json(complete_message)
175
+
176
+ await self.websocket.send_json(
177
+ CompleteMessage({"type": "complete", "id": operation_id})
178
+ )
179
179
  except asyncio.CancelledError:
180
- complete_message: CompleteMessage = {"type": "complete", "id": operation_id}
181
- await self.websocket.send_json(complete_message)
180
+ await self.websocket.send_json(
181
+ CompleteMessage({"type": "complete", "id": operation_id})
182
+ )
182
183
 
183
184
  async def cleanup_operation(self, operation_id: str) -> None:
184
185
  if operation_id in self.subscriptions:
@@ -350,7 +350,12 @@ def eval_type(
350
350
  assert ast_unparse
351
351
  type_ = ForwardRef(ast_unparse(ast_obj))
352
352
 
353
- return _eval_type(type_, globalns, localns)
353
+ extra: Dict[str, Any] = {}
354
+
355
+ if sys.version_info >= (3, 13):
356
+ extra = {"type_params": None}
357
+
358
+ return _eval_type(type_, globalns, localns, **extra)
354
359
 
355
360
  origin = get_origin(type_)
356
361
  if origin is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.248.0
3
+ Version: 0.248.1
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -16,11 +16,11 @@ strawberry/channels/handlers/base.py,sha256=KV4KA0eF5NRtikV9m4ssoPI5pmCZvDuRkfoT
16
16
  strawberry/channels/handlers/http_handler.py,sha256=fnQcPwdUz2CboVlnI3s1urQ_ZnZyNZvRx7SM_xPLLEA,11577
17
17
  strawberry/channels/handlers/ws_handler.py,sha256=k9xax8S1g0tfEFSe76UOHkheHqIrnYjEioYlLm4UPLo,6052
18
18
  strawberry/channels/router.py,sha256=DKIbl4zuRBhfvViUVpyu0Rf_WRT41E6uZC-Yic9Ltvo,2024
19
- strawberry/channels/testing.py,sha256=Ae2G8v4bKdkw8Se6itQ-gkaHpZREhrHWPPpF5dbhroY,6592
19
+ strawberry/channels/testing.py,sha256=2cZvF9S4ofYLLRh2G8iyWZTphfQi7XrUcFpRqGjUmPQ,6688
20
20
  strawberry/cli/__init__.py,sha256=byS5VrEiTJatAH6YS4V1Kd4SOwMRAQO2M1oJdIddivg,585
21
21
  strawberry/cli/app.py,sha256=tTMBV1pdWqMcwjWO2yn-8oLDhMhfJvUzyQtWs75LWJ0,54
22
22
  strawberry/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- strawberry/cli/commands/codegen.py,sha256=f3TKQVeg0iMYV3qcSXlvTNgG73ZWC60zjbeuK_RkQ3M,3825
23
+ strawberry/cli/commands/codegen.py,sha256=79CRVa01AScZ0dactJzMMpWP_2O00urNIjBAyWjPzA8,3910
24
24
  strawberry/cli/commands/export_schema.py,sha256=8XBqbejk0kT2fHky74DzW2TnE8APNMs0cKtatEjErUA,1024
25
25
  strawberry/cli/commands/schema_codegen.py,sha256=G6eV08a51sjVxCm3jn75oPn9hC8YarKiAKOY5bpTuKU,749
26
26
  strawberry/cli/commands/server.py,sha256=M175Etn4163oqP3egHBpZ8ga2Ilk8XgdDJtz6zfHPxM,2189
@@ -79,7 +79,7 @@ strawberry/experimental/pydantic/conversion_types.py,sha256=LdLFp0e7_YPntmHDwZDp
79
79
  strawberry/experimental/pydantic/error_type.py,sha256=kHqACk3F8kKT3V8PZr2h7-KI9M4UNpMjtq_TiOwYI38,4382
80
80
  strawberry/experimental/pydantic/exceptions.py,sha256=Q8Deq3bNkMgc8fwvIYdcfxHSONXVMu-ZB6jcsh1NQYo,1498
81
81
  strawberry/experimental/pydantic/fields.py,sha256=pmBqlq1DUtNkmDlXdA0Hmp3Xy252P6v5uyDF4WGcnl0,2588
82
- strawberry/experimental/pydantic/object_type.py,sha256=4CUtBR5wxe4dP-bpKBwNLU6trje7zygkD39_GoiPVBM,12432
82
+ strawberry/experimental/pydantic/object_type.py,sha256=KWpKIPpCsZRmURJOlkce5qODgWm7xgaJ49YZlJQcB80,12464
83
83
  strawberry/experimental/pydantic/utils.py,sha256=ViR7HGtnlYmyjUwIqGaEoBPo6dcibckwTFgp0GgwO6A,4073
84
84
  strawberry/ext/LICENSE,sha256=_oY0TZg0b_sW0--0T44aMTpy2e2zF1Kiyn8E1qDiivo,1249
85
85
  strawberry/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -190,7 +190,7 @@ strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py,sha256=wN6dk
190
190
  strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py,sha256=_h-xNf_ZRtjn8PGbxZk3u9qTR-NNNCevdgaFF0uXciw,14728
191
191
  strawberry/subscriptions/protocols/graphql_transport_ws/types.py,sha256=udYxzGtwjETYvY5f23org0t-aY4cimTjEGFYUR3idaY,2596
192
192
  strawberry/subscriptions/protocols/graphql_ws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
193
- strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=IQsOqh_9uWZMuBPmo05ThEzE9cC98WiRFt2K-2GWymk,7703
193
+ strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=oM0o85zC24LpBjtVq8VakKx2hBGL0kb3Q9yl0GyFLS8,7614
194
194
  strawberry/subscriptions/protocols/graphql_ws/types.py,sha256=diZ36w56Nb_YmgfWXe6uXGiQOKmWIVjNEkcM-PkjaSs,1939
195
195
  strawberry/test/__init__.py,sha256=U3B5Ng7C_H8GpCpfvgZZcfADMw6cor5hm78gS3nDdMI,115
196
196
  strawberry/test/client.py,sha256=Va7J1tIjZ6PxbOqPl57jSp5lNLOZSueHPmrUuUx5sRY,6462
@@ -229,9 +229,9 @@ strawberry/utils/inspect.py,sha256=2WOeK3o8pjVkIH-rP_TaaLDa_AvroKC1WXc0gSE0Suc,3
229
229
  strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,746
230
230
  strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
231
231
  strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
232
- strawberry/utils/typing.py,sha256=3xws5kxSQGsp8BnYyUwClvxXNzZakMAuOPoq1rjHRuk,14252
233
- strawberry_graphql-0.248.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
234
- strawberry_graphql-0.248.0.dist-info/METADATA,sha256=aKYBf7nSLOqh8q-WwFvOugbyH8ZlZBDokIS6Y5HfoMw,7758
235
- strawberry_graphql-0.248.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
236
- strawberry_graphql-0.248.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
237
- strawberry_graphql-0.248.0.dist-info/RECORD,,
232
+ strawberry/utils/typing.py,sha256=G6k2wWD1TDQ9WFk-Togekj_hTVFqHV-g7Phf2Wu41ms,14380
233
+ strawberry_graphql-0.248.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
234
+ strawberry_graphql-0.248.1.dist-info/METADATA,sha256=4QSuJdbk6cKZOzgkTHqSSja1u2TpyxIH1XdfBysw-5E,7758
235
+ strawberry_graphql-0.248.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
236
+ strawberry_graphql-0.248.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
237
+ strawberry_graphql-0.248.1.dist-info/RECORD,,