/usr/lib/python3.10/asyncio
NameSizeModeActions
__pycache__/-0755rm
base_events.py743410644editdlrm
base_futures.py25740644editdlrm
base_subprocess.py88430644editdlrm
base_tasks.py24670644editdlrm
constants.py8880644editdlrm
coroutines.py87970644editdlrm
events.py273460644editdlrm
exceptions.py16330644editdlrm
format_helpers.py24040644editdlrm
futures.py141870644editdlrm
locks.py141220644editdlrm
log.py1240644editdlrm
mixins.py8030644editdlrm
proactor_events.py325410644editdlrm
protocols.py69570644editdlrm
queues.py80340644editdlrm
runners.py21040644editdlrm
selector_events.py397000644editdlrm
sslproto.py274590644editdlrm
staggered.py59920644editdlrm
streams.py257490644editdlrm
subprocess.py74050644editdlrm
tasks.py324580644editdlrm
threads.py7900644editdlrm
transports.py107240644editdlrm
trsock.py58760644editdlrm
unix_events.py516240644editdlrm
windows_events.py333940644editdlrm
windows_utils.py50600644editdlrm
__init__.py11080644editdlrm
__main__.py33430644editdlrm
Edit: /usr/lib/python3.10/asyncio/threads.py (790B)
"""High-level support for working with threads in asyncio""" import functools import contextvars from . import events __all__ = "to_thread", async def to_thread(func, /, *args, **kwargs): """Asynchronously run function *func* in a separate thread. Any *args and **kwargs supplied for this function are directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the main thread to be accessed in the separate thread. Return a coroutine that can be awaited to get the eventual result of *func*. """ loop = events.get_running_loop() ctx = contextvars.copy_context() func_call = functools.partial(ctx.run, func, *args, **kwargs) return await loop.run_in_executor(None, func_call)