Mercurial > repos > jpayne > bioproject_to_srr_2
comparison requests/compat.py @ 7:5eb2d5e3bf22
planemo upload for repository https://toolrepo.galaxytrakr.org/view/jpayne/bioproject_to_srr_2/556cac4fb538
author | jpayne |
---|---|
date | Sun, 05 May 2024 23:32:17 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:b2745907b1eb | 7:5eb2d5e3bf22 |
---|---|
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 try: | |
11 import chardet | |
12 except ImportError: | |
13 import charset_normalizer as chardet | |
14 | |
15 import sys | |
16 | |
17 # ------- | |
18 # Pythons | |
19 # ------- | |
20 | |
21 # Syntax sugar. | |
22 _ver = sys.version_info | |
23 | |
24 #: Python 2.x? | |
25 is_py2 = _ver[0] == 2 | |
26 | |
27 #: Python 3.x? | |
28 is_py3 = _ver[0] == 3 | |
29 | |
30 # json/simplejson module import resolution | |
31 has_simplejson = False | |
32 try: | |
33 import simplejson as json | |
34 | |
35 has_simplejson = True | |
36 except ImportError: | |
37 import json | |
38 | |
39 if has_simplejson: | |
40 from simplejson import JSONDecodeError | |
41 else: | |
42 from json import JSONDecodeError | |
43 | |
44 # Keep OrderedDict for backwards compatibility. | |
45 from collections import OrderedDict | |
46 from collections.abc import Callable, Mapping, MutableMapping | |
47 from http import cookiejar as cookielib | |
48 from http.cookies import Morsel | |
49 from io import StringIO | |
50 | |
51 # -------------- | |
52 # Legacy Imports | |
53 # -------------- | |
54 from 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 ) | |
66 from urllib.request import ( | |
67 getproxies, | |
68 getproxies_environment, | |
69 parse_http_list, | |
70 proxy_bypass, | |
71 proxy_bypass_environment, | |
72 ) | |
73 | |
74 builtin_str = str | |
75 str = str | |
76 bytes = bytes | |
77 basestring = (str, bytes) | |
78 numeric_types = (int, float) | |
79 integer_types = (int,) |