aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/compat.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-04-12 01:39:26 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-04-12 05:32:50 +0530
commitf9934b96145af8ac5dfdcbf684827aeaea9912a7 (patch)
tree0a00b551be555ed8aa70eac863cc83d335dc7b8a /yt_dlp/compat.py
parentcfb0511d822b39748c5a64dfe86b61ff8d5af176 (diff)
downloadhypervideo-pre-f9934b96145af8ac5dfdcbf684827aeaea9912a7.tar.lz
hypervideo-pre-f9934b96145af8ac5dfdcbf684827aeaea9912a7.tar.xz
hypervideo-pre-f9934b96145af8ac5dfdcbf684827aeaea9912a7.zip
[cleanup] Mark some compat variables for removal (#2173)
Authored by fstirlitz, pukkandan
Diffstat (limited to 'yt_dlp/compat.py')
-rw-r--r--yt_dlp/compat.py71
1 files changed, 35 insertions, 36 deletions
diff --git a/yt_dlp/compat.py b/yt_dlp/compat.py
index 6128ff524..5bac87c10 100644
--- a/yt_dlp/compat.py
+++ b/yt_dlp/compat.py
@@ -81,10 +81,6 @@ else:
compat_realpath = os.path.realpath
-def compat_print(s):
- assert isinstance(s, compat_str)
- print(s)
-
try:
compat_Pattern = re.Pattern
except AttributeError:
@@ -173,61 +169,64 @@ def windows_enable_vt_mode(): # TODO: Do this the proper way https://bugs.pytho
# Deprecated
-compat_basestring = str
-compat_chr = chr
-compat_filter = filter
-compat_input = input
-compat_integer_types = (int, )
-compat_kwargs = lambda kwargs: kwargs
-compat_map = map
-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
-compat_HTTPError = urllib.error.HTTPError
-compat_Struct = struct.Struct
compat_b64decode = base64.b64decode
+compat_chr = chr
compat_cookiejar = http.cookiejar
-compat_cookiejar_Cookie = compat_cookiejar.Cookie
-compat_cookies = http.cookies
-compat_cookies_SimpleCookie = compat_cookies.SimpleCookie
-compat_etree_Element = etree.Element
-compat_etree_register_namespace = etree.register_namespace
+compat_cookiejar_Cookie = http.cookiejar.Cookie
+compat_cookies_SimpleCookie = http.cookies.SimpleCookie
compat_get_terminal_size = shutil.get_terminal_size
compat_getenv = os.getenv
compat_getpass = getpass.getpass
compat_html_entities = html.entities
-compat_html_entities_html5 = compat_html_entities.html5
+compat_html_entities_html5 = html.entities.html5
+compat_HTMLParser = html.parser.HTMLParser
compat_http_client = http.client
compat_http_server = http.server
+compat_HTTPError = urllib.error.HTTPError
compat_itertools_count = itertools.count
compat_parse_qs = urllib.parse.parse_qs
-compat_shlex_split = shlex.split
-compat_socket_create_connection = socket.create_connection
+compat_str = str
compat_struct_pack = struct.pack
compat_struct_unpack = struct.unpack
-compat_subprocess_get_DEVNULL = lambda: DEVNULL
compat_tokenize_tokenize = tokenize.tokenize
compat_urllib_error = urllib.error
-compat_urllib_parse = urllib.parse
-compat_urllib_parse_quote = urllib.parse.quote
-compat_urllib_parse_quote_plus = urllib.parse.quote_plus
compat_urllib_parse_unquote = urllib.parse.unquote
compat_urllib_parse_unquote_plus = urllib.parse.unquote_plus
-compat_urllib_parse_unquote_to_bytes = urllib.parse.unquote_to_bytes
compat_urllib_parse_urlencode = urllib.parse.urlencode
compat_urllib_parse_urlparse = urllib.parse.urlparse
-compat_urllib_parse_urlunparse = urllib.parse.urlunparse
compat_urllib_request = urllib.request
+compat_urlparse = compat_urllib_parse = urllib.parse
+
+
+# To be removed
+
+compat_basestring = str
+compat_collections_abc = collections.abc
+compat_cookies = http.cookies
+compat_etree_Element = etree.Element
+compat_etree_register_namespace = etree.register_namespace
+compat_filter = filter
+compat_input = input
+compat_integer_types = (int, )
+compat_kwargs = lambda kwargs: kwargs
+compat_map = map
+compat_numeric_types = (int, float, complex)
+compat_print = print
+compat_shlex_split = shlex.split
+compat_socket_create_connection = socket.create_connection
+compat_Struct = struct.Struct
+compat_subprocess_get_DEVNULL = lambda: DEVNULL
+compat_urllib_parse_quote = urllib.parse.quote
+compat_urllib_parse_quote_plus = urllib.parse.quote_plus
+compat_urllib_parse_unquote_to_bytes = urllib.parse.unquote_to_bytes
+compat_urllib_parse_urlunparse = urllib.parse.urlunparse
compat_urllib_request_DataHandler = urllib.request.DataHandler
compat_urllib_response = urllib.response
-compat_urlparse = urllib.parse
compat_urlretrieve = urllib.request.urlretrieve
compat_xml_parse_error = etree.ParseError
+compat_xpath = lambda xpath: xpath
+compat_zip = zip
+workaround_optparse_bug9161 = lambda: None
# Set public objects