Skip to content

Commit 233df17

Browse files
committed
Introduces new incremental response format
Replicates graphql/graphql-js@00e2b50
1 parent 59d478a commit 233df17

18 files changed

+2290
-1013
lines changed

docs/conf.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@
147147
types.TracebackType
148148
TypeMap
149149
AwaitableOrValue
150+
DeferredFragmentRecord
151+
DeferUsage
150152
EnterLeaveVisitor
151153
ExperimentalIncrementalExecutionResults
152154
FieldGroup
@@ -165,18 +167,31 @@
165167
IncrementalResult
166168
InitialResultRecord
167169
Middleware
170+
StreamItemsRecord
171+
StreamRecord
168172
SubsequentDataRecord
169173
asyncio.events.AbstractEventLoop
170-
graphql.execution.collect_fields.FieldsAndPatches
174+
collections.abc.MutableMapping
175+
collections.abc.MutableSet
176+
graphql.execution.collect_fields.DeferUsage
177+
graphql.execution.collect_fields.CollectFieldsResult
178+
graphql.execution.collect_fields.FieldGroup
171179
graphql.execution.execute.StreamArguments
180+
graphql.execution.execute.StreamUsage
172181
graphql.execution.map_async_iterable.map_async_iterable
182+
graphql.execution.incremental_publisher.CompletedResult
173183
graphql.execution.incremental_publisher.DeferredFragmentRecord
184+
graphql.execution.incremental_publisher.DeferredGroupedFieldSetRecord
185+
graphql.execution.incremental_publisher.FormattedCompletedResult
174186
graphql.execution.incremental_publisher.IncrementalPublisher
175187
graphql.execution.incremental_publisher.InitialResultRecord
176188
graphql.execution.incremental_publisher.StreamItemsRecord
189+
graphql.execution.incremental_publisher.StreamRecord
177190
graphql.execution.Middleware
178191
graphql.language.lexer.EscapeSequence
179192
graphql.language.visitor.EnterLeaveVisitor
193+
graphql.pyutils.ref_map.K
194+
graphql.pyutils.ref_map.V
180195
graphql.type.definition.GT_co
181196
graphql.type.definition.GNT_co
182197
graphql.type.definition.TContext

docs/modules/pyutils.rst

+4
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ PyUtils
3030
.. autoclass:: SimplePubSub
3131
.. autoclass:: SimplePubSubIterator
3232
.. autodata:: Undefined
33+
.. autoclass:: RefMap
34+
:no-inherited-members:
35+
.. autoclass:: RefSet
36+
:no-inherited-members:

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ timeout = "100"
320320
filterwarnings = "ignore::pytest.PytestConfigWarning"
321321
# All tests can be found in the tests directory.
322322
testpaths = ["tests"]
323+
# Use the functions scope as the default for asynchronous tests.
324+
asyncio_default_fixture_loop_scope = "function"
323325

324326
[build-system]
325327
requires = ["poetry_core>=1.6.1,<2"]

src/graphql/execution/async_iterables.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from contextlib import AbstractAsyncContextManager
5+
from contextlib import AbstractAsyncContextManager, suppress
66
from typing import (
77
AsyncGenerator,
88
AsyncIterable,
@@ -20,6 +20,8 @@
2020

2121
AsyncIterableOrGenerator = Union[AsyncGenerator[T, None], AsyncIterable[T]]
2222

23+
suppress_exceptions = suppress(Exception)
24+
2325

2426
class aclosing(AbstractAsyncContextManager, Generic[T]): # noqa: N801
2527
"""Async context manager for safely finalizing an async iterator or generator.
@@ -40,7 +42,8 @@ async def __aexit__(self, *_exc_info: object) -> None:
4042
except AttributeError:
4143
pass # do not complain if the iterator has no aclose() method
4244
else:
43-
await aclose()
45+
with suppress_exceptions: # or if the aclose() method fails
46+
await aclose()
4447

4548

4649
async def map_async_iterable(

0 commit comments

Comments
 (0)