mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-22 17:47:12 +03:00
Improved PEP8 syntax
This commit is contained in:
parent
d11719507c
commit
70dbd4b512
|
@ -1,7 +1,6 @@
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from cookbook.schema import schema
|
|
||||||
from graphene_django.views import GraphQLView
|
from graphene_django.views import GraphQLView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import Schema, relay, resolve_only_args
|
from graphene import Schema, relay, resolve_only_args
|
||||||
from graphene_django import DjangoObjectType, DjangoConnectionField
|
from graphene_django import DjangoConnectionField, DjangoObjectType
|
||||||
|
|
||||||
from .data import (create_ship, get_empire, get_faction, get_rebels, get_ship,
|
from .data import (create_ship, get_empire, get_faction, get_rebels, get_ship,
|
||||||
get_ships)
|
get_ships)
|
||||||
|
|
|
@ -32,7 +32,6 @@ else:
|
||||||
class CommandArguments(BaseCommand):
|
class CommandArguments(BaseCommand):
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
from django.conf import settings
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--schema',
|
'--schema',
|
||||||
type=str,
|
type=str,
|
||||||
|
@ -57,7 +56,6 @@ class Command(CommandArguments):
|
||||||
json.dump(schema_dict, outfile)
|
json.dump(schema_dict, outfile)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
from django.conf import settings
|
|
||||||
options_schema = options.get('schema')
|
options_schema = options.get('schema')
|
||||||
if options_schema:
|
if options_schema:
|
||||||
schema = importlib.import_module(options_schema)
|
schema = importlib.import_module(options_schema)
|
||||||
|
|
|
@ -43,7 +43,6 @@ IMPORT_STRINGS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def perform_import(val, setting_name):
|
def perform_import(val, setting_name):
|
||||||
"""
|
"""
|
||||||
If the given setting is a string import notation,
|
If the given setting is a string import notation,
|
||||||
|
@ -82,6 +81,7 @@ class GrapheneSettings(object):
|
||||||
Any setting with string import paths will be automatically resolved
|
Any setting with string import paths will be automatically resolved
|
||||||
and return the class, rather than the string literal.
|
and return the class, rather than the string literal.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, user_settings=None, defaults=None, import_strings=None):
|
def __init__(self, user_settings=None, defaults=None, import_strings=None):
|
||||||
if user_settings:
|
if user_settings:
|
||||||
self._user_settings = user_settings
|
self._user_settings = user_settings
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import Schema, ObjectType, relay
|
from graphene import ObjectType, Schema
|
||||||
|
|
||||||
from ..types import DjangoObjectType
|
|
||||||
from .models import Article, Reporter
|
|
||||||
|
|
||||||
|
|
||||||
class QueryRoot(ObjectType):
|
class QueryRoot(ObjectType):
|
||||||
|
|
|
@ -19,7 +19,6 @@ from .models import Article, Film, FilmDetails, Reporter
|
||||||
# from graphene.core.types.custom_scalars import DateTime, JSONString
|
# from graphene.core.types.custom_scalars import DateTime, JSONString
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def assert_conversion(django_field, graphene_field, *args, **kwargs):
|
def assert_conversion(django_field, graphene_field, *args, **kwargs):
|
||||||
field = django_field(help_text='Custom Help Text', *args, **kwargs)
|
field = django_field(help_text='Custom Help Text', *args, **kwargs)
|
||||||
graphene_type = convert_django_field(field)
|
graphene_type = convert_django_field(field)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import pytest
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from ..views import GraphQLView
|
from ..views import GraphQLView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from graphql_django_view import GraphQLView
|
from graphql_django_view import GraphQLView
|
||||||
|
|
||||||
from .schema_view import schema
|
from .schema_view import schema
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
import re
|
|
||||||
import json
|
import json
|
||||||
import six
|
import re
|
||||||
|
|
||||||
|
import six
|
||||||
from django.http import HttpResponse, HttpResponseNotAllowed
|
from django.http import HttpResponse, HttpResponseNotAllowed
|
||||||
from django.http.response import HttpResponseBadRequest
|
from django.http.response import HttpResponseBadRequest
|
||||||
from django.views.generic import View
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.views.generic import View
|
||||||
|
|
||||||
from graphql import Source, parse, execute, validate
|
from graphql import Source, execute, parse, validate
|
||||||
from graphql.error import GraphQLError, format_error as format_graphql_error
|
from graphql.error import format_error as format_graphql_error
|
||||||
|
from graphql.error import GraphQLError
|
||||||
from graphql.execution import ExecutionResult
|
from graphql.execution import ExecutionResult
|
||||||
from graphql.type.schema import GraphQLSchema
|
|
||||||
from graphql.execution.middleware import MiddlewareManager
|
from graphql.execution.middleware import MiddlewareManager
|
||||||
|
from graphql.type.schema import GraphQLSchema
|
||||||
from graphql.utils.get_operation_ast import get_operation_ast
|
from graphql.utils.get_operation_ast import get_operation_ast
|
||||||
|
|
||||||
from .settings import graphene_settings
|
from .settings import graphene_settings
|
||||||
|
|
||||||
|
|
||||||
class HttpError(Exception):
|
class HttpError(Exception):
|
||||||
|
|
||||||
def __init__(self, response, message=None, *args, **kwargs):
|
def __init__(self, response, message=None, *args, **kwargs):
|
||||||
self.response = response
|
self.response = response
|
||||||
self.message = message = message or response.content.decode()
|
self.message = message = message or response.content.decode()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user