Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
compat.py80 linesDownload Raw Back to requests
1"""2requests.compat3~~~~~~~~~~~~~~~4 5This module previously handled import compatibility issues6between Python 2 and Python 3. It remains for backwards7compatibility until the next major version.8"""9 10try:11    import chardet12except ImportError:13    import charset_normalizer as chardet14 15import sys16 17# -------18# Pythons19# -------20 21# Syntax sugar.22_ver = sys.version_info23 24#: Python 2.x?25is_py2 = _ver[0] == 226 27#: Python 3.x?28is_py3 = _ver[0] == 329 30# json/simplejson module import resolution31has_simplejson = False32try:33    import simplejson as json34 35    has_simplejson = True36except ImportError:37    import json38 39if has_simplejson:40    from simplejson import JSONDecodeError41else:42    from json import JSONDecodeError43 44# Keep OrderedDict for backwards compatibility.45from collections import OrderedDict46from collections.abc import Callable, Mapping, MutableMapping47from http import cookiejar as cookielib48from http.cookies import Morsel49from io import StringIO50 51# --------------52# Legacy Imports53# --------------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)73 74builtin_str = str75str = str76bytes = bytes77basestring = (str, bytes)78numeric_types = (int, float)79integer_types = (int,)80 
codekingpro/portable-devtools · Team Ai