]>
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 | |
c365dba8 | 13 | |
69bec673 | 14 | |
15 | def encodeFilename(s, for_subprocess=False): | |
16 | assert isinstance(s, str) | |
17 | return s | |
18 | ||
19 | ||
20 | def decodeFilename(b, for_subprocess=False): | |
21 | return b | |
22 | ||
23 | ||
24 | def decodeArgument(b): | |
25 | return b | |
26 | ||
27 | ||
28 | def 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 | ||
38 | def error_to_compat_str(err): | |
39 | return str(err) |