strawberry-graphql 0.227.0.dev1713463204__py3-none-any.whl → 0.227.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.
Files changed (47) hide show
  1. strawberry/__init__.py +1 -2
  2. strawberry/channels/handlers/base.py +7 -14
  3. strawberry/codegen/query_codegen.py +2 -4
  4. strawberry/custom_scalar.py +2 -4
  5. strawberry/dataloader.py +2 -4
  6. strawberry/directive.py +1 -2
  7. strawberry/django/views.py +1 -1
  8. strawberry/enum.py +2 -4
  9. strawberry/experimental/pydantic/conversion_types.py +5 -10
  10. strawberry/experimental/pydantic/error_type.py +1 -1
  11. strawberry/experimental/pydantic/object_type.py +1 -1
  12. strawberry/ext/mypy_plugin.py +24 -1
  13. strawberry/federation/enum.py +2 -4
  14. strawberry/federation/field.py +3 -6
  15. strawberry/federation/object_type.py +8 -16
  16. strawberry/federation/scalar.py +2 -4
  17. strawberry/federation/schema_directive.py +1 -1
  18. strawberry/field.py +3 -6
  19. strawberry/http/async_base_view.py +12 -24
  20. strawberry/http/base.py +3 -6
  21. strawberry/http/sync_base_view.py +13 -26
  22. strawberry/litestar/controller.py +2 -2
  23. strawberry/object_type.py +32 -69
  24. strawberry/parent.py +1 -2
  25. strawberry/printer/printer.py +3 -6
  26. strawberry/private.py +1 -2
  27. strawberry/relay/fields.py +2 -4
  28. strawberry/relay/types.py +12 -24
  29. strawberry/schema/execute.py +0 -2
  30. strawberry/schema/schema.py +0 -11
  31. strawberry/schema/schema_converter.py +1 -35
  32. strawberry/schema_codegen/__init__.py +96 -87
  33. strawberry/schema_directive.py +1 -1
  34. strawberry/starlite/controller.py +2 -2
  35. strawberry/type.py +4 -12
  36. strawberry/types/type_resolver.py +9 -2
  37. strawberry/types/types.py +1 -13
  38. strawberry/utils/aio.py +1 -1
  39. strawberry/utils/typing.py +2 -4
  40. {strawberry_graphql-0.227.0.dev1713463204.dist-info → strawberry_graphql-0.227.1.dist-info}/METADATA +2 -1
  41. {strawberry_graphql-0.227.0.dev1713463204.dist-info → strawberry_graphql-0.227.1.dist-info}/RECORD +44 -47
  42. strawberry/schema/validation_rules/__init__.py +0 -0
  43. strawberry/schema/validation_rules/one_of.py +0 -80
  44. strawberry/schema_directives.py +0 -9
  45. {strawberry_graphql-0.227.0.dev1713463204.dist-info → strawberry_graphql-0.227.1.dist-info}/LICENSE +0 -0
  46. {strawberry_graphql-0.227.0.dev1713463204.dist-info → strawberry_graphql-0.227.1.dist-info}/WHEEL +0 -0
  47. {strawberry_graphql-0.227.0.dev1713463204.dist-info → strawberry_graphql-0.227.1.dist-info}/entry_points.txt +0 -0
strawberry/__init__.py CHANGED
@@ -7,7 +7,7 @@ from .enum import enum, enum_value
7
7
  from .field import field
8
8
  from .lazy_type import LazyType, lazy
9
9
  from .mutation import mutation, subscription
10
- from .object_type import asdict, input, interface, one_of_input, type
10
+ from .object_type import asdict, input, interface, type
11
11
  from .parent import Parent
12
12
  from .permission import BasePermission
13
13
  from .private import Private
