strawberry-graphql 0.232.0__py3-none-any.whl → 0.232.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/custom_scalar.py +5 -6
- strawberry/experimental/pydantic/conversion.py +1 -1
- strawberry/extensions/base_extension.py +8 -8
- strawberry/fastapi/router.py +3 -3
- strawberry/federation/scalar.py +3 -4
- strawberry/federation/schema.py +5 -5
- strawberry/federation/schema_directive.py +1 -1
- strawberry/field.py +51 -5
- strawberry/object_type.py +4 -4
- strawberry/printer/printer.py +1 -1
- strawberry/relay/fields.py +13 -5
- strawberry/relay/types.py +1 -1
- strawberry/schema/schema.py +3 -3
- strawberry/schema/schema_converter.py +12 -7
- strawberry/schema/types/base_scalars.py +1 -1
- strawberry/schema_directive.py +1 -1
- strawberry/utils/typing.py +10 -5
- {strawberry_graphql-0.232.0.dist-info → strawberry_graphql-0.232.2.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.232.0.dist-info → strawberry_graphql-0.232.2.dist-info}/RECORD +22 -22
- {strawberry_graphql-0.232.0.dist-info → strawberry_graphql-0.232.2.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.232.0.dist-info → strawberry_graphql-0.232.2.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.232.0.dist-info → strawberry_graphql-0.232.2.dist-info}/entry_points.txt +0 -0
strawberry/custom_scalar.py
CHANGED
@@ -10,7 +10,6 @@ from typing import (
|
|
10
10
|
Mapping,
|
11
11
|
NewType,
|
12
12
|
Optional,
|
13
|
-
Type,
|
14
13
|
TypeVar,
|
15
14
|
Union,
|
16
15
|
overload,
|
@@ -85,7 +84,7 @@ class ScalarWrapper:
|
|
85
84
|
|
86
85
|
|
87
86
|
def _process_scalar(
|
88
|
-
cls:
|
87
|
+
cls: _T,
|
89
88
|
*,
|
90
89
|
name: Optional[str] = None,
|
91
90
|
description: Optional[str] = None,
|
@@ -94,10 +93,10 @@ def _process_scalar(
|
|
94
93
|
parse_value: Optional[Callable] = None,
|
95
94
|
parse_literal: Optional[Callable] = None,
|
96
95
|
directives: Iterable[object] = (),
|
97
|
-
):
|
96
|
+
) -> ScalarWrapper:
|
98
97
|
from strawberry.exceptions.handler import should_use_rich_exceptions
|
99
98
|
|
100
|
-
name = name or to_camel_case(cls.__name__)
|
99
|
+
name = name or to_camel_case(cls.__name__) # type: ignore[union-attr]
|
101
100
|
|
102
101
|
_source_file = None
|
103
102
|
_source_line = None
|
@@ -155,7 +154,7 @@ def scalar(
|
|
155
154
|
# here or else it won't let us use any custom scalar to annotate attributes in
|
156
155
|
# dataclasses/types. This should be properly solved when implementing StrawberryScalar
|
157
156
|
def scalar(
|
158
|
-
cls=None,
|
157
|
+
cls: Optional[_T] = None,
|
159
158
|
*,
|
160
159
|
name: Optional[str] = None,
|
161
160
|
description: Optional[str] = None,
|
@@ -194,7 +193,7 @@ def scalar(
|
|
194
193
|
if parse_value is None:
|
195
194
|
parse_value = cls
|
196
195
|
|
197
|
-
def wrap(cls:
|
196
|
+
def wrap(cls: _T) -> ScalarWrapper:
|
198
197
|
return _process_scalar(
|
199
198
|
cls,
|
200
199
|
name=name,
|
@@ -21,7 +21,7 @@ def _convert_from_pydantic_to_strawberry_type(
|
|
21
21
|
type_: Union[StrawberryType, type],
|
22
22
|
data_from_model=None, # noqa: ANN001
|
23
23
|
extra=None, # noqa: ANN001
|
24
|
-
):
|
24
|
+
) -> Any:
|
25
25
|
data = data_from_model if data_from_model is not None else extra
|
26
26
|
|
27
27
|
if isinstance(type_, StrawberryOptional):
|
@@ -24,27 +24,27 @@ class SchemaExtension:
|
|
24
24
|
def __init__(self, *, execution_context: ExecutionContext) -> None:
|
25
25
|
self.execution_context = execution_context
|
26
26
|
|
27
|
-
def on_operation(
|
27
|
+
def on_operation( # type: ignore
|
28
28
|
self,
|
29
|
-
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
29
|
+
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
30
30
|
"""Called before and after a GraphQL operation (query / mutation) starts"""
|
31
31
|
yield None
|
32
32
|
|
33
|
-
def on_validate(
|
33
|
+
def on_validate( # type: ignore
|
34
34
|
self,
|
35
|
-
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
35
|
+
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
36
36
|
"""Called before and after the validation step"""
|
37
37
|
yield None
|
38
38
|
|
39
|
-
def on_parse(
|
39
|
+
def on_parse( # type: ignore
|
40
40
|
self,
|
41
|
-
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
41
|
+
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
42
42
|
"""Called before and after the parsing step"""
|
43
43
|
yield None
|
44
44
|
|
45
|
-
def on_execute(
|
45
|
+
def on_execute( # type: ignore
|
46
46
|
self,
|
47
|
-
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
47
|
+
) -> AsyncIteratorOrIterator[None]: # pragma: no cover
|
48
48
|
"""Called before and after the execution step"""
|
49
49
|
yield None
|
50
50
|
|
strawberry/fastapi/router.py
CHANGED
@@ -291,11 +291,11 @@ class GraphQLRouter(
|
|
291
291
|
websocket: WebSocket,
|
292
292
|
context: Context = Depends(self.context_getter),
|
293
293
|
root_value: RootValue = Depends(self.root_value_getter),
|
294
|
-
):
|
295
|
-
async def _get_context():
|
294
|
+
) -> None:
|
295
|
+
async def _get_context() -> Context:
|
296
296
|
return context
|
297
297
|
|
298
|
-
async def _get_root_value():
|
298
|
+
async def _get_root_value() -> RootValue:
|
299
299
|
return root_value
|
300
300
|
|
301
301
|
preferred_protocol = self.pick_preferred_protocol(websocket)
|
strawberry/federation/scalar.py
CHANGED
@@ -6,13 +6,12 @@ from typing import (
|
|
6
6
|
List,
|
7
7
|
NewType,
|
8
8
|
Optional,
|
9
|
-
Type,
|
10
9
|
TypeVar,
|
11
10
|
Union,
|
12
11
|
overload,
|
13
12
|
)
|
14
13
|
|
15
|
-
from strawberry.custom_scalar import _process_scalar
|
14
|
+
from strawberry.custom_scalar import ScalarWrapper, _process_scalar
|
16
15
|
|
17
16
|
# in python 3.10+ NewType is a class
|
18
17
|
if sys.version_info >= (3, 10):
|
@@ -63,7 +62,7 @@ def scalar(
|
|
63
62
|
|
64
63
|
|
65
64
|
def scalar(
|
66
|
-
cls=None,
|
65
|
+
cls: Optional[_T] = None,
|
67
66
|
*,
|
68
67
|
name: Optional[str] = None,
|
69
68
|
description: Optional[str] = None,
|
@@ -131,7 +130,7 @@ def scalar(
|
|
131
130
|
if tags:
|
132
131
|
directives.extend(Tag(name=tag) for tag in tags)
|
133
132
|
|
134
|
-
def wrap(cls:
|
133
|
+
def wrap(cls: _T) -> ScalarWrapper:
|
135
134
|
return _process_scalar(
|
136
135
|
cls,
|
137
136
|
name=name,
|
strawberry/federation/schema.py
CHANGED
@@ -151,7 +151,7 @@ class Schema(BaseSchema):
|
|
151
151
|
|
152
152
|
return query_type
|
153
153
|
|
154
|
-
def _add_entities_to_query(self):
|
154
|
+
def _add_entities_to_query(self) -> None:
|
155
155
|
entity_type = _get_entity_type(self.schema_converter.type_map)
|
156
156
|
|
157
157
|
if not entity_type:
|
@@ -222,7 +222,7 @@ class Schema(BaseSchema):
|
|
222
222
|
|
223
223
|
return results
|
224
224
|
|
225
|
-
def _add_scalars(self):
|
225
|
+
def _add_scalars(self) -> None:
|
226
226
|
self.Any = GraphQLScalarType("_Any")
|
227
227
|
|
228
228
|
self._schema.type_map["_Any"] = self.Any
|
@@ -283,7 +283,7 @@ class Schema(BaseSchema):
|
|
283
283
|
|
284
284
|
def _add_link_directives(
|
285
285
|
self, additional_directives: Optional[List[object]] = None
|
286
|
-
):
|
286
|
+
) -> None:
|
287
287
|
from .schema_directives import FederationDirective, Link
|
288
288
|
|
289
289
|
directive_by_url: DefaultDict[str, Set[str]] = defaultdict(set)
|
@@ -354,7 +354,7 @@ class Schema(BaseSchema):
|
|
354
354
|
pass
|
355
355
|
|
356
356
|
|
357
|
-
def _get_entity_type(type_map: "TypeMap"):
|
357
|
+
def _get_entity_type(type_map: "TypeMap") -> Optional[GraphQLUnionType]:
|
358
358
|
# https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#resolve-requests-for-entities
|
359
359
|
|
360
360
|
# To implement the _Entity union, each type annotated with @key
|
@@ -375,7 +375,7 @@ def _get_entity_type(type_map: "TypeMap"):
|
|
375
375
|
|
376
376
|
entity_type = GraphQLUnionType("_Entity", federation_key_types) # type: ignore
|
377
377
|
|
378
|
-
def _resolve_type(self, value,
|
378
|
+
def _resolve_type(self: Any, value: Any, info: Any) -> str:
|
379
379
|
return self.__strawberry_definition__.name
|
380
380
|
|
381
381
|
entity_type.resolve_type = _resolve_type
|
@@ -38,7 +38,7 @@ def schema_directive(
|
|
38
38
|
import_url: Optional[str] = None,
|
39
39
|
) -> Callable[..., T]:
|
40
40
|
def _wrap(cls: T) -> T:
|
41
|
-
cls = _wrap_dataclass(cls)
|
41
|
+
cls = _wrap_dataclass(cls) # type: ignore
|
42
42
|
fields = _get_fields(cls, {})
|
43
43
|
|
44
44
|
cls.__strawberry_directive__ = StrawberryFederationSchemaDirective(
|
strawberry/field.py
CHANGED
@@ -46,15 +46,20 @@ if TYPE_CHECKING:
|
|
46
46
|
|
47
47
|
T = TypeVar("T")
|
48
48
|
|
49
|
-
|
49
|
+
_RESOLVER_TYPE_SYNC = Union[
|
50
50
|
StrawberryResolver[T],
|
51
51
|
Callable[..., T],
|
52
|
-
Callable[..., Coroutine[Any, Any, T]],
|
53
|
-
Callable[..., Awaitable[T]],
|
54
52
|
"staticmethod[Any, T]",
|
55
53
|
"classmethod[Any, Any, T]",
|
56
54
|
]
|
57
55
|
|
56
|
+
_RESOLVER_TYPE_ASYNC = Union[
|
57
|
+
Callable[..., Coroutine[Any, Any, T]],
|
58
|
+
Callable[..., Awaitable[T]],
|
59
|
+
]
|
60
|
+
|
61
|
+
_RESOLVER_TYPE = Union[_RESOLVER_TYPE_SYNC[T], _RESOLVER_TYPE_ASYNC[T]]
|
62
|
+
|
58
63
|
UNRESOLVED = object()
|
59
64
|
|
60
65
|
|
@@ -416,10 +421,33 @@ class StrawberryField(dataclasses.Field):
|
|
416
421
|
return self._has_async_base_resolver
|
417
422
|
|
418
423
|
|
424
|
+
# NOTE: we are separating the sync and async resolvers because using both
|
425
|
+
# in the same function will cause mypy to raise an error. Not sure if it is a bug
|
426
|
+
|
427
|
+
|
428
|
+
@overload
|
429
|
+
def field(
|
430
|
+
*,
|
431
|
+
resolver: _RESOLVER_TYPE_ASYNC[T],
|
432
|
+
name: Optional[str] = None,
|
433
|
+
is_subscription: bool = False,
|
434
|
+
description: Optional[str] = None,
|
435
|
+
init: Literal[False] = False,
|
436
|
+
permission_classes: Optional[List[Type[BasePermission]]] = None,
|
437
|
+
deprecation_reason: Optional[str] = None,
|
438
|
+
default: Any = dataclasses.MISSING,
|
439
|
+
default_factory: Union[Callable[..., object], object] = dataclasses.MISSING,
|
440
|
+
metadata: Optional[Mapping[Any, Any]] = None,
|
441
|
+
directives: Optional[Sequence[object]] = (),
|
442
|
+
extensions: Optional[List[FieldExtension]] = None,
|
443
|
+
graphql_type: Optional[Any] = None,
|
444
|
+
) -> T: ...
|
445
|
+
|
446
|
+
|
419
447
|
@overload
|
420
448
|
def field(
|
421
449
|
*,
|
422
|
-
resolver:
|
450
|
+
resolver: _RESOLVER_TYPE_SYNC[T],
|
423
451
|
name: Optional[str] = None,
|
424
452
|
is_subscription: bool = False,
|
425
453
|
description: Optional[str] = None,
|
@@ -455,7 +483,25 @@ def field(
|
|
455
483
|
|
456
484
|
@overload
|
457
485
|
def field(
|
458
|
-
resolver:
|
486
|
+
resolver: _RESOLVER_TYPE_ASYNC[T],
|
487
|
+
*,
|
488
|
+
name: Optional[str] = None,
|
489
|
+
is_subscription: bool = False,
|
490
|
+
description: Optional[str] = None,
|
491
|
+
permission_classes: Optional[List[Type[BasePermission]]] = None,
|
492
|
+
deprecation_reason: Optional[str] = None,
|
493
|
+
default: Any = dataclasses.MISSING,
|
494
|
+
default_factory: Union[Callable[..., object], object] = dataclasses.MISSING,
|
495
|
+
metadata: Optional[Mapping[Any, Any]] = None,
|
496
|
+
directives: Optional[Sequence[object]] = (),
|
497
|
+
extensions: Optional[List[FieldExtension]] = None,
|
498
|
+
graphql_type: Optional[Any] = None,
|
499
|
+
) -> StrawberryField: ...
|
500
|
+
|
501
|
+
|
502
|
+
@overload
|
503
|
+
def field(
|
504
|
+
resolver: _RESOLVER_TYPE_SYNC[T],
|
459
505
|
*,
|
460
506
|
name: Optional[str] = None,
|
461
507
|
is_subscription: bool = False,
|
strawberry/object_type.py
CHANGED
@@ -44,7 +44,7 @@ def _get_interfaces(cls: Type[Any]) -> List[StrawberryObjectDefinition]:
|
|
44
44
|
return interfaces
|
45
45
|
|
46
46
|
|
47
|
-
def _check_field_annotations(cls: Type[Any]):
|
47
|
+
def _check_field_annotations(cls: Type[Any]) -> None:
|
48
48
|
"""Are any of the dataclass Fields missing type annotations?
|
49
49
|
|
50
50
|
This is similar to the check that dataclasses do during creation, but allows us to
|
@@ -102,7 +102,7 @@ def _check_field_annotations(cls: Type[Any]):
|
|
102
102
|
raise MissingFieldAnnotationError(field_name, cls)
|
103
103
|
|
104
104
|
|
105
|
-
def _wrap_dataclass(cls: Type[
|
105
|
+
def _wrap_dataclass(cls: Type[T]) -> Type[T]:
|
106
106
|
"""Wrap a strawberry.type class with a dataclass and check for any issues
|
107
107
|
before doing so"""
|
108
108
|
|
@@ -239,7 +239,7 @@ def type(
|
|
239
239
|
>>> field_abc: str = "ABC"
|
240
240
|
"""
|
241
241
|
|
242
|
-
def wrap(cls:
|
242
|
+
def wrap(cls: T) -> T:
|
243
243
|
if not inspect.isclass(cls):
|
244
244
|
if is_input:
|
245
245
|
exc = ObjectIsNotClassError.input
|
@@ -268,7 +268,7 @@ def type(
|
|
268
268
|
|
269
269
|
wrapped = _wrap_dataclass(cls)
|
270
270
|
|
271
|
-
return _process_type(
|
271
|
+
return _process_type( # type: ignore
|
272
272
|
wrapped,
|
273
273
|
name=name,
|
274
274
|
is_input=is_input,
|
strawberry/printer/printer.py
CHANGED
@@ -566,7 +566,7 @@ def print_schema(schema: BaseSchema) -> str:
|
|
566
566
|
None, [print_directive(directive, schema=schema) for directive in directives]
|
567
567
|
)
|
568
568
|
|
569
|
-
def _name_getter(type_: Any):
|
569
|
+
def _name_getter(type_: Any) -> str:
|
570
570
|
if hasattr(type_, "name"):
|
571
571
|
return type_.name
|
572
572
|
if isinstance(type_, ScalarWrapper):
|
strawberry/relay/fields.py
CHANGED
@@ -9,6 +9,7 @@ from typing import (
|
|
9
9
|
TYPE_CHECKING,
|
10
10
|
Any,
|
11
11
|
AsyncIterator,
|
12
|
+
Awaitable,
|
12
13
|
Callable,
|
13
14
|
DefaultDict,
|
14
15
|
Dict,
|
@@ -35,6 +36,7 @@ from strawberry.extensions.field_extension import (
|
|
35
36
|
SyncExtensionResolver,
|
36
37
|
)
|
37
38
|
from strawberry.field import _RESOLVER_TYPE, StrawberryField, field
|
39
|
+
from strawberry.lazy_type import LazyType
|
38
40
|
from strawberry.relay.exceptions import (
|
39
41
|
RelayWrongAnnotationError,
|
40
42
|
RelayWrongResolverAnnotationError,
|
@@ -42,7 +44,7 @@ from strawberry.relay.exceptions import (
|
|
42
44
|
from strawberry.type import StrawberryList, StrawberryOptional
|
43
45
|
from strawberry.types.fields.resolver import StrawberryResolver
|
44
46
|
from strawberry.utils.aio import asyncgen_to_list
|
45
|
-
from strawberry.utils.typing import eval_type
|
47
|
+
from strawberry.utils.typing import eval_type, is_generic_alias
|
46
48
|
|
47
49
|
from .types import Connection, GlobalID, Node, NodeIterableType, NodeType
|
48
50
|
|
@@ -86,7 +88,7 @@ class NodeExtension(FieldExtension):
|
|
86
88
|
def resolver(
|
87
89
|
info: Info,
|
88
90
|
id: Annotated[GlobalID, argument(description="The ID of the object.")],
|
89
|
-
):
|
91
|
+
) -> Union[Node, None, Awaitable[Union[Node, None]]]:
|
90
92
|
return id.resolve_type(info).resolve_node(
|
91
93
|
id.node_id,
|
92
94
|
info=info,
|
@@ -105,7 +107,7 @@ class NodeExtension(FieldExtension):
|
|
105
107
|
ids: Annotated[
|
106
108
|
List[GlobalID], argument(description="The IDs of the objects.")
|
107
109
|
],
|
108
|
-
):
|
110
|
+
) -> Union[List[Node], Awaitable[List[Node]]]:
|
109
111
|
nodes_map: DefaultDict[Type[Node], List[str]] = defaultdict(list)
|
110
112
|
# Store the index of the node in the list of nodes of the same type
|
111
113
|
# so that we can return them in the same order while also supporting
|
@@ -138,7 +140,7 @@ class NodeExtension(FieldExtension):
|
|
138
140
|
|
139
141
|
if awaitable_nodes or asyncgen_nodes:
|
140
142
|
|
141
|
-
async def resolve(resolved=resolved_nodes)
|
143
|
+
async def resolve(resolved: Any = resolved_nodes) -> List[Node]:
|
142
144
|
resolved.update(
|
143
145
|
zip(
|
144
146
|
[
|
@@ -222,7 +224,13 @@ class ConnectionExtension(FieldExtension):
|
|
222
224
|
]
|
223
225
|
|
224
226
|
f_type = field.type
|
225
|
-
|
227
|
+
|
228
|
+
if isinstance(f_type, LazyType):
|
229
|
+
f_type = f_type.resolve_type()
|
230
|
+
field.type = f_type
|
231
|
+
|
232
|
+
type_origin = get_origin(f_type) if is_generic_alias(f_type) else f_type
|
233
|
+
if not isinstance(type_origin, type) or not issubclass(type_origin, Connection):
|
226
234
|
raise RelayWrongAnnotationError(field.name, cast(type, field.origin))
|
227
235
|
|
228
236
|
assert field.base_resolver
|
strawberry/relay/types.py
CHANGED
@@ -859,7 +859,7 @@ class ListConnection(Connection[NodeType]):
|
|
859
859
|
|
860
860
|
if isinstance(nodes, (AsyncIterator, AsyncIterable)) and in_async_context():
|
861
861
|
|
862
|
-
async def resolver():
|
862
|
+
async def resolver() -> Self:
|
863
863
|
try:
|
864
864
|
iterator = cast(
|
865
865
|
Union[AsyncIterator[NodeType], AsyncIterable[NodeType]],
|
strawberry/schema/schema.py
CHANGED
@@ -324,7 +324,7 @@ class Schema(BaseSchema):
|
|
324
324
|
operation_name=operation_name,
|
325
325
|
)
|
326
326
|
|
327
|
-
def _resolve_node_ids(self):
|
327
|
+
def _resolve_node_ids(self) -> None:
|
328
328
|
for concrete_type in self.schema_converter.type_map.values():
|
329
329
|
type_def = concrete_type.definition
|
330
330
|
|
@@ -355,7 +355,7 @@ class Schema(BaseSchema):
|
|
355
355
|
if not has_custom_resolve_id:
|
356
356
|
origin.resolve_id_attr()
|
357
357
|
|
358
|
-
def _warn_for_federation_directives(self):
|
358
|
+
def _warn_for_federation_directives(self) -> None:
|
359
359
|
"""Raises a warning if the schema has any federation directives."""
|
360
360
|
from strawberry.federation.schema_directives import FederationDirective
|
361
361
|
|
@@ -378,7 +378,7 @@ class Schema(BaseSchema):
|
|
378
378
|
stacklevel=3,
|
379
379
|
)
|
380
380
|
|
381
|
-
def _extend_introspection(self):
|
381
|
+
def _extend_introspection(self) -> None:
|
382
382
|
def _resolve_is_one_of(obj: Any, info: Any) -> bool:
|
383
383
|
return obj.extensions["strawberry-definition"].is_one_of
|
384
384
|
|
@@ -462,7 +462,12 @@ class GraphQLCoreConverter:
|
|
462
462
|
assert isinstance(graphql_interface, GraphQLInterfaceType) # For mypy
|
463
463
|
return graphql_interface
|
464
464
|
|
465
|
-
def _get_resolve_type()
|
465
|
+
def _get_resolve_type() -> (
|
466
|
+
Callable[
|
467
|
+
[Any, GraphQLResolveInfo, GraphQLAbstractType],
|
468
|
+
Union[Awaitable[Optional[str]], str, None],
|
469
|
+
]
|
470
|
+
):
|
466
471
|
if interface.resolve_type:
|
467
472
|
return interface.resolve_type
|
468
473
|
|
@@ -594,7 +599,7 @@ class GraphQLCoreConverter:
|
|
594
599
|
|
595
600
|
if field.is_basic_field:
|
596
601
|
|
597
|
-
def _get_basic_result(_source: Any, *args: str, **kwargs: Any):
|
602
|
+
def _get_basic_result(_source: Any, *args: str, **kwargs: Any) -> Any:
|
598
603
|
# Call `get_result` without an info object or any args or
|
599
604
|
# kwargs because this is a basic field with no resolver.
|
600
605
|
return field.get_result(_source, info=None, args=[], kwargs={})
|
@@ -664,7 +669,7 @@ class GraphQLCoreConverter:
|
|
664
669
|
info: Info,
|
665
670
|
field_args: List[Any],
|
666
671
|
field_kwargs: Dict[str, Any],
|
667
|
-
):
|
672
|
+
) -> Any:
|
668
673
|
return field.get_result(
|
669
674
|
_source, info=info, args=field_args, kwargs=field_kwargs
|
670
675
|
)
|
@@ -681,7 +686,7 @@ class GraphQLCoreConverter:
|
|
681
686
|
_source: Any,
|
682
687
|
info: Info,
|
683
688
|
**kwargs: Any,
|
684
|
-
):
|
689
|
+
) -> Any:
|
685
690
|
# parse field arguments into Strawberry input types and convert
|
686
691
|
# field names to Python equivalents
|
687
692
|
field_args, field_kwargs = _get_arguments(
|
@@ -698,7 +703,7 @@ class GraphQLCoreConverter:
|
|
698
703
|
# `_get_result` expects `field_args` and `field_kwargs` as
|
699
704
|
# separate arguments so we have to wrap the function so that we
|
700
705
|
# can pass them in
|
701
|
-
def wrapped_get_result(_source: Any, info: Info, **kwargs: Any):
|
706
|
+
def wrapped_get_result(_source: Any, info: Info, **kwargs: Any) -> Any:
|
702
707
|
# if the resolver function requested the info object info
|
703
708
|
# then put it back in the kwargs dictionary
|
704
709
|
if resolver_requested_info:
|
@@ -719,7 +724,7 @@ class GraphQLCoreConverter:
|
|
719
724
|
|
720
725
|
_get_result_with_extensions = wrap_field_extensions()
|
721
726
|
|
722
|
-
def _resolver(_source: Any, info: GraphQLResolveInfo, **kwargs: Any):
|
727
|
+
def _resolver(_source: Any, info: GraphQLResolveInfo, **kwargs: Any) -> Any:
|
723
728
|
strawberry_info = _strawberry_info_from_graphql(info)
|
724
729
|
|
725
730
|
return _get_result_with_extensions(
|
@@ -730,7 +735,7 @@ class GraphQLCoreConverter:
|
|
730
735
|
|
731
736
|
async def _async_resolver(
|
732
737
|
_source: Any, info: GraphQLResolveInfo, **kwargs: Any
|
733
|
-
):
|
738
|
+
) -> Any:
|
734
739
|
strawberry_info = _strawberry_info_from_graphql(info)
|
735
740
|
|
736
741
|
return await await_maybe(
|
strawberry/schema_directive.py
CHANGED
@@ -53,7 +53,7 @@ def schema_directive(
|
|
53
53
|
print_definition: bool = True,
|
54
54
|
) -> Callable[..., T]:
|
55
55
|
def _wrap(cls: T) -> T:
|
56
|
-
cls = _wrap_dataclass(cls)
|
56
|
+
cls = _wrap_dataclass(cls) # type: ignore
|
57
57
|
fields = _get_fields(cls, {})
|
58
58
|
|
59
59
|
cls.__strawberry_directive__ = StrawberrySchemaDirective(
|
strawberry/utils/typing.py
CHANGED
@@ -23,7 +23,7 @@ from typing import ( # type: ignore
|
|
23
23
|
cast,
|
24
24
|
overload,
|
25
25
|
)
|
26
|
-
from typing_extensions import Annotated, get_args, get_origin
|
26
|
+
from typing_extensions import Annotated, TypeGuard, get_args, get_origin
|
27
27
|
|
28
28
|
ast_unparse = getattr(ast, "unparse", None)
|
29
29
|
# ast.unparse is only available on python 3.9+. For older versions we will
|
@@ -63,15 +63,20 @@ def get_generic_alias(type_: Type) -> Type:
|
|
63
63
|
continue
|
64
64
|
|
65
65
|
attr = getattr(typing, attr_name)
|
66
|
-
|
67
|
-
# this is a subclass of it. But if it has an "_inst" attribute
|
68
|
-
# then it for sure is a _GenericAlias
|
69
|
-
if hasattr(attr, "_inst") and attr.__origin__ is type_:
|
66
|
+
if is_generic_alias(attr) and attr.__origin__ is type_:
|
70
67
|
return attr
|
71
68
|
|
72
69
|
raise AssertionError(f"No GenericAlias available for {type_}") # pragma: no cover
|
73
70
|
|
74
71
|
|
72
|
+
def is_generic_alias(type_: Any) -> TypeGuard[_GenericAlias]:
|
73
|
+
"""Returns True if the type is a generic alias."""
|
74
|
+
# _GenericAlias overrides all the methods that we can use to know if
|
75
|
+
# this is a subclass of it. But if it has an "_inst" attribute
|
76
|
+
# then it for sure is a _GenericAlias
|
77
|
+
return hasattr(type_, "_inst")
|
78
|
+
|
79
|
+
|
75
80
|
def is_list(annotation: object) -> bool:
|
76
81
|
"""Returns True if annotation is a List"""
|
77
82
|
|
@@ -50,7 +50,7 @@ strawberry/codegen/query_codegen.py,sha256=hwkn60vJLuktdJV4C5Nhc1U6slPQOKwjKtZE9
|
|
50
50
|
strawberry/codegen/types.py,sha256=7q3pJAHADYsEyQ47d16txJUYFVpaMR_bs6qZp2_eAjk,3486
|
51
51
|
strawberry/codemods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
52
|
strawberry/codemods/annotated_unions.py,sha256=TStU8ye5J1---P5mNWXBGeQa8m_J7FyPU_MYjzDZ-RU,5910
|
53
|
-
strawberry/custom_scalar.py,sha256=
|
53
|
+
strawberry/custom_scalar.py,sha256=IHVEmyTrBY0_O1c7d4P7sGiVEuI6prtwaUCzej5Cdgo,5741
|
54
54
|
strawberry/dataloader.py,sha256=0UDtZZhu46fw-wB8IK8wVBpOL0Ueu0QGkagQnxuwZWQ,7681
|
55
55
|
strawberry/directive.py,sha256=TkUAXBRVUnmczjT-Ubg8ctnCg0z1Ei4GAuXD6LMkJ5c,2303
|
56
56
|
strawberry/django/__init__.py,sha256=07cxG0P0UzHQZPPzG1RNw3YaGSICjPbJrJdPFelxJVI,799
|
@@ -85,7 +85,7 @@ strawberry/exceptions/utils/source_finder.py,sha256=AcuevLgWwOSOR5zBDJbVyXMGRUxs
|
|
85
85
|
strawberry/experimental/__init__.py,sha256=2HP5XtxL8ZKsPp4EDRAbMCqiP7p2V4Cca278JUGxnt0,102
|
86
86
|
strawberry/experimental/pydantic/__init__.py,sha256=jlsYH1j_9W4ieRpUKgt5zQPERDL7nc1ZBNQ3dAhJs8w,241
|
87
87
|
strawberry/experimental/pydantic/_compat.py,sha256=Qnuxy6d0cq5agd8SBlJWqvCPrH3wzMa3gm5Wtzmh0cM,8147
|
88
|
-
strawberry/experimental/pydantic/conversion.py,sha256=
|
88
|
+
strawberry/experimental/pydantic/conversion.py,sha256=nS79s_-nVDvJJgazE84pIgPx2u4g4r-ouOOzRGMuwlU,4220
|
89
89
|
strawberry/experimental/pydantic/conversion_types.py,sha256=VuuBULz2v6cz_N1fa51ayJMA5_bQkqZmxaCumDsTGRM,931
|
90
90
|
strawberry/experimental/pydantic/error_type.py,sha256=iSDNlbsRYZyU5zrg3mzU3ntREUPnU1f2waGmY_kiXLU,4370
|
91
91
|
strawberry/experimental/pydantic/exceptions.py,sha256=Q8Deq3bNkMgc8fwvIYdcfxHSONXVMu-ZB6jcsh1NQYo,1498
|
@@ -100,7 +100,7 @@ strawberry/ext/dataclasses/dataclasses.py,sha256=Le32f96qmahuenVsMW5xjIr-EPnO7WK
|
|
100
100
|
strawberry/ext/mypy_plugin.py,sha256=iqqRtJk3YRt1-rxDDl7aa9QtxZ0QYcu9-o6OWaczkqo,19716
|
101
101
|
strawberry/extensions/__init__.py,sha256=SZ-YEMnxAzoDZFo-uHXMHOaY_PPkYm1muPpK4ccJ3Xk,1248
|
102
102
|
strawberry/extensions/add_validation_rules.py,sha256=l1cCl6VGQ8c2EELK3cIjmn6RftonHD1jKoWQ5-hMTf0,1366
|
103
|
-
strawberry/extensions/base_extension.py,sha256=
|
103
|
+
strawberry/extensions/base_extension.py,sha256=_IS5rM8QNAvptQAem65LZqZ2zdGt2nCw_VjlBQ44ZUg,1992
|
104
104
|
strawberry/extensions/context.py,sha256=j2pxKnZ8HOgugm_P_YJV6Fbp_SXkS-U5OLQvn-ofjRM,7210
|
105
105
|
strawberry/extensions/directives.py,sha256=ulS80mDTDE-pM8d9IEk16O84kzjkXM1P4vMcqYp5Q1U,2968
|
106
106
|
strawberry/extensions/disable_validation.py,sha256=GL_rYvoDrAry1Po6vXCdhi7H8iG1Un0okGTcnC0M9us,728
|
@@ -125,20 +125,20 @@ strawberry/fastapi/context.py,sha256=hxLoihS9TM16iyUPiAGQf-0i4wv975CJYHHI6EwOewA
|
|
125
125
|
strawberry/fastapi/handlers/__init__.py,sha256=TziBHyibYBOGiidjpCkjNThYbVY7K_nt0hnRLVHVh3I,241
|
126
126
|
strawberry/fastapi/handlers/graphql_transport_ws_handler.py,sha256=k8BhP1xQAFc1GnbQoFhi8KQSWwY1x-ngR9qIDVJW_ic,549
|
127
127
|
strawberry/fastapi/handlers/graphql_ws_handler.py,sha256=U84lpd7Lxl2bEnFr9QroswmEaMO5ipLCZTeYRAaZH-g,504
|
128
|
-
strawberry/fastapi/router.py,sha256=
|
128
|
+
strawberry/fastapi/router.py,sha256=14fB2_-cpmo_huxlG1XeDQJADRofQYnR1t7M2Gfpqeg,13311
|
129
129
|
strawberry/federation/__init__.py,sha256=FeUxLiBVuk9TKBmJJi51SeUaI8c80rS8hbl9No-hjII,535
|
130
130
|
strawberry/federation/argument.py,sha256=5qyJYlQGEZd6iXWseQ7dnnejCYj5HyglfK10jOCIJBg,802
|
131
131
|
strawberry/federation/enum.py,sha256=riVfcf2Qe4ERE7SqPqFJ-yaKNG3ve47DniVC0IHZj2A,2969
|
132
132
|
strawberry/federation/field.py,sha256=eEzEyNSrkbwHRsdT27Ti9RucuDI0hPoDT9ohrBCuI8o,6172
|
133
133
|
strawberry/federation/mutation.py,sha256=0lV5HJwgw4HYR_59pwxWqnPs342HwakTNMc98w5Hb-c,43
|
134
134
|
strawberry/federation/object_type.py,sha256=qY4LgXRc0bRXtOeaGruvv8fJDJ1wD73uB7RmFHu0Hrc,9270
|
135
|
-
strawberry/federation/scalar.py,sha256=
|
136
|
-
strawberry/federation/schema.py,sha256=
|
137
|
-
strawberry/federation/schema_directive.py,sha256=
|
135
|
+
strawberry/federation/scalar.py,sha256=178cF0DE8jf4TyIJ3ghy1QpHT0HFPfxHwMvS4_xkDQI,3835
|
136
|
+
strawberry/federation/schema.py,sha256=b0TTbr55nFh_7VXYOGcJ34up32b-1Ko0D7YSBSWRmn4,13774
|
137
|
+
strawberry/federation/schema_directive.py,sha256=cypvRzcwKOeYFTl80DJeaWUfLA8yHZy6Tcz4qYEwVLM,1739
|
138
138
|
strawberry/federation/schema_directives.py,sha256=Awb-BqICDptYtDNRF3BUNnbNcrsSTDN8AWAwKxVZ3UQ,6139
|
139
139
|
strawberry/federation/types.py,sha256=mM70g1aLgjplOc3SdtuJjy7NAKFLv35Z4BDC4s_j5us,301
|
140
140
|
strawberry/federation/union.py,sha256=QXeh-nhApqFtXa3To9MX_IwvtwErZBhWYnssUK7JB2E,1005
|
141
|
-
strawberry/field.py,sha256=
|
141
|
+
strawberry/field.py,sha256=jUOchyxLXmTzatazPF-gDjn4iTizC5XhjD-kPcs8mxE,20448
|
142
142
|
strawberry/field_extensions/__init__.py,sha256=0z6RG9jEO7jpAuyEaQhRI5A_30rdcvsBM0qMhLs8y2s,96
|
143
143
|
strawberry/field_extensions/input_mutation.py,sha256=a2zK97Fc5biqBt2ZlUPEPTQgMTRx6sJCSd3hSsjLSxI,2650
|
144
144
|
strawberry/file_uploads/__init__.py,sha256=v2-6FGBqnTnMPSUTFOiXpIutDMl-ga0PFtw5tKlcagk,50
|
@@ -161,20 +161,20 @@ strawberry/litestar/controller.py,sha256=BCntaDTmQNoBRHINi8TztuF7G4-FiED-KxEPTZ6
|
|
161
161
|
strawberry/litestar/handlers/graphql_transport_ws_handler.py,sha256=q_erlgzPsxarohRQXGp1yK0mjKyS8vsWntMYEmrQx4s,2008
|
162
162
|
strawberry/litestar/handlers/graphql_ws_handler.py,sha256=vVpjd5rJOldF8aQWEGjmmNd60WE1p6q6hFmB_DtCzDU,2250
|
163
163
|
strawberry/mutation.py,sha256=NROPvHJU1BBxZB7Wj4Okxw4hDIYM59MCpukAGEmSNYA,255
|
164
|
-
strawberry/object_type.py,sha256=
|
164
|
+
strawberry/object_type.py,sha256=Npp_sw_uuyoT5WHhTTSOZ6JSc_5TmCgCPVD8a8Z3RS8,12794
|
165
165
|
strawberry/parent.py,sha256=rmedKjN4zdg4KTnNV8DENrzgNYVL67rXpHjHoBofMS4,825
|
166
166
|
strawberry/permission.py,sha256=dcKx4Zlg4ZhcxEDBOSWzz0CUN4WPkcc_kJUVuvLLs6w,5925
|
167
167
|
strawberry/printer/__init__.py,sha256=DmepjmgtkdF5RxK_7yC6qUyRWn56U-9qeZMbkztYB9w,62
|
168
168
|
strawberry/printer/ast_from_value.py,sha256=MFIX2V51d9ocRvD0Njemjk8YIzKh2BB1g2iUcX6a3d8,4946
|
169
|
-
strawberry/printer/printer.py,sha256=
|
169
|
+
strawberry/printer/printer.py,sha256=FY2x-eC5ZDH6T8DzE8ErM9Rc9r44PNCNi7eY3LBq0PA,17456
|
170
170
|
strawberry/private.py,sha256=Vl1o0YZBgNJe30nrrQyOIycsJd3r1Nyx327NlLZURjc,530
|
171
171
|
strawberry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
172
172
|
strawberry/quart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
173
173
|
strawberry/quart/views.py,sha256=SDUaDX7bPKsv8PziMPb0C3nH6vre-Q3bhzSQp4uPjbY,3404
|
174
174
|
strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,553
|
175
175
|
strawberry/relay/exceptions.py,sha256=b7sU2MhHVWJOfq27lvqdFcqBZ5P_JWk41JWRjtP-AOI,3916
|
176
|
-
strawberry/relay/fields.py,sha256=
|
177
|
-
strawberry/relay/types.py,sha256=
|
176
|
+
strawberry/relay/fields.py,sha256=4V8jhPDECx0hPqtc0ZsNxvmhRYMf5whD_686O2-6_Dc,15934
|
177
|
+
strawberry/relay/types.py,sha256=_bCYCDKLG_eCcTf66H6JsmQHX-8mEnpplxr82_2oJcI,30718
|
178
178
|
strawberry/relay/utils.py,sha256=STuJ2j-sTPa70O9juJX21nbhK6yhnHdwiAOWBYKOVdo,3160
|
179
179
|
strawberry/resolvers.py,sha256=g7_g3jmXszziGydY1UG6IItf9s6B1lGLUCnwW1kb8U0,224
|
180
180
|
strawberry/sanic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -189,16 +189,16 @@ strawberry/schema/config.py,sha256=XkWwmxEsmecscH29o4qU0iSe-hgwJJ2X0DPBVlka2OE,6
|
|
189
189
|
strawberry/schema/exceptions.py,sha256=T-DsvBtjx9svkegIm1YrVPGPswpVEpMTFc0_7flLEkM,542
|
190
190
|
strawberry/schema/execute.py,sha256=dwxMrJrR2Qdd1nPGcIS9-Viq7h5qtPfsD6qdujALoMw,11153
|
191
191
|
strawberry/schema/name_converter.py,sha256=UdNyd-QtqF2HsDCQK-nsOcLGxDTj4hJwYFNvMtZnpq4,6533
|
192
|
-
strawberry/schema/schema.py,sha256=
|
193
|
-
strawberry/schema/schema_converter.py,sha256=
|
192
|
+
strawberry/schema/schema.py,sha256=ooZYWqy_LWQwbrIbvuoxHFPzOG8o3Ybv7nSZf2RlNrA,14276
|
193
|
+
strawberry/schema/schema_converter.py,sha256=dszExcSpy1pakPMePp69Yp3Zcj6AG7ReRQ8URG_EkzM,36822
|
194
194
|
strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
|
195
|
-
strawberry/schema/types/base_scalars.py,sha256=
|
195
|
+
strawberry/schema/types/base_scalars.py,sha256=NzGQmDtHdCcBeJpRpyeZQ6EgYRpQBTd8fUf1p9cMWlQ,1847
|
196
196
|
strawberry/schema/types/concrete_type.py,sha256=HB30G1hMUuuvjAvfSe6ADS35iI_T_wKO-EprVOWTMSs,746
|
197
197
|
strawberry/schema/types/scalar.py,sha256=SVJ8HiKncCvOw2xwABI5xYaHcC7KkGHG-tx2WDtSoCA,2802
|
198
198
|
strawberry/schema/validation_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
199
199
|
strawberry/schema/validation_rules/one_of.py,sha256=hO0Re1fQQWT9zIqo_7BHLM2bdSsmNJDbKia8AUTSXQQ,2588
|
200
200
|
strawberry/schema_codegen/__init__.py,sha256=PcCVXjS0Y5Buxadm07YAZOVunkQ_DmmwsBrgsH1T4ds,24375
|
201
|
-
strawberry/schema_directive.py,sha256=
|
201
|
+
strawberry/schema_directive.py,sha256=yDwLBX7soQTAJwDW5YgH8mAnK4Jmnh9yhH76MbQeqX0,1983
|
202
202
|
strawberry/schema_directives.py,sha256=KGKFWCODjm1Ah9qNV_bBwbic7Mld4qLWnWQkev-PG8A,175
|
203
203
|
strawberry/starlite/__init__.py,sha256=v209swT8H9MljVL-npvANhEO1zz3__PSfxb_Ix-NoeE,134
|
204
204
|
strawberry/starlite/controller.py,sha256=moo2HlaJT6w9AijwjHvXi4UibUydaZfA75JMFZVMJPw,12191
|
@@ -244,9 +244,9 @@ strawberry/utils/inspect.py,sha256=6z-tJpiWWm6E4-O6OUfhu689W9k1uY0m3FDwAfVCiNs,2
|
|
244
244
|
strawberry/utils/logging.py,sha256=flS7hV0JiIOEdXcrIjda4WyIWix86cpHHFNJL8gl1y4,713
|
245
245
|
strawberry/utils/operation.py,sha256=Um-tBCPl3_bVFN2Ph7o1mnrxfxBes4HFCj6T0x4kZxE,1135
|
246
246
|
strawberry/utils/str_converters.py,sha256=avIgPVLg98vZH9mA2lhzVdyyjqzLsK2NdBw9mJQ02Xk,813
|
247
|
-
strawberry/utils/typing.py,sha256=
|
248
|
-
strawberry_graphql-0.232.
|
249
|
-
strawberry_graphql-0.232.
|
250
|
-
strawberry_graphql-0.232.
|
251
|
-
strawberry_graphql-0.232.
|
252
|
-
strawberry_graphql-0.232.
|
247
|
+
strawberry/utils/typing.py,sha256=G92wuT2WhEGQrwjek_On2K8l0nyVFtBW3P7I_cfjG-8,13870
|
248
|
+
strawberry_graphql-0.232.2.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
249
|
+
strawberry_graphql-0.232.2.dist-info/METADATA,sha256=v2Ylrs3U4-h8sz9o3hBkKYkcPiINpCjGyRgg_59mIvU,7821
|
250
|
+
strawberry_graphql-0.232.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
251
|
+
strawberry_graphql-0.232.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
252
|
+
strawberry_graphql-0.232.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{strawberry_graphql-0.232.0.dist-info → strawberry_graphql-0.232.2.dist-info}/entry_points.txt
RENAMED
File without changes
|