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