mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 01:26:49 +03:00
Improved PEP8 syntax and order imports
This commit is contained in:
parent
e1145b88fb
commit
69062aa6d1
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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
|
||||
|
||||
admin.site.register(Ingredient)
|
||||
admin.site.register(Category)
|
||||
|
|
|
@ -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,13 +1,13 @@
|
|||
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']
|
||||
|
@ -15,6 +15,7 @@ class CategoryNode(DjangoNode):
|
|||
|
||||
|
||||
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 = [
|
||||
url(r'^admin/', admin.site.urls),
|
||||
|
|
|
@ -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 @@ import six
|
|||
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,
|
||||
GlobalIDMultipleChoiceField)
|
||||
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,7 +1,6 @@
|
|||
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
|
||||
|
@ -9,8 +8,7 @@ from graphene.contrib.django.forms import (GlobalIDFormField,
|
|||
GlobalIDMultipleChoiceField)
|
||||
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 = []
|
||||
if DJANGO_FILTER_INSTALLED:
|
||||
|
|
|
@ -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 @@ import binascii
|
|||
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 django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
import importlib
|
||||
import json
|
||||
|
||||
from django.core.management.base 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 collections import Iterable
|
|||
from functools import wraps
|
||||
|
||||
import six
|
||||
|
||||
from graphql_relay.connection.arrayconnection import connection_from_list
|
||||
from graphql_relay.node.node import to_global_id
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user