Skip to content

Commit 730de3f

Browse files
committed
Merge branch 'refs/heads/master' into features/plugins-autocamelcase
Conflicts: graphene/core/types/argument.py
2 parents 9e1dd8e + 2724025 commit 730de3f

File tree

6 files changed

+30
-25
lines changed

6 files changed

+30
-25
lines changed

graphene/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Interface,
1212
Mutation,
1313
Scalar,
14-
BaseType,
14+
InstanceType,
1515
LazyType,
1616
Argument,
1717
Field,
@@ -51,7 +51,7 @@
5151
'NonNull',
5252
'signals',
5353
'Schema',
54-
'BaseType',
54+
'InstanceType',
5555
'LazyType',
5656
'ObjectType',
5757
'InputObjectType',

graphene/core/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212

1313
from .types import (
14-
BaseType,
14+
InstanceType,
1515
LazyType,
1616
Argument,
1717
Field,
@@ -35,7 +35,7 @@
3535
'List',
3636
'NonNull',
3737
'Schema',
38-
'BaseType',
38+
'InstanceType',
3939
'LazyType',
4040
'ObjectType',
4141
'InputObjectType',

graphene/core/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from ..plugins import CamelCase, Plugin
1414
from .classtypes.base import ClassType
15-
from .types.base import BaseType
15+
from .types.base import InstanceType
1616

1717

1818
class GraphQLSchema(_GraphQLSchema):
@@ -59,7 +59,7 @@ def T(self, _type):
5959
if not _type:
6060
return
6161
is_classtype = inspect.isclass(_type) and issubclass(_type, ClassType)
62-
is_instancetype = isinstance(_type, BaseType)
62+
is_instancetype = isinstance(_type, InstanceType)
6363
if is_classtype or is_instancetype:
6464
if _type not in self._types:
6565
internal_type = self.get_internal_type(_type)

graphene/core/types/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .base import BaseType, LazyType, OrderedType
1+
from .base import InstanceType, LazyType, OrderedType
22
from .argument import Argument, ArgumentsGroup, to_arguments
33
from .definitions import List, NonNull
44
# Compatibility import
@@ -8,7 +8,7 @@
88
from .field import Field, InputField
99

1010
__all__ = [
11-
'BaseType',
11+
'InstanceType',
1212
'LazyType',
1313
'OrderedType',
1414
'Argument',

graphene/core/types/base.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
import six
55

66

7-
class BaseType(object):
7+
class InstanceType(object):
88

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__))
1211

1312

14-
class MountType(BaseType):
13+
class MountType(InstanceType):
1514
parent = None
1615

1716
def mount(self, cls):
@@ -129,11 +128,11 @@ class MountedType(FieldType, ArgumentType):
129128
pass
130129

131130

132-
class NamedType(BaseType):
131+
class NamedType(InstanceType):
133132
pass
134133

135134

136-
class GroupNamedType(BaseType):
135+
class GroupNamedType(InstanceType):
137136

138137
def __init__(self, *types):
139138
self.types = types

graphene/core/types/scalars.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,27 @@
44
from .base import MountedType
55

66

7-
class String(MountedType):
8-
T = GraphQLString
7+
class ScalarType(MountedType):
98

9+
def internal_type(self, schema):
10+
return self._internal_type
1011

11-
class Int(MountedType):
12-
T = GraphQLInt
1312

13+
class String(ScalarType):
14+
_internal_type = GraphQLString
1415

15-
class Boolean(MountedType):
16-
T = GraphQLBoolean
1716

17+
class Int(ScalarType):
18+
_internal_type = GraphQLInt
1819

19-
class ID(MountedType):
20-
T = GraphQLID
2120

21+
class Boolean(ScalarType):
22+
_internal_type = GraphQLBoolean
2223

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

0 commit comments

Comments
 (0)