Skip to content

Commit

Permalink
Minor simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Apr 5, 2024
1 parent a91e4b2 commit ae91327
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/graphql/execution/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,6 @@ async def await_data(
awaitable: Awaitable[Dict[str, Any]],
) -> Optional[Dict[str, Any]]:
# noinspection PyShadowingNames

try:
return await awaitable
except GraphQLError as error:
Expand Down Expand Up @@ -2607,16 +2606,14 @@ async def wait(self) -> Optional[Dict[str, Any]]:
if self.parent_context:
await self.parent_context.completed.wait()
_data = self._data
try:
data = (
await _data # type: ignore
if self._context.is_awaitable(_data)
else _data
)
finally:
await sleep(ASYNC_DELAY) # always defer completion a little bit
self.data = data
self.completed.set()
data = (
await _data # type: ignore
if self._context.is_awaitable(_data)
else _data
)
await sleep(ASYNC_DELAY) # always defer completion a little bit
self.completed.set()
self.data = data
return data

def add_data(self, data: AwaitableOrValue[Optional[Dict[str, Any]]]) -> None:
Expand Down Expand Up @@ -2680,16 +2677,14 @@ async def wait(self) -> Optional[List[str]]:
if self.parent_context:
await self.parent_context.completed.wait()
_items = self._items
try:
items = (
await _items # type: ignore
if self._context.is_awaitable(_items)
else _items
)
finally:
await sleep(ASYNC_DELAY) # always defer completion a little bit
self.items = items
self.completed.set()
items = (
await _items # type: ignore
if self._context.is_awaitable(_items)
else _items
)
await sleep(ASYNC_DELAY) # always defer completion a little bit
self.items = items
self.completed.set()
return items

def add_items(self, items: AwaitableOrValue[Optional[List[Any]]]) -> None:
Expand Down

0 comments on commit ae91327

Please sign in to comment.