strawberry-graphql 0.274.0__py3-none-any.whl → 0.274.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.
strawberry/annotation.py CHANGED
@@ -145,10 +145,8 @@ class StrawberryAnnotation:
145
145
  return evaled_type
146
146
  if self._is_list(evaled_type):
147
147
  return self.create_list(evaled_type)
148
- if type_of := self._get_maybe_type(evaled_type):
149
- return StrawberryMaybe(
150
- of_type=type_of,
151
- )
148
+ if self._is_maybe(evaled_type):
149
+ return self.create_maybe(evaled_type)
152
150
 
153
151
  if self._is_graphql_generic(evaled_type):
154
152
  if any(is_type_var(type_) for type_ in get_args(evaled_type)):
@@ -224,6 +222,17 @@ class StrawberryAnnotation:
224
222
 
225
223
  return StrawberryOptional(of_type)
226
224
 
225
+ def create_maybe(self, evaled_type: Any) -> StrawberryMaybe:
226
+ # we expect a single arg to the evaled type,
227
+ # as unions on input types are not supported
228
+ # and maybe[t] already represents t | None
229
+ inner_type = get_args(evaled_type)[0]
230
+
231
+ of_type = StrawberryAnnotation(
232
+ annotation=inner_type, namespace=self.namespace
233
+ ).resolve()
234
+ return StrawberryMaybe(of_type)
235
+
227
236
  def create_type_var(self, evaled_type: TypeVar) -> StrawberryTypeVar:
228
237
  return StrawberryTypeVar(evaled_type)
229
238
 
@@ -320,8 +329,8 @@ class StrawberryAnnotation:
320
329
  )
321
330
 
322
331
  @classmethod
323
- def _get_maybe_type(cls, annotation: Any) -> type | None:
324
- return get_args(annotation)[0] if _annotation_is_maybe(annotation) else None
332
+ def _is_maybe(cls, annotation: Any) -> bool:
333
+ return _annotation_is_maybe(annotation)
325
334
 
326
335
  @classmethod
327
336
  def _is_strawberry_type(cls, evaled_type: Any) -> bool:
@@ -412,6 +412,7 @@ class Schema(BaseSchema):
412
412
  context_value: Optional[Any] = None,
413
413
  root_value: Optional[Any] = None,
414
414
  operation_name: Optional[str] = None,
415
+ operation_extensions: Optional[dict[str, Any]] = None,
415
416
  ) -> ExecutionContext:
416
417
  return ExecutionContext(
417
418
  query=query,
@@ -421,6 +422,7 @@ class Schema(BaseSchema):
421
422
  root_value=root_value,
422
423
  variables=variable_values,
423
424
  provided_operation_name=operation_name,
425
+ operation_extensions=operation_extensions,
424
426
  )
425
427
 
426
428
  @lru_cache
@@ -554,6 +556,7 @@ class Schema(BaseSchema):
554
556
  context_value=context_value,
555
557
  root_value=root_value,
556
558
  operation_name=operation_name,
559
+ operation_extensions=operation_extensions,
557
560
  )
558
561
  extensions = self.get_extensions()
559
562
  # TODO (#3571): remove this when we implement execution context as parameter.
@@ -646,6 +649,7 @@ class Schema(BaseSchema):
646
649
  context_value=context_value,
647
650
  root_value=root_value,
648
651
  operation_name=operation_name,
652
+ operation_extensions=operation_extensions,
649
653
  )
650
654
  extensions = self._sync_extensions
651
655
  # TODO (#3571): remove this when we implement execution context as parameter.
@@ -52,6 +52,8 @@ class ExecutionContext:
52
52
  result: Optional[GraphQLExecutionResult] = None
53
53
  extensions_results: dict[str, Any] = dataclasses.field(default_factory=dict)
54
54
 
55
+ operation_extensions: Optional[dict[str, Any]] = None
56
+
55
57
  def __post_init__(self, provided_operation_name: str | None) -> None:
56
58
  self._provided_operation_name = provided_operation_name
57
59
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.274.0
3
+ Version: 0.274.2
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
@@ -4,7 +4,7 @@ strawberry/aiohttp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
4
4
  strawberry/aiohttp/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
5
5
  strawberry/aiohttp/test/client.py,sha256=8FKZTnvawxYpgEICOri-34O3wHRHLhRpjH_Ktp2EupQ,1801
6
6
  strawberry/aiohttp/views.py,sha256=ffVZtxpjh7vs3VbqE6AkLTh0peEO9i9I484D_TJEuKc,7904
