Skip to content

Commit d9c9b90

Browse files
Citomvanlonden
authored andcommitted
Update dependencies, reformat changes with black
1 parent 88507c7 commit d9c9b90

18 files changed

+68
-69
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ repos:
2323
- id: black
2424
language_version: python3
2525
- repo: https://github.com/PyCQA/flake8
26-
rev: 3.7.7
26+
rev: 3.7.8
2727
hooks:
2828
- id: flake8

graphene/relay/connection.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ class Meta:
4545
def page_info_adapter(startCursor, endCursor, hasPreviousPage, hasNextPage):
4646
"""Adapter for creating PageInfo instances"""
4747
return PageInfo(
48-
start_cursor=startCursor, end_cursor=endCursor,
49-
has_previous_page=hasPreviousPage, has_next_page=hasNextPage)
48+
start_cursor=startCursor,
49+
end_cursor=endCursor,
50+
has_previous_page=hasPreviousPage,
51+
has_next_page=hasNextPage,
52+
)
5053

5154

5255
class ConnectionOptions(ObjectTypeOptions):

graphene/relay/mutation.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def __init_subclass_with_meta__(
2929
cls.Input = type(
3030
"{}Input".format(base_name),
3131
bases,
32-
dict(
33-
input_fields, client_mutation_id=String(name="clientMutationId")
34-
),
32+
dict(input_fields, client_mutation_id=String(name="clientMutationId")),
3533
)
3634

3735
arguments = dict(

graphene/relay/node.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ class Meta:
7171
@classmethod
7272
def __init_subclass_with_meta__(cls, **options):
7373
_meta = InterfaceOptions(cls)
74-
_meta.fields = {
75-
'id': GlobalID(cls, description="The ID of the object")
76-
}
74+
_meta.fields = {"id": GlobalID(cls, description="The ID of the object")}
7775
super(AbstractNode, cls).__init_subclass_with_meta__(_meta=_meta, **options)
7876

7977

graphene/relay/tests/test_connection_query.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ async def test_respects_an_overly_large_last():
134134

135135
@mark.asyncio
136136
async def test_respects_first_and_after():
137-
await check('first: 2, after: "{}"'.format(cursor_for("B")), "CD", has_next_page=True)
137+
await check(
138+
'first: 2, after: "{}"'.format(cursor_for("B")), "CD", has_next_page=True
139+
)
138140

139141

140142
@mark.asyncio
@@ -144,7 +146,9 @@ async def test_respects_first_and_after_with_long_first():
144146

145147
@mark.asyncio
146148
async def test_respects_last_and_before():
147-
await check('last: 2, before: "{}"'.format(cursor_for("D")), "BC", has_previous_page=True)
149+
await check(
150+
'last: 2, before: "{}"'.format(cursor_for("D")), "BC", has_previous_page=True
151+
)
148152

149153

150154
@mark.asyncio

graphene/relay/tests/test_node.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def test_subclassed_node_query():
7272
assert not executed.errors
7373
assert executed.data == {
7474
"node": {
75-
"shared": "1",
76-
"extraField": "extra field info.",
77-
"somethingElse": "----"
75+
"shared": "1",
76+
"extraField": "extra field info.",
77+
"somethingElse": "----",
7878
}
7979
}
8080

@@ -144,43 +144,43 @@ def test_node_field_only_lazy_type_wrong():
144144

145145

146146
def test_str_schema():
147-
assert (str(schema) == dedent(
147+
assert str(schema) == dedent(
148148
'''
149149
schema {
150150
query: RootQuery
151151
}
152-
152+
153153
type MyNode implements Node {
154154
"""The ID of the object"""
155155
id: ID!
156156
name: String
157157
}
158-
158+
159159
type MyOtherNode implements Node {
160160
"""The ID of the object"""
161161
id: ID!
162162
shared: String
163163
somethingElse: String
164164
extraField: String
165165
}
166-
166+
167167
"""An object with an ID"""
168168
interface Node {
169169
"""The ID of the object"""
170170
id: ID!
171171
}
172-
172+
173173
type RootQuery {
174174
first: String
175-
175+
176176
"""The ID of the object"""
177177
node(id: ID!): Node
178-
178+
179179
"""The ID of the object"""
180180
onlyNode(id: ID!): MyNode
181-
181+
182182
"""The ID of the object"""
183183
onlyNodeLazy(id: ID!): MyNode
184184
}
185-
''')
185+
'''
186186
)

graphene/relay/tests/test_node_custom.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,43 +53,43 @@ class RootQuery(ObjectType):
5353

5454

5555
def test_str_schema_correct():
56-
assert (str(schema) == dedent(
56+
assert str(schema) == dedent(
5757
'''
5858
schema {
5959
query: RootQuery
6060
}
61-
61+
6262
interface BasePhoto {
6363
"""The width of the photo in pixels"""
6464
width: Int
6565
}
66-
66+
6767
interface Node {
6868
"""The ID of the object"""
6969
id: ID!
7070
}
71-
71+
7272
type Photo implements Node & BasePhoto {
7373
"""The ID of the object"""
7474
id: ID!
75-
75+
7676
"""The width of the photo in pixels"""
7777
width: Int
7878
}
79-
79+
8080
type RootQuery {
8181
"""The ID of the object"""
8282
node(id: ID!): Node
8383
}
84-
84+
8585
type User implements Node {
8686
"""The ID of the object"""
8787
id: ID!
88-
88+
8989
"""The full name of the user"""
9090
name: String
9191
}
92-
''')
92+
'''
9393
)
9494

9595

graphene/types/tests/test_argument.py

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

3-
from pytest import raises
3+
from pytest import raises
44

55
from ..argument import Argument, to_arguments
66
from ..field import Field

graphene/types/tests/test_datetime.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def test_bad_datetime_query():
8585
error = result.errors[0]
8686
assert isinstance(error, GraphQLError)
8787
assert error.message == (
88-
"Expected type DateTime, found \"Some string that's not a datetime\".")
88+
'Expected type DateTime, found "Some string that\'s not a datetime".'
89+
)
8990
assert result.data is None
9091

9192

@@ -97,7 +98,8 @@ def test_bad_date_query():
9798
error = result.errors[0]
9899
assert isinstance(error, GraphQLError)
99100
assert error.message == (
100-
"Expected type Date, found \"Some string that's not a date\".")
101+
'Expected type Date, found "Some string that\'s not a date".'
102+
)
101103
assert result.data is None
102104

103105

@@ -109,7 +111,8 @@ def test_bad_time_query():
109111
error = result.errors[0]
110112
assert isinstance(error, GraphQLError)
111113
assert error.message == (
112-
"Expected type Time, found \"Some string that's not a time\".")
114+
'Expected type Time, found "Some string that\'s not a time".'
115+
)
113116
assert result.data is None
114117

