Renamed BaseType to InstanceType for code clarity

This commit is contained in:
Syrus Akbary 2015-12-06 15:49:54 -08:00
parent 5e708cc919
commit 37a454b831
6 changed files with 12 additions and 12 deletions

View File

@ -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',

View File

@ -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',

View File

@ -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)

View File

@ -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',

View File

@ -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)

View File

@ -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):