diff options
author | felix <felix.von.s@posteo.de> | 2021-12-30 13:23:36 +0100 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-04-12 05:32:50 +0530 |
commit | cfb0511d822b39748c5a64dfe86b61ff8d5af176 (patch) | |
tree | 3988b2fd19f0b1bdf5e946381a1e96d86b39a2c0 /yt_dlp/compat.py | |
parent | ab96d1ad1bcdb943aa6519980e5383ca91f7da2b (diff) | |
download | hypervideo-pre-cfb0511d822b39748c5a64dfe86b61ff8d5af176.tar.lz hypervideo-pre-cfb0511d822b39748c5a64dfe86b61ff8d5af176.tar.xz hypervideo-pre-cfb0511d822b39748c5a64dfe86b61ff8d5af176.zip |
[cleanup] Remove unused code paths (#2173)
Notes:
* `_windows_write_string`: Fixed in 3.6
* https://bugs.python.org/issue1602
* PEP: https://www.python.org/dev/peps/pep-0528
* Windows UTF-8 fix: Fixed in 3.3
* https://bugs.python.org/issue13216
* `__loader__`: is always present in 3.3+
* https://bugs.python.org/issue14646
* `workaround_optparse_bug9161`: Fixed in 2.7
* https://bugs.python.org/issue9161
Authored by: fstirlitz
Diffstat (limited to 'yt_dlp/compat.py')
-rw-r--r-- | yt_dlp/compat.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/yt_dlp/compat.py b/yt_dlp/compat.py index 0a0d3b351..6128ff524 100644 --- a/yt_dlp/compat.py +++ b/yt_dlp/compat.py @@ -13,7 +13,6 @@ import http.cookiejar import http.cookies import http.server import itertools -import optparse import os import re import shlex @@ -86,28 +85,6 @@ def compat_print(s): assert isinstance(s, compat_str) print(s) - -# Fix https://github.com/ytdl-org/youtube-dl/issues/4223 -# See http://bugs.python.org/issue9161 for what is broken -def workaround_optparse_bug9161(): - op = optparse.OptionParser() - og = optparse.OptionGroup(op, 'foo') - try: - og.add_option('-t') - except TypeError: - real_add_option = optparse.OptionGroup.add_option - - def _compat_add_option(self, *args, **kwargs): - enc = lambda v: ( - v.encode('ascii', 'replace') if isinstance(v, compat_str) - else v) - bargs = [enc(a) for a in args] - bkwargs = dict( - (k, enc(v)) for k, v in kwargs.items()) - return real_add_option(self, *bargs, **bkwargs) - optparse.OptionGroup.add_option = _compat_add_option - - try: compat_Pattern = re.Pattern except AttributeError: @@ -207,6 +184,7 @@ compat_numeric_types = (int, float, complex) compat_str = str compat_xpath = lambda xpath: xpath compat_zip = zip +workaround_optparse_bug9161 = lambda: None compat_collections_abc = collections.abc compat_HTMLParser = html.parser.HTMLParser |