MCPcopy
hub / github.com/bloomberg/memray / async_run

Function async_run

tests/utils.py:101–113  ·  view source on GitHub ↗
(coro)

Source from the content-addressed store, hash-verified

99
100
101def async_run(coro):
102 # This technique shamelessly cribbed from Textual itself...
103 # `asyncio.get_event_loop()` is deprecated since Python 3.10:
104 asyncio_get_event_loop_is_deprecated = sys.version_info >= (3, 10, 0)
105
106 if asyncio_get_event_loop_is_deprecated:
107 # N.B. This doesn't work with Python<3.10, as we end up with 2 event loops:
108 return asyncio.run(coro)
109 else:
110 # pragma: no cover
111 # However, this works with Python<3.10:
112 event_loop = asyncio.get_event_loop()
113 return event_loop.run_until_complete(coro)

Calls 1

runMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…