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