Skip to content

Commit 331c7bc

Browse files
committed
Minor typing and linting fixes
1 parent 9f19b40 commit 331c7bc

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

src/graphql/execution/collect_fields.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,7 @@ def should_include_node(
281281
return False
282282

283283
include = get_directive_values(GraphQLIncludeDirective, node, variable_values)
284-
if include and not include["if"]:
285-
return False
286-
287-
return True
284+
return not (include and not include["if"])
288285

289286

290287
def does_fragment_condition_match(

src/graphql/execution/execute.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ class ExecutionContext(IncrementalPublisherMixin):
354354
middleware_manager: MiddlewareManager | None
355355

356356
is_awaitable: Callable[[Any], TypeGuard[Awaitable]] = staticmethod(
357-
default_is_awaitable # type: ignore
357+
default_is_awaitable
358358
)
359359

360360
def __init__(
@@ -1113,13 +1113,13 @@ async def get_completed_results() -> list[Any]:
11131113
index = awaitable_indices[0]
11141114
completed_results[index] = await completed_results[index]
11151115
else:
1116-
for index, result in zip(
1116+
for index, sub_result in zip(
11171117
awaitable_indices,
11181118
await gather(
11191119
*(completed_results[index] for index in awaitable_indices)
11201120
),
11211121
):
1122-
completed_results[index] = result
1122+
completed_results[index] = sub_result
11231123
return completed_results
11241124

11251125
return get_completed_results()

src/graphql/language/block_string.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def is_printable_as_block_string(value: str) -> bool:
9797
if is_empty_line:
9898
return False # has trailing empty lines
9999

100-
if has_common_indent and seen_non_empty_line:
100+
if has_common_indent and seen_non_empty_line: # noqa: SIM103
101101
return False # has internal indent
102102

103103
return True

src/graphql/type/definition.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ def fields(self) -> GraphQLFieldMap:
783783
"""Get provided fields, wrapping them as GraphQLFields if needed."""
784784
try:
785785
fields = resolve_thunk(self._fields)
786-
except Exception as error: # noqa: BLE001
786+
except Exception as error:
787787
cls = GraphQLError if isinstance(error, GraphQLError) else TypeError
788788
msg = f"{self.name} fields cannot be resolved. {error}"
789789
raise cls(msg) from error
@@ -801,7 +801,7 @@ def interfaces(self) -> tuple[GraphQLInterfaceType, ...]:
801801
interfaces: Collection[GraphQLInterfaceType] = resolve_thunk(
802802
self._interfaces # type: ignore
803803
)
804-
except Exception as error: # noqa: BLE001
804+
except Exception as error:
805805
cls = GraphQLError if isinstance(error, GraphQLError) else TypeError
806806
msg = f"{self.name} interfaces cannot be resolved. {error}"
807807
raise cls(msg) from error
@@ -888,7 +888,7 @@ def fields(self) -> GraphQLFieldMap:
888888
"""Get provided fields, wrapping them as GraphQLFields if needed."""
889889
try:
890890
fields = resolve_thunk(self._fields)
891-
except Exception as error: # noqa: BLE001
891+
except Exception as error:
892892
cls = GraphQLError if isinstance(error, GraphQLError) else TypeError
893893
msg = f"{self.name} fields cannot be resolved. {error}"
894894
raise cls(msg) from error
@@ -906,7 +906,7 @@ def interfaces(self) -> tuple[GraphQLInterfaceType, ...]:
906906
interfaces: Collection[GraphQLInterfaceType] = resolve_thunk(
907907
self._interfaces # type: ignore
908908
)
909-
except Exception as error: # noqa: BLE001
909+
except Exception as error:
910910
cls = GraphQLError if isinstance(error, GraphQLError) else TypeError
911911
msg = f"{self.name} interfaces cannot be resolved. {error}"
912912
raise cls(msg) from error
@@ -992,7 +992,7 @@ def types(self) -> tuple[GraphQLObjectType, ...]:
992992
"""Get provided types."""
993993
try:
994994
types: Collection[GraphQLObjectType] = resolve_thunk(self._types)
995-
except Exception as error: # noqa: BLE001
995+
except Exception as error:
996996
cls = GraphQLError if isinstance(error, GraphQLError) else TypeError
997997
msg = f"{self.name} types cannot be resolved. {error}"
998998
raise cls(msg) from error
@@ -1350,7 +1350,7 @@ def fields(self) -> GraphQLInputFieldMap:
13501350
"""Get provided fields, wrap them as GraphQLInputField if needed."""
13511351
try:
13521352
fields = resolve_thunk(self._fields)
1353-
except Exception as error: # noqa: BLE001
1353+
except Exception as error:
13541354
cls = GraphQLError if isinstance(error, GraphQLError) else TypeError
13551355
msg = f"{self.name} fields cannot be resolved. {error}"
13561356
raise cls(msg) from error

0 commit comments

Comments
 (0)