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