File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6161 packages = find_packages (),
6262 install_requires = [
6363 "trio" ,
64+ "async_generator >= 1.6" ,
6465 ],
6566 # This means, just install *everything* you see under trio/, even if it
6667 # doesn't look like a source file, so long as it appears in MANIFEST.in:
Original file line number Diff line number Diff line change 11# This code implements a clone of the asyncio mainloop which hooks into
22# Trio.
33
4- import inspect
4+ from async_generator import isasyncgenfunction
55import trio_asyncio
66
77# import logging
1313
1414
1515def trio2aio (proc ):
16- if inspect . isasyncgenfunction (proc ):
16+ if isasyncgenfunction (proc ):
1717
1818 @wraps (proc )
1919 def call (* args , ** kwargs ):
Original file line number Diff line number Diff line change 44import trio
55import asyncio
66import sys
7+ from async_generator import async_generator , yield_
78
89__all__ = ['run_future' ]
910
@@ -50,6 +51,7 @@ def abort_cb(raise_cancel_arg):
5051STOP = object ()
5152
5253
54+ @async_generator
5355async def run_generator (loop , async_generator ):
5456 task = trio .hazmat .current_task ()
5557 raise_cancel = None
@@ -79,7 +81,7 @@ def abort_cb(raise_cancel_arg):
7981 item = await trio .hazmat .wait_task_rescheduled (abort_cb )
8082 if item is STOP :
8183 break
82- yield item
84+ await yield_ ( item )
8385
8486 except asyncio .CancelledError as exc :
8587 if raise_cancel is not None :
You can’t perform that action at this time.
0 commit comments