]> jfr.im git - yt-dlp.git/blame - yt_dlp/utils/_deprecated.py
Better warning when requested subs format not found (#9873)
[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
c365dba8 13
69bec673 14
15def encodeFilename(s, for_subprocess=False):
16 assert isinstance(s, str)
17 return s
18
19
20def decodeFilename(b, for_subprocess=False):
21 return b
22
23
24def decodeArgument(b):
25 return b
26
27
28def decodeOption(optval):
29 if optval is None:
30 return optval
31 if isinstance(optval, bytes):
32 optval = optval.decode(preferredencoding())
33
34 assert isinstance(optval, str)
35 return optval
36
37
38def error_to_compat_str(err):
39 return str(err)