mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
Improved ScalarTypes code
This commit is contained in:
parent
37a454b831
commit
2724025a5b
|
@ -5,9 +5,8 @@ import six
|
|||
|
||||
class InstanceType(object):
|
||||
|
||||
@classmethod
|
||||
def internal_type(cls, schema):
|
||||
return getattr(cls, 'T', None)
|
||||
def internal_type(self, schema):
|
||||
raise NotImplementedError("internal_type for type {} is not implemented".format(self.__class__.__name__))
|
||||
|
||||
|
||||
class MountType(InstanceType):
|
||||
|
|
|
@ -4,21 +4,26 @@ from graphql.core.type import (GraphQLBoolean, GraphQLFloat, GraphQLID,
|
|||
from .base import MountedType
|
||||
|
||||
|
||||
class String(MountedType):
|
||||
T = GraphQLString
|
||||
class ScalarType(MountedType):
|
||||
def internal_type(self, schema):
|
||||
return self._internal_type
|
||||
|
||||
|
||||
class Int(MountedType):
|
||||
T = GraphQLInt
|
||||
class String(ScalarType):
|
||||
_internal_type = GraphQLString
|
||||
|
||||
|
||||
class Boolean(MountedType):
|
||||
T = GraphQLBoolean
|
||||
class Int(ScalarType):
|
||||
_internal_type = GraphQLInt
|
||||
|
||||
|
||||
class ID(MountedType):
|
||||
T = GraphQLID
|
||||
class Boolean(ScalarType):
|
||||
_internal_type = GraphQLBoolean
|
||||
|
||||
|
||||
class Float(MountedType):
|
||||
T = GraphQLFloat
|
||||
class ID(ScalarType):
|
||||
_internal_type = GraphQLID
|
||||
|
||||
|
||||
class Float(ScalarType):
|
||||
_internal_type = GraphQLFloat
|
||||
|
|
Loading…
Reference in New Issue
Block a user