aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/compat/asyncio.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-05-17 10:10:39 +0800
committerJesús <heckyel@hyperbola.info>2022-05-17 10:10:39 +0800
commit4bbf329feb5a820ac21269fa426c95ca14d7af25 (patch)
tree2c147a162b4bddc7862ed5895f1f66edd9a675e8 /yt_dlp/compat/asyncio.py
parente21342911839b7796a5c788a7c3f13b06d975c64 (diff)
parent5faf6528fb701724ac32e0a487f92281c7800bda (diff)
downloadhypervideo-pre-4bbf329feb5a820ac21269fa426c95ca14d7af25.tar.lz
hypervideo-pre-4bbf329feb5a820ac21269fa426c95ca14d7af25.tar.xz
hypervideo-pre-4bbf329feb5a820ac21269fa426c95ca14d7af25.zip
updated from upstream | 17/05/2022 at 10:10
Diffstat (limited to 'yt_dlp/compat/asyncio.py')
-rw-r--r--yt_dlp/compat/asyncio.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/yt_dlp/compat/asyncio.py b/yt_dlp/compat/asyncio.py
new file mode 100644
index 000000000..c61e5c8fd
--- /dev/null
+++ b/yt_dlp/compat/asyncio.py
@@ -0,0 +1,23 @@
+# flake8: noqa: F405
+from asyncio import * # noqa: F403
+
+from .compat_utils import passthrough_module
+
+passthrough_module(__name__, 'asyncio')
+del passthrough_module
+
+try:
+ run # >= 3.7
+except NameError:
+ def run(coro):
+ try:
+ loop = get_event_loop()
+ except RuntimeError:
+ loop = new_event_loop()
+ set_event_loop(loop)
+ loop.run_until_complete(coro)
+
+try:
+ all_tasks # >= 3.7
+except NameError:
+ all_tasks = Task.all_tasks