mirror of
https://github.com/graphql-python/graphene.git
synced 2025-04-25 20:13:40 +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,
|
Interface,
|
||||||
Mutation,
|
Mutation,
|
||||||
Scalar,
|
Scalar,
|
||||||
BaseType,
|
InstanceType,
|
||||||
LazyType,
|
LazyType,
|
||||||
Argument,
|
Argument,
|
||||||
Field,
|
Field,
|
||||||
|
@ -51,7 +51,7 @@ __all__ = [
|
||||||
'NonNull',
|
'NonNull',
|
||||||
'signals',
|
'signals',
|
||||||
'Schema',
|
'Schema',
|
||||||
'BaseType',
|
'InstanceType',
|
||||||
'LazyType',
|
'LazyType',
|
||||||
'ObjectType',
|
'ObjectType',
|
||||||
'InputObjectType',
|
'InputObjectType',
|
||||||
|
|
|
@ -11,7 +11,7 @@ from .classtypes import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from .types import (
|
from .types import (
|
||||||
BaseType,
|
InstanceType,
|
||||||
LazyType,
|
LazyType,
|
||||||
Argument,
|
Argument,
|
||||||
Field,
|
Field,
|
||||||
|
@ -35,7 +35,7 @@ __all__ = [
|
||||||
'List',
|
'List',
|
||||||
'NonNull',
|
'NonNull',
|
||||||
'Schema',
|
'Schema',
|
||||||
'BaseType',
|
'InstanceType',
|
||||||
'LazyType',
|
'LazyType',
|
||||||
'ObjectType',
|
'ObjectType',
|
||||||
'InputObjectType',
|
'InputObjectType',
|
||||||
|
|
|
@ -11,7 +11,7 @@ from graphql.core.utils.schema_printer import print_schema
|
||||||
from graphene import signals
|
from graphene import signals
|
||||||
|
|
||||||
from .classtypes.base import ClassType
|
from .classtypes.base import ClassType
|
||||||
from .types.base import BaseType
|
from .types.base import InstanceType
|
||||||
|
|
||||||
|
|
||||||
class GraphQLSchema(_GraphQLSchema):
|
class GraphQLSchema(_GraphQLSchema):
|
||||||
|
@ -42,7 +42,7 @@ class Schema(object):
|
||||||
if not _type:
|
if not _type:
|
||||||
return
|
return
|
||||||
is_classtype = inspect.isclass(_type) and issubclass(_type, ClassType)
|
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 is_classtype or is_instancetype:
|
||||||
if _type not in self._types:
|
if _type not in self._types:
|
||||||
internal_type = _type.internal_type(self)
|
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 .argument import Argument, ArgumentsGroup, to_arguments
|
||||||
from .definitions import List, NonNull
|
from .definitions import List, NonNull
|
||||||
# Compatibility import
|
# Compatibility import
|
||||||
|
@ -8,7 +8,7 @@ from .scalars import String, ID, Boolean, Int, Float
|
||||||
from .field import Field, InputField
|
from .field import Field, InputField
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'BaseType',
|
'InstanceType',
|
||||||
'LazyType',
|
'LazyType',
|
||||||
'OrderedType',
|
'OrderedType',
|
||||||
'Argument',
|
'Argument',
|
||||||
|
|
|
@ -5,7 +5,7 @@ from itertools import chain
|
||||||
from graphql.core.type import GraphQLArgument
|
from graphql.core.type import GraphQLArgument
|
||||||
|
|
||||||
from ...utils import ProxySnakeDict, to_camel_case
|
from ...utils import ProxySnakeDict, to_camel_case
|
||||||
from .base import ArgumentType, BaseType, OrderedType
|
from .base import ArgumentType, InstanceType, OrderedType
|
||||||
|
|
||||||
|
|
||||||
class Argument(OrderedType):
|
class Argument(OrderedType):
|
||||||
|
@ -27,7 +27,7 @@ class Argument(OrderedType):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
class ArgumentsGroup(BaseType):
|
class ArgumentsGroup(InstanceType):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
arguments = to_arguments(*args, **kwargs)
|
arguments = to_arguments(*args, **kwargs)
|
||||||
|
|
|
@ -3,14 +3,14 @@ from functools import total_ordering
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
||||||
class BaseType(object):
|
class InstanceType(object):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def internal_type(cls, schema):
|
def internal_type(cls, schema):
|
||||||
return getattr(cls, 'T', None)
|
return getattr(cls, 'T', None)
|
||||||
|
|
||||||
|
|
||||||
class MountType(BaseType):
|
class MountType(InstanceType):
|
||||||
parent = None
|
parent = None
|
||||||
|
|
||||||
def mount(self, cls):
|
def mount(self, cls):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user