strawberry-graphql 0.236.1__py3-none-any.whl → 0.236.2__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.
@@ -1,5 +1,5 @@
1
1
  from collections import defaultdict
2
- from functools import cached_property, partial
2
+ from functools import cached_property
3
3
  from itertools import chain
4
4
  from typing import (
5
5
  TYPE_CHECKING,
@@ -17,8 +17,6 @@ from typing import (
17
17
  cast,
18
18
  )
19
19
 
20
- from graphql import GraphQLError
21
-
22
20
  from strawberry.annotation import StrawberryAnnotation
23
21
  from strawberry.printer import print_schema
24
22
  from strawberry.schema import Schema as BaseSchema
@@ -178,28 +176,25 @@ class Schema(BaseSchema):
178
176
  if "info" in func_args:
179
177
  kwargs["info"] = info
180
178
 
181
- get_result = partial(resolve_reference, **kwargs)
179
+ try:
180
+ result = resolve_reference(**kwargs)
181
+ except Exception as e:
182
+ result = e
182
183
  else:
183
184
  from strawberry.types.arguments import convert_argument
184
185
 
185
186
  config = info.schema.config
186
187
  scalar_registry = info.schema.schema_converter.scalar_registry
187
188
 
188
- get_result = partial(
189
- convert_argument,
190
- representation,
191
- type_=definition.origin,
192
- scalar_registry=scalar_registry,
193
- config=config,
194
- )
195
-
196
- try:
197
- result = get_result()
198
- except Exception as e:
199
- result = GraphQLError(
200
- f"Unable to resolve reference for {definition.origin}",
201
- original_error=e,
202
- )
189
+ try:
190
+ result = convert_argument(
191
+ representation,
192
+ type_=definition.origin,
193
+ scalar_registry=scalar_registry,
194
+ config=config,
195
+ )
196
+ except Exception:
197
+ result = TypeError(f"Unable to resolve reference for {type_name}")
203
198
 
204
199
  results.append(result)
205
200
 
@@ -84,7 +84,7 @@ def _serialize_dataclasses(value: object) -> object: ...
84
84
 
85
85
  def _serialize_dataclasses(value):
86
86
  if dataclasses.is_dataclass(value):
87
- return dataclasses.asdict(value)
87
+ return dataclasses.asdict(value) # type: ignore
88
88
  if isinstance(value, (list, tuple)):
89
89
  return [_serialize_dataclasses(v) for v in value]
90
90
  if isinstance(value, dict):
@@ -155,7 +155,7 @@ class NodeExtension(FieldExtension):
155
155
  await asyncio.gather(
156
156
  *awaitable_nodes.values(),
157
157
  *(
158
- asyncgen_to_list(nodes)
158
+ asyncgen_to_list(nodes) # type: ignore
159
159
  for nodes in asyncgen_nodes.values()
160
160
  ),
161
161
  ),
strawberry/relay/types.py CHANGED
@@ -185,7 +185,7 @@ class GlobalID:
185
185
 
186
186
  """
187
187
  n_type = self.resolve_type(info)
188
- node = cast(
188
+ node: Node | Awaitable[Node] = cast(
189
189
  Awaitable[Node],
190
190
  n_type.resolve_node(
191
191
  self.node_id,
@@ -4,7 +4,6 @@ from asyncio import ensure_future
4
4
  from inspect import isawaitable
5
5
  from typing import (
6
6
  TYPE_CHECKING,
7
- Awaitable,
8
7
  Callable,
9
8
  Iterable,
10
9
  List,
@@ -14,7 +13,6 @@ from typing import (
14
13
  Type,
15
14
  TypedDict,
16
15
  Union,
17
- cast,
18
16
  )
19
17
 
20
18
  from graphql import GraphQLError, parse
@@ -32,7 +30,6 @@ if TYPE_CHECKING:
32
30
  from typing_extensions import NotRequired, Unpack
33
31
 
34
32
  from graphql import ExecutionContext as GraphQLExecutionContext
35
- from graphql import ExecutionResult as GraphQLExecutionResult
36
33
  from graphql import GraphQLSchema
37
34
  from graphql.language import DocumentNode
38
35
  from graphql.validation import ASTValidationRule
@@ -139,9 +136,8 @@ async def execute(
139
136
  )
140
137
 
141
138
  if isawaitable(result):
142
- result = await cast(Awaitable["GraphQLExecutionResult"], result)
139
+ result = await result
143
140
 
144
- result = cast("GraphQLExecutionResult", result)
145
141
  execution_context.result = result
146
142
  # Also set errors on the execution_context so that it's easier
147
143
  # to access in extensions
@@ -237,13 +233,11 @@ def execute_sync(
237
233
  )
238
234
 
239
235
  if isawaitable(result):
240
- result = cast(Awaitable["GraphQLExecutionResult"], result)
241
236
  ensure_future(result).cancel()
242
237
  raise RuntimeError(
243
238
  "GraphQL execution failed to complete synchronously."
244
239
  )
245
240
 
246
- result = cast("GraphQLExecutionResult", result)
247
241
  execution_context.result = result
248
242
  # Also set errors on the execution_context so that it's easier
249
243
  # to access in extensions
@@ -58,7 +58,7 @@ class LazyType(Generic[TypeName, Module]):
58
58
 
59
59
  return cls(type_name, module, package)
60
60
 
61
- def __or__(self, other: Other) -> Union[Self, Other]:
61
+ def __or__(self, other: Other) -> object:
62
62
  return Union[self, other]
63
63
 
64
64
  def resolve_type(self) -> Type[Any]:
@@ -1,5 +1,5 @@
1
1
  import inspect
2
- from typing import AsyncIterator, Awaitable, Iterator, TypeVar, Union, cast
2
+ from typing import AsyncIterator, Awaitable, Iterator, TypeVar, Union
3
3
 
4
4
  T = TypeVar("T")
5
5
 
@@ -11,7 +11,7 @@ async def await_maybe(value: AwaitableOrValue[T]) -> T:
11
11
  if inspect.isawaitable(value):
12
12
  return await value
13
13
 
14
- return cast(T, value)
14
+ return value
15
15
 
16
16
 
17
17
  __all__ = ["await_maybe", "AwaitableOrValue", "AsyncIteratorOrIterator"]
@@ -239,7 +239,7 @@ def _ast_replace_union_operation(
239
239
  expr = ast.Subscript(
240
240
  expr.value,
241
241
  # The cast is required for mypy on python 3.7 and 3.8
242
- ast.Index(_ast_replace_union_operation(cast(Any, expr.slice).value)),
242
+ ast.Index(_ast_replace_union_operation(cast(Any, expr.slice).value)), # type: ignore
243
243
  ast.Load(),
244
244
  )
245
245
  elif isinstance(expr.slice, (ast.BinOp, ast.Tuple)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.236.1
3
+ Version: 0.236.2
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -131,7 +131,7 @@ strawberry/federation/field.py,sha256=u7J2f2QAwzkgYx9S3oxCy9b2LduC6pglyUUHbVkk-X
131
131
  strawberry/federation/mutation.py,sha256=5t2E419m4K2W6LoWEOzWgMdL2J0PwHnsffYkpChqqDQ,67
132
132
  strawberry/federation/object_type.py,sha256=vrf7KC9p_UNV4hXIVDjZeUjx9xzfH3BF6ZYdlUEQW50,9357
133
133
  strawberry/federation/scalar.py,sha256=c1FI3uPxbSM4wj88TaXsBK5t2w6S-rypzojcSNC-pnQ,4636
134
- strawberry/federation/schema.py,sha256=7b29dUGZU1HEdbhxV26I7xhtXSC-xZ6D8XFpMWlxPzk,13325
134
+ strawberry/federation/schema.py,sha256=Dsy__upYMu3za6oNssMt9hz5uaEufI_yUtprLFDJRPw,13235
135
135
  strawberry/federation/schema_directive.py,sha256=GxmwapBQq80ZOjA4v_xhogHU3eV3N-ZiTRJOXffltbg,1751
136
136
  strawberry/federation/schema_directives.py,sha256=aIJ1zpASClF6ujLCUWmNuSR1ccX3pyvBTK501DUh-5Q,6400
137
137
  strawberry/federation/types.py,sha256=cqyx_-GJ5d__hac7bip_dQKm9NGR88D0N1JVnde0Ji8,360
@@ -161,14 +161,14 @@ strawberry/parent.py,sha256=sXURm0lauSpjUADsmfNGY-Zl7kHs0A67BFcWuWKzRxw,771
161
161
  strawberry/permission.py,sha256=NsYq-c4AgDCDBsYXsJN94yWJjuwYkvytpqXE4BIf_vc,7226
162
162
  strawberry/printer/__init__.py,sha256=DmepjmgtkdF5RxK_7yC6qUyRWn56U-9qeZMbkztYB9w,62
163
163
  strawberry/printer/ast_from_value.py,sha256=LgM5g2qvBOnAIf9znbiMEcRX0PGSQohR3Vr3QYfU604,4983
164
- strawberry/printer/printer.py,sha256=5reR7kVGVQn7iGSeRYjLNOVgdnd5K8fKH_otWStCmHA,17508
164
+ strawberry/printer/printer.py,sha256=GntTBivg3fb_zPM41Q8DtWMiRmkmM9xwTF-aFWvnqTg,17524
165
165
  strawberry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
166
  strawberry/quart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
167
  strawberry/quart/views.py,sha256=5Y7JNv3oi9u__iQx2l2fQvz-Ha1H-ZhhYslaFsNUIs0,3432
168
168
  strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,553
169
169
  strawberry/relay/exceptions.py,sha256=KZSRJYlfutrAQALtBPnzJHRIMK6GZSnKAT_H4wIzGcI,4035
170
- strawberry/relay/fields.py,sha256=5Goe-eh2wi_sIeHy6RpuQlJmgYBxhzAA77lUehSu70c,16911
171
- strawberry/relay/types.py,sha256=YCBU2AxYnipwxjgOHRRMbqGr34HNVJGwkT65EzJ5-VM,29752
170
+ strawberry/relay/fields.py,sha256=qrpDxDQ_bdzDUKtd8gxo9P3Oermxbux3yjFvHvHC1Ho,16927
171
+ strawberry/relay/types.py,sha256=m700VJK6-JTQRrxGBk2ZyuXsnB9__RWflQ5iZvpuxcQ,29776
172
172
  strawberry/relay/utils.py,sha256=Vqi4raWdzRkqt7jU_RBMCwXp4h6H-16WJ7la0lugZi0,5692
173
173
  strawberry/resolvers.py,sha256=Vdidc3YFc4-olSQZD_xQ1icyAFbyzqs_8I3eSpMFlA4,260
174
174
  strawberry/sanic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -181,7 +181,7 @@ strawberry/schema/base.py,sha256=eH0nyrCKwdtvgzLS810LMTffpY5CsRd9qY-uZs9pZ3U,364
181
181
  strawberry/schema/compat.py,sha256=rRqUm5-XgPXC018_u0Mrd4iad7tTRCNA45Ko4NaT6gk,1836
182
182
  strawberry/schema/config.py,sha256=Aa01oqnHb0ZPlw8Ti_O840LxlT827LNio15BQrc37A0,717
183
183
  strawberry/schema/exceptions.py,sha256=rqVNb_oYrKM0dHPgvAemqCG6Um282LPPu4zwQ5cZqs4,584
184
- strawberry/schema/execute.py,sha256=4wqdNOIDhOfx6bwZrqhACKwpiG_D2Eexf70S-VFpnIY,11193
184
+ strawberry/schema/execute.py,sha256=74eGjXrptVO_EP-luZmSHUeXtt3Lk5BbEoZv9v7w0jo,10840
185
185
  strawberry/schema/name_converter.py,sha256=tpqw2XCSFvJI-H844iWhE2Z1sKic7DrjIZxt11eJN5Y,6574
186
186
  strawberry/schema/schema.py,sha256=0zZirswxx5_lryhDTzXpjyDOnjfWuOvWHxkM9ZTyYF4,15789
187
187
  strawberry/schema/schema_converter.py,sha256=lckL2LoxAb6mNfJIVcerht2buzBG573ly3BHyl7wra4,36859
@@ -226,7 +226,7 @@ strawberry/types/fields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
226
226
  strawberry/types/fields/resolver.py,sha256=EoNFUbz_cV6QH_jHi5uMtgd5EnE_fnvbJPTWeNpYL6M,13992
227
227
  strawberry/types/graphql.py,sha256=Hnt7RplzBdcthNYxYB4PA3LqffG99ICQSgSrDa28bJQ,717
228
228
  strawberry/types/info.py,sha256=Y5nVRPJBwKaqT8CtSrMGpWdsgT_eW88dJXNwMAKNG0k,4750
229
- strawberry/types/lazy_type.py,sha256=Nn4qsJA-FMRKddsh89wgXFwmMAKrX-kqRcJ0SnuAlIo,5110
229
+ strawberry/types/lazy_type.py,sha256=sDQZYR-rEqVhsiBsnyY7y2qcC21luJgtJqrc0MbsnQM,5098
230
230
  strawberry/types/mutation.py,sha256=bS2WotWenRP-lKJazPIvuzpD4sfS3Rp5leq7-DPNS_I,11975
231
231
  strawberry/types/nodes.py,sha256=TVQ4TWeJEK2vdtlQMXMjD8tb57PkuONhne4Orgzaf90,5114
232
232
  strawberry/types/object_type.py,sha256=-LvRnigI5iK9SgfH82b7eLzXw6DswM2ad6ZVOBUU_sE,14952
@@ -237,7 +237,7 @@ strawberry/types/union.py,sha256=sMCatme1HM1VJRc3i2y0sQqtqxvpLotL-669hu06EMc,100
237
237
  strawberry/types/unset.py,sha256=s2l9DCWesItiC-NtT3InLFrD1XeIOBxXZKahigQ11wQ,1712
238
238
  strawberry/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
239
239
  strawberry/utils/aio.py,sha256=8n4mrAHjx12zp1phqNv1mXx2-1mQRXLNRbpNMS2MDoM,1706
240
- strawberry/utils/await_maybe.py,sha256=LO29eZZU-yqkMO_srrEsyCwMossHuz1tsyIawVGvz8I,437
240
+ strawberry/utils/await_maybe.py,sha256=7KMNa8DSjzQP1XbPyEIbFMokAbKxs_6AlTKWseJOwNw,422
241
241
  strawberry/utils/dataclasses.py,sha256=1wvVq0vgvjrRSamJ3CBJpkLu1KVweTmw5JLXmagdGes,856
242
242
  strawberry/utils/debug.py,sha256=U4oxSO_gUV8IiH2RG8u3SeHJXGF6ztvXdMa_yZkly1c,1430
243
243
  strawberry/utils/deprecations.py,sha256=_1sxRhFYlaHeEEqK4dy0k1IaYXA3_e1GRsO_LqQLtig,774
@@ -247,9 +247,9 @@ strawberry/utils/inspect.py,sha256=2WOeK3o8pjVkIH-rP_TaaLDa_AvroKC1WXc0gSE0Suc,3
247
247
  strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,746
248
248
  strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
249
249
  strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
250
- strawberry/utils/typing.py,sha256=x_CONoYlbmha-VHu6mGNB_PBA1iejLE-giUF13zmVMY,14244
251
- strawberry_graphql-0.236.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
252
- strawberry_graphql-0.236.1.dist-info/METADATA,sha256=HqExGi7_C6FyJU1YMc-LTt6bP1_2Cn0Qk_QcGNYDirM,7821
253
- strawberry_graphql-0.236.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
254
- strawberry_graphql-0.236.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
255
- strawberry_graphql-0.236.1.dist-info/RECORD,,
250
+ strawberry/utils/typing.py,sha256=tUHHX2YTGX417EEQHB6j0B8-p-fg31ZI8csc9SUoq2I,14260
251
+ strawberry_graphql-0.236.2.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
252
+ strawberry_graphql-0.236.2.dist-info/METADATA,sha256=FwItEhdLmHf_nC9kB_rc4O95eHbtRIsHj-b4X7OSi5E,7821
253
+ strawberry_graphql-0.236.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
254
+ strawberry_graphql-0.236.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
255
+ strawberry_graphql-0.236.2.dist-info/RECORD,,