2022-02-04 14:37:02 +01:00
|
|
|
""" Do not use! """
|
|
|
|
|
|
|
|
import collections
|
|
|
|
import ctypes
|
2022-06-24 10:10:17 +02:00
|
|
|
import getpass
|
|
|
|
import html.entities
|
|
|
|
import html.parser
|
2022-02-04 14:37:02 +01:00
|
|
|
import http.client
|
|
|
|
import http.cookiejar
|
|
|
|
import http.cookies
|
|
|
|
import http.server
|
2022-06-24 10:10:17 +02:00
|
|
|
import itertools
|
|
|
|
import os
|
2022-02-04 14:37:02 +01:00
|
|
|
import shlex
|
2022-06-24 10:10:17 +02:00
|
|
|
import shutil
|
2022-02-04 14:37:02 +01:00
|
|
|
import socket
|
|
|
|
import struct
|
2022-06-24 10:10:17 +02:00
|
|
|
import tokenize
|
|
|
|
import urllib.error
|
|
|
|
import urllib.parse
|
|
|
|
import urllib.request
|
2022-02-04 14:37:02 +01:00
|
|
|
import xml.etree.ElementTree as etree
|
|
|
|
from subprocess import DEVNULL
|
|
|
|
|
2022-07-18 02:20:54 +02:00
|
|
|
# isort: split
|
|
|
|
import asyncio # noqa: F401
|
|
|
|
import re # noqa: F401
|
|
|
|
from asyncio import run as compat_asyncio_run # noqa: F401
|
|
|
|
from re import Pattern as compat_Pattern # noqa: F401
|
|
|
|
from re import match as compat_Match # noqa: F401
|
|
|
|
|
|
|
|
from .compat_utils import passthrough_module
|
2022-04-20 21:05:57 +02:00
|
|
|
from ..dependencies import Cryptodome_AES as compat_pycrypto_AES # noqa: F401
|
|
|
|
from ..dependencies import brotli as compat_brotli # noqa: F401
|
|
|
|
from ..dependencies import websockets as compat_websockets # noqa: F401
|
2022-02-04 14:37:02 +01:00
|
|
|
|
2022-06-24 12:10:13 +02:00
|
|
|
passthrough_module(__name__, '...utils', ('WINDOWS_VT_MODE', 'windows_enable_vt_mode'))
|
|
|
|
|
|
|
|
|
2022-02-04 14:37:02 +01:00
|
|
|
# compat_ctypes_WINFUNCTYPE = ctypes.WINFUNCTYPE
|
|
|
|
# will not work since ctypes.WINFUNCTYPE does not exist in UNIX machines
|
|
|
|
def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
|
|
|
|
return ctypes.WINFUNCTYPE(*args, **kwargs)
|
|
|
|
|
|
|
|
|
2022-06-24 10:10:17 +02:00
|
|
|
def compat_setenv(key, value, env=os.environ):
|
|
|
|
env[key] = value
|
|
|
|
|
|
|
|
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_basestring = str
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_chr = chr
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_collections_abc = collections.abc
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_cookiejar = http.cookiejar
|
|
|
|
compat_cookiejar_Cookie = http.cookiejar.Cookie
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_cookies = http.cookies
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_cookies_SimpleCookie = http.cookies.SimpleCookie
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_etree_Element = etree.Element
|
|
|
|
compat_etree_register_namespace = etree.register_namespace
|
|
|
|
compat_filter = filter
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_get_terminal_size = shutil.get_terminal_size
|
2022-06-24 10:10:17 +02:00
|
|
|
compat_getenv = os.getenv
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_getpass = getpass.getpass
|
|
|
|
compat_html_entities = html.entities
|
|
|
|
compat_html_entities_html5 = html.entities.html5
|
|
|
|
compat_HTMLParser = html.parser.HTMLParser
|
|
|
|
compat_http_client = http.client
|
|
|
|
compat_http_server = http.server
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_input = input
|
|
|
|
compat_integer_types = (int, )
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_itertools_count = itertools.count
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_kwargs = lambda kwargs: kwargs
|
|
|
|
compat_map = map
|
|
|
|
compat_numeric_types = (int, float, complex)
|
|
|
|
compat_print = print
|
|
|
|
compat_shlex_split = shlex.split
|
|
|
|
compat_socket_create_connection = socket.create_connection
|
|
|
|
compat_Struct = struct.Struct
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_struct_pack = struct.pack
|
|
|
|
compat_struct_unpack = struct.unpack
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_subprocess_get_DEVNULL = lambda: DEVNULL
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_tokenize_tokenize = tokenize.tokenize
|
|
|
|
compat_urllib_error = urllib.error
|
|
|
|
compat_urllib_parse = urllib.parse
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_urllib_parse_quote = urllib.parse.quote
|
|
|
|
compat_urllib_parse_quote_plus = urllib.parse.quote_plus
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_urllib_parse_unquote_plus = urllib.parse.unquote_plus
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_urllib_parse_unquote_to_bytes = urllib.parse.unquote_to_bytes
|
|
|
|
compat_urllib_parse_urlunparse = urllib.parse.urlunparse
|
2022-06-24 10:10:17 +02:00
|
|
|
compat_urllib_request = urllib.request
|
2022-06-28 07:10:54 +02:00
|
|
|
compat_urllib_request_DataHandler = urllib.request.DataHandler
|
2022-02-04 14:37:02 +01:00
|
|
|
compat_urllib_response = urllib.response
|
|
|
|
compat_urlretrieve = urllib.request.urlretrieve
|
|
|
|
compat_xml_parse_error = etree.ParseError
|
|
|
|
compat_xpath = lambda xpath: xpath
|
|
|
|
compat_zip = zip
|
|
|
|
workaround_optparse_bug9161 = lambda: None
|