mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 20:54:16 +03:00
Merge branch 'refs/heads/master' into features/plugins-autocamelcase
Conflicts: graphene/core/types/argument.py
This commit is contained in:
commit
730de3f289
|
@ -11,7 +11,7 @@ from .core import (
|
|||
Interface,
|
||||
Mutation,
|
||||
Scalar,
|
||||
BaseType,
|
||||
InstanceType,
|
||||
LazyType,
|
||||
Argument,
|
||||
Field,
|
||||
|
@ -51,7 +51,7 @@ __all__ = [
|
|||
'NonNull',
|
||||
'signals',
|
||||
'Schema',
|
||||
'BaseType',
|
||||
'InstanceType',
|
||||
'LazyType',
|
||||
'ObjectType',
|
||||
'InputObjectType',
|
||||
|
|
|
@ -11,7 +11,7 @@ from .classtypes import (
|
|||
)
|
||||
|
||||
from .types import (
|
||||
BaseType,
|
||||
InstanceType,
|
||||
LazyType,
|
||||
Argument,
|
||||
Field,
|
||||
|
@ -35,7 +35,7 @@ __all__ = [
|
|||
'List',
|
||||
'NonNull',
|
||||
'Schema',
|
||||
'BaseType',
|
||||
'InstanceType',
|
||||
'LazyType',
|
||||
'ObjectType',
|
||||
'InputObjectType',
|
||||
|
|
|
@ -12,7 +12,7 @@ from graphene import signals
|
|||
|
||||
from ..plugins import CamelCase, Plugin
|
||||
from .classtypes.base import ClassType
|
||||
from .types.base import BaseType
|
||||
from .types.base import InstanceType
|
||||
|
||||
|
||||
class GraphQLSchema(_GraphQLSchema):
|
||||
|
@ -59,7 +59,7 @@ class Schema(object):
|
|||
if not _type:
|
||||
return
|
||||
is_classtype = inspect.isclass(_type) and issubclass(_type, ClassType)
|
||||
is_instancetype = isinstance(_type, BaseType)
|
||||
is_instancetype = isinstance(_type, InstanceType)
|
||||
if is_classtype or is_instancetype:
|
||||
if _type not in self._types:
|
||||
internal_type = self.get_internal_type(_type)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from .base import BaseType, LazyType, OrderedType
|
||||
from .base import InstanceType, LazyType, OrderedType
|
||||
from .argument import Argument, ArgumentsGroup, to_arguments
|
||||
from .definitions import List, NonNull
|
||||
# Compatibility import
|
||||
|
@ -8,7 +8,7 @@ from .scalars import String, ID, Boolean, Int, Float
|
|||
from .field import Field, InputField
|
||||
|
||||
__all__ = [
|
||||
'BaseType',
|
||||
'InstanceType',
|
||||
'LazyType',
|
||||
'OrderedType',
|
||||
'Argument',
|
||||
|
|
|
@ -4,14 +4,13 @@ from functools import partial, total_ordering
|
|||
import six
|
||||
|
||||
|
||||
class BaseType(object):
|
||||
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(BaseType):
|
||||
class MountType(InstanceType):
|
||||
parent = None
|
||||
|
||||
def mount(self, cls):
|
||||
|
@ -129,11 +128,11 @@ class MountedType(FieldType, ArgumentType):
|
|||
pass
|
||||
|
||||
|
||||
class NamedType(BaseType):
|
||||
class NamedType(InstanceType):
|
||||
pass
|
||||
|
||||
|
||||
class GroupNamedType(BaseType):
|
||||
class GroupNamedType(InstanceType):
|
||||
|
||||
def __init__(self, *types):
|
||||
self.types = types
|
||||
|
|
|
@ -4,21 +4,27 @@ 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