mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-29 21:13:58 +03:00
Rewrite imports to be relative instead of absolute
This commit is contained in:
parent
f4a8d53409
commit
5282627537
|
@ -1,9 +1,8 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from singledispatch import singledispatch
|
from singledispatch import singledispatch
|
||||||
|
|
||||||
from graphene.contrib.django.fields import (ConnectionOrListField,
|
from ...core.types.scalars import ID, Boolean, Float, Int, String
|
||||||
DjangoModelField)
|
from .fields import ConnectionOrListField, DjangoModelField
|
||||||
from graphene.core.types.scalars import ID, Boolean, Float, Int, String
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
UUIDField = models.UUIDField
|
UUIDField = models.UUIDField
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
from graphene import relay
|
from ...core.exceptions import SkipField
|
||||||
from graphene.contrib.django.utils import get_type_for_model, lazy_map
|
from ...core.fields import Field
|
||||||
from graphene.core.exceptions import SkipField
|
from ...core.types.base import FieldType
|
||||||
from graphene.core.fields import Field
|
from ...core.types.definitions import List
|
||||||
from graphene.core.types.base import FieldType
|
from ...relay import ConnectionField
|
||||||
from graphene.core.types.definitions import List
|
from ...relay.utils import is_node
|
||||||
from graphene.relay.utils import is_node
|
from .utils import get_type_for_model, lazy_map
|
||||||
|
|
||||||
|
|
||||||
class DjangoConnectionField(relay.ConnectionField):
|
class DjangoConnectionField(ConnectionField):
|
||||||
|
|
||||||
def wrap_resolved(self, value, instance, args, info):
|
def wrap_resolved(self, value, instance, args, info):
|
||||||
schema = info.schema.graphene_schema
|
schema = info.schema.graphene_schema
|
||||||
|
|
|
@ -2,9 +2,9 @@ import inspect
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from graphene.core.options import Options
|
from ...core.options import Options
|
||||||
from graphene.relay.types import Node
|
from ...relay.types import Node
|
||||||
from graphene.relay.utils import is_node
|
from ...relay.utils import is_node
|
||||||
|
|
||||||
VALID_ATTRS = ('model', 'only_fields', 'exclude_fields')
|
VALID_ATTRS = ('model', 'only_fields', 'exclude_fields')
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphene.contrib.django.converter import convert_django_field
|
from ...core.types import BaseObjectType, ObjectTypeMeta
|
||||||
from graphene.contrib.django.options import DjangoOptions
|
from ...relay.fields import GlobalIDField
|
||||||
from graphene.contrib.django.utils import get_reverse_fields
|
from ...relay.types import BaseNode
|
||||||
from graphene.core.types import BaseObjectType, ObjectTypeMeta
|
from .converter import convert_django_field
|
||||||
from graphene.relay.fields import GlobalIDField
|
from .options import DjangoOptions
|
||||||
from graphene.relay.types import BaseNode
|
from .utils import get_reverse_fields
|
||||||
|
|
||||||
|
|
||||||
class DjangoObjectTypeMeta(ObjectTypeMeta):
|
class DjangoObjectTypeMeta(ObjectTypeMeta):
|
||||||
|
|
|
@ -2,7 +2,7 @@ from django.db import models
|
||||||
from django.db.models.manager import Manager
|
from django.db.models.manager import Manager
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
from graphene.utils import LazyMap
|
from ...utils import LazyMap
|
||||||
|
|
||||||
|
|
||||||
def get_type_for_model(schema, model):
|
def get_type_for_model(schema, model):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from graphene.utils import cached_property
|
from ..utils import cached_property
|
||||||
|
|
||||||
DEFAULT_NAMES = ('description', 'name', 'is_interface', 'is_mutation',
|
DEFAULT_NAMES = ('description', 'name', 'is_interface', 'is_mutation',
|
||||||
'type_name', 'interfaces')
|
'type_name', 'interfaces')
|
||||||
|
|
|
@ -2,14 +2,15 @@ import inspect
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from graphene import signals
|
from graphene import signals
|
||||||
from graphene.core.types.base import BaseType
|
|
||||||
from graphene.core.types.objecttype import BaseObjectType
|
|
||||||
from graphql.core.execution.executor import Executor
|
from graphql.core.execution.executor import Executor
|
||||||
from graphql.core.execution.middlewares.sync import \
|
from graphql.core.execution.middlewares.sync import \
|
||||||
SynchronousExecutionMiddleware
|
SynchronousExecutionMiddleware
|
||||||
from graphql.core.type import GraphQLSchema as _GraphQLSchema
|
from graphql.core.type import GraphQLSchema as _GraphQLSchema
|
||||||
from graphql.core.utils.introspection_query import introspection_query
|
from graphql.core.utils.introspection_query import introspection_query
|
||||||
|
|
||||||
|
from .types.base import BaseType
|
||||||
|
from .types.objecttype import BaseObjectType
|
||||||
|
|
||||||
|
|
||||||
class GraphQLSchema(_GraphQLSchema):
|
class GraphQLSchema(_GraphQLSchema):
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from itertools import chain
|
||||||
|
|
||||||
from graphql.core.type import GraphQLArgument
|
from graphql.core.type import GraphQLArgument
|
||||||
|
|
||||||
from ...utils import to_camel_case, ProxySnakeDict
|
from ...utils import ProxySnakeDict, to_camel_case
|
||||||
from .base import ArgumentType, BaseType, OrderedType
|
from .base import ArgumentType, BaseType, OrderedType
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,15 @@ from functools import partial
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphene import signals
|
from graphene import signals
|
||||||
from graphene.core.exceptions import SkipField
|
|
||||||
from graphene.core.options import Options
|
|
||||||
from graphene.core.types.argument import ArgumentsGroup
|
|
||||||
from graphene.core.types.base import BaseType
|
|
||||||
from graphene.core.types.definitions import List, NonNull
|
|
||||||
from graphql.core.type import (GraphQLArgument, GraphQLInputObjectType,
|
from graphql.core.type import (GraphQLArgument, GraphQLInputObjectType,
|
||||||
GraphQLInterfaceType, GraphQLObjectType)
|
GraphQLInterfaceType, GraphQLObjectType)
|
||||||
|
|
||||||
|
from ..exceptions import SkipField
|
||||||
|
from ..options import Options
|
||||||
|
from .argument import ArgumentsGroup
|
||||||
|
from .base import BaseType
|
||||||
|
from .definitions import List, NonNull
|
||||||
|
|
||||||
|
|
||||||
class ObjectTypeMeta(type):
|
class ObjectTypeMeta(type):
|
||||||
options_cls = Options
|
options_cls = Options
|
||||||
|
@ -210,6 +211,7 @@ class ObjectType(six.with_metaclass(ObjectTypeMeta, BaseObjectType)):
|
||||||
|
|
||||||
|
|
||||||
class Mutation(six.with_metaclass(ObjectTypeMeta, BaseObjectType)):
|
class Mutation(six.with_metaclass(ObjectTypeMeta, BaseObjectType)):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _construct_arguments(cls, items):
|
def _construct_arguments(cls, items):
|
||||||
return ArgumentsGroup(**items)
|
return ArgumentsGroup(**items)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from graphene.core.schema import Schema
|
||||||
from graphene.core.types import ObjectType
|
from graphene.core.types import ObjectType
|
||||||
from graphql.core.type import GraphQLArgument
|
from graphql.core.type import GraphQLArgument
|
||||||
|
|
||||||
from ..argument import Argument, to_arguments, snake_case_args
|
from ..argument import Argument, snake_case_args, to_arguments
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ from graphene.core.types import InputObjectType, ObjectType
|
||||||
|
|
||||||
from ..argument import Argument
|
from ..argument import Argument
|
||||||
from ..base import MountedType, OrderedType
|
from ..base import MountedType, OrderedType
|
||||||
from ..field import Field, InputField
|
|
||||||
from ..definitions import List, NonNull
|
from ..definitions import List, NonNull
|
||||||
|
from ..field import Field, InputField
|
||||||
|
|
||||||
|
|
||||||
def test_orderedtype_equal():
|
def test_orderedtype_equal():
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from graphene.relay.fields import (
|
from .fields import (
|
||||||
ConnectionField,
|
ConnectionField,
|
||||||
NodeField,
|
NodeField,
|
||||||
GlobalIDField,
|
GlobalIDField,
|
||||||
)
|
)
|
||||||
|
|
||||||
from graphene.relay.types import (
|
from .types import (
|
||||||
Node,
|
Node,
|
||||||
PageInfo,
|
PageInfo,
|
||||||
Edge,
|
Edge,
|
||||||
|
@ -12,7 +12,7 @@ from graphene.relay.types import (
|
||||||
ClientIDMutation
|
ClientIDMutation
|
||||||
)
|
)
|
||||||
|
|
||||||
from graphene.relay.utils import is_node
|
from .utils import is_node
|
||||||
|
|
||||||
__all__ = ['ConnectionField', 'NodeField', 'GlobalIDField', 'Node',
|
__all__ = ['ConnectionField', 'NodeField', 'GlobalIDField', 'Node',
|
||||||
'PageInfo', 'Edge', 'Connection', 'ClientIDMutation', 'is_node']
|
'PageInfo', 'Edge', 'Connection', 'ClientIDMutation', 'is_node']
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
from collections import Iterable
|
from collections import Iterable
|
||||||
|
|
||||||
from graphene.core.fields import Field
|
|
||||||
from graphene.core.types.definitions import NonNull
|
|
||||||
from graphene.core.types.scalars import ID, Int, String
|
|
||||||
from graphql_relay.connection.arrayconnection import connection_from_list
|
from graphql_relay.connection.arrayconnection import connection_from_list
|
||||||
from graphql_relay.node.node import from_global_id
|
from graphql_relay.node.node import from_global_id
|
||||||
|
|
||||||
|
from ..core.fields import Field
|
||||||
|
from ..core.types.definitions import NonNull
|
||||||
|
from ..core.types.scalars import ID, Int, String
|
||||||
|
|
||||||
|
|
||||||
class ConnectionField(Field):
|
class ConnectionField(Field):
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
from graphene.core.types import (Boolean, Field, InputObjectType, Interface,
|
|
||||||
List, Mutation, ObjectType, String)
|
|
||||||
from graphene.core.types.argument import ArgumentsGroup
|
|
||||||
from graphene.core.types.base import LazyType
|
|
||||||
from graphene.core.types.definitions import NonNull
|
|
||||||
from graphene.relay.fields import GlobalIDField
|
|
||||||
from graphene.utils import memoize
|
|
||||||
from graphql_relay.node.node import to_global_id
|
from graphql_relay.node.node import to_global_id
|
||||||
|
|
||||||
|
from ..core.types import (Boolean, Field, InputObjectType, Interface, List,
|
||||||
|
Mutation, ObjectType, String)
|
||||||
|
from ..core.types.argument import ArgumentsGroup
|
||||||
|
from ..core.types.base import LazyType
|
||||||
|
from ..core.types.definitions import NonNull
|
||||||
|
from ..utils import memoize
|
||||||
|
from .fields import GlobalIDField
|
||||||
|
|
||||||
|
|
||||||
class PageInfo(ObjectType):
|
class PageInfo(ObjectType):
|
||||||
has_next_page = Boolean(
|
has_next_page = Boolean(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from graphene.relay.types import BaseNode
|
from .types import BaseNode
|
||||||
|
|
||||||
|
|
||||||
def is_node(object_type):
|
def is_node(object_type):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user