Skip to content

Commit 4769655

Browse files
committed
run linters locally
1 parent 2e5944e commit 4769655

File tree

10 files changed

+24
-60
lines changed

10 files changed

+24
-60
lines changed

graphene/pyutils/dataclasses.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,7 @@ def __set_name__(self, owner, name):
291291

292292

293293
class _DataclassParams:
294-
__slots__ = (
295-
"init",
296-
"repr",
297-
"eq",
298-
"order",
299-
"unsafe_hash",
300-
"frozen",
301-
)
294+
__slots__ = ("init", "repr", "eq", "order", "unsafe_hash", "frozen")
302295

303296
def __init__(self, init, repr, eq, order, unsafe_hash, frozen):
304297
self.init = init
@@ -1157,10 +1150,7 @@ class C(Base):
11571150
name = item
11581151
tp = "typing.Any"
11591152
elif len(item) == 2:
1160-
(
1161-
name,
1162-
tp,
1163-
) = item
1153+
(name, tp) = item
11641154
elif len(item) == 3:
11651155
name, tp, spec = item
11661156
namespace[name] = spec

graphene/relay/node.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,9 @@ def get_node_from_global_id(cls, info, global_id, only_type=None):
9292
_type, _id = cls.from_global_id(global_id)
9393
except Exception as e:
9494
raise Exception(
95-
(
96-
f'Unable to parse global ID "{global_id}". '
97-
'Make sure it is a base64 encoded string in the format: "TypeName:id". '
98-
f"Exception message: {str(e)}"
99-
)
95+
f'Unable to parse global ID "{global_id}". '
96+
'Make sure it is a base64 encoded string in the format: "TypeName:id". '
97+
f"Exception message: {str(e)}"
10098
)
10199

102100
graphene_type = info.schema.get_type(_type)

graphene/relay/tests/test_connection_query.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,14 @@ async def test_respects_first_and_after_and_before_too_few():
163163
@mark.asyncio
164164
async def test_respects_first_and_after_and_before_too_many():
165165
await check(
166-
f'first: 4, after: "{cursor_for("A")}", before: "{cursor_for("E")}"',
167-
"BCD",
166+
f'first: 4, after: "{cursor_for("A")}", before: "{cursor_for("E")}"', "BCD"
168167
)
169168

170169

171170
@mark.asyncio
172171
async def test_respects_first_and_after_and_before_exactly_right():
173172
await check(
174-
f'first: 3, after: "{cursor_for("A")}", before: "{cursor_for("E")}"',
175-
"BCD",
173+
f'first: 3, after: "{cursor_for("A")}", before: "{cursor_for("E")}"', "BCD"
176174
)
177175

178176

@@ -188,16 +186,14 @@ async def test_respects_last_and_after_and_before_too_few():
188186
@mark.asyncio
189187
async def test_respects_last_and_after_and_before_too_many():
190188
await check(
191-
f'last: 4, after: "{cursor_for("A")}", before: "{cursor_for("E")}"',
192-
"BCD",
189+
f'last: 4, after: "{cursor_for("A")}", before: "{cursor_for("E")}"', "BCD"
193190
)
194191

195192

196193
@mark.asyncio
197194
async def test_respects_last_and_after_and_before_exactly_right():
198195
await check(
199-
f'last: 3, after: "{cursor_for("A")}", before: "{cursor_for("E")}"',
200-
"BCD",
196+
f'last: 3, after: "{cursor_for("A")}", before: "{cursor_for("E")}"', "BCD"
201197
)
202198

203199

