mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 17:46:57 +03:00
Merge branch 'master' of github.com:dan98765/graphene into pre_commit_runs_as_part_of_continuous_integration
This commit is contained in:
commit
6116901ab6
|
@ -11,4 +11,3 @@ trim_trailing_whitespace = true
|
|||
[*.{py,rst,ini}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
|
|
2
.isort.cfg
Normal file
2
.isort.cfg
Normal file
|
@ -0,0 +1,2 @@
|
|||
[settings]
|
||||
known_third_party = aniso8601,graphql,graphql_relay,promise,pytest,pytz,pyutils,setuptools,six,snapshottest,sphinx_graphene_theme
|
|
@ -1,5 +1,6 @@
|
|||
repos:
|
||||
- repo: git://github.com/pre-commit/pre-commit-hooks
|
||||
sha: v0.8.0
|
||||
rev: v1.2.3
|
||||
hooks:
|
||||
- id: autopep8-wrapper
|
||||
args:
|
||||
|
@ -15,3 +16,11 @@
|
|||
- id: pretty-format-json
|
||||
args:
|
||||
- --autofix
|
||||
- repo: https://github.com/asottile/seed-isort-config
|
||||
rev: v1.0.0
|
||||
hooks:
|
||||
- id: seed-isort-config
|
||||
- repo: https://github.com/pre-commit/mirrors-isort
|
||||
rev: v4.3.4
|
||||
hooks:
|
||||
- id: isort
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import sphinx_graphene_theme
|
||||
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
|
||||
|
@ -136,7 +137,6 @@ todo_include_todos = True
|
|||
# html_theme = 'alabaster'
|
||||
# if on_rtd:
|
||||
# html_theme = 'sphinx_rtd_theme'
|
||||
import sphinx_graphene_theme
|
||||
|
||||
html_theme = "sphinx_graphene_theme"
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from snapshottest import Snapshot
|
||||
|
||||
|
||||
snapshots = Snapshot()
|
||||
|
||||
snapshots['test_hero_name_query 1'] = {
|
||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from snapshottest import Snapshot
|
||||
|
||||
|
||||
snapshots = Snapshot()
|
||||
|
||||
snapshots['test_correct_fetch_first_ship_rebels 1'] = {
|
||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from snapshottest import Snapshot
|
||||
|
||||
|
||||
snapshots = Snapshot()
|
||||
|
||||
snapshots['test_mutations 1'] = {
|
||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from snapshottest import Snapshot
|
||||
|
||||
|
||||
snapshots = Snapshot()
|
||||
|
||||
snapshots['test_correctly_fetches_id_name_rebels 1'] = {
|
||||
|
|
|
@ -35,7 +35,7 @@ from .utils.resolve_only_args import resolve_only_args
|
|||
from .utils.module_loading import lazy_import
|
||||
|
||||
|
||||
VERSION = (2, 1, 0, 'final', 0)
|
||||
VERSION = (2, 1, 1, 'final', 0)
|
||||
|
||||
__version__ = get_version(VERSION)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import six
|
||||
|
||||
try:
|
||||
|
|
|
@ -4,11 +4,11 @@ Back port of Python 3.3's function signature tools from the inspect module,
|
|||
modified to be compatible with Python 2.7 and 3.2+.
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import itertools
|
||||
|
||||
import functools
|
||||
import itertools
|
||||
import re
|
||||
import types
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
__version__ = "0.4"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from ...types import Argument, Field, Int, List, NonNull, ObjectType, String, Schema
|
||||
from ...types import (Argument, Field, Int, List, NonNull, ObjectType, Schema,
|
||||
String)
|
||||
from ..connection import Connection, ConnectionField, PageInfo
|
||||
from ..node import Node
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import pytest
|
||||
|
||||
from promise import Promise
|
||||
|
||||
from ...types import (ID, Argument, Field, InputField, InputObjectType,
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# https://github.com/graphql-python/graphene/issues/425
|
||||
# Adapted for Graphene 2.0
|
||||
|
||||
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
|
||||
from graphene.types.inputobjecttype import InputObjectType, InputObjectTypeOptions
|
||||
from graphene.types.enum import Enum, EnumOptions
|
||||
from graphene.types.inputobjecttype import (InputObjectType,
|
||||
InputObjectTypeOptions)
|
||||
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
|
||||
|
||||
|
||||
# ObjectType
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from ..utils.subclass_with_meta import SubclassWithMeta
|
||||
from ..utils.deprecated import warn_deprecation
|
||||
from ..utils.subclass_with_meta import SubclassWithMeta
|
||||
|
||||
|
||||
class AbstractType(SubclassWithMeta):
|
||||
|
|
|
@ -2,8 +2,8 @@ from __future__ import absolute_import
|
|||
|
||||
import datetime
|
||||
|
||||
from aniso8601 import parse_date, parse_datetime, parse_time
|
||||
from graphql.language import ast
|
||||
from aniso8601 import parse_datetime, parse_date, parse_time
|
||||
|
||||
from .scalars import Scalar
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import inspect
|
||||
from functools import partial
|
||||
|
||||
from .mountedtype import MountedType
|
||||
|
||||
|
@ -11,7 +12,7 @@ class Dynamic(MountedType):
|
|||
|
||||
def __init__(self, type, with_schema=False, _creation_counter=None):
|
||||
super(Dynamic, self).__init__(_creation_counter=_creation_counter)
|
||||
assert inspect.isfunction(type)
|
||||
assert inspect.isfunction(type) or isinstance(type, partial)
|
||||
self.type = type
|
||||
self.with_schema = with_schema
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@ import six
|
|||
|
||||
from graphene.utils.subclass_with_meta import SubclassWithMeta_Meta
|
||||
|
||||
from ..pyutils.compat import Enum as PyEnum
|
||||
from .base import BaseOptions, BaseType
|
||||
from .unmountedtype import UnmountedType
|
||||
|
||||
from ..pyutils.compat import Enum as PyEnum
|
||||
|
||||
|
||||
def eq_enum(self, other):
|
||||
if isinstance(other, self.__class__):
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from graphene.types.scalars import MAX_INT, MIN_INT
|
||||
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
||||
ListValue, ObjectValue, StringValue)
|
||||
|
||||
from graphene.types.scalars import MAX_INT, MIN_INT
|
||||
|
||||
from .scalars import Scalar
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
from ..utils.deprecated import warn_deprecation
|
||||
from ..utils.get_unbound_function import get_unbound_function
|
||||
from ..utils.props import props
|
||||
from .field import Field
|
||||
from .objecttype import ObjectType, ObjectTypeOptions
|
||||
from .utils import yank_fields_from_attrs
|
||||
from ..utils.deprecated import warn_deprecation
|
||||
|
||||
|
||||
# For static type checking with Mypy
|
||||
MYPY = False
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import six
|
||||
|
||||
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
||||
StringValue)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import inspect
|
||||
|
||||
from graphql import GraphQLSchema, graphql, is_type, GraphQLObjectType
|
||||
from graphql import GraphQLObjectType, GraphQLSchema, graphql, is_type
|
||||
from graphql.type.directives import (GraphQLDirective, GraphQLIncludeDirective,
|
||||
GraphQLSkipDirective)
|
||||
from graphql.type.introspection import IntrospectionSchema
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import pytest
|
||||
|
||||
from .. import abstracttype
|
||||
from ..abstracttype import AbstractType
|
||||
from ..field import Field
|
||||
from ..objecttype import ObjectType
|
||||
from ..unmountedtype import UnmountedType
|
||||
from ..abstracttype import AbstractType
|
||||
from .. import abstracttype
|
||||
from ..field import Field
|
||||
|
||||
|
||||
class MyType(ObjectType):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from ..base import BaseType, BaseOptions
|
||||
from ..base import BaseOptions, BaseType
|
||||
|
||||
|
||||
class CustomOptions(BaseOptions):
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import datetime
|
||||
|
||||
import pytz
|
||||
|
||||
from graphql import GraphQLError
|
||||
|
||||
from ..datetime import DateTime, Date, Time
|
||||
from ..datetime import Date, DateTime, Time
|
||||
from ..objecttype import ObjectType
|
||||
from ..schema import Schema
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from functools import partial
|
||||
|
||||
from ..dynamic import Dynamic
|
||||
from ..scalars import String
|
||||
from ..structures import List, NonNull
|
||||
|
@ -25,3 +27,11 @@ def test_list_non_null():
|
|||
dynamic = Dynamic(lambda: List(NonNull(String)))
|
||||
assert dynamic.get_type().of_type.of_type == String
|
||||
assert str(dynamic.get_type()) == '[String!]'
|
||||
|
||||
|
||||
def test_partial():
|
||||
def __type(_type):
|
||||
return _type
|
||||
dynamic = Dynamic(partial(__type, String))
|
||||
assert dynamic.get_type() == String
|
||||
assert str(dynamic.get_type()) == 'String'
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import six
|
||||
|
||||
from ..schema import Schema, ObjectType
|
||||
from ..argument import Argument
|
||||
from ..enum import Enum, PyEnum
|
||||
from ..field import Field
|
||||
from ..inputfield import InputField
|
||||
from ..schema import ObjectType, Schema
|
||||
|
||||
|
||||
def test_enum_construction():
|
||||
|
|
|
@ -4,9 +4,9 @@ from ..field import Field
|
|||
from ..inputfield import InputField
|
||||
from ..inputobjecttype import InputObjectType
|
||||
from ..objecttype import ObjectType
|
||||
from ..unmountedtype import UnmountedType
|
||||
from ..scalars import String, Boolean
|
||||
from ..scalars import Boolean, String
|
||||
from ..schema import Schema
|
||||
from ..unmountedtype import UnmountedType
|
||||
|
||||
|
||||
class MyType(object):
|
||||
|
|
|
@ -3,10 +3,10 @@ import pytest
|
|||
from ..field import Field
|
||||
from ..interface import Interface
|
||||
from ..objecttype import ObjectType
|
||||
from ..unmountedtype import UnmountedType
|
||||
from ..structures import NonNull
|
||||
from ..scalars import String
|
||||
from ..schema import Schema
|
||||
from ..structures import NonNull
|
||||
from ..unmountedtype import UnmountedType
|
||||
|
||||
|
||||
class MyType(Interface):
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import json
|
||||
from functools import partial
|
||||
|
||||
from graphql import GraphQLError, Source, execute, parse, ResolveInfo
|
||||
from graphql import GraphQLError, ResolveInfo, Source, execute, parse
|
||||
|
||||
from ..context import Context
|
||||
from ..dynamic import Dynamic
|
||||
from ..field import Field
|
||||
from ..inputfield import InputField
|
||||
from ..inputobjecttype import InputObjectType
|
||||
from ..interface import Interface
|
||||
from ..objecttype import ObjectType
|
||||
from ..scalars import Int, String, Boolean
|
||||
from ..scalars import Boolean, Int, String
|
||||
from ..schema import Schema
|
||||
from ..structures import List, NonNull
|
||||
from ..union import Union
|
||||
from ..context import Context
|
||||
|
||||
|
||||
def test_query():
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import pytest
|
||||
|
||||
from graphql.type import (GraphQLArgument, GraphQLEnumType, GraphQLEnumValue,
|
||||
GraphQLField, GraphQLInputObjectField,
|
||||
GraphQLInputObjectType, GraphQLInterfaceType,
|
||||
GraphQLObjectType, GraphQLString)
|
||||
|
||||
from ..structures import List, NonNull
|
||||
from ..dynamic import Dynamic
|
||||
from ..enum import Enum
|
||||
from ..field import Field
|
||||
|
@ -13,7 +11,8 @@ from ..inputfield import InputField
|
|||
from ..inputobjecttype import InputObjectType
|
||||
from ..interface import Interface
|
||||
from ..objecttype import ObjectType
|
||||
from ..scalars import String, Int
|
||||
from ..scalars import Int, String
|
||||
from ..structures import List, NonNull
|
||||
from ..typemap import TypeMap, resolve_type
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from ..uuid import UUID
|
||||
from ..objecttype import ObjectType
|
||||
from ..schema import Schema
|
||||
from ..uuid import UUID
|
||||
|
||||
|
||||
class Query(ObjectType):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from .base import BaseOptions, BaseType
|
||||
from .unmountedtype import UnmountedType
|
||||
|
||||
|
||||
# For static type checking with Mypy
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import six
|
||||
from ..pyutils.compat import signature, func_name
|
||||
|
||||
from ..pyutils.compat import func_name, signature
|
||||
from .deprecated import warn_deprecation
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from functools import wraps
|
||||
|
||||
from .deprecated import deprecated
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import six
|
||||
from inspect import isclass
|
||||
|
||||
import six
|
||||
|
||||
from ..pyutils.init_subclass import InitSubclassMeta
|
||||
from .props import props
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from ..annotate import annotate
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import pytest
|
||||
|
||||
from .. import deprecated
|
||||
from ..deprecated import deprecated as deprecated_decorator, warn_deprecation
|
||||
from ..deprecated import deprecated as deprecated_decorator
|
||||
from ..deprecated import warn_deprecation
|
||||
|
||||
|
||||
def test_warn_deprecation(mocker):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from ..resolve_only_args import resolve_only_args
|
||||
from .. import deprecated
|
||||
from ..resolve_only_args import resolve_only_args
|
||||
|
||||
|
||||
def test_resolve_only_args(mocker):
|
||||
|
|
7
setup.py
7
setup.py
|
@ -1,8 +1,9 @@
|
|||
from setuptools import find_packages, setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
import sys
|
||||
import ast
|
||||
import re
|
||||
import sys
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
_version_re = re.compile(r'VERSION\s+=\s+(.*)')
|
||||
|
||||
|
|
13
tox.ini
13
tox.ini
|
@ -3,18 +3,7 @@ envlist = flake8,py27,py33,py34,py35,py36,pre-commit,pypy
|
|||
skipsdist = true
|
||||
|
||||
[testenv]
|
||||
deps=
|
||||
pytest>=2.7.2
|
||||
graphql-core>=1.1
|
||||
promise>=2.0
|
||||
graphql-relay>=0.4.5
|
||||
six
|
||||
blinker
|
||||
singledispatch
|
||||
mock
|
||||
pytz
|
||||
iso8601
|
||||
pytest-benchmark
|
||||
deps = .[test]
|
||||
setenv =
|
||||
PYTHONPATH = .:{envdir}
|
||||
commands=
|
||||
|
|
Loading…
Reference in New Issue
Block a user