strawberry-graphql 0.274.0__py3-none-any.whl → 0.274.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.
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.274.0
3
+ Version: 0.274.1
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
@@ -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.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
236
+ strawberry_graphql-0.274.1.dist-info/METADATA,sha256=dlqg7FwnCWKp0jQHBq0qi2IiZJALsgpEIed6YMuhneg,7444
237
+ strawberry_graphql-0.274.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
238
+ strawberry_graphql-0.274.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
239
+ strawberry_graphql-0.274.1.dist-info/RECORD,,