]>
Commit | Line | Data |
---|---|---|
69bec673 | 1 | """Deprecated - New code should avoid these""" |
c365dba8 | 2 | import warnings |
3 | ||
4 | from ..compat.compat_utils import passthrough_module | |
5 | ||
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)) | |
9 | del passthrough_module | |
10 | ||
69bec673 | 11 | |
12 | from ._utils import preferredencoding | |
13 | ||
c365dba8 | 14 | # isort: split |
15 | from ..networking._urllib import PUTRequest # noqa: F401 | |
16 | from ..networking._urllib import SUPPORTED_ENCODINGS, HEADRequest # noqa: F401 | |
17 | from ..networking._urllib import HTTPHandler as YoutubeDLHandler # noqa: F401 | |
18 | from ..networking._urllib import ProxyHandler as PerRequestProxyHandler # noqa: F401 | |
19 | from ..networking._urllib import RedirectHandler as YoutubeDLRedirectHandler # noqa: F401 | |
20 | from ..networking._urllib import make_socks_conn_class, update_Request # noqa: F401 | |
21 | from ..networking.exceptions import network_exceptions # noqa: F401 | |
22 | from .networking import random_user_agent, std_headers # noqa: F401 | |
23 | ||
69bec673 | 24 | |
25 | def encodeFilename(s, for_subprocess=False): | |
26 | assert isinstance(s, str) | |
27 | return s | |
28 | ||
29 | ||
30 | def decodeFilename(b, for_subprocess=False): | |
31 | return b | |
32 | ||
33 | ||
34 | def decodeArgument(b): | |
35 | return b | |
36 | ||
37 | ||
38 | def 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 | ||
48 | def error_to_compat_str(err): | |
49 | return str(err) |