mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-26 19:43:56 +03:00
Renamed BaseType to InstanceType for code clarity
This commit is contained in:
parent
5e708cc919
commit
37a454b831
|
@ -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',
|
||||
|
|
|
@ -11,7 +11,7 @@ from graphql.core.utils.schema_printer import print_schema
|
|||
from graphene import signals
|
||||
|
||||
from .classtypes.base import ClassType
|
||||
from .types.base import BaseType
|
||||
from .types.base import InstanceType
|
||||
|
||||
|
||||
class GraphQLSchema(_GraphQLSchema):
|
||||
|
@ -42,7 +42,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 = _type.internal_type(self)
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -5,7 +5,7 @@ from itertools import chain
|
|||
from graphql.core.type import GraphQLArgument
|
||||
|
||||
from ...utils import ProxySnakeDict, to_camel_case
|
||||
from .base import ArgumentType, BaseType, OrderedType
|
||||
from .base import ArgumentType, InstanceType, OrderedType
|
||||
|
||||
|
||||
class Argument(OrderedType):
|
||||
|
@ -27,7 +27,7 @@ class Argument(OrderedType):
|
|||
return self.name
|
||||
|
||||
|
||||
class ArgumentsGroup(BaseType):
|
||||
class ArgumentsGroup(InstanceType):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
arguments = to_arguments(*args, **kwargs)
|
||||
|
|
|
@ -3,14 +3,14 @@ from functools import total_ordering
|
|||
import six
|
||||
|
||||
|
||||
class BaseType(object):
|
||||
class InstanceType(object):
|
||||
|
||||
@classmethod
|
||||
def internal_type(cls, schema):
|
||||
return getattr(cls, 'T', None)
|
||||
|
||||
|
||||
class MountType(BaseType):
|
||||
class MountType(InstanceType):
|
||||
parent = None
|
||||
|
||||
def mount(self, cls):
|
||||
|
|
Loading…
Reference in New Issue
Block a user