File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -188,18 +188,17 @@ async def _run_async_impl(
188188 pause_invocation = False
189189 try :
190190 # TODO remove if once Python <3.11 is no longer supported.
191- if sys .version_info >= (3 , 11 ):
192- async with Aclosing (_merge_agent_run (agent_runs )) as agen :
193- async for event in agen :
194- yield event
195- if ctx .should_pause_invocation (event ):
196- pause_invocation = True
197- else :
198- async with Aclosing (_merge_agent_run_pre_3_11 (agent_runs )) as agen :
199- async for event in agen :
200- yield event
201- if ctx .should_pause_invocation (event ):
202- pause_invocation = True
191+ merge_func = (
192+ _merge_agent_run
193+ if sys .version_info >= (3 , 11 )
194+ else _merge_agent_run_pre_3_11
195+ )
196+
197+ async with Aclosing (merge_func (agent_runs )) as agen :
198+ async for event in agen :
199+ yield event
200+ if ctx .should_pause_invocation (event ):
201+ pause_invocation = True
203202
204203 if pause_invocation :
205204 return
You can’t perform that action at this time.
0 commit comments