Skip to content

Commit ba6e73b

Browse files
committed
perf: use None for empty lists
Replicates graphql/graphql-js@92f9bb0
1 parent a5b93d5 commit ba6e73b

17 files changed

+205
-131
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
"graphql.execution.collect_fields.CollectedFields",
193193
"graphql.execution.collect_fields.DeferUsage",
194194
"graphql.execution.collect_fields.FieldDetails",
195+
"graphql.execution.execute.GraphQLWrappedResult",
195196
"graphql.execution.execute.IncrementalContext",
196197
"graphql.execution.execute.StreamArguments",
197198
"graphql.execution.execute.SubFieldPlan",

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ disallow_untyped_defs = false
275275
[tool.pyright]
276276
# silence pyright since we're using mypy already
277277
reportArgumentType = false
278+
reportAssignmentType = false
278279
reportAttributeAccessIssue = false
279280
reportIncompatibleVariableOverride = false
280281
reportInvalidTypeForm = false

src/graphql/error/graphql_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def __init__(
151151
self.source = source
152152
if not source and node_locations:
153153
loc = node_locations[0]
154-
if loc.source: # pragma: no cover else
154+
if loc.source: # pragma: no branch
155155
self.source = loc.source
156156
if not positions and node_locations:
157157
positions = [loc.start for loc in node_locations]

src/graphql/execution/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
default_type_resolver,
1414
subscribe,
1515
ExecutionContext,
16+
GraphQLWrappedResult,
1617
Middleware,
1718
)
1819
from .incremental_publisher import (
@@ -44,6 +45,7 @@
4445
"FormattedIncrementalStreamResult",
4546
"FormattedInitialIncrementalExecutionResult",
4647
"FormattedSubsequentIncrementalExecutionResult",
48+
"GraphQLWrappedResult",
4749
"IncrementalDeferResult",
4850
"IncrementalResult",
4951
"IncrementalStreamResult",

src/graphql/execution/collect_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def collect_fields_impl(
223223
new_defer_usages,
224224
new_defer_usage,
225225
)
226-
elif isinstance(selection, FragmentSpreadNode): # pragma: no cover else
226+
elif isinstance(selection, FragmentSpreadNode): # pragma: no branch
227227
frag_name = selection.name.value
228228

229229
new_defer_usage = get_defer_usage(

0 commit comments

Comments
 (0)