@@ -38,7 +38,6 @@ __all__ = [
38
38
  "federation",
39
39
  "field",
40
40
  "input",
41
- "one_of_input",
42
41
  "interface",
43
42
  "mutation",
44
43
  "scalar",
@@ -33,32 +33,25 @@ class ChannelsLayer(Protocol): # pragma: no cover
33
33
 
34
34
  extensions: List[Literal["groups", "flush"]]
35
35
 
36
- async def send(self, channel: str, message: dict) -> None:
37
- ...
36
+ async def send(self, channel: str, message: dict) -> None: ...
38
37
 
39
- async def receive(self, channel: str) -> dict:
40
- ...
38
+ async def receive(self, channel: str) -> dict: ...
41
39
 
42
- async def new_channel(self, prefix: str = ...) -> str:
43
- ...
40
+ async def new_channel(self, prefix: str = ...) -> str: ...
44
41
 
45
42
  # If groups extension is supported
46
43
 
47
44
  group_expiry: int
48
45
 
49
- async def group_add(self, group: str, channel: str) -> None:
50
- ...
46
+ async def group_add(self, group: str, channel: str) -> None: ...
51
47
 
52
- async def group_discard(self, group: str, channel: str) -> None:
53
- ...
48
+ async def group_discard(self, group: str, channel: str) -> None: ...
54
49
 
55
- async def group_send(self, group: str, message: dict) -> None:
56
- ...
50
+ async def group_send(self, group: str, message: dict) -> None: ...
57
51
 
58
52
  # If flush extension is supported
59
53
 
60
- async def flush(self) -> None:
61
- ...
54
+ async def flush(self) -> None: ...
62
55
 
63
56
 
64
57
  class ChannelsConsumer(AsyncConsumer):
@@ -139,11 +139,9 @@ class QueryCodegenPlugin:
139
139
  """
140
140
  self.query = query
141
141
 
142
- def on_start(self) -> None:
143
- ...
142
+ def on_start(self) -> None: ...
144
143
 
145
- def on_end(self, result: CodegenResult) -> None:
146
- ...
144
+ def on_end(self, result: CodegenResult) -> None: ...
147
145
 
148
146
  def generate_code(
149
147
  self, types: List[GraphQLType], operation: GraphQLOperation
@@ -134,8 +134,7 @@ def scalar(
134
134
  parse_value: Optional[Callable] = None,
135
135
  parse_literal: Optional[Callable] = None,
136
136
  directives: Iterable[object] = (),
137
- ) -> Callable[[_T], _T]:
138
- ...
137
+ ) -> Callable[[_T], _T]: ...
139
138
 
140
139
 
141
140
  @overload
@@ -149,8 +148,7 @@ def scalar(
149
148
  parse_value: Optional[Callable] = None,
150
149
  parse_literal: Optional[Callable] = None,
151
150
  directives: Iterable[object] = (),
152
- ) -> _T:
153
- ...
151
+ ) -> _T: ...
154
152
 
155
153
 
156
154
  # TODO: We are tricking pyright into thinking that we are returning the given type
strawberry/dataloader.py CHANGED
@@ -105,8 +105,7 @@ class DataLoader(Generic[K, T]):
105
105
  loop: Optional[AbstractEventLoop] = None,
106
106
  cache_map: Optional[AbstractCache[K, T]] = None,
107
107
  cache_key_fn: Optional[Callable[[K], Hashable]] = None,
108
- ) -> None:
109
- ...
108
+ ) -> None: ...
110
109
 
111
110
  # fallback if load_fn is untyped and there's no other info for inference
112
111
  @overload
@@ -118,8 +117,7 @@ class DataLoader(Generic[K, T]):
118
117
  loop: Optional[AbstractEventLoop] = None,
119
118
  cache_map: Optional[AbstractCache[K, T]] = None,
120
119
  cache_key_fn: Optional[Callable[[K], Hashable]] = None,
121
- ) -> None:
122
- ...
120
+ ) -> None: ...
123
121
 
124
122
  def __init__(
125
123
  self,
strawberry/directive.py CHANGED
@@ -32,8 +32,7 @@ def directive_field(name: str, default: object = UNSET) -> Any:
32
32
  T = TypeVar("T")
33
33
 
34
34
 
35
- class StrawberryDirectiveValue:
36
- ...
35
+ class StrawberryDirectiveValue: ...
37
36
 
38
37
 
39
38
  DirectiveValue = Annotated[T, StrawberryDirectiveValue()]
@@ -54,7 +54,7 @@ class TemporalHttpResponse(JsonResponse):
54
54
  if self.status_code is not None:
55
55
  return super().__repr__()
56
56
 
57
- return "<{cls} status_code={status_code}{content_type}>".format(
57
+ return "<{cls} status_code={status_code}{content_type}>".format( # noqa: UP032
58
58
  cls=self.__class__.__name__,
59
59
  status_code=self.status_code,
60
60
  content_type=self._content_type_for_repr, # pyright: ignore
strawberry/enum.py CHANGED
@@ -136,8 +136,7 @@ def enum(
136
136
  name: Optional[str] = None,
137
137
  description: Optional[str] = None,
138
138
  directives: Iterable[object] = (),
139
- ) -> EnumType:
140
- ...
139
+ ) -> EnumType: ...
141
140
 
142
141
 
143
142
  @overload
@@ -147,8 +146,7 @@ def enum(
147
146
  name: Optional[str] = None,
148
147
  description: Optional[str] = None,
149
148
  directives: Iterable[object] = (),
150
- ) -> Callable[[EnumType], EnumType]:
151
- ...
149
+ ) -> Callable[[EnumType], EnumType]: ...
152
150
 
153
151
 
154
152
  def enum(
@@ -16,22 +16,17 @@ class StrawberryTypeFromPydantic(Protocol[PydanticModel]):
16
16
  """This class does not exist in runtime.
17
17
  It only makes the methods below visible for IDEs"""
18
18
 
19
- def __init__(self, **kwargs: Any) -> None:
20
- ...
19
+ def __init__(self, **kwargs: Any) -> None: ...
21
20
 
22
21
  @staticmethod
23
22
  def from_pydantic(
24
23
  instance: PydanticModel, extra: Optional[Dict[str, Any]] = None
25
- ) -> StrawberryTypeFromPydantic[PydanticModel]:
26
- ...
24
+ ) -> StrawberryTypeFromPydantic[PydanticModel]: ...
27
25
 
28
- def to_pydantic(self, **kwargs: Any) -> PydanticModel:
29
- ...
26
+ def to_pydantic(self, **kwargs: Any) -> PydanticModel: ...
30
27
 
31
28
  @property
32
- def __strawberry_definition__(self) -> StrawberryObjectDefinition:
33
- ...
29
+ def __strawberry_definition__(self) -> StrawberryObjectDefinition: ...
34
30
 
35
31
  @property
36
- def _pydantic_type(self) -> Type[PydanticModel]:
37
- ...
32
+ def _pydantic_type(self) -> Type[PydanticModel]: ...
@@ -114,7 +114,7 @@ def error_type(
114
114
  ]
115
115
 
116
116
  wrapped = _wrap_dataclass(cls)
117
- extra_fields = cast(List[dataclasses.Field], _get_fields(wrapped))
117
+ extra_fields = cast(List[dataclasses.Field], _get_fields(wrapped, {}))
118
118
  private_fields = get_private_fields(wrapped)
119
119
 
120
120
  all_model_fields.extend(
@@ -177,7 +177,7 @@ def type(
177
177
  )
178
178
 
179
179
  wrapped = _wrap_dataclass(cls)
180
- extra_strawberry_fields = _get_fields(wrapped)
180
+ extra_strawberry_fields = _get_fields(wrapped, {})
181
181
  extra_fields = cast(List[dataclasses.Field], extra_strawberry_fields)
182
182
  private_fields = get_private_fields(wrapped)
183
183
 
@@ -11,6 +11,7 @@ from typing import (
11
11
  List,
12
12
  Optional,
13
13
  Set,
14
+ Tuple,
14
15
  Union,
15
16
  cast,
16
17
  )
@@ -59,11 +60,16 @@ try:
59
60
  except ImportError:
60
61
  TypeVarDef = TypeVarType
61
62
 
63
+ PYDANTIC_VERSION: Optional[Tuple[int, ...]] = None
64
+
62
65
  # To be compatible with user who don't use pydantic
63
66
  try:
67
+ import pydantic
64
68
  from pydantic.mypy import METADATA_KEY as PYDANTIC_METADATA_KEY
65
69
  from pydantic.mypy import PydanticModelField
66
70
 
71
+ PYDANTIC_VERSION = tuple(map(int, pydantic.__version__.split(".")))
72
+
67
73
  from strawberry.experimental.pydantic._compat import IS_PYDANTIC_V1
68
74
  except ImportError:
69
75
  PYDANTIC_METADATA_KEY = ""
@@ -464,6 +470,11 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
464
470
  return_type=model_type,
465
471
  )
466
472
  else:
473
+ extra = {}
474
+
475
+ if PYDANTIC_VERSION and PYDANTIC_VERSION >= (2, 7, 0):
476
+ extra["api"] = ctx.api
477
+
467
478
  add_method(
468
479
  ctx,
469
480
  "to_pydantic",
@@ -474,6 +485,7 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
474
485
  typed=True,
475
486
  force_optional=False,
476
487
  use_alias=True,
488
+ **extra,
477
489
  )
478
490
  for f in missing_pydantic_fields
479
491
  ],
@@ -487,12 +499,23 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
487
499
  initializer=None,
488
500
  kind=ARG_OPT,
489
501
  )
502
+ extra_type = ctx.api.named_type(
503
+ "builtins.dict",
504
+ [ctx.api.named_type("builtins.str"), AnyType(TypeOfAny.explicit)],
505
+ )
506
+
507
+ extra_argument = Argument(
508
+ variable=Var(name="extra", type=UnionType([NoneType(), extra_type])),
509
+ type_annotation=UnionType([NoneType(), extra_type]),
510
+ initializer=None,
511
+ kind=ARG_OPT,
512
+ )
490
513
 
491
514
  add_static_method_to_class(
492
515
  ctx.api,
493
516
  ctx.cls,
494
517
  name="from_pydantic",
495
- args=[model_argument],
518
+ args=[model_argument, extra_argument],
496
519
  return_type=fill_typevars(ctx.cls.info),
497
520
  )
498
521
 
@@ -50,8 +50,7 @@ def enum(
50
50
  policy: Optional[List[List[str]]] = None,
51
51
  requires_scopes: Optional[List[List[str]]] = None,
52
52
  tags: Optional[Iterable[str]] = (),
53
- ) -> EnumType:
54
- ...
53
+ ) -> EnumType: ...
55
54
 
56
55
 
57
56
  @overload
@@ -66,8 +65,7 @@ def enum(
66
65
  policy: Optional[List[List[str]]] = None,
67
66
  requires_scopes: Optional[List[List[str]]] = None,
68
67
  tags: Optional[Iterable[str]] = (),
69
- ) -> Callable[[EnumType], EnumType]:
70
- ...
68
+ ) -> Callable[[EnumType], EnumType]: ...
71
69
 
72
70
 
73
71
  def enum(
@@ -55,8 +55,7 @@ def field(
55
55
  directives: Sequence[object] = (),
56
56
  extensions: Optional[List[FieldExtension]] = None,
57
57
  graphql_type: Optional[Any] = None,
58
- ) -> T:
59
- ...
58
+ ) -> T: ...
60
59
 
61
60
 
62
61
  @overload
@@ -83,8 +82,7 @@ def field(
83
82
  directives: Sequence[object] = (),
84
83
  extensions: Optional[List[FieldExtension]] = None,
85
84
  graphql_type: Optional[Any] = None,
86
- ) -> Any:
87
- ...
85
+ ) -> Any: ...
88
86
 
89
87
 
90
88
  @overload
@@ -111,8 +109,7 @@ def field(
111
109
  directives: Sequence[object] = (),
112
110
  extensions: Optional[List[FieldExtension]] = None,
113
111
  graphql_type: Optional[Any] = None,
114
- ) -> StrawberryField:
115
- ...
112
+ ) -> StrawberryField: ...
116
113
 
117
114
 
118
115
  def field(
@@ -114,8 +114,7 @@ def type(
114
114
  requires_scopes: Optional[List[List[str]]] = None,
115
115
  shareable: bool = False,
116
116
  tags: Iterable[str] = (),
117
- ) -> T:
118
- ...
117
+ ) -> T: ...
119
118
 
120
119
 
121
120
  @overload
@@ -137,8 +136,7 @@ def type(
137
136
  requires_scopes: Optional[List[List[str]]] = None,
138
137
  shareable: bool = False,
139
138
  tags: Iterable[str] = (),
140
- ) -> Callable[[T], T]:
141
- ...
139
+ ) -> Callable[[T], T]: ...
142
140
 
143
141
 
144
142
  def type(
@@ -186,8 +184,7 @@ def input(
186
184
  directives: Sequence[object] = (),
187
185
  inaccessible: bool = UNSET,
188
186
  tags: Iterable[str] = (),
189
- ) -> T:
190
- ...
187
+ ) -> T: ...
191
188
 
192
189
 
193
190
  @overload
@@ -203,8 +200,7 @@ def input(
203
200
  directives: Sequence[object] = (),
204
201
  inaccessible: bool = UNSET,
205
202
  tags: Iterable[str] = (),
206
- ) -> Callable[[T], T]:
207
- ...
203
+ ) -> Callable[[T], T]: ...
208
204
 
209
205
 
210
206
  def input(
@@ -245,8 +241,7 @@ def interface(
245
241
  policy: Optional[List[List[str]]] = None,
246
242
  requires_scopes: Optional[List[List[str]]] = None,
247
243
  tags: Iterable[str] = (),
248
- ) -> T:
249
- ...
244
+ ) -> T: ...
250
245
 
251
246
 
252
247
  @overload
@@ -266,8 +261,7 @@ def interface(
266
261
  policy: Optional[List[List[str]]] = None,
267
262
  requires_scopes: Optional[List[List[str]]] = None,
268
263
  tags: Iterable[str] = (),
269
- ) -> Callable[[T], T]:
270
- ...
264
+ ) -> Callable[[T], T]: ...
271
265
 
272
266
 
273
267
  def interface(
@@ -316,8 +310,7 @@ def interface_object(
316
310
  policy: Optional[List[List[str]]] = None,
317
311
  requires_scopes: Optional[List[List[str]]] = None,
318
312
  tags: Iterable[str] = (),
319
- ) -> T:
320
- ...
313
+ ) -> T: ...
321
314
 
322
315
 
323
316
  @overload
@@ -337,8 +330,7 @@ def interface_object(
337
330
  policy: Optional[List[List[str]]] = None,
338
331
  requires_scopes: Optional[List[List[str]]] = None,
339
332
  tags: Iterable[str] = (),
340
- ) -> Callable[[T], T]:
341
- ...
333
+ ) -> Callable[[T], T]: ...
342
334
 
343
335
 
344
336
  def interface_object(
@@ -40,8 +40,7 @@ def scalar(
40
40
  policy: Optional[List[List[str]]] = None,
41
41
  requires_scopes: Optional[List[List[str]]] = None,
42
42
  tags: Optional[Iterable[str]] = (),
43
- ) -> Callable[[_T], _T]:
44
- ...
43
+ ) -> Callable[[_T], _T]: ...
45
44
 
46
45
 
47
46
  @overload
@@ -60,8 +59,7 @@ def scalar(
60
59
  policy: Optional[List[List[str]]] = None,
61
60
  requires_scopes: Optional[List[List[str]]] = None,
62
61
  tags: Optional[Iterable[str]] = (),
63
- ) -> _T:
64
- ...
62
+ ) -> _T: ...
65
63
 
66
64
 
67
65
  def scalar(
@@ -39,7 +39,7 @@ def schema_directive(
39
39
  ) -> Callable[..., T]:
40
40
  def _wrap(cls: T) -> T:
41
41
  cls = _wrap_dataclass(cls)
42
- fields = _get_fields(cls)
42
+ fields = _get_fields(cls, {})
43
43
 
44
44
  cls.__strawberry_directive__ = StrawberryFederationSchemaDirective(
45
45
  python_name=cls.__name__,
strawberry/field.py CHANGED
@@ -432,8 +432,7 @@ def field(
432
432
  directives: Optional[Sequence[object]] = (),
433
433
  extensions: Optional[List[FieldExtension]] = None,
434
434
  graphql_type: Optional[Any] = None,
435
- ) -> T:
436
- ...
435
+ ) -> T: ...
437
436
 
438
437
 
439
438
  @overload
@@ -451,8 +450,7 @@ def field(
451
450
  directives: Optional[Sequence[object]] = (),
452
451
  extensions: Optional[List[FieldExtension]] = None,
453
452
  graphql_type: Optional[Any] = None,
454
- ) -> Any:
455
- ...
453
+ ) -> Any: ...
456
454
 
457
455
 
458
456
  @overload
@@ -470,8 +468,7 @@ def field(
470
468
  directives: Optional[Sequence[object]] = (),
471
469
  extensions: Optional[List[FieldExtension]] = None,
472
470
  graphql_type: Optional[Any] = None,
473
- ) -> StrawberryField:
474
- ...
471
+ ) -> StrawberryField: ...
475
472
 
476
473
 
477
474
  def field(
@@ -31,31 +31,25 @@ from .typevars import Context, Request, Response, RootValue, SubResponse
31
31
  class AsyncHTTPRequestAdapter(abc.ABC):
32
32
  @property
33
33
  @abc.abstractmethod
34
- def query_params(self) -> QueryParams:
35
- ...
34
+ def query_params(self) -> QueryParams: ...
36
35
 
37
36
  @property
38
37
  @abc.abstractmethod
39
- def method(self) -> HTTPMethod:
40
- ...
38
+ def method(self) -> HTTPMethod: ...
41
39
 
42
40
  @property
43
41
  @abc.abstractmethod
44
- def headers(self) -> Mapping[str, str]:
45
- ...
42
+ def headers(self) -> Mapping[str, str]: ...
46
43
 
47
44
  @property
48
45
  @abc.abstractmethod
49
- def content_type(self) -> Optional[str]:
50
- ...
46
+ def content_type(self) -> Optional[str]: ...
51
47
 
52
48
  @abc.abstractmethod
53
- async def get_body(self) -> Union[str, bytes]:
54
- ...
49
+ async def get_body(self) -> Union[str, bytes]: ...
55
50
 
56
51
  @abc.abstractmethod
57
- async def get_form_data(self) -> FormData:
58
- ...
52
+ async def get_form_data(self) -> FormData: ...
59
53
 
60
54
 
61
55
  class AsyncBaseHTTPView(
@@ -69,30 +63,24 @@ class AsyncBaseHTTPView(
69
63
 
70
64
  @property
71
65
  @abc.abstractmethod
72
- def allow_queries_via_get(self) -> bool:
73
- ...
66
+ def allow_queries_via_get(self) -> bool: ...
74
67
 
75
68
  @abc.abstractmethod
76
- async def get_sub_response(self, request: Request) -> SubResponse:
77
- ...
69
+ async def get_sub_response(self, request: Request) -> SubResponse: ...
78
70
 
79
71
  @abc.abstractmethod
80
- async def get_context(self, request: Request, response: SubResponse) -> Context:
81
- ...
72
+ async def get_context(self, request: Request, response: SubResponse) -> Context: ...
82
73
 
83
74
  @abc.abstractmethod
84
- async def get_root_value(self, request: Request) -> Optional[RootValue]:
85
- ...
75
+ async def get_root_value(self, request: Request) -> Optional[RootValue]: ...
86
76
 
87
77
  @abc.abstractmethod
88
78
  def create_response(
89
79
  self, response_data: GraphQLHTTPResponse, sub_response: SubResponse
90
- ) -> Response:
91
- ...
80
+ ) -> Response: ...
92
81
 
93
82
  @abc.abstractmethod
94
- async def render_graphql_ide(self, request: Request) -> Response:
95
- ...
83
+ async def render_graphql_ide(self, request: Request) -> Response: ...
96
84
 
97
85
  async def execute_operation(
98
86
  self, request: Request, context: Context, root_value: Optional[RootValue]
strawberry/http/base.py CHANGED
@@ -12,16 +12,13 @@ from .typevars import Request
12
12
 
13
13
  class BaseRequestProtocol(Protocol):
14
14
  @property
15
- def query_params(self) -> Mapping[str, Optional[Union[str, List[str]]]]:
16
- ...
15
+ def query_params(self) -> Mapping[str, Optional[Union[str, List[str]]]]: ...
17
16
 
18
17
  @property
19
- def method(self) -> HTTPMethod:
20
- ...
18
+ def method(self) -> HTTPMethod: ...
21
19
 
22
20
  @property
23
- def headers(self) -> Mapping[str, str]:
24
- ...
21
+ def headers(self) -> Mapping[str, str]: ...
25
22
 
26
23
 
27
24
  class BaseView(Generic[Request]):
@@ -32,38 +32,31 @@ from .typevars import Context, Request, Response, RootValue, SubResponse
32
32
  class SyncHTTPRequestAdapter(abc.ABC):
33
33
  @property
34
34
  @abc.abstractmethod
35
- def query_params(self) -> QueryParams:
36
- ...
35
+ def query_params(self) -> QueryParams: ...
37
36
 
38
37
  @property
39
38
  @abc.abstractmethod
40
- def body(self) -> Union[str, bytes]:
41
- ...
39
+ def body(self) -> Union[str, bytes]: ...
42
40
 
43
41
  @property
44
42
  @abc.abstractmethod
45
- def method(self) -> HTTPMethod:
46
- ...
43
+ def method(self) -> HTTPMethod: ...
47
44
 
48
45
  @property
49
46
  @abc.abstractmethod
50
- def headers(self) -> Mapping[str, str]:
51
- ...
47
+ def headers(self) -> Mapping[str, str]: ...
52
48
 
53
49
  @property
54
50
  @abc.abstractmethod
55
- def content_type(self) -> Optional[str]:
56
- ...
51
+ def content_type(self) -> Optional[str]: ...
57
52
 
58
53
  @property
59
54
  @abc.abstractmethod
60
- def post_data(self) -> Mapping[str, Union[str, bytes]]:
61
- ...
55
+ def post_data(self) -> Mapping[str, Union[str, bytes]]: ...
62
56
 
63
57
  @property
64
58
  @abc.abstractmethod
65
- def files(self) -> Mapping[str, Any]:
66
- ...
59
+ def files(self) -> Mapping[str, Any]: ...
67
60
 
68
61
 
69
62
  class SyncBaseHTTPView(
@@ -80,30 +73,24 @@ class SyncBaseHTTPView(
80
73
 
81
74
  @property
82
75
  @abc.abstractmethod
83
- def allow_queries_via_get(self) -> bool:
84
- ...
76
+ def allow_queries_via_get(self) -> bool: ...
85
77
 
86
78
  @abc.abstractmethod
87
- def get_sub_response(self, request: Request) -> SubResponse:
88
- ...
79
+ def get_sub_response(self, request: Request) -> SubResponse: ...
89
80
 
90
81
  @abc.abstractmethod
91
- def get_context(self, request: Request, response: SubResponse) -> Context:
92
- ...
82
+ def get_context(self, request: Request, response: SubResponse) -> Context: ...
93
83
 
94
84
  @abc.abstractmethod
95
- def get_root_value(self, request: Request) -> Optional[RootValue]:
96
- ...
85
+ def get_root_value(self, request: Request) -> Optional[RootValue]: ...
97
86
 
98
87
  @abc.abstractmethod
99
88
  def create_response(
100
89
  self, response_data: GraphQLHTTPResponse, sub_response: SubResponse
101
- ) -> Response:
102
- ...
90
+ ) -> Response: ...
103
91
 
104
92
  @abc.abstractmethod
105
- def render_graphql_ide(self, request: Request) -> Response:
106
- ...
93
+ def render_graphql_ide(self, request: Request) -> Response: ...
107
94
 
108
95
  def execute_operation(
109
96
  self, request: Request, context: Context, root_value: Optional[RootValue]
@@ -211,9 +211,9 @@ class GraphQLController(
211
211
 
212
212
  request_adapter_class = LitestarRequestAdapter
213
213
  graphql_ws_handler_class: Type[GraphQLWSHandler] = GraphQLWSHandler
214
- graphql_transport_ws_handler_class: Type[
214
+ graphql_transport_ws_handler_class: Type[GraphQLTransportWSHandler] = (
215
215
  GraphQLTransportWSHandler
216
- ] = GraphQLTransportWSHandler
216
+ )
217
217
 
218
218
  allow_queries_via_get: bool = True
219
219
  graphiql_allowed_accept: FrozenSet[str] = frozenset({"text/html", "*/*"})