MCPcopy Index your code
hub / github.com/bedroombuilds/python2rust / main

Function main

13_async/python/minimal.py:13–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 return 2
12
13async def main():
14 await a()
15 await b()
16 print("serial\n")
17
18 result = await asyncio.gather(a(), b())
19 print("joined\n")
20 assert result == [1, 2]
21
22 done, pending = await asyncio.wait(
23 [asyncio.create_task(a()), asyncio.create_task(b())], return_when=asyncio.FIRST_COMPLETED)
24 for p in pending:
25 p.cancel()
26 print("done {}\n".format(done.pop().result()))
27
28 futures = [b(), a(), b()]
29 result = await asyncio.gather(*futures)
30 print("joined vector\n")
31
32if __name__ == "__main__":
33 # Python 3.7+

Callers 1

minimal.pyFile · 0.70

Calls 3

aFunction · 0.70
bFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected