Skip to content

Commit

Permalink
Actually, this input could still be a None
Browse files Browse the repository at this point in the history
  • Loading branch information
mikenerone committed Jan 6, 2024
1 parent 1a42eaa commit 4a2e9f4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions slurry/sections/_producers.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,17 @@ async def refine(self, input, output):
# pylint: disable=line-too-long
raise RuntimeError('If Repeat is used as first section, default value must be provided.')

input = cast(AsyncIterable[Any], input)
item = self.default if self.has_default else None

async def pull_task(cancel_scope, *, task_status=trio.TASK_STATUS_IGNORED):
nonlocal item
async for item in input:
task_status.started()
break
async for item in input:
pass
if input:
async for item in input:
break
task_status.started()
if input:
async for item in input:
pass
cancel_scope.cancel()

async with trio.open_nursery() as nursery:
Expand Down

0 comments on commit 4a2e9f4

Please sign in to comment.