]> jfr.im git - yt-dlp.git/blame - yt_dlp/compat/_legacy.py
[ie/youtube:tab] Detect looping feeds (#6621)
[yt-dlp.git] / yt_dlp / compat / _legacy.py
CommitLineData
77f90330 1""" Do not use! """
2
45b2ee6f 3import base64
77f90330 4import collections
5import ctypes
ac668111 6import getpass
7import html.entities
8import html.parser
77f90330 9import http.client
10import http.cookiejar
11import http.cookies
12import http.server
ac668111 13import itertools
14import os
77f90330 15import shlex
ac668111 16import shutil
77f90330 17import socket
18import struct
ac668111 19import tokenize
20import urllib.error
21import urllib.parse
22import urllib.request
77f90330 23import xml.etree.ElementTree as etree
24from subprocess import DEVNULL
25
6929b41a 26# isort: split
27import asyncio # noqa: F401
28import re # noqa: F401
29from asyncio import run as compat_asyncio_run # noqa: F401
30from re import Pattern as compat_Pattern # noqa: F401
31from re import match as compat_Match # noqa: F401
32
45b2ee6f 33from . import compat_expanduser, compat_HTMLParseError, compat_realpath
6929b41a 34from .compat_utils import passthrough_module
9b8ee23b 35from ..dependencies import brotli as compat_brotli # noqa: F401
36from ..dependencies import websockets as compat_websockets # noqa: F401
65f6e807 37from ..dependencies.Cryptodome import AES as compat_pycrypto_AES # noqa: F401
77f90330 38
3c5386cd 39passthrough_module(__name__, '...utils', ('WINDOWS_VT_MODE', 'windows_enable_vt_mode'))
40
41
77f90330 42# compat_ctypes_WINFUNCTYPE = ctypes.WINFUNCTYPE
43# will not work since ctypes.WINFUNCTYPE does not exist in UNIX machines
44def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
45 return ctypes.WINFUNCTYPE(*args, **kwargs)
46
47
ac668111 48def compat_setenv(key, value, env=os.environ):
49 env[key] = value
50
51
45b2ee6f 52compat_base64_b64decode = base64.b64decode
77f90330 53compat_basestring = str
db4678e4 54compat_casefold = str.casefold
ae61d108 55compat_chr = chr
77f90330 56compat_collections_abc = collections.abc
45b2ee6f 57compat_cookiejar = compat_http_cookiejar = http.cookiejar
58compat_cookiejar_Cookie = compat_http_cookiejar_Cookie = http.cookiejar.Cookie
59compat_cookies = compat_http_cookies = http.cookies
60compat_cookies_SimpleCookie = compat_http_cookies_SimpleCookie = http.cookies.SimpleCookie
61compat_etree_Element = compat_xml_etree_ElementTree_Element = etree.Element
62compat_etree_register_namespace = compat_xml_etree_register_namespace = etree.register_namespace
77f90330 63compat_filter = filter
ae61d108 64compat_get_terminal_size = shutil.get_terminal_size
ac668111 65compat_getenv = os.getenv
45b2ee6f 66compat_getpass = compat_getpass_getpass = getpass.getpass
ae61d108 67compat_html_entities = html.entities
68compat_html_entities_html5 = html.entities.html5
45b2ee6f 69compat_html_parser_HTMLParseError = compat_HTMLParseError
70compat_HTMLParser = compat_html_parser_HTMLParser = html.parser.HTMLParser
ae61d108 71compat_http_client = http.client
72compat_http_server = http.server
77f90330 73compat_input = input
74compat_integer_types = (int, )
ae61d108 75compat_itertools_count = itertools.count
77f90330 76compat_kwargs = lambda kwargs: kwargs
77compat_map = map
78compat_numeric_types = (int, float, complex)
45b2ee6f 79compat_os_path_expanduser = compat_expanduser
80compat_os_path_realpath = compat_realpath
77f90330 81compat_print = print
82compat_shlex_split = shlex.split
83compat_socket_create_connection = socket.create_connection
84compat_Struct = struct.Struct
ae61d108 85compat_struct_pack = struct.pack
86compat_struct_unpack = struct.unpack
77f90330 87compat_subprocess_get_DEVNULL = lambda: DEVNULL
ae61d108 88compat_tokenize_tokenize = tokenize.tokenize
89compat_urllib_error = urllib.error
45b2ee6f 90compat_urllib_HTTPError = urllib.error.HTTPError
ae61d108 91compat_urllib_parse = urllib.parse
45b2ee6f 92compat_urllib_parse_parse_qs = urllib.parse.parse_qs
77f90330 93compat_urllib_parse_quote = urllib.parse.quote
94compat_urllib_parse_quote_plus = urllib.parse.quote_plus
ae61d108 95compat_urllib_parse_unquote_plus = urllib.parse.unquote_plus
77f90330 96compat_urllib_parse_unquote_to_bytes = urllib.parse.unquote_to_bytes
97compat_urllib_parse_urlunparse = urllib.parse.urlunparse
ac668111 98compat_urllib_request = urllib.request
ae61d108 99compat_urllib_request_DataHandler = urllib.request.DataHandler
77f90330 100compat_urllib_response = urllib.response
45b2ee6f 101compat_urlretrieve = compat_urllib_request_urlretrieve = urllib.request.urlretrieve
102compat_xml_parse_error = compat_xml_etree_ElementTree_ParseError = etree.ParseError
77f90330 103compat_xpath = lambda xpath: xpath
104compat_zip = zip
105workaround_optparse_bug9161 = lambda: None
45b2ee6f 106
107legacy = []