]>
jfr.im git - yt-dlp.git/blob - yt_dlp/utils/_deprecated.py
1 """Deprecated - New code should avoid these"""
4 from ..compat
.compat_utils
import passthrough_module
6 # XXX: Implement this the same way as other DeprecationWarnings without circular import
7 passthrough_module(__name__
, '.._legacy', callback
=lambda attr
: warnings
.warn(
8 DeprecationWarning(f
'{__name__}.{attr} is deprecated'), stacklevel
=6))
12 from ._utils
import preferredencoding
13 from ..networking
._urllib
import HTTPHandler
16 from .networking
import random_user_agent
, std_headers
# noqa: F401
17 from ..networking
._urllib
import PUTRequest
# noqa: F401
18 from ..networking
._urllib
import SUPPORTED_ENCODINGS
, HEADRequest
# noqa: F401
19 from ..networking
._urllib
import ProxyHandler
as PerRequestProxyHandler
# noqa: F401
20 from ..networking
._urllib
import RedirectHandler
as YoutubeDLRedirectHandler
# noqa: F401
21 from ..networking
._urllib
import make_socks_conn_class
, update_Request
# noqa: F401
22 from ..networking
.exceptions
import network_exceptions
# noqa: F401
25 def encodeFilename(s
, for_subprocess
=False):
26 assert isinstance(s
, str)
30 def decodeFilename(b
, for_subprocess
=False):
34 def decodeArgument(b
):
38 def decodeOption(optval
):
41 if isinstance(optval
, bytes):
42 optval
= optval
.decode(preferredencoding())
44 assert isinstance(optval
, str)
48 def error_to_compat_str(err
):
52 class YoutubeDLHandler(HTTPHandler
):
53 def __init__(self
, params
, *args
, **kwargs
):
55 super().__init
__(*args
, **kwargs
)
58 YoutubeDLHTTPSHandler
= YoutubeDLHandler