@@ -66,7 +66,7 @@ def execute(
6666 allow_subscriptions = False , # type: bool
6767 ** options # type: Any
6868):
69- # type: (...) -> ExecutionResult
69+ # type: (...) -> Union[ ExecutionResult, Promise[ExecutionResult]]
7070
7171 if root is None and "root_value" in options :
7272 warnings .warn (
@@ -120,16 +120,16 @@ def execute(
120120 )
121121
122122 def promise_executor (v ):
123- # type: (Optional[Any]) -> Union[OrderedDict , Promise, Observable]
123+ # type: (Optional[Any]) -> Union[Dict , Promise[Dict] , Observable]
124124 return execute_operation (exe_context , exe_context .operation , root )
125125
126126 def on_rejected (error ):
127- # type: (Exception) -> Optional[Any]
127+ # type: (Exception) -> None
128128 exe_context .errors .append (error )
129129 return None
130130
131131 def on_resolve (data ):
132- # type: (Union[None, OrderedDict , Observable]) -> Union[ExecutionResult, Observable]
132+ # type: (Union[None, Dict , Observable]) -> Union[ExecutionResult, Observable]
133133 if isinstance (data , Observable ):
134134 return data
135135
@@ -158,7 +158,7 @@ def execute_operation(
158158 operation , # type: OperationDefinition
159159 root_value , # type: Any
160160):
161- # type: (...) -> Union[OrderedDict , Promise]
161+ # type: (...) -> Union[Dict , Promise[Dict] ]
162162 type = get_operation_root_type (exe_context .schema , operation )
163163 fields = collect_fields (
164164 exe_context , type , operation .selection_set , DefaultOrderedDict (list ), set ()
@@ -188,7 +188,7 @@ def execute_fields_serially(
188188):
189189 # type: (...) -> Promise
190190 def execute_field_callback (results , response_name ):
191- # type: (OrderedDict , str) -> Union[OrderedDict , Promise]
191+ # type: (Dict , str) -> Union[Dict , Promise[Dict] ]
192192 field_asts = fields [response_name ]
193193 result = resolve_field (
194194 exe_context ,
@@ -204,7 +204,7 @@ def execute_field_callback(results, response_name):
204204 if is_thenable (result ):
205205
206206 def collect_result (resolved_result ):
207- # type: (OrderedDict ) -> OrderedDict
207+ # type: (Dict ) -> Dict
208208 results [response_name ] = resolved_result
209209 return results
210210
@@ -232,7 +232,7 @@ def execute_fields(
232232 path , # type: List[Union[int, str]]
233233 info , # type: Optional[ResolveInfo]
234234):
235- # type: (...) -> Union[OrderedDict , Promise]
235+ # type: (...) -> Union[Dict , Promise[Dict] ]
236236 contains_promise = False
237237
238238 final_results = OrderedDict ()
@@ -271,10 +271,8 @@ def subscribe_fields(
271271 def on_error (error ):
272272 subscriber_exe_context .report_error (error )
273273
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
278276 if subscriber_exe_context .errors :
279277 result = ExecutionResult (data = data , errors = subscriber_exe_context .errors )
280278 else :
0 commit comments