graphene/types/mutation.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,10 @@ def __init_subclass_with_meta__(
9696
input_class = getattr(cls, "Input", None)
9797
if input_class:
9898
warn_deprecation(
99-
(
100-
f"Please use {cls.__name__}.Arguments instead of {cls.__name__}.Input."
101-
" Input is now only used in ClientMutationID.\n"
102-
"Read more:"
103-
" https://github.com/graphql-python/graphene/blob/v2.0.0/UPGRADE-v2.0.md#mutation-input"
104-
)
99+
f"Please use {cls.__name__}.Arguments instead of {cls.__name__}.Input."
100+
" Input is now only used in ClientMutationID.\n"
101+
"Read more:"
102+
" https://github.com/graphql-python/graphene/blob/v2.0.0/UPGRADE-v2.0.md#mutation-input"
105103
)
106104
if input_class:
107105
arguments = props(input_class)

graphene/types/objecttype.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ class InterObjectType:
2727
pass
2828

2929
base_cls = super().__new__(
30-
cls,
31-
name_,
32-
(InterObjectType,) + bases,
33-
namespace,
34-
**options,
30+
cls, name_, (InterObjectType,) + bases, namespace, **options
3531
)
3632
if base_cls._meta:
3733
fields = [

graphene/types/tests/test_base64.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,11 @@ def test_base64_query_none():
6464

6565

6666
def test_base64_query_invalid():
67-
bad_inputs = [
68-
dict(),
69-
123,
70-
"This is not valid base64",
71-
]
67+
bad_inputs = [dict(), 123, "This is not valid base64"]
7268

7369
for input_ in bad_inputs:
7470
result = schema.execute(
75-
"""{ base64(input: $input) }""",
76-
variables={"input": input_},
71+
"""{ base64(input: $input) }""", variables={"input": input_}
7772
)
7873
assert isinstance(result.errors, list)
7974
assert len(result.errors) == 1

graphene/types/tests/test_enum.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def description(self):
2626
assert RGB._meta.description == "Description"
2727

2828
values = RGB._meta.enum.__members__.values()
29-
assert sorted([v.name for v in values]) == ["BLUE", "GREEN", "RED"]
30-
assert sorted([v.description for v in values]) == [
29+
assert sorted(v.name for v in values) == ["BLUE", "GREEN", "RED"]
30+
assert sorted(v.description for v in values) == [
3131
"Description BLUE",
3232
"Description GREEN",
3333
"Description RED",
@@ -52,7 +52,7 @@ def test_enum_instance_construction():
5252
RGB = Enum("RGB", "RED,GREEN,BLUE")
5353

5454
values = RGB._meta.enum.__members__.values()
55-
assert sorted([v.name for v in values]) == ["BLUE", "GREEN", "RED"]
55+
assert sorted(v.name for v in values) == ["BLUE", "GREEN", "RED"]
5656

5757

5858
def test_enum_from_builtin_enum():
@@ -465,7 +465,7 @@ class Query(ObjectType):
465465
color
466466
}
467467
}
468-
""",
468+
"""
469469
)
470470
assert not result.errors
471471
assert result.data == {"createPaint": {"color": "RED"}}

graphene/utils/orderedtype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def __gt__(self, other):
3636
return NotImplemented
3737

3838
def __hash__(self):
39-
return hash((self.creation_counter))
39+
return hash(self.creation_counter)

graphene/validation/disable_introspection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def enter_field(self, node: FieldNode, *_args):
1111
if is_introspection_key(field_name):
1212
self.report_error(
1313
GraphQLError(
14-
f"Cannot query '{field_name}': introspection is disabled.",
15-
node,
14+
f"Cannot query '{field_name}': introspection is disabled.", node
1615
)
1716
)

graphene/validation/tests/test_depth_limit_validator.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,7 @@ def test_should_ignore_field():
236236
errors, result = run_query(
237237
query,
238238
10,
239-
ignore=[
240-
"user1",
241-
re.compile("user2"),
242-
lambda field_name: field_name == "user3",
243-
],
239+
ignore=["user1", re.compile("user2"), lambda field_name: field_name == "user3"],
244240
)
245241

246242
expected = {"read1": 2, "read2": 0}
@@ -255,8 +251,4 @@ def test_should_raise_invalid_ignore():
255251
}
256252
"""
257253
with raises(ValueError, match="Invalid ignore option:"):
258-
run_query(
259-
query,
260-
10,
261-
ignore=[True],
262-
)
254+
run_query(query, 10, ignore=[True])

0 commit comments

Comments
 (0)