mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 07:04:38 +00:00
parent
25b6e8f946
commit
a250b24733
5 changed files with 18 additions and 12 deletions
|
@ -9,15 +9,16 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
import urllib.parse
|
|
||||||
|
|
||||||
from yt_dlp import compat
|
from yt_dlp import compat
|
||||||
|
from yt_dlp.compat import urllib # isort: split
|
||||||
from yt_dlp.compat import (
|
from yt_dlp.compat import (
|
||||||
compat_etree_fromstring,
|
compat_etree_fromstring,
|
||||||
compat_expanduser,
|
compat_expanduser,
|
||||||
compat_urllib_parse_unquote,
|
compat_urllib_parse_unquote,
|
||||||
compat_urllib_parse_urlencode,
|
compat_urllib_parse_urlencode,
|
||||||
)
|
)
|
||||||
|
from yt_dlp.compat.urllib.request import getproxies
|
||||||
|
|
||||||
|
|
||||||
class TestCompat(unittest.TestCase):
|
class TestCompat(unittest.TestCase):
|
||||||
|
@ -28,8 +29,7 @@ class TestCompat(unittest.TestCase):
|
||||||
with self.assertWarns(DeprecationWarning):
|
with self.assertWarns(DeprecationWarning):
|
||||||
compat.WINDOWS_VT_MODE
|
compat.WINDOWS_VT_MODE
|
||||||
|
|
||||||
# TODO: Test submodule
|
self.assertEqual(urllib.request.getproxies, getproxies)
|
||||||
# compat.asyncio.events # Must not raise error
|
|
||||||
|
|
||||||
with self.assertWarns(DeprecationWarning):
|
with self.assertWarns(DeprecationWarning):
|
||||||
compat.compat_pycrypto_AES # Must not raise error
|
compat.compat_pycrypto_AES # Must not raise error
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
import xml.etree.ElementTree as etree
|
import xml.etree.ElementTree as etree
|
||||||
|
|
||||||
from ._deprecated import * # noqa: F401, F403
|
|
||||||
from .compat_utils import passthrough_module
|
from .compat_utils import passthrough_module
|
||||||
|
|
||||||
# XXX: Implement this the same way as other DeprecationWarnings without circular import
|
passthrough_module(__name__, '._deprecated')
|
||||||
passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
|
del passthrough_module
|
||||||
DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=5))
|
|
||||||
|
|
||||||
|
|
||||||
# HTMLParseError has been deprecated in Python 3.3 and removed in
|
# HTMLParseError has been deprecated in Python 3.3 and removed in
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
"""Deprecated - New code should avoid these"""
|
"""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 base64
|
||||||
import urllib.error
|
import urllib.error
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# flake8: noqa: F405
|
# flake8: noqa: F405
|
||||||
from urllib import * # noqa: F403
|
from urllib import * # noqa: F403
|
||||||
|
|
||||||
|
del request
|
||||||
|
from . import request # noqa: F401
|
||||||
|
|
||||||
from ..compat_utils import passthrough_module
|
from ..compat_utils import passthrough_module
|
||||||
|
|
||||||
passthrough_module(__name__, 'urllib')
|
passthrough_module(__name__, 'urllib')
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# flake8: noqa: F401, F403
|
# flake8: noqa: F403
|
||||||
import warnings
|
|
||||||
|
|
||||||
from ..compat.compat_utils import passthrough_module
|
from ..compat.compat_utils import passthrough_module
|
||||||
|
|
||||||
passthrough_module(__name__, '._deprecated')
|
passthrough_module(__name__, '._deprecated')
|
||||||
|
@ -9,4 +7,4 @@ del passthrough_module
|
||||||
# isort: off
|
# isort: off
|
||||||
from .traversal import *
|
from .traversal import *
|
||||||
from ._utils import *
|
from ._utils import *
|
||||||
from ._utils import _configuration_args, _get_exe_version_output
|
from ._utils import _configuration_args, _get_exe_version_output # noqa: F401
|
||||||
|
|
Loading…
Reference in a new issue