Skip to content

Commit b89e2c3

Browse files
author
Daniel Gallagher
committed
Merge branch 'master' of github.com:dan98765/graphene into append_underscore_to_type_arg
2 parents 01735b1 + 05a362c commit b89e2c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+74
-66
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ trim_trailing_whitespace = true
1111
[*.{py,rst,ini}]
1212
indent_style = space
1313
indent_size = 4
14-

.isort.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
known_third_party = aniso8601,graphql,graphql_relay,promise,pytest,pytz,pyutils,setuptools,six,snapshottest,sphinx_graphene_theme

.pre-commit-config.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
repos:
12
- repo: git://github.com/pre-commit/pre-commit-hooks
2-
sha: v0.8.0
3+
rev: v1.2.3
34
hooks:
45
- id: autopep8-wrapper
56
args:
@@ -15,3 +16,11 @@
1516
- id: pretty-format-json
1617
args:
1718
- --autofix
19+
- repo: https://github.com/asottile/seed-isort-config
20+
rev: v1.0.0
21+
hooks:
22+
- id: seed-isort-config
23+
- repo: https://github.com/pre-commit/mirrors-isort
24+
rev: v4.3.4
25+
hooks:
26+
- id: isort

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sphinx_graphene_theme
23

34
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
45

@@ -136,7 +137,6 @@
136137
# html_theme = 'alabaster'
137138
# if on_rtd:
138139
# html_theme = 'sphinx_rtd_theme'
139-
import sphinx_graphene_theme
140140

141141
html_theme = "sphinx_graphene_theme"
142142

docs/execution/dataloader.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Naively, if ``me``, ``bestFriend`` and ``friends`` each need to request the back
8888
there could be at most 13 database requests!
8989

9090

91-
When using DataLoader, we could define the User type using our previous example with
91+
When using DataLoader, we could define the User type using our previous example with
9292
leaner code and at most 4 database requests, and possibly fewer if there are cache hits.
9393

9494

docs/relay/mutations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Mutations can also accept files, that's how it will work with different integrat
4141
class Input:
4242
pass
4343
# nothing needed for uploading file
44-
44+
4545
# your return fields
4646
success = graphene.String()
4747

docs/testing/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Here is a simple example on how our tests will look if we use ``pytest``:
101101
If we are using ``unittest``:
102102

103103
.. code:: python
104-
104+
105105
from snapshottest import TestCase
106106
107107
class APITestCase(TestCase):

examples/starwars/tests/snapshots/snap_test_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from snapshottest import Snapshot
66

7-
87
snapshots = Snapshot()
98

