MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _assume_async

Function _assume_async

lib/sqlalchemy/testing/asyncio.py:37–51  ·  view source on GitHub ↗

Run a function in an asyncio loop unconditionally. This function is used for provisioning features like testing a database connection for server info. Note that for blocking IO database drivers, this means they block the event loop.

(fn, *args, **kwargs)

Source from the content-addressed store, hash-verified

35
36
37def _assume_async(fn, *args, **kwargs):
38 """Run a function in an asyncio loop unconditionally.
39
40 This function is used for provisioning features like
41 testing a database connection for server info.
42
43 Note that for blocking IO database drivers, this means they block the
44 event loop.
45
46 """
47
48 if not ENABLE_ASYNCIO:
49 return fn(*args, **kwargs)
50
51 return _async_util.run_in_greenlet(fn, *args, **kwargs)
52
53
54def _maybe_async_provisioning(fn, *args, **kwargs):

Callers

nothing calls this directly

Calls 1

run_in_greenletMethod · 0.80

Tested by

no test coverage detected