115118

graphene/types/tests/test_enum.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@ class Query(ObjectType):
8585
episode = schema.get_type("PyEpisode")
8686

8787
assert episode.description == "StarWars Episodes"
88-
assert [(name, value.description, value.deprecation_reason)
89-
for name, value in episode.values.items()] == [
90-
('NEWHOPE', 'New Hope Episode', 'meh'),
91-
('EMPIRE', 'Other', None), ('JEDI', 'Other', None)]
88+
assert [
89+
(name, value.description, value.deprecation_reason)
90+
for name, value in episode.values.items()
91+
] == [
92+
("NEWHOPE", "New Hope Episode", "meh"),
93+
("EMPIRE", "Other", None),
94+
("JEDI", "Other", None),
95+
]
9296

9397

9498
def test_enum_from_python3_enum_uses_enum_doc():

graphene/types/tests/test_objecttype.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,7 @@ def test_parent_container_get_fields():
146146

147147

148148
def test_parent_container_interface_get_fields():
149-
assert list(ContainerWithInterface._meta.fields) == [
150-
"ifield",
151-
"field1",
152-
"field2",
153-
]
149+
assert list(ContainerWithInterface._meta.fields) == ["ifield", "field1", "field2"]
154150

155151

156152
def test_objecttype_as_container_only_args():

graphene/types/tests/test_query.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,16 @@ def resolve_test(self, info, **args):
263263
result = test_schema.execute('{ test(aInput: {aField: "String!"} ) }', "Source!")
264264
assert not result.errors
265265
assert result.data == {
266-
"test": '["Source!",{"a_input":{"a_field":"String!","recursive_field":null}}]'}
266+
"test": '["Source!",{"a_input":{"a_field":"String!","recursive_field":null}}]'
267+
}
267268

