File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8383 create_task = "wolframclient.utils.asyncio.create_task" ,
8484 ensure_future = "asyncio.ensure_future" ,
8585 wrap_future = "asyncio.wrap_future" ,
86+ run = "wolframclient.utils.asyncio.run" ,
8687 get_event_loop = "asyncio.get_event_loop" ,
8788 new_event_loop = "asyncio.new_event_loop" ,
8889 Queue = "asyncio.Queue" ,
Original file line number Diff line number Diff line change @@ -14,15 +14,6 @@ def wrapped(*args, **kwargs):
1414 return wrapped
1515
1616
17- def run_all (args , ** opts ):
18- done = tuple (iterate (* args ))
19- if done and len (done ) > 1 :
20- return asyncio .ensure_future (asyncio .wait (done ), ** opts )
21- elif done :
22- return asyncio .ensure_future (first (done ), ** opts )
23- return done
24-
25-
2617def get_event_loop (loop = None ):
2718 try :
2819 return loop or asyncio .get_event_loop ()
@@ -32,18 +23,12 @@ def get_event_loop(loop=None):
3223 return loop
3324
3425
35- def silence (* exceptions ):
36- def wrap (fn ):
37- @functools .wraps (fn )
38- def wrapper (* args , ** kwargs ):
39- try :
40- return fn (* args , ** kwargs )
41- except tuple (exceptions ):
42- pass
43-
44- return wrapper
45-
46- return wrap
26+ if hasattr (asyncio , 'run' ):
27+ run = asyncio .run
28+ else :
29+ def run (main ):
30+ loop = get_event_loop ()
31+ return loop .run_until_complete (main )
4732
4833
4934if hasattr (asyncio , "create_task" ):
You can’t perform that action at this time.
0 commit comments