strawberry-graphql 0.183.4__py3-none-any.whl → 0.183.5__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/types/types.py +1 -8
- strawberry/utils/inspect.py +15 -39
- {strawberry_graphql-0.183.4.dist-info → strawberry_graphql-0.183.5.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.183.4.dist-info → strawberry_graphql-0.183.5.dist-info}/RECORD +7 -7
- {strawberry_graphql-0.183.4.dist-info → strawberry_graphql-0.183.5.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.183.4.dist-info → strawberry_graphql-0.183.5.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.183.4.dist-info → strawberry_graphql-0.183.5.dist-info}/entry_points.txt +0 -0
strawberry/types/types.py
CHANGED
@@ -16,7 +16,6 @@ from typing import (
|
|
16
16
|
from typing_extensions import Self
|
17
17
|
|
18
18
|
from strawberry.type import StrawberryType, StrawberryTypeVar
|
19
|
-
from strawberry.utils.inspect import get_specialized_type_var_map
|
20
19
|
from strawberry.utils.typing import is_generic as is_type_generic
|
21
20
|
|
22
21
|
if TYPE_CHECKING:
|
@@ -116,13 +115,7 @@ class TypeDefinition(StrawberryType):
|
|
116
115
|
|
117
116
|
@property
|
118
117
|
def is_specialized_generic(self) -> bool:
|
119
|
-
|
120
|
-
return False
|
121
|
-
|
122
|
-
type_var_map = get_specialized_type_var_map(self.origin, include_type_vars=True)
|
123
|
-
return type_var_map is None or not any(
|
124
|
-
isinstance(arg, TypeVar) for arg in type_var_map.values()
|
125
|
-
)
|
118
|
+
return self.is_generic and not getattr(self.origin, "__parameters__", None)
|
126
119
|
|
127
120
|
@property
|
128
121
|
def type_params(self) -> List[TypeVar]:
|
strawberry/utils/inspect.py
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
import asyncio
|
2
2
|
import inspect
|
3
3
|
from functools import lru_cache
|
4
|
-
from typing import
|
5
|
-
|
4
|
+
from typing import (
|
5
|
+
Any,
|
6
|
+
Callable,
|
7
|
+
Dict,
|
8
|
+
List,
|
9
|
+
Optional,
|
10
|
+
TypeVar,
|
11
|
+
)
|
12
|
+
from typing_extensions import get_args
|
6
13
|
|
7
14
|
|
8
15
|
def in_async_context() -> bool:
|
@@ -29,36 +36,7 @@ def get_func_args(func: Callable[[Any], Any]) -> List[str]:
|
|
29
36
|
]
|
30
37
|
|
31
38
|
|
32
|
-
|
33
|
-
def get_specialized_type_var_map(
|
34
|
-
cls: type,
|
35
|
-
*,
|
36
|
-
include_type_vars: Literal[True],
|
37
|
-
) -> Optional[Dict[TypeVar, Union[TypeVar, type]]]:
|
38
|
-
...
|
39
|
-
|
40
|
-
|
41
|
-
@overload
|
42
|
-
def get_specialized_type_var_map(
|
43
|
-
cls: type,
|
44
|
-
*,
|
45
|
-
include_type_vars: Literal[False] = ...,
|
46
|
-
) -> Optional[Dict[TypeVar, type]]:
|
47
|
-
...
|
48
|
-
|
49
|
-
|
50
|
-
@overload
|
51
|
-
def get_specialized_type_var_map(
|
52
|
-
cls: type,
|
53
|
-
*,
|
54
|
-
include_type_vars: bool,
|
55
|
-
) -> Optional[
|
56
|
-
Union[Optional[Dict[TypeVar, type]], Dict[TypeVar, Union[TypeVar, type]]]
|
57
|
-
]:
|
58
|
-
...
|
59
|
-
|
60
|
-
|
61
|
-
def get_specialized_type_var_map(cls: type, *, include_type_vars: bool = False):
|
39
|
+
def get_specialized_type_var_map(cls: type) -> Optional[Dict[TypeVar, type]]:
|
62
40
|
"""Get a type var map for specialized types.
|
63
41
|
|
64
42
|
Consider the following:
|
@@ -85,8 +63,6 @@ def get_specialized_type_var_map(cls: type, *, include_type_vars: bool = False):
|
|
85
63
|
None
|
86
64
|
>>> get_specialized_type_var_map(Foo)
|
87
65
|
{}
|
88
|
-
>>> get_specialized_type_var_map(Foo, include_type_vars=True)
|
89
|
-
{~T: ~T}
|
90
66
|
>>> get_specialized_type_var_map(Bar)
|
91
67
|
{~T: ~T}
|
92
68
|
>>> get_specialized_type_var_map(IntBar)
|
@@ -104,6 +80,10 @@ def get_specialized_type_var_map(cls: type, *, include_type_vars: bool = False):
|
|
104
80
|
|
105
81
|
type_var_map = {}
|
106
82
|
|
83
|
+
# only get type vars for base generics (ie. Generic[T]) and for strawberry types
|
84
|
+
|
85
|
+
orig_bases = [b for b in orig_bases if hasattr(b, "_type_definition")]
|
86
|
+
|
107
87
|
for base in orig_bases:
|
108
88
|
# Recursively get type var map from base classes
|
109
89
|
base_type_var_map = get_specialized_type_var_map(base)
|
@@ -121,11 +101,7 @@ def get_specialized_type_var_map(cls: type, *, include_type_vars: bool = False):
|
|
121
101
|
continue
|
122
102
|
|
123
103
|
type_var_map.update(
|
124
|
-
{
|
125
|
-
p: a
|
126
|
-
for p, a in zip(params, args)
|
127
|
-
if include_type_vars or not isinstance(a, TypeVar)
|
128
|
-
}
|
104
|
+
{p: a for p, a in zip(params, args) if not isinstance(a, TypeVar)}
|
129
105
|
)
|
130
106
|
|
131
107
|
return type_var_map
|
@@ -206,7 +206,7 @@ strawberry/types/graphql.py,sha256=3SWZEsa0Zy1eVW6vy75BnB7t9_lJVi6TBV3_1j3RNBs,6
|
|
206
206
|
strawberry/types/info.py,sha256=-ZppOgyEWdUYtkRpUVVn9SJGVsMNtR6gaChk8V3DmIg,2754
|
207
207
|
strawberry/types/nodes.py,sha256=2ZVa1HOFgHZ96QTfz3QEr1fufi6Sz9hAzcZxsN7KtGE,5026
|
208
208
|
strawberry/types/type_resolver.py,sha256=bktpUGS8VOF01tx3IwSbmjgXmKR3tREc8qhdIDGaHAA,7306
|
209
|
-
strawberry/types/types.py,sha256=
|
209
|
+
strawberry/types/types.py,sha256=_9aHLBLZRZLwRMuT6DCFW3KlxO2AjmRU6jrYdkyt8-I,5754
|
210
210
|
strawberry/union.py,sha256=Ne2Q8UHxxdmFC4GgnfSMHh_mEDi9Lq5XcU7hqtCZ2X4,9360
|
211
211
|
strawberry/unset.py,sha256=_180_Wxvw-umn-URMb3CmO-WegBfZHjVZW0L0RXrQrI,1097
|
212
212
|
strawberry/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -218,13 +218,13 @@ strawberry/utils/debug.py,sha256=-MtRqM5e1J-GDNgKQXoVFcBB9f3dHvhEGrTc82uN4LM,137
|
|
218
218
|
strawberry/utils/graphiql.py,sha256=-l6j5YyFzKMNLeDuNqD_tBl-b2ulvj8ZgMNU1eqEwJE,437
|
219
219
|
strawberry/utils/graphql_lexer.py,sha256=U1mTE5fWy0gcF5fITiZzLWftCpo_C3xOi4BpQxasP3M,1085
|
220
220
|
strawberry/utils/importer.py,sha256=hzTiWCeL9ju6opXTU_kjGpatbUy3UUTW8O1Y5hNA_W8,592
|
221
|
-
strawberry/utils/inspect.py,sha256=
|
221
|
+
strawberry/utils/inspect.py,sha256=1RyhShhzJ2YuC0tyaTRtpwHx0toiedq1SPWhM1gG9PQ,2775
|
222
222
|
strawberry/utils/logging.py,sha256=pz1pRJtx5xX2ejGKNN-fG8zPA4SJjnq1HK9xaQpjd4s,1106
|
223
223
|
strawberry/utils/operation.py,sha256=Um-tBCPl3_bVFN2Ph7o1mnrxfxBes4HFCj6T0x4kZxE,1135
|
224
224
|
strawberry/utils/str_converters.py,sha256=VdOnzaxhwJnmQl1Lon0VOjl72uXhM8tLfGxoGwn3arI,657
|
225
225
|
strawberry/utils/typing.py,sha256=MpKjtblkpDBCbjS-yeNSxnOo594_2FLHBOdXiYlAjLM,12716
|
226
|
-
strawberry_graphql-0.183.
|
227
|
-
strawberry_graphql-0.183.
|
228
|
-
strawberry_graphql-0.183.
|
229
|
-
strawberry_graphql-0.183.
|
230
|
-
strawberry_graphql-0.183.
|
226
|
+
strawberry_graphql-0.183.5.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
227
|
+
strawberry_graphql-0.183.5.dist-info/METADATA,sha256=1674sEwb-L-qyjJ-OplJbTHwbnfu9GKCogMaz4iOe5w,7644
|
228
|
+
strawberry_graphql-0.183.5.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
229
|
+
strawberry_graphql-0.183.5.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
230
|
+
strawberry_graphql-0.183.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{strawberry_graphql-0.183.4.dist-info → strawberry_graphql-0.183.5.dist-info}/entry_points.txt
RENAMED
File without changes
|