10
10
default_resolve_fn ,
11
11
get_field_def ,
12
12
)
13
+ from ..pyutils .ordereddict import OrderedDict
13
14
from ..error .format_error import format_error as default_format_error
14
15
15
16
# Necessary for static type checking
16
17
if False : # flake8: noqa
17
- from typing import Any , Optional , Dict , List , Union
18
+ from typing import Any , Optional , Dict , List , Union , Callable , Type
18
19
from ..language .ast import Field , OperationDefinition
19
20
from ..type .definition import GraphQLList , GraphQLObjectType , GraphQLScalarType
20
21
from ..type .schema import GraphQLSchema
@@ -28,7 +29,7 @@ class ExecutionResult(object):
28
29
__slots__ = "data" , "errors" , "invalid" , "extensions"
29
30
30
31
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
32
33
self .data = data
33
34
self .errors = errors
34
35
self .extensions = extensions or dict ()
@@ -39,14 +40,16 @@ def __init__(self, data=None, errors=None, invalid=False, extensions=None):
39
40
self .invalid = invalid
40
41
41
42
def __eq__ (self , other ):
43
+ # type: (Any) -> bool
42
44
return self is other or (
43
45
isinstance (other , ExecutionResult )
44
46
and self .data == other .data
45
47
and self .errors == other .errors
46
48
and self .invalid == other .invalid
47
49
)
48
50
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]
50
53
if format_error is None :
51
54
format_error = default_format_error
52
55
0 commit comments