7
- strawberry/annotation.py,sha256=iqSXtJ4pTTLDZRPyil0f-yzpcCm8UYRiwvFWkD5LgpQ,13498
7
+ strawberry/annotation.py,sha256=FS-5IIEhFit79QIQyWebaScO9kFZYY_jKOLKCXBhXrw,13828
8
8
  strawberry/asgi/__init__.py,sha256=psdKl_52LGkxKKbzZlmwNGZ9jz2FLyLSC7fUhys4FqY,8169
9
9
  strawberry/asgi/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
10
10
  strawberry/asgi/test/client.py,sha256=kp2O5znHWuAB5VVYO8p4XPSTEDDXBSjNz5WHqW0r6GM,1473
@@ -170,7 +170,7 @@ strawberry/schema/compat.py,sha256=xNpOEDfi-MODpplMGaKuKeQIVcr-tcAaKaU3TlBc1Zs,1
170
170
  strawberry/schema/config.py,sha256=6d2MPrAgq97-7aze555dRcB3yw-aeUexYMP3KVN22c0,1024
171
171
  strawberry/schema/exceptions.py,sha256=8gsMxxFDynMvRkUDuVL9Wwxk_zsmo6QoJ2l4NPxd64M,1137
172
172
  strawberry/schema/name_converter.py,sha256=xFOXEgqldFkxXRkIQvsJN1dPkWbEUaIrTYNOMYSEVwQ,6945
173
- strawberry/schema/schema.py,sha256=dnmSxoNdlrT02mca32Crtl0F55eweIqE-VOC77kuGjE,37723
173
+ strawberry/schema/schema.py,sha256=-dVGJfOAyq-w2lpEbzCaiRNPMH68nirv-Q6gZ4aW0UU,37951
174
174
  strawberry/schema/schema_converter.py,sha256=vxFghA8c4vPLx0XM07gjIbWqMWUnaognzmsuCWTSkTk,39112
175
175
  strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
176
176
  strawberry/schema/types/base_scalars.py,sha256=JRUq0WjEkR9dFewstZnqnZKp0uOEipo4UXNF5dzRf4M,1971
@@ -203,7 +203,7 @@ strawberry/types/auto.py,sha256=WZ2cQAI8nREUigBzpzFqIKGjJ_C2VqpAPNe8vPjTciM,3007
203
203
  strawberry/types/base.py,sha256=Bfa-5Wen8qR7m6tlSMRRGlGE-chRGMHjQMopfNdbbrk,15197
204
204
  strawberry/types/cast.py,sha256=fx86MkLW77GIximBAwUk5vZxSGwDqUA6XicXvz8EXwQ,916
205
205
  strawberry/types/enum.py,sha256=IcCz0FLswJtDC_bU8aG1cjreawcqHywAzzVRBZUSAqs,6229
206
- strawberry/types/execution.py,sha256=m27VlmvaRLQsMnWWymxMMPOlaf0lUge4ZXea_OsoH2k,3761
206
+ strawberry/types/execution.py,sha256=kW5rgkWP98oysJWNc_fcxyO1PZ36NJpPTPZpZP2ZXYk,3820
207
207
  strawberry/types/field.py,sha256=vxb7JvkHfRmDCYsjhDmVnO2lMbtSOteQm3jQUeSFu6g,21605
208
208
  strawberry/types/fields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
209
209
  strawberry/types/fields/resolver.py,sha256=b6lxfw6AMOUFWm7vs7a9KzNkpR8b_S110DoIosrrWDQ,14679
@@ -232,8 +232,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
232
232
  strawberry/utils/operation.py,sha256=ZgVOw3K2jQuLjNOYUHauF7itJD0QDNoPw9PBi0IYf6k,1234
233
233
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
234
234
  strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
235
- strawberry_graphql-0.274.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
236
- strawberry_graphql-0.274.0.dist-info/METADATA,sha256=Qi_EBzRuPvmFcfFTQWmxWId7EoPQVqlgJusjp9345kk,7444
237
- strawberry_graphql-0.274.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
238
- strawberry_graphql-0.274.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
239
- strawberry_graphql-0.274.0.dist-info/RECORD,,
235
+ strawberry_graphql-0.274.2.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
236
+ strawberry_graphql-0.274.2.dist-info/METADATA,sha256=wiQIHSo_eBtZMKje2nrJOi6pDCfyovgEXL8bECIeefI,7444
237
+ strawberry_graphql-0.274.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
238
+ strawberry_graphql-0.274.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
239
+ strawberry_graphql-0.274.2.dist-info/RECORD,,