File tree Expand file tree Collapse file tree 6 files changed +30
-25
lines changed Expand file tree Collapse file tree 6 files changed +30
-25
lines changed Original file line number Diff line number Diff line change 11
11
Interface ,
12
12
Mutation ,
13
13
Scalar ,
14
- BaseType ,
14
+ InstanceType ,
15
15
LazyType ,
16
16
Argument ,
17
17
Field ,
51
51
'NonNull' ,
52
52
'signals' ,
53
53
'Schema' ,
54
- 'BaseType ' ,
54
+ 'InstanceType ' ,
55
55
'LazyType' ,
56
56
'ObjectType' ,
57
57
'InputObjectType' ,
Original file line number Diff line number Diff line change 11
11
)
12
12
13
13
from .types import (
14
- BaseType ,
14
+ InstanceType ,
15
15
LazyType ,
16
16
Argument ,
17
17
Field ,
35
35
'List' ,
36
36
'NonNull' ,
37
37
'Schema' ,
38
- 'BaseType ' ,
38
+ 'InstanceType ' ,
39
39
'LazyType' ,
40
40
'ObjectType' ,
41
41
'InputObjectType' ,
Original file line number Diff line number Diff line change 12
12
13
13
from ..plugins import CamelCase , Plugin
14
14
from .classtypes .base import ClassType
15
- from .types .base import BaseType
15
+ from .types .base import InstanceType
16
16
17
17
18
18
class GraphQLSchema (_GraphQLSchema ):
@@ -59,7 +59,7 @@ def T(self, _type):
59
59
if not _type :
60
60
return
61
61
is_classtype = inspect .isclass (_type ) and issubclass (_type , ClassType )
62
- is_instancetype = isinstance (_type , BaseType )
62
+ is_instancetype = isinstance (_type , InstanceType )
63
63
if is_classtype or is_instancetype :
64
64
if _type not in self ._types :
65
65
internal_type = self .get_internal_type (_type )
Original file line number Diff line number Diff line change 1
- from .base import BaseType , LazyType , OrderedType
1
+ from .base import InstanceType , LazyType , OrderedType
2
2
from .argument import Argument , ArgumentsGroup , to_arguments
3
3
from .definitions import List , NonNull
4
4
# Compatibility import
8
8
from .field import Field , InputField
9
9
10
10
__all__ = [
11
- 'BaseType ' ,
11
+ 'InstanceType ' ,
12
12
'LazyType' ,
13
13
'OrderedType' ,
14
14
'Argument' ,
Original file line number Diff line number Diff line change 4
4
import six
5
5
6
6
7
- class BaseType (object ):
7
+ class InstanceType (object ):
8
8
9
- @classmethod
10
- def internal_type (cls , schema ):
11
- return getattr (cls , 'T' , None )
9
+ def internal_type (self , schema ):
10
+ raise NotImplementedError ("internal_type for type {} is not implemented" .format (self .__class__ .__name__ ))
12
11
13
12
14
- class MountType (BaseType ):
13
+ class MountType (InstanceType ):
15
14
parent = None
16
15
17
16
def mount (self , cls ):
@@ -129,11 +128,11 @@ class MountedType(FieldType, ArgumentType):
129
128
pass
130
129
131
130
132
- class NamedType (BaseType ):
131
+ class NamedType (InstanceType ):
133
132
pass
134
133
135
134
136
- class GroupNamedType (BaseType ):
135
+ class GroupNamedType (InstanceType ):
137
136
138
137
def __init__ (self , * types ):
139
138
self .types = types
Original file line number Diff line number Diff line change 4
4
from .base import MountedType
5
5
6
6
7
- class String (MountedType ):
8
- T = GraphQLString
7
+ class ScalarType (MountedType ):
9
8
9
+ def internal_type (self , schema ):
10
+ return self ._internal_type
10
11
11
- class Int (MountedType ):
12
- T = GraphQLInt
13
12
13
+ class String (ScalarType ):
14
+ _internal_type = GraphQLString
14
15
15
- class Boolean (MountedType ):
16
- T = GraphQLBoolean
17
16
17
+ class Int (ScalarType ):
18
+ _internal_type = GraphQLInt
18
19
19
- class ID (MountedType ):
20
- T = GraphQLID
21
20
21
+ class Boolean (ScalarType ):
22
+ _internal_type = GraphQLBoolean
22
23
23
- class Float (MountedType ):
24
- T = GraphQLFloat
24
+
25
+ class ID (ScalarType ):
26
+ _internal_type = GraphQLID
27
+
28
+
29
+ class Float (ScalarType ):
30
+ _internal_type = GraphQLFloat
You can’t perform that action at this time.
0 commit comments