109
snapshots['test_hero_name_query 1'] = {

examples/starwars_relay/tests/snapshots/snap_test_connections.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from snapshottest import Snapshot
66

7-
87
snapshots = Snapshot()
98

109
snapshots['test_correct_fetch_first_ship_rebels 1'] = {

examples/starwars_relay/tests/snapshots/snap_test_mutation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from snapshottest import Snapshot
66

7-
87
snapshots = Snapshot()
98

109
snapshots['test_mutations 1'] = {

examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from snapshottest import Snapshot
66

7-
87
snapshots = Snapshot()
98

109
snapshots['test_correctly_fetches_id_name_rebels 1'] = {

graphene/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from .utils.module_loading import lazy_import
3636

3737

38-
VERSION = (2, 1, 0, 'final', 0)
38+
VERSION = (2, 1, 1, 'final', 0)
3939

4040
__version__ = get_version(VERSION)
4141

graphene/pyutils/compat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import absolute_import
2+
23
import six
34

45
try:

graphene/pyutils/signature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
modified to be compatible with Python 2.7 and 3.2+.
55
"""
66
from __future__ import absolute_import, division, print_function
7-
import itertools
7+
88
import functools
9+
import itertools
910
import re
1011
import types
11-
1212
from collections import OrderedDict
1313

1414
__version__ = "0.4"

graphene/relay/tests/test_connection.py

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

3-
from ...types import Argument, Field, Int, List, NonNull, ObjectType, String, Schema
3+
from ...types import (Argument, Field, Int, List, NonNull, ObjectType, Schema,
4+
String)
45
from ..connection import Connection, ConnectionField, PageInfo
56
from ..node import Node
67

graphene/relay/tests/test_mutation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
32
from promise import Promise
43

54
from ...types import (ID, Argument, Field, InputField, InputObjectType,

graphene/tests/issues/test_425.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# https://github.com/graphql-python/graphene/issues/425
22
# Adapted for Graphene 2.0
33

4-
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
5-
from graphene.types.inputobjecttype import InputObjectType, InputObjectTypeOptions
64
from graphene.types.enum import Enum, EnumOptions
5+
from graphene.types.inputobjecttype import (InputObjectType,
6+
InputObjectTypeOptions)
7+
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
78

89

910
# ObjectType

graphene/types/abstracttype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from ..utils.subclass_with_meta import SubclassWithMeta
21
from ..utils.deprecated import warn_deprecation
2+
from ..utils.subclass_with_meta import SubclassWithMeta
33

44

55
class AbstractType(SubclassWithMeta):

graphene/types/datetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import datetime
44

5+
from aniso8601 import parse_date, parse_datetime, parse_time
56
from graphql.language import ast
6-
from aniso8601 import parse_datetime, parse_date, parse_time
77

88
from .scalars import Scalar
99

graphene/types/dynamic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import inspect
2+
from functools import partial
23

34
from .mountedtype import MountedType
45

@@ -11,7 +12,7 @@ class Dynamic(MountedType):
1112

1213
def __init__(self, type_, with_schema=False, _creation_counter=None):
1314
super(Dynamic, self).__init__(_creation_counter=_creation_counter)
14-
assert inspect.isfunction(type_)
15+
assert inspect.isfunction(type_) or isinstance(type_, partial)
1516
self.type = type_
1617
self.with_schema = with_schema
1718

graphene/types/enum.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
from graphene.utils.subclass_with_meta import SubclassWithMeta_Meta
66

7+
from ..pyutils.compat import Enum as PyEnum
78
from .base import BaseOptions, BaseType
89
from .unmountedtype import UnmountedType
910

10-
from ..pyutils.compat import Enum as PyEnum
11-
1211

1312
def eq_enum(self, other):
1413
if isinstance(other, self.__class__):

graphene/types/generic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from __future__ import unicode_literals
22

3-
from graphene.types.scalars import MAX_INT, MIN_INT
43
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
54
ListValue, ObjectValue, StringValue)
65

6+
from graphene.types.scalars import MAX_INT, MIN_INT
7+
78
from .scalars import Scalar
89

910

graphene/types/mutation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from collections import OrderedDict
22

3+
from ..utils.deprecated import warn_deprecation
34
from ..utils.get_unbound_function import get_unbound_function
45
from ..utils.props import props
56
from .field import Field
67
from .objecttype import ObjectType, ObjectTypeOptions
78
from .utils import yank_fields_from_attrs
8-
from ..utils.deprecated import warn_deprecation
9-
109

1110
# For static type checking with Mypy
1211
MYPY = False

graphene/types/scalars.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import six
2-
32
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
43
StringValue)
54

graphene/types/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import inspect
22

3-
from graphql import GraphQLSchema, graphql, is_type, GraphQLObjectType
3+
from graphql import GraphQLObjectType, GraphQLSchema, graphql, is_type
44
from graphql.type.directives import (GraphQLDirective, GraphQLIncludeDirective,
55
GraphQLSkipDirective)
66
from graphql.type.introspection import IntrospectionSchema

graphene/types/tests/test_abstracttype.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import pytest
22

3-
from ..objecttype import ObjectType
4-
from ..unmountedtype import UnmountedType
5-
from ..abstracttype import AbstractType
63
from .. import abstracttype
4+
from ..abstracttype import AbstractType
75
from ..field import Field
6+
from ..objecttype import ObjectType
7+
from ..unmountedtype import UnmountedType
88

99

1010
class MyType(ObjectType):

graphene/types/tests/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from ..base import BaseType, BaseOptions
3+
from ..base import BaseOptions, BaseType
44

55

66
class CustomOptions(BaseOptions):

graphene/types/tests/test_datetime.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import datetime
22

33
import pytz
4-
54
from graphql import GraphQLError
65

7-
from ..datetime import DateTime, Date, Time
6+
from ..datetime import Date, DateTime, Time
87
from ..objecttype import ObjectType
98
from ..schema import Schema
109

graphene/types/tests/test_dynamic.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from functools import partial
2+
13
from ..dynamic import Dynamic
24
from ..scalars import String
35
from ..structures import List, NonNull
@@ -25,3 +27,11 @@ def test_list_non_null():
2527
dynamic = Dynamic(lambda: List(NonNull(String)))
2628
assert dynamic.get_type().of_type.of_type == String
2729
assert str(dynamic.get_type()) == '[String!]'
30+
31+
32+
def test_partial():
33+
def __type(_type):
34+
return _type
35+
dynamic = Dynamic(partial(__type, String))
36+
assert dynamic.get_type() == String
37+
assert str(dynamic.get_type()) == 'String'

graphene/types/tests/test_enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import six
22

3-
from ..schema import Schema, ObjectType
43
from ..argument import Argument
54
from ..enum import Enum, PyEnum
65
from ..field import Field
76
from ..inputfield import InputField
7+
from ..schema import ObjectType, Schema
88

99

1010
def test_enum_construction():

graphene/types/tests/test_inputobjecttype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from ..inputfield import InputField
55
from ..inputobjecttype import InputObjectType
66
from ..objecttype import ObjectType
7-
from ..unmountedtype import UnmountedType
8-
from ..scalars import String, Boolean
7+
from ..scalars import Boolean, String
98
from ..schema import Schema
9+
from ..unmountedtype import UnmountedType
1010

1111

1212
class MyType(object):

graphene/types/tests/test_objecttype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from ..field import Field
44
from ..interface import Interface
55
from ..objecttype import ObjectType
6-
from ..unmountedtype import UnmountedType
7-
from ..structures import NonNull
86
from ..scalars import String
97
from ..schema import Schema
8+
from ..structures import NonNull
9+
from ..unmountedtype import UnmountedType
1010

1111

1212
class MyType(Interface):

graphene/types/tests/test_query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import json
22
from functools import partial
33

4-
from graphql import GraphQLError, Source, execute, parse, ResolveInfo
4+
from graphql import GraphQLError, ResolveInfo, Source, execute, parse
55

6+
from ..context import Context
67
from ..dynamic import Dynamic
78
from ..field import Field
89
from ..inputfield import InputField
910
from ..inputobjecttype import InputObjectType
1011
from ..interface import Interface
1112
from ..objecttype import ObjectType
12-
from ..scalars import Int, String, Boolean
13+
from ..scalars import Boolean, Int, String
1314
from ..schema import Schema
1415
from ..structures import List, NonNull
1516
from ..union import Union
16-
from ..context import Context
1717

1818

1919
def test_query():

graphene/types/tests/test_typemap.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import pytest
2-
32
from graphql.type import (GraphQLArgument, GraphQLEnumType, GraphQLEnumValue,
43
GraphQLField, GraphQLInputObjectField,
54
GraphQLInputObjectType, GraphQLInterfaceType,
65
GraphQLObjectType, GraphQLString)
76

8-
from ..structures import List, NonNull
97
from ..dynamic import Dynamic
108
from ..enum import Enum
119
from ..field import Field
1210
from ..inputfield import InputField
1311
from ..inputobjecttype import InputObjectType
1412
from ..interface import Interface
1513
from ..objecttype import ObjectType
16-
from ..scalars import String, Int
14+
from ..scalars import Int, String
15+
from ..structures import List, NonNull
1716
from ..typemap import TypeMap, resolve_type
1817

1918

graphene/types/tests/test_uuid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from ..uuid import UUID
21
from ..objecttype import ObjectType
32
from ..schema import Schema
3+
from ..uuid import UUID
44

55

66
class Query(ObjectType):

graphene/types/union.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from .base import BaseOptions, BaseType
22
from .unmountedtype import UnmountedType
33

4-
54
# For static type checking with Mypy
65
MYPY = False
76
if MYPY:

0 commit comments

Comments
 (0)