aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/utils/_deprecated.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/utils/_deprecated.py')
-rw-r--r--yt_dlp/utils/_deprecated.py36
1 files changed, 14 insertions, 22 deletions
diff --git a/yt_dlp/utils/_deprecated.py b/yt_dlp/utils/_deprecated.py
index a8ae8ecb5..e4762699b 100644
--- a/yt_dlp/utils/_deprecated.py
+++ b/yt_dlp/utils/_deprecated.py
@@ -9,31 +9,23 @@ passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn(
del passthrough_module
-from ._utils import preferredencoding
+import re
+import struct
-def encodeFilename(s, for_subprocess=False):
- assert isinstance(s, str)
- return s
+def bytes_to_intlist(bs):
+ if not bs:
+ return []
+ if isinstance(bs[0], int): # Python 3
+ return list(bs)
+ else:
+ return [ord(c) for c in bs]
-def decodeFilename(b, for_subprocess=False):
- return b
+def intlist_to_bytes(xs):
+ if not xs:
+ return b''
+ return struct.pack('%dB' % len(xs), *xs)
-def decodeArgument(b):
- return b
-
-
-def decodeOption(optval):
- if optval is None:
- return optval
- if isinstance(optval, bytes):
- optval = optval.decode(preferredencoding())
-
- assert isinstance(optval, str)
- return optval
-
-
-def error_to_compat_str(err):
- return str(err)
+compiled_regex_type = type(re.compile(''))