Skip to content

Commit 20a1a69

Browse files
committed
Fix a minor flake8 issue
1 parent f4e9f07 commit 20a1a69

File tree

2 files changed

+28
-40
lines changed

2 files changed

+28
-40
lines changed

graphql/utilities/find_breaking_changes.py

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -444,37 +444,28 @@ def is_change_safe_for_object_or_interface_field(
444444
if is_named_type(old_type):
445445
return (
446446
# if they're both named types, see if their names are equivalent
447-
(
448-
is_named_type(new_type)
449-
and cast(GraphQLNamedType, old_type).name
450-
== cast(GraphQLNamedType, new_type).name
451-
)
452-
or
447+
is_named_type(new_type)
448+
and cast(GraphQLNamedType, old_type).name
449+
== cast(GraphQLNamedType, new_type).name
450+
) or (
453451
# moving from nullable to non-null of same underlying type is safe
454-
(
455-
is_non_null_type(new_type)
456-
and is_change_safe_for_object_or_interface_field(
457-
old_type, cast(GraphQLNonNull, new_type).of_type
458-
)
452+
is_non_null_type(new_type)
453+
and is_change_safe_for_object_or_interface_field(
454+
old_type, cast(GraphQLNonNull, new_type).of_type
459455
)
460456
)
461457
elif is_list_type(old_type):
462458
return (
463459
# if they're both lists, make sure underlying types are compatible
464-
(
465-
is_list_type(new_type)
466-
and is_change_safe_for_object_or_interface_field(
467-
cast(GraphQLList, old_type).of_type,
468-
cast(GraphQLList, new_type).of_type,
469-
)
460+
is_list_type(new_type)
461+
and is_change_safe_for_object_or_interface_field(
462+
cast(GraphQLList, old_type).of_type, cast(GraphQLList, new_type).of_type
470463
)
471-
or
464+
) or (
472465
# moving from nullable to non-null of same underlying type is safe
473-
(
474-
is_non_null_type(new_type)
475-
and is_change_safe_for_object_or_interface_field(
476-
old_type, cast(GraphQLNonNull, new_type).of_type
477-
)
466+
is_non_null_type(new_type)
467+
and is_change_safe_for_object_or_interface_field(
468+
old_type, cast(GraphQLNonNull, new_type).of_type
478469
)
479470
)
480471
elif is_non_null_type(old_type):
@@ -493,36 +484,33 @@ def is_change_safe_for_input_object_field_or_field_arg(
493484
old_type: GraphQLType, new_type: GraphQLType
494485
) -> bool:
495486
if is_named_type(old_type):
496-
# if they're both named types, see if their names are equivalent
497487
return (
488+
# if they're both named types, see if their names are equivalent
498489
is_named_type(new_type)
499490
and cast(GraphQLNamedType, old_type).name
500491
== cast(GraphQLNamedType, new_type).name
501492
)
502493
elif is_list_type(old_type):
503-
# if they're both lists, make sure underlying types are compatible
494+
504495
return is_list_type(
496+
# if they're both lists, make sure underlying types are compatible
505497
new_type
506498
) and is_change_safe_for_input_object_field_or_field_arg(
507499
cast(GraphQLList, old_type).of_type, cast(GraphQLList, new_type).of_type
508500
)
509501
elif is_non_null_type(old_type):
510502
return (
511503
# if they're both non-null, make sure the underlying types are compatible
512-
(
513-
is_non_null_type(new_type)
514-
and is_change_safe_for_input_object_field_or_field_arg(
515-
cast(GraphQLNonNull, old_type).of_type,
516-
cast(GraphQLNonNull, new_type).of_type,
517-
)
504+
is_non_null_type(new_type)
505+
and is_change_safe_for_input_object_field_or_field_arg(
506+
cast(GraphQLNonNull, old_type).of_type,
507+
cast(GraphQLNonNull, new_type).of_type,
518508
)
519-
or
509+
) or (
520510
# moving from non-null to nullable of same underlying type is safe
521-
(
522-
not is_non_null_type(new_type)
523-
and is_change_safe_for_input_object_field_or_field_arg(
524-
cast(GraphQLNonNull, old_type).of_type, new_type
525-
)
511+
not is_non_null_type(new_type)
512+
and is_change_safe_for_input_object_field_or_field_arg(
513+
cast(GraphQLNonNull, old_type).of_type, new_type
526514
)
527515
)
528516
else:

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ python =
77
3.6: py36
88

99
[testenv:black]
10-
basepython = python
10+
basepython = python3.6
1111
deps = black
1212
commands =
1313
black graphql tests --check
1414

1515
[testenv:flake8]
16-
basepython = python
16+
basepython = python3.6
1717
deps = flake8
1818
commands =
1919
flake8 graphql tests
2020

2121
[testenv:mypy]
22-
basepython = python
22+
basepython = python3.6
2323
deps = mypy
2424
commands =
2525
mypy graphql

0 commit comments

Comments
 (0)