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