2626 OperationType ,
2727 SelectionSetNode ,
2828)
29- from ..pyutils import inspect , is_invalid , is_nullish , MaybeAwaitable
29+ from ..pyutils import inspect , is_invalid , is_nullish , AwaitableOrValue
3030from ..utilities import get_operation_root_type , type_from_ast
3131from ..type import (
3232 GraphQLAbstractType ,
@@ -116,7 +116,7 @@ def execute(
116116 type_resolver : GraphQLTypeResolver = None ,
117117 middleware : Middleware = None ,
118118 execution_context_class : Type ["ExecutionContext" ] = None ,
119- ) -> MaybeAwaitable [ExecutionResult ]:
119+ ) -> AwaitableOrValue [ExecutionResult ]:
120120 """Execute a GraphQL operation.
121121
122122 Implements the "Evaluating requests" section of the GraphQL specification.
@@ -304,8 +304,8 @@ def build(
304304 )
305305
306306 def build_response (
307- self , data : MaybeAwaitable [Optional [Dict [str , Any ]]]
308- ) -> MaybeAwaitable [ExecutionResult ]:
307+ self , data : AwaitableOrValue [Optional [Dict [str , Any ]]]
308+ ) -> AwaitableOrValue [ExecutionResult ]:
309309 """Build response.
310310
311311 Given a completed execution context and data, build the (data, errors) response
@@ -328,7 +328,7 @@ async def build_response_async():
328328
329329 def execute_operation (
330330 self , operation : OperationDefinitionNode , root_value : Any
331- ) -> Optional [MaybeAwaitable [Any ]]:
331+ ) -> Optional [AwaitableOrValue [Any ]]:
332332 """Execute an operation.
333333
334334 Implements the "Evaluating operations" section of the spec.
@@ -377,7 +377,7 @@ def execute_fields_serially(
377377 source_value : Any ,
378378 path : Optional [ResponsePath ],
379379 fields : Dict [str , List [FieldNode ]],
380- ) -> MaybeAwaitable [Dict [str , Any ]]:
380+ ) -> AwaitableOrValue [Dict [str , Any ]]:
381381 """Execute the given fields serially.
382382
383383 Implements the "Evaluating selection sets" section of the spec for "write" mode.
@@ -427,7 +427,7 @@ def execute_fields(
427427 source_value : Any ,
428428 path : Optional [ResponsePath ],
429429 fields : Dict [str , List [FieldNode ]],
430- ) -> MaybeAwaitable [Dict [str , Any ]]:
430+ ) -> AwaitableOrValue [Dict [str , Any ]]:
431431 """Execute the given fields concurrently.
432432
433433 Implements the "Evaluating selection sets" section of the spec for "read" mode.
@@ -581,7 +581,7 @@ def resolve_field(
581581 source : Any ,
582582 field_nodes : List [FieldNode ],
583583 path : ResponsePath ,
584- ) -> MaybeAwaitable [Any ]:
584+ ) -> AwaitableOrValue [Any ]:
585585 """Resolve the field on the given source object.
586586
587587 In particular, this figures out the value that the field returns by calling its
@@ -652,7 +652,7 @@ def complete_value_catching_error(
652652 info : GraphQLResolveInfo ,
653653 path : ResponsePath ,
654654 result : Any ,
655- ) -> MaybeAwaitable [Any ]:
655+ ) -> AwaitableOrValue [Any ]:
656656 """Complete a value while catching an error.
657657
658658 This is a small wrapper around completeValue which detects and logs errors in
@@ -713,7 +713,7 @@ def complete_value(
713713 info : GraphQLResolveInfo ,
714714 path : ResponsePath ,
715715 result : Any ,
716- ) -> MaybeAwaitable [Any ]:
716+ ) -> AwaitableOrValue [Any ]:
717717 """Complete a value.
718718
719719 Implements the instructions for completeValue as defined in the "Field entries"
@@ -797,7 +797,7 @@ def complete_list_value(
797797 info : GraphQLResolveInfo ,
798798 path : ResponsePath ,
799799 result : Iterable [Any ],
800- ) -> MaybeAwaitable [Any ]:
800+ ) -> AwaitableOrValue [Any ]:
801801 """Complete a list value.
802802
803803 Complete a list value by completing each item in the list with the inner type.
@@ -866,7 +866,7 @@ def complete_abstract_value(
866866 info : GraphQLResolveInfo ,
867867 path : ResponsePath ,
868868 result : Any ,
869- ) -> MaybeAwaitable [Any ]:
869+ ) -> AwaitableOrValue [Any ]:
870870 """Complete an abstract value.
871871
872872 Complete a value of an abstract type by determining the runtime object type of
@@ -947,7 +947,7 @@ def complete_object_value(
947947 info : GraphQLResolveInfo ,
948948 path : ResponsePath ,
949949 result : Any ,
950- ) -> MaybeAwaitable [Dict [str , Any ]]:
950+ ) -> AwaitableOrValue [Dict [str , Any ]]:
951951 """Complete an Object value by executing all sub-selections."""
952952 # If there is an `is_type_of()` predicate function, call it with the current
953953 # result. If `is_type_of()` returns False, then raise an error rather than
@@ -981,7 +981,7 @@ def collect_and_execute_subfields(
981981 field_nodes : List [FieldNode ],
982982 path : ResponsePath ,
983983 result : Any ,
984- ) -> MaybeAwaitable [Dict [str , Any ]]:
984+ ) -> AwaitableOrValue [Dict [str , Any ]]:
985985 """Collect sub-fields to execute to complete this value."""
986986 sub_field_nodes = self .collect_subfields (return_type , field_nodes )
987987 return self .execute_fields (return_type , result , path , sub_field_nodes )
@@ -1100,7 +1100,7 @@ def invalid_return_type_error(
11001100
11011101def default_type_resolver (
11021102 value : Any , info : GraphQLResolveInfo , abstract_type : GraphQLAbstractType
1103- ) -> MaybeAwaitable [Optional [Union [GraphQLObjectType , str ]]]:
1103+ ) -> AwaitableOrValue [Optional [Union [GraphQLObjectType , str ]]]:
11041104 """Default type resolver function.
11051105
11061106 If a resolve_type function is not given, then a default resolve behavior is used
0 commit comments