MCPcopy
hub / github.com/psycopg/psycopg / spawn

Function spawn

tests/acompat.py:47–59  ·  view source on GitHub ↗

Equivalent to asyncio.create_task or creating and running a Thread.

(f, args=None)

Source from the content-addressed store, hash-verified

45
46
47def spawn(f, args=None):
48 """
49 Equivalent to asyncio.create_task or creating and running a Thread.
50 """
51 if not args:
52 args = ()
53
54 if inspect.iscoroutinefunction(f):
55 return asyncio.create_task(f(*args))
56 else:
57 t = threading.Thread(target=f, args=args, daemon=True)
58 t.start()
59 return t
60
61
62def gather(*ts, return_exceptions=False, timeout=None):

Callers 15

test_notifyFunction · 0.70
test_notify_timeoutFunction · 0.70
test_stop_afterFunction · 0.70
test_stop_after_batchFunction · 0.70
test_notifies_blockingFunction · 0.70
test_notify_query_notifyFunction · 0.70
test_copy_concurrencyFunction · 0.70
test_notifyFunction · 0.70
test_notify_timeoutFunction · 0.70
test_stop_afterFunction · 0.70
test_stop_after_batchFunction · 0.70

Calls 2

fFunction · 0.50
startMethod · 0.45

Tested by 15

test_notifyFunction · 0.56
test_notify_timeoutFunction · 0.56
test_stop_afterFunction · 0.56
test_stop_after_batchFunction · 0.56
test_notifies_blockingFunction · 0.56
test_notify_query_notifyFunction · 0.56
test_copy_concurrencyFunction · 0.56
test_notifyFunction · 0.56
test_notify_timeoutFunction · 0.56
test_stop_afterFunction · 0.56
test_stop_after_batchFunction · 0.56