Skip to content

Commit 69062aa

Browse files
committed
Improved PEP8 syntax and order imports
1 parent e1145b8 commit 69062aa

File tree

17 files changed

+22
-24
lines changed

17 files changed

+22
-24
lines changed

bin/autolinter

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Install the required scripts with
4+
# pip install autoflake autopep8 isort
35
autoflake ./examples/ ./graphene/ -r --remove-unused-variables --remove-all-unused-imports --in-place
46
autopep8 ./examples/ ./graphene/ -r --in-place --experimental --aggressive --max-line-length 120
57
isort -rc ./examples/ ./graphene/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django.contrib import admin
22

3-
from cookbook.ingredients.models import Ingredient, Category
3+
from cookbook.ingredients.models import Category, Ingredient
44

55
admin.site.register(Ingredient)
66
admin.site.register(Category)

examples/cookbook/cookbook/ingredients/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Generated by Django 1.9 on 2015-12-04 18:15
33
from __future__ import unicode_literals
44

5-
from django.db import migrations, models
65
import django.db.models.deletion
6+
from django.db import migrations, models
77

88

99
class Migration(migrations.Migration):

examples/cookbook/cookbook/ingredients/schema.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
from graphene import relay, ObjectType
1+
from cookbook.ingredients.models import Category, Ingredient
2+
from graphene import ObjectType, relay
23
from graphene.contrib.django.filter import DjangoFilterConnectionField
34
from graphene.contrib.django.types import DjangoNode
45

5-
from cookbook.ingredients.models import Category, Ingredient
6-
76

87
# Graphene will automatically map the User model's fields onto the UserType.
98
# This is configured in the UserType's Meta class (as you can see below)
109
class CategoryNode(DjangoNode):
10+
1111
class Meta:
1212
model = Category
1313
filter_fields = ['name', 'ingredients']
1414
filter_order_by = ['name']
1515

1616

1717
class IngredientNode(DjangoNode):
18+
1819
class Meta:
1920
model = Ingredient
2021
# Allow for some more advanced filtering here

examples/cookbook/cookbook/schema.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import graphene
2-
31
import cookbook.ingredients.schema
2+
import graphene
43

54

65
class Query(cookbook.ingredients.schema.Query):

examples/cookbook/cookbook/urls.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
from django.conf.urls import url, include
1+
from django.conf.urls import include, url
22
from django.contrib import admin
33
from django.views.decorators.csrf import csrf_exempt
44

5-
from graphene.contrib.django.views import GraphQLView
6-
75
from cookbook.schema import schema
6+
from graphene.contrib.django.views import GraphQLView
87

98
urlpatterns = [
109
url(r'^admin/', admin.site.urls),

graphene/contrib/django/filter/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .utils import get_filterset_class, get_filtering_args_from_filterset
21
from ..fields import DjangoConnectionField
2+
from .utils import get_filtering_args_from_filterset, get_filterset_class
33

44

55
class DjangoFilterConnectionField(DjangoConnectionField):

graphene/contrib/django/filter/filterset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
from django.conf import settings
33
from django.db import models
44
from django.utils.text import capfirst
5-
65
from django_filters import Filter, MultipleChoiceFilter
76
from django_filters.filterset import FilterSet, FilterSetMetaclass
7+
from graphql_relay.node.node import from_global_id
8+
89
from graphene.contrib.django.forms import (GlobalIDFormField,
910
GlobalIDMultipleChoiceField)
10-
from graphql_relay.node.node import from_global_id
1111

1212

1313
class GlobalIDFilter(Filter):

graphene/contrib/django/filter/tests/filters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import django_filters
2+
23
from graphene.contrib.django.tests.models import Article, Pet, Reporter
34

45

graphene/contrib/django/filter/tests/test_fields.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
from datetime import datetime
22

33
import pytest
4-
from graphql.core.execution.base import ResolveInfo, ExecutionContext
54

65
from graphene import ObjectType, Schema
76
from graphene.contrib.django import DjangoNode
87
from graphene.contrib.django.forms import (GlobalIDFormField,
98
GlobalIDMultipleChoiceField)
109
from graphene.contrib.django.tests.models import Article, Pet, Reporter
1110
from graphene.contrib.django.utils import DJANGO_FILTER_INSTALLED
12-
from graphene.relay import NodeField, ConnectionField
13-
from graphene.utils import ProxySnakeDict
11+
from graphene.relay import NodeField
1412

1513
pytestmark = []
1614
if DJANGO_FILTER_INSTALLED:

0 commit comments

Comments
 (0)