268269
result = test_schema.execute(
269270
'{ test(aInput: {recursiveField: {aField: "String!"}}) }', "Source!"
270271
)
271272
assert not result.errors
272273
assert result.data == {
273274
"test": '["Source!",{"a_input":{"a_field":null,"recursive_field":'
274-
'{"a_field":"String!","recursive_field":null}}}]'
275+
'{"a_field":"String!","recursive_field":null}}}]'
275276
}
276277

277278

graphene/types/tests/test_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_schema_str():
4242
type MyOtherType {
4343
field: String
4444
}
45-
45+
4646
type Query {
4747
inner: MyOtherType
4848
}

graphene/types/tests/test_type_map.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def deprecation_reason(self):
5353
assert graphql_enum.name == "MyEnum"
5454
assert graphql_enum.description == "Description"
5555
assert graphql_enum.values == {
56-
'foo': GraphQLEnumValue(
56+
"foo": GraphQLEnumValue(
5757
value=1, description="Description foo=1", deprecation_reason="Is deprecated"
5858
),
59-
'bar': GraphQLEnumValue(value=2, description="Description bar=2"),
59+
"bar": GraphQLEnumValue(value=2, description="Description bar=2"),
6060
}
6161

6262

@@ -230,11 +230,7 @@ class MyObjectType(ObjectType):
230230
foo_field = fields["fooBar"]
231231
assert isinstance(foo_field, GraphQLField)
232232
assert foo_field.args == {
233-
"barFoo": GraphQLArgument(
234-
GraphQLString,
235-
default_value=None,
236-
out_name="bar_foo"
237-
)
233+
"barFoo": GraphQLArgument(GraphQLString, default_value=None, out_name="bar_foo")
238234
}
239235

240236

@@ -257,9 +253,7 @@ class MyObjectType(ObjectType):
257253
assert isinstance(foo_field, GraphQLField)
258254
assert foo_field.args == {
259255
"bar_foo": GraphQLArgument(
260-
GraphQLString,
261-
default_value=None,
262-
out_name="bar_foo"
256+
GraphQLString, default_value=None, out_name="bar_foo"
263257
)
264258
}
265259

graphene/utils/tests/test_crunch.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@
4242
],
4343
[
4444
"complex object",
45-
{
46-
"a": True,
47-
"b": [1, 2, 3],
48-
"c": {"a": True, "b": [1, 2, 3]},
49-
},
45+
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
5046
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
5147
],
5248
],

tests_asyncio/test_relay_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async def test_connection_async():
109109
}
110110
}
111111
}
112-
""",
112+
"""
113113
)
114114

115115
assert not result.errors

tests_asyncio/test_relay_mutation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Mutation(ObjectType):
6666
@mark.asyncio
6767
async def test_node_query_promise():
6868
executed = await schema.execute_async(
69-
'mutation a { sayPromise(input: {what:"hello", clientMutationId:"1"}) { phrase } }',
69+
'mutation a { sayPromise(input: {what:"hello", clientMutationId:"1"}) { phrase } }'
7070
)
7171
assert not executed.errors
7272
assert executed.data == {"sayPromise": {"phrase": "hello"}}
@@ -75,7 +75,7 @@ async def test_node_query_promise():
7575
@mark.asyncio
7676
async def test_edge_query():
7777
executed = await schema.execute_async(
78-
'mutation a { other(input: {clientMutationId:"1"}) { clientMutationId, myNodeEdge { cursor node { name }} } }',
78+
'mutation a { other(input: {clientMutationId:"1"}) { clientMutationId, myNodeEdge { cursor node { name }} } }'
7979
)
8080
assert not executed.errors
8181
assert dict(executed.data) == {

tox.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ commands =
2222
[testenv:mypy]
2323
basepython=python3.7
2424
deps =
25-
mypy
25+
mypy>=0.720
2626
commands =
2727
mypy graphene
2828

2929
[testenv:flake8]
30-
deps = flake8
30+
basepython=python3.6
31+
deps =
32+
flake8>=3.7,<4
3133
commands =
32-
pip install -e .
34+
pip install --pre -e .
3335
flake8 graphene
3436

3537
[pytest]

0 commit comments

Comments
 (0)