Skip to content

Commit 70dbd4b

Browse files
committed
Improved PEP8 syntax
1 parent d117195 commit 70dbd4b

File tree

10 files changed

+19
-21
lines changed

10 files changed

+19
-21
lines changed

examples/cookbook/cookbook/urls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from django.conf.urls import include, url
1+
from django.conf.urls import url
22
from django.contrib import admin
33

4-
from cookbook.schema import schema
54
from graphene_django.views import GraphQLView
65

76
urlpatterns = [

examples/starwars/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import graphene
22
from graphene import Schema, relay, resolve_only_args
3-
from graphene_django import DjangoObjectType, DjangoConnectionField
3+
from graphene_django import DjangoConnectionField, DjangoObjectType
44

55
from .data import (create_ship, get_empire, get_faction, get_rebels, get_ship,
66
get_ships)

graphene_django/management/commands/graphql_schema.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class CommandArguments(BaseCommand):
3232
class CommandArguments(BaseCommand):
3333

3434
def add_arguments(self, parser):
35-
from django.conf import settings
3635
parser.add_argument(
3736
'--schema',
3837
type=str,
@@ -57,7 +56,6 @@ def save_file(self, out, schema_dict):
5756
json.dump(schema_dict, outfile)
5857

5958
def handle(self, *args, **options):
60-
from django.conf import settings
6159
options_schema = options.get('schema')
6260
if options_schema:
6361
schema = importlib.import_module(options_schema)

graphene_django/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
)
4444

4545

46-
4746
def perform_import(val, setting_name):
4847
"""
4948
If the given setting is a string import notation,
@@ -82,6 +81,7 @@ class GrapheneSettings(object):
8281
Any setting with string import paths will be automatically resolved
8382
and return the class, rather than the string literal.
8483
"""
84+
8585
def __init__(self, user_settings=None, defaults=None, import_strings=None):
8686
if user_settings:
8787
self._user_settings = user_settings

graphene_django/tests/schema_view.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import graphene
2-
from graphene import Schema, ObjectType, relay
3-
4-
from ..types import DjangoObjectType
5-
from .models import Article, Reporter
2+
from graphene import ObjectType, Schema
63

74

85
class QueryRoot(ObjectType):
96

107
thrower = graphene.String(required=True)
118
request = graphene.String(required=True)
129
test = graphene.String(who=graphene.String())
13-
10+
1411
def resolve_thrower(self, args, context, info):
1512
raise Exception("Throws!")
16-
13+
1714
def resolve_request(self, args, context, info):
1815
request = context
1916
return request.GET.get('q')

graphene_django/tests/test_converter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
# from graphene.core.types.custom_scalars import DateTime, JSONString
2020

2121

22-
2322
def assert_conversion(django_field, graphene_field, *args, **kwargs):
2423
field = django_field(help_text='Custom Help Text', *args, **kwargs)
2524
graphene_type = convert_django_field(field)

graphene_django/tests/test_views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import pytest
21
import json
32

3+
import pytest
4+
45
try:
56
from urllib import urlencode
67
except ImportError:

graphene_django/tests/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.conf.urls import url
2+
23
from ..views import GraphQLView
34

45
urlpatterns = [

graphene_django/tests/urls_pretty.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.conf.urls import url
2+
23
from graphql_django_view import GraphQLView
34

45
from .schema_view import schema

graphene_django/views.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
import re
21
import json
3-
import six
2+
import re
43

4+
import six
55
from django.http import HttpResponse, HttpResponseNotAllowed
66
from django.http.response import HttpResponseBadRequest
7-
from django.views.generic import View
87
from django.shortcuts import render
8+
from django.views.generic import View
99

10-
from graphql import Source, parse, execute, validate
11-
from graphql.error import GraphQLError, format_error as format_graphql_error
10+
from graphql import Source, execute, parse, validate
11+
from graphql.error import format_error as format_graphql_error
12+
from graphql.error import GraphQLError
1213
from graphql.execution import ExecutionResult
13-
from graphql.type.schema import GraphQLSchema
1414
from graphql.execution.middleware import MiddlewareManager
15+
from graphql.type.schema import GraphQLSchema
1516
from graphql.utils.get_operation_ast import get_operation_ast
1617

1718
from .settings import graphene_settings
1819

1920

2021
class HttpError(Exception):
22+
2123
def __init__(self, response, message=None, *args, **kwargs):
2224
self.response = response
2325
self.message = message = message or response.content.decode()
@@ -192,7 +194,7 @@ def execute_graphql_request(self, request, data, query, variables, operation_nam
192194
if operation_ast and operation_ast.operation != 'query':
193195
if show_graphiql:
194196
return None
195-
197+
196198
raise HttpError(HttpResponseNotAllowed(
197199
['POST'], 'Can only perform a {} operation from a POST request.'.format(operation_ast.operation)
198200
))

0 commit comments

Comments
 (0)