mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-22 13:59:51 +03:00
isort observer in root dir
This commit is contained in:
parent
cc764ebc7b
commit
207ea631ad
|
@ -3,7 +3,7 @@ droid_data = {}
|
||||||
|
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
from .schema import Human, Droid
|
from .schema import Droid, Human
|
||||||
|
|
||||||
global human_data, droid_data
|
global human_data, droid_data
|
||||||
luke = Human(
|
luke = Human(
|
||||||
|
|
|
@ -4,7 +4,7 @@ data = {}
|
||||||
def setup():
|
def setup():
|
||||||
global data
|
global data
|
||||||
|
|
||||||
from .schema import Ship, Faction
|
from .schema import Faction, Ship
|
||||||
|
|
||||||
xwing = Ship(id="1", name="X-Wing")
|
xwing = Ship(id="1", name="X-Wing")
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from snapshottest import Snapshot
|
from snapshottest import Snapshot
|
||||||
|
|
||||||
|
|
||||||
snapshots = Snapshot()
|
snapshots = Snapshot()
|
||||||
|
|
||||||
snapshots["test_correctly_fetches_id_name_rebels 1"] = {
|
snapshots["test_correctly_fetches_id_name_rebels 1"] = {
|
||||||
|
|
|
@ -1,43 +1,11 @@
|
||||||
from .pyutils.version import get_version
|
from .pyutils.version import get_version
|
||||||
from .relay import (
|
from .relay import (ClientIDMutation, Connection, ConnectionField, GlobalID,
|
||||||
ClientIDMutation,
|
Node, PageInfo, is_node)
|
||||||
Connection,
|
from .types import (ID, UUID, Argument, Base64, Boolean, Context, Date,
|
||||||
ConnectionField,
|
DateTime, Decimal, Dynamic, Enum, Field, Float, InputField,
|
||||||
GlobalID,
|
InputObjectType, Int, Interface, JSONString, List,
|
||||||
Node,
|
Mutation, NonNull, ObjectType, ResolveInfo, Scalar, Schema,
|
||||||
PageInfo,
|
String, Time, Union)
|
||||||
is_node,
|
|
||||||
)
|
|
||||||
from .types import (
|
|
||||||
ID,
|
|
||||||
UUID,
|
|
||||||
Argument,
|
|
||||||
Base64,
|
|
||||||
Boolean,
|
|
||||||
Context,
|
|
||||||
Date,
|
|
||||||
DateTime,
|
|
||||||
Decimal,
|
|
||||||
Dynamic,
|
|
||||||
Enum,
|
|
||||||
Field,
|
|
||||||
Float,
|
|
||||||
InputField,
|
|
||||||
InputObjectType,
|
|
||||||
Int,
|
|
||||||
Interface,
|
|
||||||
JSONString,
|
|
||||||
List,
|
|
||||||
Mutation,
|
|
||||||
NonNull,
|
|
||||||
ObjectType,
|
|
||||||
ResolveInfo,
|
|
||||||
Scalar,
|
|
||||||
Schema,
|
|
||||||
String,
|
|
||||||
Time,
|
|
||||||
Union,
|
|
||||||
)
|
|
||||||
from .utils.module_loading import lazy_import
|
from .utils.module_loading import lazy_import
|
||||||
from .utils.resolve_only_args import resolve_only_args
|
from .utils.resolve_only_args import resolve_only_args
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
# https://docs.python.org/3/library/dataclasses.html
|
# https://docs.python.org/3/library/dataclasses.html
|
||||||
# Original PEP proposal: PEP 557
|
# Original PEP proposal: PEP 557
|
||||||
# https://www.python.org/dev/peps/pep-0557/
|
# https://www.python.org/dev/peps/pep-0557/
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import copy
|
import copy
|
||||||
import types
|
|
||||||
import inspect
|
import inspect
|
||||||
import keyword
|
import keyword
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import types
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"dataclass",
|
"dataclass",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from promise import Promise, is_thenable
|
|
||||||
from graphql.error import format_error as format_graphql_error
|
|
||||||
from graphql.error import GraphQLError
|
from graphql.error import GraphQLError
|
||||||
|
from graphql.error import format_error as format_graphql_error
|
||||||
|
from promise import Promise, is_thenable
|
||||||
|
|
||||||
from graphene.types.schema import Schema
|
from graphene.types.schema import Schema
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ class Argument(MountedType):
|
||||||
|
|
||||||
|
|
||||||
def to_arguments(args, extra_args=None):
|
def to_arguments(args, extra_args=None):
|
||||||
from .unmountedtype import UnmountedType
|
|
||||||
from .field import Field
|
from .field import Field
|
||||||
from .inputfield import InputField
|
from .inputfield import InputField
|
||||||
|
from .unmountedtype import UnmountedType
|
||||||
|
|
||||||
if extra_args:
|
if extra_args:
|
||||||
extra_args = sorted(extra_args.items(), key=lambda f: f[1])
|
extra_args = sorted(extra_args.items(), key=lambda f: f[1])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from binascii import Error as _Error
|
|
||||||
from base64 import b64decode, b64encode
|
from base64 import b64decode, b64encode
|
||||||
|
from binascii import Error as _Error
|
||||||
|
|
||||||
from graphql.error import GraphQLError
|
from graphql.error import GraphQLError
|
||||||
from graphql.language import StringValueNode, print_ast
|
from graphql.language import StringValueNode, print_ast
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
from enum import Enum as PyEnum
|
from enum import Enum as PyEnum
|
||||||
|
|
||||||
from graphql import (
|
from graphql import (GraphQLEnumType, GraphQLInputObjectType,
|
||||||
GraphQLEnumType,
|
GraphQLInterfaceType, GraphQLObjectType,
|
||||||
GraphQLInputObjectType,
|
GraphQLScalarType, GraphQLUnionType, Undefined)
|
||||||
GraphQLInterfaceType,
|
|
||||||
GraphQLObjectType,
|
|
||||||
GraphQLScalarType,
|
|
||||||
GraphQLUnionType,
|
|
||||||
Undefined,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class GrapheneGraphQLType:
|
class GrapheneGraphQLType:
|
||||||
|
|
|
@ -2,13 +2,13 @@ import inspect
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
from ..utils.deprecated import warn_deprecation
|
||||||
from .argument import Argument, to_arguments
|
from .argument import Argument, to_arguments
|
||||||
from .mountedtype import MountedType
|
from .mountedtype import MountedType
|
||||||
from .resolver import default_resolver
|
from .resolver import default_resolver
|
||||||
from .structures import NonNull
|
from .structures import NonNull
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
from .utils import get_type
|
from .utils import get_type
|
||||||
from ..utils.deprecated import warn_deprecation
|
|
||||||
|
|
||||||
base_type = type
|
base_type = type
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from graphql.language.ast import (
|
from graphql.language.ast import (BooleanValueNode, FloatValueNode,
|
||||||
BooleanValueNode,
|
IntValueNode, ListValueNode, ObjectValueNode,
|
||||||
FloatValueNode,
|
StringValueNode)
|
||||||
IntValueNode,
|
|
||||||
ListValueNode,
|
|
||||||
ObjectValueNode,
|
|
||||||
StringValueNode,
|
|
||||||
)
|
|
||||||
|
|
||||||
from graphene.types.scalars import MAX_INT, MIN_INT
|
from graphene.types.scalars import MAX_INT, MIN_INT
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from .utils import yank_fields_from_attrs
|
||||||
# For static type checking with Mypy
|
# For static type checking with Mypy
|
||||||
MYPY = False
|
MYPY = False
|
||||||
if MYPY:
|
if MYPY:
|
||||||
from typing import Dict, Callable # NOQA
|
from typing import Callable, Dict # NOQA
|
||||||
|
|
||||||
|
|
||||||
class InputObjectTypeOptions(BaseOptions):
|
class InputObjectTypeOptions(BaseOptions):
|
||||||
|
|
|
@ -2,15 +2,16 @@ from ..utils.deprecated import warn_deprecation
|
||||||
from ..utils.get_unbound_function import get_unbound_function
|
from ..utils.get_unbound_function import get_unbound_function
|
||||||
from ..utils.props import props
|
from ..utils.props import props
|
||||||
from .field import Field
|
from .field import Field
|
||||||
|
from .interface import Interface
|
||||||
from .objecttype import ObjectType, ObjectTypeOptions
|
from .objecttype import ObjectType, ObjectTypeOptions
|
||||||
from .utils import yank_fields_from_attrs
|
from .utils import yank_fields_from_attrs
|
||||||
from .interface import Interface
|
|
||||||
|
|
||||||
# For static type checking with Mypy
|
# For static type checking with Mypy
|
||||||
MYPY = False
|
MYPY = False
|
||||||
if MYPY:
|
if MYPY:
|
||||||
|
from typing import Callable, Dict, Iterable, Type # NOQA
|
||||||
|
|
||||||
from .argument import Argument # NOQA
|
from .argument import Argument # NOQA
|
||||||
from typing import Dict, Type, Callable, Iterable # NOQA
|
|
||||||
|
|
||||||
|
|
||||||
class MutationOptions(ObjectTypeOptions):
|
class MutationOptions(ObjectTypeOptions):
|
||||||
|
|
|
@ -4,9 +4,9 @@ from .interface import Interface
|
||||||
from .utils import yank_fields_from_attrs
|
from .utils import yank_fields_from_attrs
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from dataclasses import make_dataclass, field
|
from dataclasses import field, make_dataclass
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ..pyutils.dataclasses import make_dataclass, field # type: ignore
|
from ..pyutils.dataclasses import field, make_dataclass # type: ignore
|
||||||
|
|
||||||
# For static type checking with Mypy
|
# For static type checking with Mypy
|
||||||
MYPY = False
|
MYPY = False
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from graphql.language.ast import (
|
from graphql.language.ast import (BooleanValueNode, FloatValueNode,
|
||||||
BooleanValueNode,
|
IntValueNode, StringValueNode)
|
||||||
FloatValueNode,
|
|
||||||
IntValueNode,
|
|
||||||
StringValueNode,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .base import BaseOptions, BaseType
|
from .base import BaseOptions, BaseType
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
|
|
|
@ -1,45 +1,21 @@
|
||||||
import inspect
|
import inspect
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from graphql import (
|
from graphql import (ExecutionResult, GraphQLArgument, GraphQLBoolean,
|
||||||
default_type_resolver,
|
GraphQLEnumValue, GraphQLError, GraphQLField,
|
||||||
get_introspection_query,
|
GraphQLFloat, GraphQLID, GraphQLInputField, GraphQLInt,
|
||||||
graphql,
|
GraphQLList, GraphQLNonNull, GraphQLObjectType,
|
||||||
graphql_sync,
|
GraphQLSchema, GraphQLString, Undefined,
|
||||||
introspection_types,
|
default_type_resolver, get_introspection_query, graphql,
|
||||||
parse,
|
graphql_sync, introspection_types, parse, print_schema,
|
||||||
print_schema,
|
subscribe, validate)
|
||||||
subscribe,
|
|
||||||
validate,
|
|
||||||
ExecutionResult,
|
|
||||||
GraphQLArgument,
|
|
||||||
GraphQLBoolean,
|
|
||||||
GraphQLError,
|
|
||||||
GraphQLEnumValue,
|
|
||||||
GraphQLField,
|
|
||||||
GraphQLFloat,
|
|
||||||
GraphQLID,
|
|
||||||
GraphQLInputField,
|
|
||||||
GraphQLInt,
|
|
||||||
GraphQLList,
|
|
||||||
GraphQLNonNull,
|
|
||||||
GraphQLObjectType,
|
|
||||||
GraphQLSchema,
|
|
||||||
GraphQLString,
|
|
||||||
Undefined,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ..utils.str_converters import to_camel_case
|
|
||||||
from ..utils.get_unbound_function import get_unbound_function
|
from ..utils.get_unbound_function import get_unbound_function
|
||||||
from .definitions import (
|
from ..utils.str_converters import to_camel_case
|
||||||
GrapheneEnumType,
|
from .definitions import (GrapheneEnumType, GrapheneGraphQLType,
|
||||||
GrapheneGraphQLType,
|
GrapheneInputObjectType, GrapheneInterfaceType,
|
||||||
GrapheneInputObjectType,
|
GrapheneObjectType, GrapheneScalarType,
|
||||||
GrapheneInterfaceType,
|
GrapheneUnionType)
|
||||||
GrapheneObjectType,
|
|
||||||
GrapheneScalarType,
|
|
||||||
GrapheneUnionType,
|
|
||||||
)
|
|
||||||
from .dynamic import Dynamic
|
from .dynamic import Dynamic
|
||||||
from .enum import Enum
|
from .enum import Enum
|
||||||
from .field import Field
|
from .field import Field
|
||||||
|
|
|
@ -2,10 +2,10 @@ import base64
|
||||||
|
|
||||||
from graphql import GraphQLError
|
from graphql import GraphQLError
|
||||||
|
|
||||||
|
from ..base64 import Base64
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
from ..schema import Schema
|
from ..schema import Schema
|
||||||
from ..base64 import Base64
|
|
||||||
|
|
||||||
|
|
||||||
class Query(ObjectType):
|
class Query(ObjectType):
|
||||||
|
|
|
@ -2,7 +2,6 @@ import datetime
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
from graphql import GraphQLError
|
from graphql import GraphQLError
|
||||||
|
|
||||||
from pytest import fixture
|
from pytest import fixture
|
||||||
|
|
||||||
from ..datetime import Date, DateTime, Time
|
from ..datetime import Date, DateTime, Time
|
||||||
|
|
|
@ -2,12 +2,12 @@ from pytest import raises
|
||||||
|
|
||||||
from ..argument import Argument
|
from ..argument import Argument
|
||||||
from ..dynamic import Dynamic
|
from ..dynamic import Dynamic
|
||||||
|
from ..interface import Interface
|
||||||
from ..mutation import Mutation
|
from ..mutation import Mutation
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
from ..schema import Schema
|
from ..schema import Schema
|
||||||
from ..structures import NonNull
|
from ..structures import NonNull
|
||||||
from ..interface import Interface
|
|
||||||
|
|
||||||
|
|
||||||
class MyType(Interface):
|
class MyType(Interface):
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import json
|
import json
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from graphql import (
|
from graphql import GraphQLError
|
||||||
GraphQLError,
|
from graphql import GraphQLResolveInfo as ResolveInfo
|
||||||
GraphQLResolveInfo as ResolveInfo,
|
from graphql import Source, execute, parse
|
||||||
Source,
|
|
||||||
execute,
|
|
||||||
parse,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ..context import Context
|
from ..context import Context
|
||||||
from ..dynamic import Dynamic
|
from ..dynamic import Dynamic
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
from ..resolver import (
|
from ..resolver import (attr_resolver, dict_or_attr_resolver, dict_resolver,
|
||||||
attr_resolver,
|
get_default_resolver, set_default_resolver)
|
||||||
dict_resolver,
|
|
||||||
dict_or_attr_resolver,
|
|
||||||
get_default_resolver,
|
|
||||||
set_default_resolver,
|
|
||||||
)
|
|
||||||
|
|
||||||
args = {}
|
args = {}
|
||||||
context = None
|
context = None
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from ..scalars import Scalar, Int, BigInt
|
|
||||||
from graphql.language.ast import IntValueNode
|
from graphql.language.ast import IntValueNode
|
||||||
|
|
||||||
|
from ..scalars import BigInt, Int, Scalar
|
||||||
|
|
||||||
|
|
||||||
def test_scalar():
|
def test_scalar():
|
||||||
class JSONScalar(Scalar):
|
class JSONScalar(Scalar):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from pytest import mark
|
from pytest import mark
|
||||||
|
|
||||||
from graphene import ObjectType, Int, String, Schema, Field
|
from graphene import Field, Int, ObjectType, Schema, String
|
||||||
|
|
||||||
|
|
||||||
class Query(ObjectType):
|
class Query(ObjectType):
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
from graphql.type import (
|
from graphql.type import (GraphQLArgument, GraphQLEnumType, GraphQLEnumValue,
|
||||||
GraphQLArgument,
|
GraphQLField, GraphQLInputField,
|
||||||
GraphQLEnumType,
|
GraphQLInputObjectType, GraphQLInterfaceType,
|
||||||
GraphQLEnumValue,
|
GraphQLObjectType, GraphQLString)
|
||||||
GraphQLField,
|
|
||||||
GraphQLInputField,
|
|
||||||
GraphQLInputObjectType,
|
|
||||||
GraphQLInterfaceType,
|
|
||||||
GraphQLObjectType,
|
|
||||||
GraphQLString,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ..dynamic import Dynamic
|
from ..dynamic import Dynamic
|
||||||
from ..enum import Enum
|
from ..enum import Enum
|
||||||
|
@ -18,8 +11,8 @@ from ..inputobjecttype import InputObjectType
|
||||||
from ..interface import Interface
|
from ..interface import Interface
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
from ..scalars import Int, String
|
from ..scalars import Int, String
|
||||||
from ..structures import List, NonNull
|
|
||||||
from ..schema import Schema
|
from ..schema import Schema
|
||||||
|
from ..structures import List, NonNull
|
||||||
|
|
||||||
|
|
||||||
def create_type_map(types, auto_camelcase=True):
|
def create_type_map(types, auto_camelcase=True):
|
||||||
|
|
|
@ -4,9 +4,10 @@ from .unmountedtype import UnmountedType
|
||||||
# For static type checking with Mypy
|
# For static type checking with Mypy
|
||||||
MYPY = False
|
MYPY = False
|
||||||
if MYPY:
|
if MYPY:
|
||||||
from .objecttype import ObjectType # NOQA
|
|
||||||
from typing import Iterable, Type # NOQA
|
from typing import Iterable, Type # NOQA
|
||||||
|
|
||||||
|
from .objecttype import ObjectType # NOQA
|
||||||
|
|
||||||
|
|
||||||
class UnionOptions(BaseOptions):
|
class UnionOptions(BaseOptions):
|
||||||
types = () # type: Iterable[Type[ObjectType]]
|
types = () # type: Iterable[Type[ObjectType]]
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from uuid import UUID as _UUID
|
from uuid import UUID as _UUID
|
||||||
|
|
||||||
from graphql.language.ast import StringValueNode
|
from graphql.language.ast import StringValueNode
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import relay
|
from graphene import relay
|
||||||
from graphene.types.resolver import dict_resolver
|
from graphene.types.resolver import dict_resolver
|
||||||
|
|
Loading…
Reference in New Issue
Block a user