@@ -66,7 +66,7 @@ def execute(
66
66
allow_subscriptions = False , # type: bool
67
67
** options # type: Any
68
68
):
69
- # type: (...) -> ExecutionResult
69
+ # type: (...) -> Union[ ExecutionResult, Promise[ExecutionResult]]
70
70
71
71
if root is None and "root_value" in options :
72
72
warnings .warn (
@@ -120,16 +120,16 @@ def execute(
120
120
)
121
121
122
122
def promise_executor (v ):
123
- # type: (Optional[Any]) -> Union[OrderedDict , Promise, Observable]
123
+ # type: (Optional[Any]) -> Union[Dict , Promise[Dict] , Observable]
124
124
return execute_operation (exe_context , exe_context .operation , root )
125
125
126
126
def on_rejected (error ):
127
- # type: (Exception) -> Optional[Any]
127
+ # type: (Exception) -> None
128
128
exe_context .errors .append (error )
129
129
return None
130
130
131
131
def on_resolve (data ):
132
- # type: (Union[None, OrderedDict , Observable]) -> Union[ExecutionResult, Observable]
132
+ # type: (Union[None, Dict , Observable]) -> Union[ExecutionResult, Observable]
133
133
if isinstance (data , Observable ):
134
134
return data
135
135
@@ -158,7 +158,7 @@ def execute_operation(
158
158
operation , # type: OperationDefinition
159
159
root_value , # type: Any
160
160
):
161
- # type: (...) -> Union[OrderedDict , Promise]
161
+ # type: (...) -> Union[Dict , Promise[Dict] ]
162
162
type = get_operation_root_type (exe_context .schema , operation )
163
163
fields = collect_fields (
164
164
exe_context , type , operation .selection_set , DefaultOrderedDict (list ), set ()
@@ -188,7 +188,7 @@ def execute_fields_serially(
188
188
):
189
189
# type: (...) -> Promise
190
190
def execute_field_callback (results , response_name ):
191
- # type: (OrderedDict , str) -> Union[OrderedDict , Promise]
191
+ # type: (Dict , str) -> Union[Dict , Promise[Dict] ]
192
192
field_asts = fields [response_name ]
193
193
result = resolve_field (
194
194
exe_context ,
@@ -204,7 +204,7 @@ def execute_field_callback(results, response_name):
204
204
if is_thenable (result ):
205
205
206
206
def collect_result (resolved_result ):
207
- # type: (OrderedDict ) -> OrderedDict
207
+ # type: (Dict ) -> Dict
208
208
results [response_name ] = resolved_result
209
209
return results
210
210
@@ -232,7 +232,7 @@ def execute_fields(
232
232
path , # type: List[Union[int, str]]
233
233
info , # type: Optional[ResolveInfo]
234
234
):
235
- # type: (...) -> Union[OrderedDict , Promise]
235
+ # type: (...) -> Union[Dict , Promise[Dict] ]
236
236
contains_promise = False
237
237
238
238
final_results = OrderedDict ()
@@ -271,10 +271,8 @@ def subscribe_fields(
271
271
def on_error (error ):
272
272
subscriber_exe_context .report_error (error )
273
273
274
- def map_result (
275
- data # type: Union[Dict[str, None], Dict[str, OrderedDict], Dict[str, str]]
276
- ):
277
- # type: (...) -> ExecutionResult
274
+ def map_result (data ):
275
+ # type: (Dict[str, Any]) -> ExecutionResult
278
276
if subscriber_exe_context .errors :
279
277
result = ExecutionResult (data = data , errors = subscriber_exe_context .errors )
280
278
else :
0 commit comments