strawberry-graphql 0.276.0.dev1750672223__py3-none-any.whl → 0.276.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/__init__.py CHANGED
@@ -11,7 +11,6 @@ from .permission import BasePermission
11
11
  from .scalars import ID
12
12
  from .schema import Schema
13
13
  from .schema_directive import schema_directive
14
- from .streamable import Streamable
15
14
  from .types.arguments import argument
16
15
  from .types.auto import auto
17
16
  from .types.cast import cast
@@ -38,7 +37,6 @@ __all__ = [
38
37
  "Private",
39
38
  "Schema",
40
39
  "Some",
41
- "Streamable",
42
40
  "argument",
43
41
  "asdict",
44
42
  "auto",
strawberry/annotation.py CHANGED
@@ -17,7 +17,6 @@ from typing import (
17
17
  )
18
18
  from typing_extensions import Self, get_args, get_origin
19
19
 
20
- from strawberry.streamable import StrawberryStreamable
21
20
  from strawberry.types.base import (
22
21
  StrawberryList,
23
22
  StrawberryMaybe,
@@ -144,8 +143,6 @@ class StrawberryAnnotation:
144
143
 
145
144
  if self._is_lazy_type(evaled_type):
146
145
  return evaled_type
147
- if self._is_streamable(evaled_type, args):
148
- return self.create_list(list[evaled_type])
149
146
  if self._is_list(evaled_type):
150
147
  return self.create_list(evaled_type)
151
148
  if self._is_maybe(evaled_type):
@@ -335,10 +332,6 @@ class StrawberryAnnotation:
335
332
  def _is_maybe(cls, annotation: Any) -> bool:
336
333
  return _annotation_is_maybe(annotation)
337
334
 
338
- @classmethod
339
- def _is_streamable(cls, annotation: Any, args: list[Any]) -> bool:
340
- return any(isinstance(arg, StrawberryStreamable) for arg in args)
341
-
342
335
  @classmethod
343
336
  def _is_strawberry_type(cls, evaled_type: Any) -> bool:
344
337
  # Prevent import cycles
@@ -1,15 +1,15 @@
1
1
  try:
2
2
  from .app import app
3
- from .commands.codegen import codegen as codegen # noqa: PLC0414
4
- from .commands.export_schema import export_schema as export_schema # noqa: PLC0414
3
+ from .commands.codegen import codegen as codegen
4
+ from .commands.export_schema import export_schema as export_schema
5
5
  from .commands.locate_definition import (
6
- locate_definition as locate_definition, # noqa: PLC0414
6
+ locate_definition as locate_definition,
7
7
  )
8
8
  from .commands.schema_codegen import (
9
- schema_codegen as schema_codegen, # noqa: PLC0414
9
+ schema_codegen as schema_codegen,
10
10
  )
11
- from .commands.server import server as server # noqa: PLC0414
12
- from .commands.upgrade import upgrade as upgrade # noqa: PLC0414
11
+ from .commands.server import server as server
12
+ from .commands.upgrade import upgrade as upgrade
13
13
 
14
14
  def run() -> None:
15
15
  app()
@@ -1,13 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
- from typing import Any, Optional
4
+ from typing import TYPE_CHECKING, Any, Optional
5
5
  from typing_extensions import Literal, TypedDict
6
6
 
7
- from strawberry.schema._graphql_core import (
8
- GraphQLIncrementalExecutionResults,
9
- ResultType,
10
- )
7
+ if TYPE_CHECKING:
8
+ from strawberry.types import ExecutionResult
11
9
 
12
10
 
13
11
  class GraphQLHTTPResponse(TypedDict, total=False):
@@ -16,16 +14,13 @@ class GraphQLHTTPResponse(TypedDict, total=False):
16
14
  extensions: Optional[dict[str, object]]
17
15
 
18
16
 
19
- def process_result(result: ResultType) -> GraphQLHTTPResponse:
20
- if isinstance(result, GraphQLIncrementalExecutionResults):
21
- return result
17
+ def process_result(result: ExecutionResult) -> GraphQLHTTPResponse:
18
+ data: GraphQLHTTPResponse = {"data": result.data}
22
19
 
23
- errors, extensions = result.errors, result.extensions
24
- data: GraphQLHTTPResponse = {
25
- "data": result.data,
26
- **({"errors": [err.formatted for err in errors]} if errors else {}),
27
- **({"extensions": extensions} if extensions else {}),
28
- }
20
+ if result.errors:
21
+ data["errors"] = [err.formatted for err in result.errors]
22
+ if result.extensions:
23
+ data["extensions"] = result.extensions
29
24
 
30
25
  return data
31
26
 
@@ -25,9 +25,6 @@ from strawberry.http import (
25
25
  process_result,
26
26
  )
27
27
  from strawberry.http.ides import GraphQL_IDE
28
- from strawberry.schema._graphql_core import (
29
- GraphQLIncrementalExecutionResults,
30
- )
31
28
  from strawberry.schema.base import BaseSchema
32
29
  from strawberry.schema.exceptions import (
33
30
  CannotGetOperationTypeError,
@@ -201,8 +198,6 @@ class AsyncBaseHTTPView(
201
198
  if not self.allow_queries_via_get and request_adapter.method == "GET":
202
199
  allowed_operation_types = allowed_operation_types - {OperationType.QUERY}
203
200
 
204
- assert self.schema
205
-
206
201
  if request_data.protocol == "multipart-subscription":
207
202
  return await self.schema.subscribe(
208
203
  request_data.query, # type: ignore
@@ -266,7 +261,7 @@ class AsyncBaseHTTPView(
266
261
  root_value: Optional[RootValue] = UNSET,
267
262
  ) -> WebSocketResponse: ...
268
263
 
269
- async def run( # noqa: PLR0915
264
+ async def run(
270
265
  self,
271
266
  request: Union[Request, WebSocketRequest],
272
267
  context: Context = UNSET,
@@ -294,7 +289,7 @@ class AsyncBaseHTTPView(
294
289
  view=self,
295
290
  websocket=websocket,
296
291
  context=context,
297
- root_value=root_value, # type: ignore
292
+ root_value=root_value,
298
293
  schema=self.schema,
299
294
  debug=self.debug,
300
295
  connection_init_wait_timeout=self.connection_init_wait_timeout,
@@ -304,7 +299,7 @@ class AsyncBaseHTTPView(
304
299
  view=self,
305
300
  websocket=websocket,
306
301
  context=context,
307
- root_value=root_value, # type: ignore
302
+ root_value=root_value,
308
303
  schema=self.schema,
309
304
  debug=self.debug,
310
305
  keep_alive=self.keep_alive,
@@ -357,75 +352,6 @@ class AsyncBaseHTTPView(
357
352
  "Content-Type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
358
353
  },
359
354
  )
360
- if isinstance(result, GraphQLIncrementalExecutionResults):
361
-
362
- async def stream() -> AsyncGenerator[str, None]:
363
- yield "---"
364
-
365
- response = await self.process_result(request, result.initial_result)
366
-
367
- response["hasNext"] = result.initial_result.has_next
368
- response["pending"] = [
369
- p.formatted for p in result.initial_result.pending
370
- ]
371
- response["extensions"] = result.initial_result.extensions
372
-
373
- yield self.encode_multipart_data(response, "-")
374
-
375
- all_pending = result.initial_result.pending
376
-
377
- async for value in result.subsequent_results:
378
- response = {
379
- "hasNext": value.has_next,
380
- "extensions": value.extensions,
381
- }
382
-
383
- if value.pending:
384
- response["pending"] = [p.formatted for p in value.pending]
385
-
386
- if value.completed:
387
- response["completed"] = [p.formatted for p in value.completed]
388
-
389
- if value.incremental:
390
- incremental = []
391
-
392
- all_pending.extend(value.pending)
393
-
394
- for incremental_value in value.incremental:
395
- pending_value = next(
396
- (
397
- v
398
- for v in all_pending
399
- if v.id == incremental_value.id
400
- ),
401
- None,
402
- )
403
-
404
- assert pending_value
405
-
406
- incremental.append(
407
- {
408
- **incremental_value.formatted,
409
- "path": pending_value.path,
410
- "label": pending_value.label,
411
- }
412
- )
413
-
414
- response["incremental"] = incremental
415
-
416
- yield self.encode_multipart_data(response, "-")
417
-
418
- yield "--\r\n"
419
-
420
- return await self.create_streaming_response(
421
- request,
422
- stream,
423
- sub_response,
424
- headers={
425
- "Transfer-Encoding": "chunked",
426
- "Content-Type": 'multipart/mixed; boundary="-"',
427
- },
428
- )
429
355
 
430
356
  response_data = await self.process_result(request=request, result=result)
431
357
 
@@ -437,16 +363,12 @@ class AsyncBaseHTTPView(
437
363
  )
438
364
 
439
365
  def encode_multipart_data(self, data: Any, separator: str) -> str:
440
- encoded_data = self.encode_json(data)
441
-
442
366
  return "".join(
443
367
  [
444
- "\r\n",
445
- "Content-Type: application/json; charset=utf-8\r\n",
446
- "Content-Length: " + str(len(encoded_data)) + "\r\n",
447
- "\r\n",
448
- encoded_data,
449
- f"\r\n--{separator}",
368
+ f"\r\n--{separator}\r\n",
369
+ "Content-Type: application/json\r\n\r\n",
370
+ self.encode_json(data),
371
+ "\n",
450
372
  ]
451
373
  )
452
374
 
@@ -605,11 +527,32 @@ class AsyncBaseHTTPView(
605
527
  else:
606
528
  raise HTTPException(400, "Unsupported content type")
607
529
 
530
+ query = data.get("query")
531
+ if not isinstance(query, (str, type(None))):
532
+ raise HTTPException(
533
+ 400,
534
+ "The GraphQL operation's `query` must be a string or null, if provided.",
535
+ )
536
+
537
+ variables = data.get("variables")
538
+ if not isinstance(variables, (dict, type(None))):
539
+ raise HTTPException(
540
+ 400,
541
+ "The GraphQL operation's `variables` must be an object or null, if provided.",
542
+ )
543
+
544
+ extensions = data.get("extensions")
545
+ if not isinstance(extensions, (dict, type(None))):
546
+ raise HTTPException(
547
+ 400,
548
+ "The GraphQL operation's `extensions` must be an object or null, if provided.",
549
+ )
550
+
608
551
  return GraphQLRequestData(
609
- query=data.get("query"),
610
- variables=data.get("variables"),
552
+ query=query,
553
+ variables=variables,
611
554
  operation_name=data.get("operationName"),
612
- extensions=data.get("extensions"),
555
+ extensions=extensions,
613
556
  protocol=protocol,
614
557
  )
615
558
 
@@ -116,8 +116,6 @@ class SyncBaseHTTPView(
116
116
  if not self.allow_queries_via_get and request_adapter.method == "GET":
117
117
  allowed_operation_types = allowed_operation_types - {OperationType.QUERY}
118
118
 
119
- assert self.schema
120
-
121
119
  return self.schema.execute_sync(
122
120
  request_data.query,
123
121
  root_value=root_value,
@@ -154,11 +152,32 @@ class SyncBaseHTTPView(
154
152
  else:
155
153
  raise HTTPException(400, "Unsupported content type")
156
154
 
155
+ query = data.get("query")
156
+ if not isinstance(query, (str, type(None))):
157
+ raise HTTPException(
158
+ 400,
159
+ "The GraphQL operation's `query` must be a string or null, if provided.",
160
+ )
161
+
162
+ variables = data.get("variables")
163
+ if not isinstance(variables, (dict, type(None))):
164
+ raise HTTPException(
165
+ 400,
166
+ "The GraphQL operation's `variables` must be an object or null, if provided.",
167
+ )
168
+
169
+ extensions = data.get("extensions")
170
+ if not isinstance(extensions, (dict, type(None))):
171
+ raise HTTPException(
172
+ 400,
173
+ "The GraphQL operation's `extensions` must be an object or null, if provided.",
174
+ )
175
+
157
176
  return GraphQLRequestData(
158
- query=data.get("query"),
159
- variables=data.get("variables"),
177
+ query=query,
178
+ variables=variables,
160
179
  operation_name=data.get("operationName"),
161
- extensions=data.get("extensions"),
180
+ extensions=extensions,
162
181
  )
163
182
 
164
183
  def _handle_errors(
@@ -561,9 +561,9 @@ def print_schema_definition(
561
561
  def print_directive(
562
562
  directive: GraphQLDirective, *, schema: BaseSchema
563
563
  ) -> Optional[str]:
564
- strawberry_directive = directive.extensions.get("strawberry-definition")
564
+ strawberry_directive = directive.extensions["strawberry-definition"]
565
565
 
566
- if strawberry_directive is None or (
566
+ if (
567
567
  isinstance(strawberry_directive, StrawberrySchemaDirective)
568
568
  and not strawberry_directive.print_definition
569
569
  ):
@@ -621,14 +621,6 @@ def print_schema(schema: BaseSchema) -> str:
621
621
  if (printed_directive := print_directive(directive, schema=schema)) is not None
622
622
  ]
623
623
 
624
- if schema.config.enable_experimental_incremental_execution:
625
- directives.append(
626
- "directive @defer(if: Boolean, label: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT"
627
- )
628
- directives.append(
629
- "directive @stream(if: Boolean, label: String, initialCount: Int = 0) on FIELD"
630
- )
631
-
632
624
  def _name_getter(type_: Any) -> str:
633
625
  if hasattr(type_, "name"):
634
626
  return type_.name
@@ -261,7 +261,12 @@ class ConnectionExtension(FieldExtension):
261
261
  if isinstance(f_type, StrawberryOptional):
262
262
  f_type = f_type.of_type
263
263
 
264
+ if isinstance(f_type, LazyType):
265
+ f_type = f_type.resolve_type()
266
+
264
267
  type_origin = get_origin(f_type) if is_generic_alias(f_type) else f_type
268
+ if isinstance(type_origin, LazyType):
269
+ type_origin = type_origin.resolve_type()
265
270
 
266
271
  if not isinstance(type_origin, type) or not issubclass(type_origin, Connection):
267
272
  raise RelayWrongAnnotationError(field.name, cast("type", field.origin))
@@ -17,7 +17,6 @@ class StrawberryConfig:
17
17
  relay_use_legacy_global_id: bool = False
18
18
  disable_field_suggestions: bool = False
19
19
  info_class: type[Info] = Info
20
- enable_experimental_incremental_execution: bool = False
21
20
  _unsafe_disable_same_type_validation: bool = False
22
21
 
23
22
  def __post_init__(
@@ -150,8 +150,9 @@ class NameConverter:
150
150
  type_ = eval_type(type_)
151
151
 
152
152
  if isinstance(type_, LazyType):
153
- name = type_.type_name
154
- elif isinstance(type_, EnumDefinition):
153
+ type_ = type_.resolve_type()
154
+
155
+ if isinstance(type_, EnumDefinition):
155
156
  name = type_.name
156
157
  elif isinstance(type_, StrawberryUnion):
157
158
  name = type_.graphql_name if type_.graphql_name else self.from_union(type_)
@@ -15,6 +15,7 @@ from typing import (
15
15
  cast,
16
16
  )
17
17
 
18
+ from graphql import ExecutionContext as GraphQLExecutionContext
18
19
  from graphql import ExecutionResult as GraphQLExecutionResult
19
20
  from graphql import (
20
21
  ExecutionResult as OriginalExecutionResult,
@@ -35,6 +36,7 @@ from graphql import (
35
36
  parse,
36
37
  validate_schema,
37
38
  )
39
+ from graphql.execution import execute, subscribe
38
40
  from graphql.execution.middleware import MiddlewareManager
39
41
  from graphql.type.directives import specified_directives
40
42
  from graphql.validation import validate
@@ -67,15 +69,6 @@ from strawberry.utils.aio import aclosing
67
69
  from strawberry.utils.await_maybe import await_maybe
68
70
 
69
71
  from . import compat
70
- from ._graphql_core import (
71
- GraphQLExecutionContext,
72
- GraphQLIncrementalExecutionResults,
73
- ResultType,
74
- execute,
75
- experimental_execute_incrementally,
76
- incremental_execution_directives,
77
- subscribe,
78
- )
79
72
  from .base import BaseSchema
80
73
  from .config import StrawberryConfig
81
74
  from .exceptions import CannotGetOperationTypeError, InvalidOperationTypeError
@@ -106,7 +99,6 @@ OriginSubscriptionResult = Union[
106
99
  AsyncIterator[OriginalExecutionResult],
107
100
  ]
108
101
 
109
-
110
102
  DEFAULT_ALLOWED_OPERATION_TYPES = {
111
103
  OperationType.QUERY,
112
104
  OperationType.MUTATION,
@@ -329,16 +321,11 @@ class Schema(BaseSchema):
329
321
  graphql_types.append(graphql_type)
330
322
 
331
323
  try:
332
- directives = specified_directives + tuple(graphql_directives)
333
-
334
- if self.config.enable_experimental_incremental_execution:
335
- directives = tuple(directives) + tuple(incremental_execution_directives)
336
-
337
324
  self._schema = GraphQLSchema(
338
325
  query=query_type,
339
326
  mutation=mutation_type,
340
327
  subscription=subscription_type if subscription else None,
341
- directives=directives,
328
+ directives=specified_directives + tuple(graphql_directives),
342
329
  types=graphql_types,
343
330
  extensions={
344
331
  GraphQLCoreConverter.DEFINITION_BACKREF: self,
@@ -531,16 +518,12 @@ class Schema(BaseSchema):
531
518
  async def _handle_execution_result(
532
519
  self,
533
520
  context: ExecutionContext,
534
- result: ResultType,
521
+ result: Union[GraphQLExecutionResult, ExecutionResult],
535
522
  extensions_runner: SchemaExtensionsRunner,
536
523
  *,
537
524
  # TODO: can we remove this somehow, see comment in execute
538
525
  skip_process_errors: bool = False,
539
526
  ) -> ExecutionResult:
540
- # TODO: handle this, also, why do we have both GraphQLExecutionResult and ExecutionResult?
541
- if isinstance(result, GraphQLIncrementalExecutionResults):
542
- return result
543
-
544
527
  # Set errors on the context so that it's easier
545
528
  # to access in extensions
546
529
  if result.errors:
@@ -583,17 +566,6 @@ class Schema(BaseSchema):
583
566
  extensions_runner = self.create_extensions_runner(execution_context, extensions)
584
567
  middleware_manager = self._get_middleware_manager(extensions)
585
568
 
586
- execute_function = execute
587
-
588
- if self.config.enable_experimental_incremental_execution:
589
- execute_function = experimental_execute_incrementally
590
-
591
- if execute_function is None:
592
- raise RuntimeError(
593
- "Incremental execution is enabled but experimental_execute_incrementally is not available, "
594
- "please install graphql-core>=3.3.0"
595
- )
596
-
597
569
  custom_context_kwargs = self._get_custom_context_kwargs(operation_extensions)
598
570
 
599
571
  try:
@@ -614,7 +586,7 @@ class Schema(BaseSchema):
614
586
  async with extensions_runner.executing():
615
587
  if not execution_context.result:
616
588
  result = await await_maybe(
617
- execute_function(
589
+ execute(
618
590
  self._schema,
619
591
  execution_context.graphql_document,
620
592
  root_value=execution_context.root_value,
@@ -631,9 +603,7 @@ class Schema(BaseSchema):
631
603
  result = execution_context.result
632
604
  # Also set errors on the execution_context so that it's easier
633
605
  # to access in extensions
634
-
635
- # TODO: maybe here use the first result from incremental execution if it exists
636
- if isinstance(result, GraphQLExecutionResult) and result.errors:
606
+ if result.errors:
637
607
  execution_context.errors = result.errors
638
608
 
639
609
  # Run the `Schema.process_errors` function here before
@@ -689,16 +659,6 @@ class Schema(BaseSchema):
689
659
  extensions_runner = self.create_extensions_runner(execution_context, extensions)
690
660
  middleware_manager = self._get_middleware_manager(extensions)
691
661
 
692
- execute_function = execute
693
-
694
- if self.config.enable_experimental_incremental_execution:
695
- execute_function = experimental_execute_incrementally
696
-
697
- if execute_function is None:
698
- raise RuntimeError(
699
- "Incremental execution is enabled but experimental_execute_incrementally is not available, "
700
- "please install graphql-core>=3.3.0"
701
- )
702
662
  custom_context_kwargs = self._get_custom_context_kwargs(operation_extensions)
703
663
 
704
664
  try:
@@ -749,7 +709,7 @@ class Schema(BaseSchema):
749
709
 
750
710
  with extensions_runner.executing():
751
711
  if not execution_context.result:
752
- result = execute_function(
712
+ result = execute(
753
713
  self._schema,
754
714
  execution_context.graphql_document,
755
715
  root_value=execution_context.root_value,
@@ -1003,43 +1003,11 @@ class GraphQLCoreConverter:
1003
1003
  first_type_definition = cached_type.definition
1004
1004
  second_type_definition = type_definition
1005
1005
 
1006
- # TODO: maybe move this on the StrawberryType class
1007
- if (
1008
- isinstance(first_type_definition, StrawberryObjectDefinition)
1009
- and isinstance(second_type_definition, StrawberryObjectDefinition)
1010
- and first_type_definition.concrete_of is not None
1011
- and first_type_definition.concrete_of == second_type_definition.concrete_of
1012
- and (
1013
- first_type_definition.type_var_map.keys()
1014
- == second_type_definition.type_var_map.keys()
1015
- )
1006
+ if self.is_same_type_definition(
1007
+ first_type_definition,
1008
+ second_type_definition,
1016
1009
  ):
1017
- # manually compare type_var_maps while resolving any lazy types
1018
- # so that they're considered equal to the actual types they're referencing
1019
- equal = True
1020
- for type_var, type1 in first_type_definition.type_var_map.items():
1021
- type2 = second_type_definition.type_var_map[type_var]
1022
- # both lazy types are always resolved because two different lazy types
1023
- # may be referencing the same actual type
1024
- if isinstance(type1, LazyType):
1025
- type1 = type1.resolve_type() # noqa: PLW2901
1026
- elif isinstance(type1, StrawberryOptional) and isinstance(
1027
- type1.of_type, LazyType
1028
- ):
1029
- type1.of_type = type1.of_type.resolve_type()
1030
-
1031
- if isinstance(type2, LazyType):
1032
- type2 = type2.resolve_type()
1033
- elif isinstance(type2, StrawberryOptional) and isinstance(
1034
- type2.of_type, LazyType
1035
- ):
1036
- type2.of_type = type2.of_type.resolve_type()
1037
-
1038
- if type1 != type2:
1039
- equal = False
1040
- break
1041
- if equal:
1042
- return
1010
+ return
1043
1011
 
1044
1012
  if isinstance(second_type_definition, StrawberryObjectDefinition):
1045
1013
  first_origin = second_type_definition.origin
@@ -1057,5 +1025,63 @@ class GraphQLCoreConverter:
1057
1025
 
1058
1026
  raise DuplicatedTypeName(first_origin, second_origin, name)
1059
1027
 
1028
+ def is_same_type_definition(
1029
+ self,
1030
+ first_type_definition: StrawberryObjectDefinition | StrawberryType,
1031
+ second_type_definition: StrawberryObjectDefinition | StrawberryType,
1032
+ ) -> bool:
1033
+ # TODO: maybe move this on the StrawberryType class
1034
+ if (
1035
+ not isinstance(first_type_definition, StrawberryObjectDefinition)
1036
+ or not isinstance(second_type_definition, StrawberryObjectDefinition)
1037
+ or first_type_definition.concrete_of is None
1038
+ or first_type_definition.concrete_of != second_type_definition.concrete_of
1039
+ or (
1040
+ first_type_definition.type_var_map.keys()
1041
+ != second_type_definition.type_var_map.keys()
1042
+ )
1043
+ ):
1044
+ return False
1045
+
1046
+ # manually compare type_var_maps while resolving any lazy types
1047
+ # so that they're considered equal to the actual types they're referencing
1048
+ for type_var, type1 in first_type_definition.type_var_map.items():
1049
+ type2 = second_type_definition.type_var_map[type_var]
1050
+
1051
+ # both lazy types are always resolved because two different lazy types
1052
+ # may be referencing the same actual type
1053
+ if isinstance(type1, LazyType):
1054
+ type1 = type1.resolve_type() # noqa: PLW2901
1055
+ elif isinstance(type1, StrawberryOptional) and isinstance(
1056
+ type1.of_type, LazyType
1057
+ ):
1058
+ type1.of_type = type1.of_type.resolve_type()
1059
+
1060
+ if isinstance(type2, LazyType):
1061
+ type2 = type2.resolve_type()
1062
+ elif isinstance(type2, StrawberryOptional) and isinstance(
1063
+ type2.of_type, LazyType
1064
+ ):
1065
+ type2.of_type = type2.of_type.resolve_type()
1066
+
1067
+ same_type = type1 == type2
1068
+ # If both types have object definitions, we are handling a nested generic
1069
+ # type like `Foo[Foo[int]]`, meaning we need to compare their type definitions
1070
+ # as they will actually be different instances of the type
1071
+ if (
1072
+ not same_type
1073
+ and has_object_definition(type1)
1074
+ and has_object_definition(type2)
1075
+ ):
1076
+ same_type = self.is_same_type_definition(
1077
+ type1.__strawberry_definition__,
1078
+ type2.__strawberry_definition__,
1079
+ )
1080
+
1081
+ if not same_type:
1082
+ return False
1083
+
1084
+ return True
1085
+
1060
1086
 
1061
1087
  __all__ = ["GraphQLCoreConverter"]
@@ -1,4 +1,4 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
4
  <title>Strawberry GraphiQL</title>
@@ -61,8 +61,8 @@
61
61
  <link
62
62
  crossorigin
63
63
  rel="stylesheet"
64
- href="https://unpkg.com/graphiql@3.8.3/graphiql.min.css"
65
- integrity="sha384-Mq3vbRBY71jfjQAt/DcjxUIYY33ksal4cgdRt9U/hNPvHBCaT2JfJ/PTRiPKf0aM"
64
+ href="https://unpkg.com/graphiql@3.0.9/graphiql.min.css"
65
+ integrity="sha384-yz3/sqpuplkA7msMo0FE4ekg0xdwdvZ8JX9MVZREsxipqjU4h8IRfmAMRcb1QpUy"
66
66
  />
67
67
 
68
68
  <link
@@ -77,8 +77,8 @@
77
77
  <div id="graphiql" class="graphiql-container">Loading...</div>
78
78
  <script
79
79
  crossorigin
80
- src="https://unpkg.com/graphiql@3.8.3/graphiql.min.js"
81
- integrity="sha384-HbRVEFG0JGJZeAHCJ9Xm2+tpknBQ7QZmNlO/DgZtkZ0aJSypT96YYGRNod99l9Ie"
80
+ src="https://unpkg.com/graphiql@3.0.9/graphiql.min.js"
81
+ integrity="sha384-Mjte+vxCWz1ZYCzszGHiJqJa5eAxiqI4mc3BErq7eDXnt+UGLXSEW7+i0wmfPiji"
82
82
  ></script>
83
83
  <script
84
84
  crossorigin
@@ -53,7 +53,7 @@ class BaseGraphQLTransportWSHandler(Generic[Context, RootValue]):
53
53
  view: AsyncBaseHTTPView[Any, Any, Any, Any, Any, Context, RootValue],
54
54
  websocket: AsyncWebSocketAdapter,
55
55
  context: Context,
56
- root_value: RootValue,
56
+ root_value: Optional[RootValue],
57
57
  schema: BaseSchema,
58
58
  debug: bool,
59
59
  connection_init_wait_timeout: timedelta,
@@ -42,7 +42,7 @@ class BaseGraphQLWSHandler(Generic[Context, RootValue]):
42
42
  view: AsyncBaseHTTPView[Any, Any, Any, Any, Any, Context, RootValue],
43
43
  websocket: AsyncWebSocketAdapter,
44
44
  context: Context,
45
- root_value: RootValue,
45
+ root_value: Optional[RootValue],
46
46
  schema: BaseSchema,
47
47
  debug: bool,
48
48
  keep_alive: bool,
@@ -144,12 +144,52 @@ class StrawberryArgument:
144
144
  return isinstance(self.type, StrawberryMaybe)
145
145
 
146
146
 
147
+ def _is_leaf_type(
148
+ type_: Union[StrawberryType, type],
149
+ scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
150
+ skip_classes: tuple[type, ...] = (),
151
+ ) -> bool:
152
+ if type_ in skip_classes:
153
+ return False
154
+
155
+ if is_scalar(type_, scalar_registry):
156
+ return True
157
+
158
+ if isinstance(type_, EnumDefinition):
159
+ return True
160
+
161
+ if isinstance(type_, LazyType):
162
+ return _is_leaf_type(type_.resolve_type(), scalar_registry)
163
+
164
+ if hasattr(type_, "_enum_definition"):
165
+ enum_definition: EnumDefinition = type_._enum_definition
166
+ return _is_leaf_type(enum_definition, scalar_registry)
167
+
168
+ return False
169
+
170
+
171
+ def _is_optional_leaf_type(
172
+ type_: Union[StrawberryType, type],
173
+ scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
174
+ skip_classes: tuple[type, ...] = (),
175
+ ) -> bool:
176
+ if type_ in skip_classes:
177
+ return False
178
+
179
+ if isinstance(type_, StrawberryOptional):
180
+ return _is_leaf_type(type_.of_type, scalar_registry, skip_classes)
181
+
182
+ return False
183
+
184
+
147
185
  def convert_argument(
148
186
  value: object,
149
187
  type_: Union[StrawberryType, type],
150
188
  scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
151
189
  config: StrawberryConfig,
152
190
  ) -> object:
191
+ from strawberry.relay.types import GlobalID
192
+
153
193
  # TODO: move this somewhere else and make it first class
154
194
  if isinstance(type_, StrawberryOptional):
155
195
  res = convert_argument(value, type_.of_type, scalar_registry, config)
@@ -164,22 +204,27 @@ def convert_argument(
164
204
 
165
205
  if isinstance(type_, StrawberryList):
166
206
  value_list = cast("Iterable", value)
207
+
208
+ if _is_leaf_type(
209
+ type_.of_type, scalar_registry, skip_classes=(GlobalID,)
210
+ ) or _is_optional_leaf_type(
211
+ type_.of_type, scalar_registry, skip_classes=(GlobalID,)
212
+ ):
213
+ return value_list
214
+
215
+ value_list = cast("Iterable", value)
216
+
167
217
  return [
168
218
  convert_argument(x, type_.of_type, scalar_registry, config)
169
219
  for x in value_list
170
220
  ]
171
221
 
172
- if is_scalar(type_, scalar_registry):
173
- from strawberry.relay.types import GlobalID
174
-
222
+ if _is_leaf_type(type_, scalar_registry):
175
223
  if type_ is GlobalID:
176
224
  return GlobalID.from_id(value) # type: ignore
177
225
 
178
226
  return value
179
227
 
180
- if isinstance(type_, EnumDefinition):
181
- return value
182
-
183
228
  if isinstance(type_, LazyType):
184
229
  return convert_argument(value, type_.resolve_type(), scalar_registry, config)
185
230
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.276.0.dev1750672223
3
+ Version: 0.276.1
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
@@ -1,10 +1,10 @@
1
- strawberry/__init__.py,sha256=tavG4mNFBNHhGBoFR2T7fhiCQ7P-ITHify10nkKBOJE,1544
1
+ strawberry/__init__.py,sha256=-K---AYIgHvBVYF_9oovgEPNBbymXH673bntlV9sOeU,1491
2
2
  strawberry/__main__.py,sha256=3U77Eu21mJ-LY27RG-JEnpbh6Z63wGOom4i-EoLtUcY,59
3
3
  strawberry/aiohttp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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=EhsaD0Ms7qhHxGyS0qDbRPKxz3VUaSdsbEZKTniIjaM,7962
7
- strawberry/annotation.py,sha256=8TFyLobOmHUgkCFXTMuobNaWNJE6KZ3_2KgU2DGP-o8,14152
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
@@ -17,7 +17,7 @@ strawberry/channels/handlers/http_handler.py,sha256=L_4zekdYMcUiE_654eATETe_FJGC
17
17
  strawberry/channels/handlers/ws_handler.py,sha256=-Iao0rIuprnRmEpbxvFFyI_dR27_MeyO2iVkOv7qF00,6177
18
18
  strawberry/channels/router.py,sha256=DKIbl4zuRBhfvViUVpyu0Rf_WRT41E6uZC-Yic9Ltvo,2024
19
19
  strawberry/channels/testing.py,sha256=dc9mvSm9YdNOUgQk5ou5K4iE2h6TP5quKnk4Xdtn-IY,6558
20
- strawberry/cli/__init__.py,sha256=pSx2JFFA4-DcZnw5PW9AEoz6oImGwhFJmi-7zn6aUlo,764
20
+ strawberry/cli/__init__.py,sha256=9rqBIeRSi0P0JljMWO43KC3inm4BBf0CX5pEWQWnTos,662
21
21
  strawberry/cli/app.py,sha256=tTMBV1pdWqMcwjWO2yn-8oLDhMhfJvUzyQtWs75LWJ0,54
22
22
  strawberry/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  strawberry/cli/commands/codegen.py,sha256=WbX8uqF-dpQk1QjQm3H4AvNSZ4lIUOTSPghii3attj8,3812
@@ -134,13 +134,13 @@ strawberry/file_uploads/scalars.py,sha256=NRDeB7j8aotqIkz9r62ISTf4DrxQxEZYUuHsX5
134
134
  strawberry/file_uploads/utils.py,sha256=-c6TbqUI-Dkb96hWCrZabh6TL2OabBuQNkCarOqgDm4,1181
135
135
  strawberry/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
136
  strawberry/flask/views.py,sha256=MCvAsNgTZLU8RvTYKWfnLU2w7Wv1ZZpxW9W3TyTZuPY,6355
137
- strawberry/http/__init__.py,sha256=7UNbLWnBt0RXAjhDUIxtacRUeXiz93JNzqK3m8MRg1A,1316
138
- strawberry/http/async_base_view.py,sha256=gG__wXCQnZUIBP0ErkQm1pzXNZToA69BP0pmblOZcVc,22923
137
+ strawberry/http/__init__.py,sha256=ytAirKk7K7D5knY21tpCGeZ-sCPgwMsijL5AxmOy-94,1163
138
+ strawberry/http/async_base_view.py,sha256=N72Ym9b1z8VbzrgrMDehoKSLFUdObK4fJ1aRZRjZQ1U,20806
139
139
  strawberry/http/base.py,sha256=MiX0-RqOkhRvlfpmuvgTHp4tygbUmG8fnLc0uCrOllU,2550
140
140
  strawberry/http/exceptions.py,sha256=9E2dreS1crRoJVUEPuHyx23NcDELDHNzkAOa-rGv-8I,348
141
141
  strawberry/http/ides.py,sha256=WjU0nsMDgr3Bd1ebWkUEkO2d1hk0dI16mLqXyCHqklA,613
142
142
  strawberry/http/parse_content_type.py,sha256=CYHO8F9b9DP1gJ1xxPjc9L2GkBwsyC1O_GCEp1QOuG0,381
143
- strawberry/http/sync_base_view.py,sha256=_lYjw3uAQoYJ8QEWBWr7g6a88aM5NX8YFTFeZ5qzH88,7424
143
+ strawberry/http/sync_base_view.py,sha256=jQwNn_No3zFMkUO0HO7w1B7YFuwZiArH3SS8HJtoDLI,8138
144
144
  strawberry/http/temporal_response.py,sha256=HTt65g-YxqlPGxjqvH5bzGoU1b3CctVR-9cmCRo5dUo,196
145
145
  strawberry/http/types.py,sha256=H0wGOdCO-5tNKZM_6cAtNRwZAjoEXnAC5N0Q7b70AtU,398
146
146
  strawberry/http/typevars.py,sha256=Uu6NkKe3h7o29ZWwldq6sJy4ioSSeXODTCDRvY2hUpE,489
@@ -150,13 +150,13 @@ strawberry/parent.py,sha256=JYFp-HGCgwbH2oB4uLSiIO4cVsoPaxX6lfYmxOKPkSg,1362
150
150
  strawberry/permission.py,sha256=dSRJMjSCmTlXfvfC24kCSrAk0txTjYKTJ5ZVU5IW91Y,7537
151
151
  strawberry/printer/__init__.py,sha256=DmepjmgtkdF5RxK_7yC6qUyRWn56U-9qeZMbkztYB9w,62
152
152
  strawberry/printer/ast_from_value.py,sha256=Tkme60qlykbN2m3dNPNMOe65X-wj6EmcDQwgQv7gUkc,4987
153
- strawberry/printer/printer.py,sha256=5E9w0wDsUv1hvkeXof12277NLMiCVy5MgJ6gSo_NJhQ,19177
153
+ strawberry/printer/printer.py,sha256=49u3QwttTGvh13HXZtbTnkZzBwL1k5SLf8rXQLiTpl4,18814
154
154
  strawberry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
155
155
  strawberry/quart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
156
  strawberry/quart/views.py,sha256=f41HWnkGPuhs1NkjwHOZ0DEVnlr5nMSMr9GCxNsBxCs,7461
157
157
  strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,553
158
158
  strawberry/relay/exceptions.py,sha256=Za0iXLBGZtd1HkesGm4xTr3QOeuyiCAe1hiCCQ2HHvE,4036
159
- strawberry/relay/fields.py,sha256=wIwBTXsDimG6incMglEn7Gr7CO8H8AA25yhM8MT8I-0,18100
159
+ strawberry/relay/fields.py,sha256=eqQOH8JAWZUP52nwaYCZ_z5Jvp69_T_gx1pxjrdgV1k,18284
160
160
  strawberry/relay/types.py,sha256=u3-V7LPe_CniEmREMJyvXH9L9Ecc2CWQC5hRfUvL_Q4,30477
161
161
  strawberry/relay/utils.py,sha256=-QxroxkSYtFnMYsJyTyfIi0I1fLtjnt6siW0kLNiyfs,5908
162
162
  strawberry/resolvers.py,sha256=Vdidc3YFc4-olSQZD_xQ1icyAFbyzqs_8I3eSpMFlA4,260
@@ -166,14 +166,13 @@ strawberry/sanic/utils.py,sha256=XjUVBFuBWfECBCZbx_YtrjQnFTUyIGTo7aISIeB22Gc,100
166
166
  strawberry/sanic/views.py,sha256=F5ZrKt-R3135evKLfhQuPd1isOexI0Lrzevm_6Te4Eg,7069
167
167
  strawberry/scalars.py,sha256=CGkG8CIfurXiYhidmW3qwy6M5BF_Mhih3wAEcWx_iBU,2278
168
168
  strawberry/schema/__init__.py,sha256=u1QCyDVQExUVDA20kyosKPz3TS5HMCN2NrXclhiFAL4,92
169
- strawberry/schema/_graphql_core.py,sha256=XHsNZLkCyiH55jANK4XJIjq6VCMhN_MgZBEFWEYj5Jc,1237
170
169
  strawberry/schema/base.py,sha256=wqvEOQ_aVkfebk9SlG9zg1YXl3MlwxGZhxFRoIkAxu0,4053
171
170
  strawberry/schema/compat.py,sha256=xNpOEDfi-MODpplMGaKuKeQIVcr-tcAaKaU3TlBc1Zs,1873
172
- strawberry/schema/config.py,sha256=EQhyuKcQTOga_1Uw3nhu5SlS6lVbgsG1YZ3LOKqeztQ,1084
171
+ strawberry/schema/config.py,sha256=6d2MPrAgq97-7aze555dRcB3yw-aeUexYMP3KVN22c0,1024
173
172
  strawberry/schema/exceptions.py,sha256=8gsMxxFDynMvRkUDuVL9Wwxk_zsmo6QoJ2l4NPxd64M,1137
174
- strawberry/schema/name_converter.py,sha256=xFOXEgqldFkxXRkIQvsJN1dPkWbEUaIrTYNOMYSEVwQ,6945
175
- strawberry/schema/schema.py,sha256=KD_iqYYLYb10xAXo5yn83gtYyg1NbnV1QB5q6JUUs2k,39450
176
- strawberry/schema/schema_converter.py,sha256=nCQXylHCwWDXW3sRRlZrAaLyCna4iIj3GAy2sBp-VEA,39267
173
+ strawberry/schema/name_converter.py,sha256=JG5JKLr9wp8BMJIvG3_bVkwFdoLGbknNR1Bt75urXN0,6950
174
+ strawberry/schema/schema.py,sha256=-dVGJfOAyq-w2lpEbzCaiRNPMH68nirv-Q6gZ4aW0UU,37951
175
+ strawberry/schema/schema_converter.py,sha256=ZGkZjLsqjZ-0y5NItsECHZbOOhjJioYRT6YROwmo4Gg,40125
177
176
  strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
178
177
  strawberry/schema/types/base_scalars.py,sha256=JRUq0WjEkR9dFewstZnqnZKp0uOEipo4UXNF5dzRf4M,1971
179
178
  strawberry/schema/types/concrete_type.py,sha256=axIyFZgdwNv-XYkiqX67464wuFX6Vp0jYATwnBZSUvM,750
@@ -184,16 +183,15 @@ strawberry/schema_codegen/__init__.py,sha256=mN4Qmu5Iakht6nHpRpt9hCs8e--oTPlVtDJ
184
183
  strawberry/schema_directive.py,sha256=CbjdX54EIeWGkJu4SgiLR8mph5_8wyNsgJk2oLoQK_0,2023
185
184
  strawberry/schema_directives.py,sha256=KGKFWCODjm1Ah9qNV_bBwbic7Mld4qLWnWQkev-PG8A,175
186
185
  strawberry/static/apollo-sandbox.html,sha256=2XzkbE0dqsFHqehE-jul9_J9TFOpwA6Ylrlo0Kdx_9w,973
187
- strawberry/static/graphiql.html,sha256=0e3pvTnAet-lNEqA_pgJ8Ak2CdMt34zPKMMMzpAkEVU,4257
186
+ strawberry/static/graphiql.html,sha256=BkiqZlC63f1sHBDs_UpMzcibcNrHKh7K41Sp23yttfo,4257
188
187
  strawberry/static/pathfinder.html,sha256=0DPx9AmJ2C_sJstFXnWOz9k5tVQHeHaK7qdVY4lAlmk,1547
189
- strawberry/streamable.py,sha256=ylfMt5lfX7RRKGi86wWokvIgYQk5jZCvQVc3shK0epk,645
190
188
  strawberry/subscriptions/__init__.py,sha256=1VGmiCzFepqRFyCikagkUoHHdoTG3XYlFu9GafoQMws,170
191
189
  strawberry/subscriptions/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
192
190
  strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py,sha256=wN6dkMu6WiaIZTE19PGoN9xXpIN_RdDE_q7F7ZgjCxk,138
193
- strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py,sha256=XJYPq_Nl6PWYu-u_uAmh-AO1k2wD3gAQjGMhRjkcwbo,15475
191
+ strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py,sha256=Uy7UWPAgbCEIZfMs1R6RDIStLkHCM33Zsc0sMpgDwrc,15485
194
192
  strawberry/subscriptions/protocols/graphql_transport_ws/types.py,sha256=N9r2mXg5jmmjYoZV5rWf3lAzgylCOUrbKGmClXCoOso,2169
195
193
  strawberry/subscriptions/protocols/graphql_ws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
196
- strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=4o_ptDXL1gMLVQUfxJYO8Xfm_I3gt-Y1Z2CsOb7K1yw,8658
194
+ strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=6Rz47q-VbzTVyL48hgHYoGpT1MRMytFi2SDGreD7axw,8668
197
195
  strawberry/subscriptions/protocols/graphql_ws/types.py,sha256=Uumiz-1O5qQnx-ERBaQtaf7db5yx-V9LMypOn9oGKwM,2003
198
196
  strawberry/test/__init__.py,sha256=lKVbKJDBnrYSPYHIKrg54UpaZcSoL93Z01zOpA1IzZM,115
199
197
  strawberry/test/client.py,sha256=ILAttb6A3jplH5wJNMeyyT1u_Q8KnollfpYLP_BVZR4,6438
@@ -201,7 +199,7 @@ strawberry/tools/__init__.py,sha256=pdGpZx8wpq03VfUZJyF9JtYxZhGqzzxCiipsalWxJX4,
201
199
  strawberry/tools/create_type.py,sha256=y10LgJnWDFtZB-xHLqpVg5ySqvz5KSFC6PNflogie1Q,2329
202
200
  strawberry/tools/merge_types.py,sha256=hUMRRNM28FyPp70jRA3d4svv9WoEBjaNpihBt3DaY0I,1023
203
201
  strawberry/types/__init__.py,sha256=baWEdDkkmCcITOhkg2hNUOenrNV1OYdxGE5qgvIRwwU,351
204
- strawberry/types/arguments.py,sha256=DVouyH70uvTcFP3PmRzo8QdMThoqXdigJbWE9Lgn5pU,9849
202
+ strawberry/types/arguments.py,sha256=Qe3bpKjJWsrN7Qh9kOr0ZjrwDVc_nb2VFWqL22XJ4II,11129
205
203
  strawberry/types/auto.py,sha256=WZ2cQAI8nREUigBzpzFqIKGjJ_C2VqpAPNe8vPjTciM,3007
206
204
  strawberry/types/base.py,sha256=Bfa-5Wen8qR7m6tlSMRRGlGE-chRGMHjQMopfNdbbrk,15197
207
205
  strawberry/types/cast.py,sha256=fx86MkLW77GIximBAwUk5vZxSGwDqUA6XicXvz8EXwQ,916
@@ -236,8 +234,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
236
234
  strawberry/utils/operation.py,sha256=ZgVOw3K2jQuLjNOYUHauF7itJD0QDNoPw9PBi0IYf6k,1234
237
235
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
238
236
  strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
239
- strawberry_graphql-0.276.0.dev1750672223.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
240
- strawberry_graphql-0.276.0.dev1750672223.dist-info/METADATA,sha256=Cind85QEFeU7F2ZOzxU6EWl8h9VxDCevpQ0XyFTcTVQ,7407
241
- strawberry_graphql-0.276.0.dev1750672223.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
242
- strawberry_graphql-0.276.0.dev1750672223.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
243
- strawberry_graphql-0.276.0.dev1750672223.dist-info/RECORD,,
237
+ strawberry_graphql-0.276.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
238
+ strawberry_graphql-0.276.1.dist-info/METADATA,sha256=zuUBSbNn5fSZbEJCLzZiEOUou-FA16hqmJQSiAE5ywI,7393
239
+ strawberry_graphql-0.276.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
240
+ strawberry_graphql-0.276.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
241
+ strawberry_graphql-0.276.1.dist-info/RECORD,,
@@ -1,46 +0,0 @@
1
- from typing import Union
2
-
3
- from graphql.execution import ExecutionContext as GraphQLExecutionContext
4
- from graphql.execution import ExecutionResult as GraphQLExecutionResult
5
- from graphql.execution import execute, subscribe
6
-
7
- from strawberry.types import ExecutionResult
8
-
9
- try:
10
- from graphql import (
11
- ExperimentalIncrementalExecutionResults as GraphQLIncrementalExecutionResults,
12
- )
13
- from graphql.execution import experimental_execute_incrementally
14
- from graphql.type.directives import (
15
- GraphQLDeferDirective,
16
- GraphQLStreamDirective,
17
- )
18
-
19
- incremental_execution_directives = (
20
- GraphQLDeferDirective,
21
- GraphQLStreamDirective,
22
- )
23
-
24
- except ImportError:
25
- GraphQLIncrementalExecutionResults = type(None)
26
-
27
- incremental_execution_directives = []
28
- experimental_execute_incrementally = None
29
-
30
-
31
- # TODO: give this a better name, maybe also a better place
32
- ResultType = Union[
33
- GraphQLExecutionResult,
34
- GraphQLIncrementalExecutionResults,
35
- ExecutionResult,
36
- ]
37
-
38
- __all__ = [
39
- "GraphQLExecutionContext",
40
- "GraphQLIncrementalExecutionResults",
41
- "ResultType",
42
- "execute",
43
- "experimental_execute_incrementally",
44
- "incremental_execution_directives",
45
- "subscribe",
46
- ]
strawberry/streamable.py DELETED
@@ -1,36 +0,0 @@
1
- from collections.abc import AsyncGenerator
2
- from typing import Annotated, TypeVar
3
-
4
-
5
- class StrawberryStreamable: ...
6
-
7
-
8
- T = TypeVar("T")
9
-
10
- Streamable = Annotated[AsyncGenerator[T, None], StrawberryStreamable()]
11
- """Represents a list that can be streamed using @stream.
12
-
13
- Example:
14
-
15
- ```python
16
- import strawberry
17
- from dataclasses import dataclass
18
-
19
-
20
- @strawberry.type
21
- class Comment:
22
- id: strawberry.ID
23
- content: str
24
-
25
-
26
- @strawberry.type
27
- class Article:
28
- @strawberry.field
29
- @staticmethod
30
- async def comments() -> strawberry.Streamable[Comment]:
31
- for comment in fetch_comments():
32
- yield comment
33
- ```
34
- """
35
-
36
- __all__ = ["Streamable"]