strawberry-graphql 0.235.0__py3-none-any.whl → 0.235.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- strawberry/annotation.py +12 -8
- strawberry/arguments.py +0 -1
- {strawberry_graphql-0.235.0.dist-info → strawberry_graphql-0.235.1.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.235.0.dist-info → strawberry_graphql-0.235.1.dist-info}/RECORD +7 -7
- {strawberry_graphql-0.235.0.dist-info → strawberry_graphql-0.235.1.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.235.0.dist-info → strawberry_graphql-0.235.1.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.235.0.dist-info → strawberry_graphql-0.235.1.dist-info}/entry_points.txt +0 -0
strawberry/annotation.py
CHANGED
@@ -54,7 +54,7 @@ ASYNC_TYPES = (
|
|
54
54
|
|
55
55
|
|
56
56
|
class StrawberryAnnotation:
|
57
|
-
__slots__ = "raw_annotation", "namespace", "
|
57
|
+
__slots__ = "raw_annotation", "namespace", "__resolve_cache__"
|
58
58
|
|
59
59
|
def __init__(
|
60
60
|
self,
|
@@ -65,7 +65,7 @@ class StrawberryAnnotation:
|
|
65
65
|
self.raw_annotation = annotation
|
66
66
|
self.namespace = namespace
|
67
67
|
|
68
|
-
self.
|
68
|
+
self.__resolve_cache__: Optional[Union[StrawberryType, type]] = None
|
69
69
|
|
70
70
|
def __eq__(self, other: object) -> bool:
|
71
71
|
if not isinstance(other, StrawberryAnnotation):
|
@@ -101,19 +101,17 @@ class StrawberryAnnotation:
|
|
101
101
|
def annotation(self, value: Union[object, str]) -> None:
|
102
102
|
self.raw_annotation = value
|
103
103
|
|
104
|
+
self.__resolve_cache__ = None
|
105
|
+
|
104
106
|
def evaluate(self) -> type:
|
105
107
|
"""Return evaluated annotation using `strawberry.util.typing.eval_type`."""
|
106
|
-
evaled_type = self.__eval_cache__
|
107
|
-
if evaled_type:
|
108
|
-
return evaled_type
|
109
|
-
|
110
108
|
annotation = self.raw_annotation
|
109
|
+
|
111
110
|
if isinstance(annotation, str):
|
112
111
|
annotation = ForwardRef(annotation)
|
113
112
|
|
114
113
|
evaled_type = eval_type(annotation, self.namespace, None)
|
115
114
|
|
116
|
-
self.__eval_cache__ = evaled_type
|
117
115
|
return evaled_type
|
118
116
|
|
119
117
|
def _get_type_with_args(
|
@@ -131,6 +129,12 @@ class StrawberryAnnotation:
|
|
131
129
|
|
132
130
|
def resolve(self) -> Union[StrawberryType, type]:
|
133
131
|
"""Return resolved (transformed) annotation."""
|
132
|
+
if self.__resolve_cache__ is None:
|
133
|
+
self.__resolve_cache__ = self._resolve()
|
134
|
+
|
135
|
+
return self.__resolve_cache__
|
136
|
+
|
137
|
+
def _resolve(self) -> Union[StrawberryType, type]:
|
134
138
|
evaled_type = cast(Any, self.evaluate())
|
135
139
|
|
136
140
|
if is_private(evaled_type):
|
@@ -172,7 +176,7 @@ class StrawberryAnnotation:
|
|
172
176
|
module = sys.modules[field.origin.__module__]
|
173
177
|
self.namespace = module.__dict__
|
174
178
|
|
175
|
-
self.
|
179
|
+
self.__resolve_cache__ = None # Invalidate cache to allow re-evaluation
|
176
180
|
|
177
181
|
def create_concrete_type(self, evaled_type: type) -> type:
|
178
182
|
if has_object_definition(evaled_type):
|
strawberry/arguments.py
CHANGED
@@ -7,8 +7,8 @@ strawberry/aiohttp/handlers/graphql_ws_handler.py,sha256=Zi1y_XLsZwqX52vvy0Se3S0
|
|
7
7
|
strawberry/aiohttp/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
|
8
8
|
strawberry/aiohttp/test/client.py,sha256=tlpHymSWqhiQbLmKwodcaX2vdc8BW1IaNTFTHlWKlOY,1323
|
9
9
|
strawberry/aiohttp/views.py,sha256=l5Gb_9twQo1TQuWk7v0dGFry0yM1ivnGztUtwQ_N5-c,6063
|
10
|
-
strawberry/annotation.py,sha256=
|
11
|
-
strawberry/arguments.py,sha256=
|
10
|
+
strawberry/annotation.py,sha256=JiQTFbDLaq8gWhUjdTlKiiE5K1jUuIobizEV8DCLxL0,13005
|
11
|
+
strawberry/arguments.py,sha256=yFbL1o9vFemrJSVGadt80wN_ajU1khw2--S0nDjrx78,8406
|
12
12
|
strawberry/asgi/__init__.py,sha256=9s_6505Aa68y_qAgzQV3yXE0IrGVZbuhQ7rIUNPXOlE,6985
|
13
13
|
strawberry/asgi/handlers/__init__.py,sha256=rz5Gth2eJUn7tDq2--99KSNFeMdDPpLFCkfA7vge0cI,235
|
14
14
|
strawberry/asgi/handlers/graphql_transport_ws_handler.py,sha256=obBZ1bQ1R9eZL1_Xcr5eKQObjSPB0FFLtMFj9EAmFc0,2105
|
@@ -245,8 +245,8 @@ strawberry/utils/logging.py,sha256=flS7hV0JiIOEdXcrIjda4WyIWix86cpHHFNJL8gl1y4,7
|
|
245
245
|
strawberry/utils/operation.py,sha256=Um-tBCPl3_bVFN2Ph7o1mnrxfxBes4HFCj6T0x4kZxE,1135
|
246
246
|
strawberry/utils/str_converters.py,sha256=avIgPVLg98vZH9mA2lhzVdyyjqzLsK2NdBw9mJQ02Xk,813
|
247
247
|
strawberry/utils/typing.py,sha256=G92wuT2WhEGQrwjek_On2K8l0nyVFtBW3P7I_cfjG-8,13870
|
248
|
-
strawberry_graphql-0.235.
|
249
|
-
strawberry_graphql-0.235.
|
250
|
-
strawberry_graphql-0.235.
|
251
|
-
strawberry_graphql-0.235.
|
252
|
-
strawberry_graphql-0.235.
|
248
|
+
strawberry_graphql-0.235.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
249
|
+
strawberry_graphql-0.235.1.dist-info/METADATA,sha256=VV9Bw1wq9Ep6V2KOZKP6mQnl-QyFtb3oSiYNFTTMFdo,7821
|
250
|
+
strawberry_graphql-0.235.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
251
|
+
strawberry_graphql-0.235.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
252
|
+
strawberry_graphql-0.235.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{strawberry_graphql-0.235.0.dist-info → strawberry_graphql-0.235.1.dist-info}/entry_points.txt
RENAMED
File without changes
|