1010 default_resolve_fn ,
1111 get_field_def ,
1212)
13+ from ..pyutils .ordereddict import OrderedDict
1314from ..error .format_error import format_error as default_format_error
1415
1516# Necessary for static type checking
1617if False : # flake8: noqa
17- from typing import Any , Optional , Dict , List , Union
18+ from typing import Any , Optional , Dict , List , Union , Callable , Type
1819 from ..language .ast import Field , OperationDefinition
1920 from ..type .definition import GraphQLList , GraphQLObjectType , GraphQLScalarType
2021 from ..type .schema import GraphQLSchema
@@ -28,7 +29,7 @@ class ExecutionResult(object):
2829 __slots__ = "data" , "errors" , "invalid" , "extensions"
2930
3031 def __init__ (self , data = None , errors = None , invalid = False , extensions = None ):
31- # type: (Any, Any , bool, Optional[Any]) -> None
32+ # type: (Optional[Dict], Optional[List[Exception]] , bool, Optional[Any]) -> None
3233 self .data = data
3334 self .errors = errors
3435 self .extensions = extensions or dict ()
@@ -39,14 +40,16 @@ def __init__(self, data=None, errors=None, invalid=False, extensions=None):
3940 self .invalid = invalid
4041
4142 def __eq__ (self , other ):
43+ # type: (Any) -> bool
4244 return self is other or (
4345 isinstance (other , ExecutionResult )
4446 and self .data == other .data
4547 and self .errors == other .errors
4648 and self .invalid == other .invalid
4749 )
4850
49- def to_dict (self , format_error = None , dict_class = dict ):
51+ def to_dict (self , format_error = None , dict_class = OrderedDict ):
52+ # type: (Optional[Callable[[Exception], Dict]], Type[Dict]) -> Dict[str, Any]
5053 if format_error is None :
5154 format_error = default_format_error
5255
0 commit comments