Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/requests/compat.py: 91%
30 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
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"""
10try:
11 import chardet
12except ImportError:
13 import charset_normalizer as chardet
15import sys
17# -------
18# Pythons
19# -------
21# Syntax sugar.
22_ver = sys.version_info
24#: Python 2.x?
25is_py2 = _ver[0] == 2
27#: Python 3.x?
28is_py3 = _ver[0] == 3
30# json/simplejson module import resolution
31has_simplejson = False
32try:
33 import simplejson as json
35 has_simplejson = True
36except ImportError:
37 import json
39if has_simplejson: 39 ↛ 40line 39 didn't jump to line 40, because the condition on line 39 was never true
40 from simplejson import JSONDecodeError
41else:
42 from json import JSONDecodeError
44# Keep OrderedDict for backwards compatibility.
45from collections import OrderedDict
46from collections.abc import Callable, Mapping, MutableMapping
47from http import cookiejar as cookielib
48from http.cookies import Morsel
49from io import StringIO
51# --------------
52# Legacy Imports
53# --------------
54from urllib.parse import (
55 quote,
56 quote_plus,
57 unquote,
58 unquote_plus,
59 urldefrag,
60 urlencode,
61 urljoin,
62 urlparse,
63 urlsplit,
64 urlunparse,
65)
66from urllib.request import (
67 getproxies,
68 getproxies_environment,
69 parse_http_list,
70 proxy_bypass,
71 proxy_bypass_environment,
72)
74builtin_str = str
75str = str
76bytes = bytes
77basestring = (str, bytes)
78numeric_types = (int, float)
79integer_types = (int,)