python (3.11.7)

(root)/
lib/
python3.11/
site-packages/
pip/
_vendor/
requests/
compat.py
       1  """
       2  requests.compat
       3  ~~~~~~~~~~~~~~~
       4  
       5  This module previously handled import compatibility issues
       6  between Python 2 and Python 3. It remains for backwards
       7  compatibility until the next major version.
       8  """
       9  
      10  from pip._vendor import chardet
      11  
      12  import sys
      13  
      14  # -------
      15  # Pythons
      16  # -------
      17  
      18  # Syntax sugar.
      19  _ver = sys.version_info
      20  
      21  #: Python 2.x?
      22  is_py2 = _ver[0] == 2
      23  
      24  #: Python 3.x?
      25  is_py3 = _ver[0] == 3
      26  
      27  # Note: We've patched out simplejson support in pip because it prevents
      28  #       upgrading simplejson on Windows.
      29  import json
      30  from json import JSONDecodeError
      31  
      32  # Keep OrderedDict for backwards compatibility.
      33  from collections import OrderedDict
      34  from collections.abc import Callable, Mapping, MutableMapping
      35  from http import cookiejar as cookielib
      36  from http.cookies import Morsel
      37  from io import StringIO
      38  
      39  # --------------
      40  # Legacy Imports
      41  # --------------
      42  from 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  )
      54  from urllib.request import (
      55      getproxies,
      56      getproxies_environment,
      57      parse_http_list,
      58      proxy_bypass,
      59      proxy_bypass_environment,
      60  )
      61  
      62  builtin_str = str
      63  str = str
      64  bytes = bytes
      65  basestring = (str, bytes)
      66  numeric_types = (int, float)
      67  integer_types = (int,)