]> jfr.im git - yt-dlp.git/blame - yt_dlp/utils/_deprecated.py
[networking] Add module (#2861)
[yt-dlp.git] / yt_dlp / utils / _deprecated.py
CommitLineData
69bec673 1"""Deprecated - New code should avoid these"""
c365dba8 2import warnings
3
4from ..compat.compat_utils import passthrough_module
5
6# XXX: Implement this the same way as other DeprecationWarnings without circular import
7passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn(
8 DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=6))
9del passthrough_module
10
69bec673 11
12from ._utils import preferredencoding
13
c365dba8 14# isort: split
15from ..networking._urllib import PUTRequest # noqa: F401
16from ..networking._urllib import SUPPORTED_ENCODINGS, HEADRequest # noqa: F401
17from ..networking._urllib import HTTPHandler as YoutubeDLHandler # noqa: F401
18from ..networking._urllib import ProxyHandler as PerRequestProxyHandler # noqa: F401
19from ..networking._urllib import RedirectHandler as YoutubeDLRedirectHandler # noqa: F401
20from ..networking._urllib import make_socks_conn_class, update_Request # noqa: F401
21from ..networking.exceptions import network_exceptions # noqa: F401
22from .networking import random_user_agent, std_headers # noqa: F401
23
69bec673 24
25def encodeFilename(s, for_subprocess=False):
26 assert isinstance(s, str)
27 return s
28
29
30def decodeFilename(b, for_subprocess=False):
31 return b
32
33
34def decodeArgument(b):
35 return b
36
37
38def decodeOption(optval):
39 if optval is None:
40 return optval
41 if isinstance(optval, bytes):
42 optval = optval.decode(preferredencoding())
43
44 assert isinstance(optval, str)
45 return optval
46
47
48def error_to_compat_str(err):
49 return str(err)