mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 20:54:16 +03:00
Fixed PEP8 + Python 3 print
This commit is contained in:
parent
7a27a9ef9f
commit
7be5b83fdf
|
@ -1,3 +1,2 @@
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.9 on 2015-12-04 18:20
|
# Generated by Django 1.9 on 2015-12-04 18:20
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
|
@ -66,4 +66,5 @@ __all__ = [
|
||||||
'ListField',
|
'ListField',
|
||||||
'NonNullField',
|
'NonNullField',
|
||||||
'FloatField',
|
'FloatField',
|
||||||
'resolve_only_args']
|
'resolve_only_args',
|
||||||
|
'with_context']
|
||||||
|
|
|
@ -149,7 +149,6 @@ def test_should_query_connection():
|
||||||
schema = graphene.Schema(query=Query, plugins=[DjangoDebugPlugin()])
|
schema = graphene.Schema(query=Query, plugins=[DjangoDebugPlugin()])
|
||||||
result = schema.execute(query)
|
result = schema.execute(query)
|
||||||
assert not result.errors
|
assert not result.errors
|
||||||
print result.data['__debug']['sql']
|
|
||||||
assert result.data['allReporters'] == expected['allReporters']
|
assert result.data['allReporters'] == expected['allReporters']
|
||||||
assert 'COUNT' in result.data['__debug']['sql'][0]['rawSql']
|
assert 'COUNT' in result.data['__debug']['sql'][0]['rawSql']
|
||||||
query = str(Reporter.objects.all()[:1].query)
|
query = str(Reporter.objects.all()[:1].query)
|
||||||
|
|
|
@ -4,10 +4,10 @@ from django.db import models
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django_filters import Filter, MultipleChoiceFilter
|
from django_filters import Filter, MultipleChoiceFilter
|
||||||
from django_filters.filterset import FilterSet, FilterSetMetaclass
|
from django_filters.filterset import FilterSet, FilterSetMetaclass
|
||||||
from graphql_relay.node.node import from_global_id
|
|
||||||
|
|
||||||
from graphene.contrib.django.forms import (GlobalIDFormField,
|
from graphene.contrib.django.forms import (GlobalIDFormField,
|
||||||
GlobalIDMultipleChoiceField)
|
GlobalIDMultipleChoiceField)
|
||||||
|
from graphql_relay.node.node import from_global_id
|
||||||
|
|
||||||
|
|
||||||
class GlobalIDFilter(Filter):
|
class GlobalIDFilter(Filter):
|
||||||
|
|
|
@ -3,6 +3,7 @@ import binascii
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.forms import CharField, Field, IntegerField, MultipleChoiceField
|
from django.forms import CharField, Field, IntegerField, MultipleChoiceField
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from graphql_relay import from_global_id
|
from graphql_relay import from_global_id
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ from graphene import relay
|
||||||
from graphene.contrib.sqlalchemy import (SQLAlchemyConnectionField,
|
from graphene.contrib.sqlalchemy import (SQLAlchemyConnectionField,
|
||||||
SQLAlchemyNode, SQLAlchemyObjectType)
|
SQLAlchemyNode, SQLAlchemyObjectType)
|
||||||
|
|
||||||
from .models import Article, Base, Reporter, Editor
|
from .models import Article, Base, Editor, Reporter
|
||||||
|
|
||||||
db = create_engine('sqlite:///test_sqlalchemy.sqlite3')
|
db = create_engine('sqlite:///test_sqlalchemy.sqlite3')
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import six
|
import six
|
||||||
from graphql.type import GraphQLEnumType, GraphQLEnumValue
|
from graphql.type import GraphQLEnumType, GraphQLEnumValue
|
||||||
|
|
||||||
from .base import ClassTypeMeta, ClassType
|
|
||||||
from ..types.base import MountedType
|
|
||||||
from ...utils.enum import Enum as PyEnum
|
from ...utils.enum import Enum as PyEnum
|
||||||
|
from ..types.base import MountedType
|
||||||
|
from .base import ClassType, ClassTypeMeta
|
||||||
|
|
||||||
|
|
||||||
class EnumMeta(ClassTypeMeta):
|
class EnumMeta(ClassTypeMeta):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from graphql.type import (GraphQLBoolean, GraphQLField, GraphQLFloat,
|
from graphql.type import (GraphQLBoolean, GraphQLField, GraphQLFloat,
|
||||||
GraphQLID, GraphQLInt, GraphQLNonNull,
|
GraphQLID, GraphQLInt, GraphQLNonNull, GraphQLString)
|
||||||
GraphQLString)
|
|
||||||
from py.test import raises
|
from py.test import raises
|
||||||
|
|
||||||
from graphene.core.fields import (BooleanField, Field, FloatField, IDField,
|
from graphene.core.fields import (BooleanField, Field, FloatField, IDField,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import iso8601
|
|
||||||
|
|
||||||
|
import iso8601
|
||||||
from graphql.language import ast
|
from graphql.language import ast
|
||||||
|
|
||||||
from ...core.classtypes.scalar import Scalar
|
from ...core.classtypes.scalar import Scalar
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from graphql.type import (GraphQLBoolean, GraphQLFloat, GraphQLID,
|
from graphql.type import (GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt,
|
||||||
GraphQLInt, GraphQLString)
|
GraphQLString)
|
||||||
|
|
||||||
from .base import MountedType
|
from .base import MountedType
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import iso8601
|
import iso8601
|
||||||
|
|
||||||
from graphql.language.ast import StringValue
|
from graphql.language.ast import StringValue
|
||||||
|
|
||||||
from ..custom_scalars import DateTime
|
from ..custom_scalars import DateTime
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from graphql.type import (GraphQLField, GraphQLInputObjectField,
|
from graphql.type import GraphQLField, GraphQLInputObjectField, GraphQLString
|
||||||
GraphQLString)
|
|
||||||
|
|
||||||
from graphene.core.schema import Schema
|
from graphene.core.schema import Schema
|
||||||
from graphene.core.types import InputObjectType, ObjectType
|
from graphene.core.types import InputObjectType, ObjectType
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from graphql.type import (GraphQLBoolean, GraphQLFloat, GraphQLID,
|
from graphql.type import (GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt,
|
||||||
GraphQLInt, GraphQLString)
|
GraphQLString)
|
||||||
|
|
||||||
from graphene.core.schema import Schema
|
from graphene.core.schema import Schema
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphql_relay.node.node import from_global_id
|
from graphql_relay.node.node import from_global_id
|
||||||
|
|
||||||
from ..core.fields import Field
|
from ..core.fields import Field
|
||||||
|
@ -6,6 +7,7 @@ from ..core.types.definitions import NonNull
|
||||||
from ..core.types.scalars import ID, Int, String
|
from ..core.types.scalars import ID, Int, String
|
||||||
from ..utils import with_context
|
from ..utils import with_context
|
||||||
|
|
||||||
|
|
||||||
class ConnectionField(Field):
|
class ConnectionField(Field):
|
||||||
|
|
||||||
def __init__(self, type, resolver=None, description='',
|
def __init__(self, type, resolver=None, description='',
|
||||||
|
|
|
@ -4,6 +4,7 @@ from collections import Iterable
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphql_relay.connection.arrayconnection import connection_from_list
|
from graphql_relay.connection.arrayconnection import connection_from_list
|
||||||
from graphql_relay.node.node import to_global_id
|
from graphql_relay.node.node import to_global_id
|
||||||
|
|
||||||
|
@ -123,10 +124,10 @@ class NodeMeta(InterfaceMeta):
|
||||||
def wrapped_node(id, context=None, info=None):
|
def wrapped_node(id, context=None, info=None):
|
||||||
node_args = [id, info, context]
|
node_args = [id, info, context]
|
||||||
if has_context(get_node):
|
if has_context(get_node):
|
||||||
return get_node(*node_args[:get_node_num_args-1], context=context)
|
return get_node(*node_args[:get_node_num_args - 1], context=context)
|
||||||
if get_node_num_args-1 == 0:
|
if get_node_num_args - 1 == 0:
|
||||||
return get_node(id)
|
return get_node(id)
|
||||||
return get_node(*node_args[:get_node_num_args-1])
|
return get_node(*node_args[:get_node_num_args - 1])
|
||||||
node_func = wrapped_node
|
node_func = wrapped_node
|
||||||
setattr(cls, 'get_node', node_func)
|
setattr(cls, 'get_node', node_func)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from ..str_converters import to_camel_case, to_snake_case, to_const
|
from ..str_converters import to_camel_case, to_const, to_snake_case
|
||||||
|
|
||||||
|
|
||||||
def test_snake_case():
|
def test_snake_case():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user