aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/compat
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/compat')
-rw-r--r--yt_dlp/compat/__init__.py7
-rw-r--r--yt_dlp/compat/_deprecated.py8
-rw-r--r--yt_dlp/compat/urllib/__init__.py3
3 files changed, 13 insertions, 5 deletions
diff --git a/yt_dlp/compat/__init__.py b/yt_dlp/compat/__init__.py
index a41a80ebb..832a9138d 100644
--- a/yt_dlp/compat/__init__.py
+++ b/yt_dlp/compat/__init__.py
@@ -1,14 +1,11 @@
import os
import sys
-import warnings
import xml.etree.ElementTree as etree
-from ._deprecated import * # noqa: F401, F403
from .compat_utils import passthrough_module
-# XXX: Implement this the same way as other DeprecationWarnings without circular import
-passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
- DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=5))
+passthrough_module(__name__, '._deprecated')
+del passthrough_module
# HTMLParseError has been deprecated in Python 3.3 and removed in
diff --git a/yt_dlp/compat/_deprecated.py b/yt_dlp/compat/_deprecated.py
index 14d37b236..607bae999 100644
--- a/yt_dlp/compat/_deprecated.py
+++ b/yt_dlp/compat/_deprecated.py
@@ -1,4 +1,12 @@
"""Deprecated - New code should avoid these"""
+import warnings
+
+from .compat_utils import passthrough_module
+
+# XXX: Implement this the same way as other DeprecationWarnings without circular import
+passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn(
+ DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=6))
+del passthrough_module
import base64
import urllib.error
diff --git a/yt_dlp/compat/urllib/__init__.py b/yt_dlp/compat/urllib/__init__.py
index 6b6b8e103..b27cc6133 100644
--- a/yt_dlp/compat/urllib/__init__.py
+++ b/yt_dlp/compat/urllib/__init__.py
@@ -1,6 +1,9 @@
# flake8: noqa: F405
from urllib import * # noqa: F403
+del request
+from . import request # noqa: F401
+
from ..compat_utils import passthrough_module
passthrough_module(__name__, 'urllib')