14 import xml
.etree
.ElementTree
as etree
15 from subprocess
import DEVNULL
17 from .asyncio
import run
as compat_asyncio_run
# noqa: F401
18 from .re
import Pattern
as compat_Pattern
# noqa: F401
19 from .re
import match
as compat_Match
# noqa: F401
20 from ..dependencies
import Cryptodome_AES
as compat_pycrypto_AES
# noqa: F401
21 from ..dependencies
import brotli
as compat_brotli
# noqa: F401
22 from ..dependencies
import websockets
as compat_websockets
# noqa: F401
25 # compat_ctypes_WINFUNCTYPE = ctypes.WINFUNCTYPE
26 # will not work since ctypes.WINFUNCTYPE does not exist in UNIX machines
27 def compat_ctypes_WINFUNCTYPE(*args
, **kwargs
):
28 return ctypes
.WINFUNCTYPE(*args
, **kwargs
)
31 compat_basestring
= str
32 compat_collections_abc
= collections
.abc
33 compat_cookies
= http
.cookies
34 compat_etree_Element
= etree
.Element
35 compat_etree_register_namespace
= etree
.register_namespace
36 compat_filter
= filter
38 compat_integer_types
= (int, )
39 compat_kwargs
= lambda kwargs
: kwargs
41 compat_numeric_types
= (int, float, complex)
43 compat_shlex_split
= shlex
.split
44 compat_socket_create_connection
= socket
.create_connection
45 compat_Struct
= struct
.Struct
46 compat_subprocess_get_DEVNULL
= lambda: DEVNULL
47 compat_urllib_parse_quote
= urllib
.parse
.quote
48 compat_urllib_parse_quote_plus
= urllib
.parse
.quote_plus
49 compat_urllib_parse_unquote_to_bytes
= urllib
.parse
.unquote_to_bytes
50 compat_urllib_parse_urlunparse
= urllib
.parse
.urlunparse
51 compat_urllib_request_DataHandler
= urllib
.request
.DataHandler
52 compat_urllib_response
= urllib
.response
53 compat_urlretrieve
= urllib
.request
.urlretrieve
54 compat_xml_parse_error
= etree
.ParseError
55 compat_xpath
= lambda xpath
: xpath
57 workaround_optparse_bug9161
= lambda: None
60 def __getattr__(name
):
61 if name
in ('WINDOWS_VT_MODE', 'windows_enable_vt_mode'):
63 return getattr(utils
, name
)
64 raise AttributeError(name
)