Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ trim_trailing_whitespace = true
[*.{py,rst,ini}]
indent_style = space
indent_size = 4

2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
known_third_party = aniso8601,graphql,graphql_relay,promise,pytest,pytz,pyutils,setuptools,six,snapshottest,sphinx_graphene_theme
11 changes: 10 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
10 changes: 5 additions & 5 deletions UPGRADE-v2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Before:
```python
class SomeMutation(Mutation):
...

@classmethod
def mutate(cls, instance, args, context, info):
...
Expand All @@ -218,7 +218,7 @@ With 2.0:
```python
class SomeMutation(Mutation):
...

def mutate(self, info, **args):
...
```
Expand All @@ -231,7 +231,7 @@ class SomeMutation(Mutation):
first_name = String(required=True)
last_name = String(required=True)
...

def mutate(self, info, first_name, last_name):
...
```
Expand All @@ -250,7 +250,7 @@ If you are using Middelwares, you need to some adjustments:
Before:

```python
class MyGrapheneMiddleware(object):
class MyGrapheneMiddleware(object):
def resolve(self, next_mw, root, args, context, info):

## Middleware code
Expand All @@ -261,7 +261,7 @@ class MyGrapheneMiddleware(object):
With 2.0:

```python
class MyGrapheneMiddleware(object):
class MyGrapheneMiddleware(object):
def resolve(self, next_mw, root, info, **args):
context = info.context

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sphinx_graphene_theme

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

Expand Down Expand Up @@ -136,7 +137,6 @@
# html_theme = 'alabaster'
# if on_rtd:
# html_theme = 'sphinx_rtd_theme'
import sphinx_graphene_theme

html_theme = "sphinx_graphene_theme"

Expand Down
2 changes: 1 addition & 1 deletion docs/execution/dataloader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Naively, if ``me``, ``bestFriend`` and ``friends`` each need to request the back
there could be at most 13 database requests!


When using DataLoader, we could define the User type using our previous example with
When using DataLoader, we could define the User type using our previous example with
leaner code and at most 4 database requests, and possibly fewer if there are cache hits.


Expand Down
2 changes: 1 addition & 1 deletion docs/relay/mutations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Mutations can also accept files, that's how it will work with different integrat
class Input:
pass
# nothing needed for uploading file

# your return fields
success = graphene.String()

Expand Down
2 changes: 1 addition & 1 deletion docs/testing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Here is a simple example on how our tests will look if we use ``pytest``:
If we are using ``unittest``:

.. code:: python

from snapshottest import TestCase

class APITestCase(TestCase):
Expand Down
1 change: 0 additions & 1 deletion examples/starwars/tests/snapshots/snap_test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from snapshottest import Snapshot


snapshots = Snapshot()

snapshots['test_hero_name_query 1'] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from snapshottest import Snapshot


snapshots = Snapshot()

snapshots['test_correct_fetch_first_ship_rebels 1'] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from snapshottest import Snapshot


snapshots = Snapshot()

snapshots['test_mutations 1'] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from snapshottest import Snapshot


snapshots = Snapshot()

snapshots['test_correctly_fetches_id_name_rebels 1'] = {
Expand Down
1 change: 1 addition & 0 deletions graphene/pyutils/compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import absolute_import

import six

try:
Expand Down
4 changes: 2 additions & 2 deletions graphene/pyutils/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
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"
Expand Down
3 changes: 2 additions & 1 deletion graphene/relay/tests/test_connection.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion graphene/relay/tests/test_mutation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

from promise import Promise

from ...types import (ID, Argument, Field, InputField, InputObjectType,
Expand Down
5 changes: 3 additions & 2 deletions graphene/tests/issues/test_425.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion graphene/types/abstracttype.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion graphene/types/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

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

Expand Down
3 changes: 1 addition & 2 deletions graphene/types/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

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__):
Expand Down
3 changes: 2 additions & 1 deletion graphene/types/generic.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
3 changes: 1 addition & 2 deletions graphene/types/mutation.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion graphene/types/scalars.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import six

from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
StringValue)

Expand Down
2 changes: 1 addition & 1 deletion graphene/types/schema.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions graphene/types/tests/test_abstracttype.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest

from ..objecttype import ObjectType
from ..unmountedtype import UnmountedType
from ..abstracttype import AbstractType
from .. import abstracttype
from ..abstracttype import AbstractType
from ..field import Field
from ..objecttype import ObjectType
from ..unmountedtype import UnmountedType


class MyType(ObjectType):
Expand Down
2 changes: 1 addition & 1 deletion graphene/types/tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from ..base import BaseType, BaseOptions
from ..base import BaseOptions, BaseType


class CustomOptions(BaseOptions):
Expand Down
3 changes: 1 addition & 2 deletions graphene/types/tests/test_datetime.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions graphene/types/tests/test_dynamic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from functools import partial

from ..dynamic import Dynamic
from ..scalars import String
from ..structures import List, NonNull
Expand Down
2 changes: 1 addition & 1 deletion graphene/types/tests/test_enum.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
4 changes: 2 additions & 2 deletions graphene/types/tests/test_inputobjecttype.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
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):
Expand Down
4 changes: 2 additions & 2 deletions graphene/types/tests/test_objecttype.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
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):
Expand Down
6 changes: 3 additions & 3 deletions graphene/types/tests/test_query.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
5 changes: 2 additions & 3 deletions graphene/types/tests/test_typemap.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
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
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


Expand Down
2 changes: 1 addition & 1 deletion graphene/types/tests/test_uuid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ..uuid import UUID
from ..objecttype import ObjectType
from ..schema import Schema
from ..uuid import UUID


class Query(ObjectType):
Expand Down
Loading