Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pip/_vendor/requests/compat.py: 100%
20 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-26 06:33 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-26 06:33 +0000
1"""
2requests.compat
3~~~~~~~~~~~~~~~
5This module previously handled import compatibility issues
6between Python 2 and Python 3. It remains for backwards
7compatibility until the next major version.
8"""
10from pip._vendor import chardet
12import sys
14# -------
15# Pythons
16# -------
18# Syntax sugar.
19_ver = sys.version_info
21#: Python 2.x?
22is_py2 = _ver[0] == 2
24#: Python 3.x?
25is_py3 = _ver[0] == 3
27# Note: We've patched out simplejson support in pip because it prevents
28# upgrading simplejson on Windows.
29import json
30from json import JSONDecodeError
32# Keep OrderedDict for backwards compatibility.
33from collections import OrderedDict
34from collections.abc import Callable, Mapping, MutableMapping
35from http import cookiejar as cookielib
36from http.cookies import Morsel
37from io import StringIO
39# --------------
40# Legacy Imports
41# --------------
42from urllib.parse import (
43 quote,
44 quote_plus,
45 unquote,
46 unquote_plus,
47 urldefrag,
48 urlencode,
49 urljoin,
50 urlparse,
51 urlsplit,
52 urlunparse,
53)
54from urllib.request import (
55 getproxies,
56 getproxies_environment,
57 parse_http_list,
58 proxy_bypass,
59 proxy_bypass_environment,
60)
62builtin_str = str
63str = str
64bytes = bytes
65basestring = (str, bytes)
66numeric_types = (int, float)
67integer_types = (int,)