Browse files

Improved PEP8 syntax and order imports

  • Loading branch information...
1 parent e1145b8 commit 69062aa6d13c5138611952d361c0075073d0a7b3 @syrusakbary syrusakbary committed Jan 2, 2016
@@ -1,5 +1,7 @@
+# Install the required scripts with
+# pip install autoflake autopep8 isort
autoflake ./examples/ ./graphene/ -r --remove-unused-variables --remove-all-unused-imports --in-place
autopep8 ./examples/ ./graphene/ -r --in-place --experimental --aggressive --max-line-length 120
isort -rc ./examples/ ./graphene/
@@ -1,6 +1,6 @@
from django.contrib import admin
-from cookbook.ingredients.models import Ingredient, Category
+from cookbook.ingredients.models import Category, Ingredient
@@ -2,8 +2,8 @@
# Generated by Django 1.9 on 2015-12-04 18:15
from __future__ import unicode_literals
-from django.db import migrations, models
import django.db.models.deletion
+from django.db import migrations, models
class Migration(migrations.Migration):
@@ -1,20 +1,21 @@
-from graphene import relay, ObjectType
+from cookbook.ingredients.models import Category, Ingredient
+from graphene import ObjectType, relay
from graphene.contrib.django.filter import DjangoFilterConnectionField
from graphene.contrib.django.types import DjangoNode
-from cookbook.ingredients.models import Category, Ingredient
# Graphene will automatically map the User model's fields onto the UserType.
# This is configured in the UserType's Meta class (as you can see below)
class CategoryNode(DjangoNode):
class Meta:
model = Category
filter_fields = ['name', 'ingredients']
filter_order_by = ['name']
class IngredientNode(DjangoNode):
class Meta:
model = Ingredient
# Allow for some more advanced filtering here
@@ -1,6 +1,5 @@
-import graphene
import cookbook.ingredients.schema
+import graphene
class Query(cookbook.ingredients.schema.Query):
@@ -1,10 +1,9 @@
-from django.conf.urls import url, include
+from django.conf.urls import include, url
from django.contrib import admin
from django.views.decorators.csrf import csrf_exempt
-from graphene.contrib.django.views import GraphQLView
from cookbook.schema import schema
+from graphene.contrib.django.views import GraphQLView
urlpatterns = [
@@ -1,5 +1,5 @@
-from .utils import get_filterset_class, get_filtering_args_from_filterset
from ..fields import DjangoConnectionField
+from .utils import get_filtering_args_from_filterset, get_filterset_class
class DjangoFilterConnectionField(DjangoConnectionField):
@@ -2,12 +2,12 @@
from django.conf import settings
from django.db import models
from django.utils.text import capfirst
from django_filters import Filter, MultipleChoiceFilter
from django_filters.filterset import FilterSet, FilterSetMetaclass
+from graphql_relay.node.node import from_global_id
from graphene.contrib.django.forms import (GlobalIDFormField,
-from graphql_relay.node.node import from_global_id
class GlobalIDFilter(Filter):
@@ -1,4 +1,5 @@
import django_filters
from graphene.contrib.django.tests.models import Article, Pet, Reporter
@@ -1,16 +1,14 @@
from datetime import datetime
import pytest
-from graphql.core.execution.base import ResolveInfo, ExecutionContext
from graphene import ObjectType, Schema
from graphene.contrib.django import DjangoNode
from graphene.contrib.django.forms import (GlobalIDFormField,
from graphene.contrib.django.tests.models import Article, Pet, Reporter
from graphene.contrib.django.utils import DJANGO_FILTER_INSTALLED
-from graphene.relay import NodeField, ConnectionField
-from graphene.utils import ProxySnakeDict
+from graphene.relay import NodeField
pytestmark = []
@@ -1,7 +1,7 @@
import six
-from .filterset import custom_filterset_factory, setup_filterset
from ....core.types import Argument, String
+from .filterset import custom_filterset_factory, setup_filterset
def get_filtering_args_from_filterset(filterset_class, type):
@@ -3,7 +3,6 @@
from django.core.exceptions import ValidationError
from django.forms import CharField, Field, IntegerField, MultipleChoiceField
from django.utils.translation import ugettext_lazy as _
from graphql_relay import from_global_id
@@ -1,8 +1,8 @@
-from import BaseCommand, CommandError
import importlib
import json
+from import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Dump Graphene schema JSON to file'
@@ -1,7 +1,7 @@
from py.test import raises
+from tests.utils import assert_equal_lists
from graphene.contrib.django import DjangoObjectType
-from tests.utils import assert_equal_lists
from .models import Reporter
@@ -1,12 +1,12 @@
from graphql.core.type import GraphQLObjectType
from mock import patch
+from tests.utils import assert_equal_lists
from graphene import Schema
from graphene.contrib.django.types import DjangoNode, DjangoObjectType
from graphene.core.fields import Field
from graphene.core.types.scalars import Int
from graphene.relay.fields import GlobalIDField
-from tests.utils import assert_equal_lists
from .models import Article, Reporter
@@ -1,10 +1,10 @@
from graphql.core import graphql
from py.test import raises
+from tests.utils import assert_equal_lists
from graphene import Interface, List, ObjectType, Schema, String
from graphene.core.fields import Field
from graphene.core.types.base import LazyType
-from tests.utils import assert_equal_lists
schema = Schema(name='My own schema')
@@ -4,7 +4,6 @@
from functools import wraps
import six
from graphql_relay.connection.arrayconnection import connection_from_list
from graphql_relay.node.node import to_global_id

0 comments on commit 69062aa

Please sign in to comment.