diff options
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/compat.py')
-rw-r--r-- | venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/compat.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/compat.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/compat.py new file mode 100644 index 0000000..4cea25e --- /dev/null +++ b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/compat.py | |||
@@ -0,0 +1,73 @@ | |||
1 | # -*- coding: utf-8 -*- | ||
2 | |||
3 | """ | ||
4 | requests.compat | ||
5 | ~~~~~~~~~~~~~~~ | ||
6 | |||
7 | This module handles import compatibility issues between Python 2 and | ||
8 | Python 3. | ||
9 | """ | ||
10 | |||
11 | from pip._vendor import chardet | ||
12 | |||
13 | import sys | ||
14 | |||
15 | # ------- | ||
16 | # Pythons | ||
17 | # ------- | ||
18 | |||
19 | # Syntax sugar. | ||
20 | _ver = sys.version_info | ||
21 | |||
22 | #: Python 2.x? | ||
23 | is_py2 = (_ver[0] == 2) | ||
24 | |||
25 | #: Python 3.x? | ||
26 | is_py3 = (_ver[0] == 3) | ||
27 | |||
28 | # Note: We've patched out simplejson support in pip because it prevents | ||
29 | # upgrading simplejson on Windows. | ||
30 | # try: | ||
31 | # import simplejson as json | ||
32 | # except (ImportError, SyntaxError): | ||
33 | # # simplejson does not support Python 3.2, it throws a SyntaxError | ||
34 | # # because of u'...' Unicode literals. | ||
35 | import json | ||
36 | |||
37 | # --------- | ||
38 | # Specifics | ||
39 | # --------- | ||
40 | |||
41 | if is_py2: | ||
42 | from urllib import ( | ||
43 | quote, unquote, quote_plus, unquote_plus, urlencode, getproxies, | ||
44 | proxy_bypass, proxy_bypass_environment, getproxies_environment) | ||
45 | from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag | ||
46 | from urllib2 import parse_http_list | ||
47 | import cookielib | ||
48 | from Cookie import Morsel | ||
49 | from StringIO import StringIO | ||
50 | |||
51 | from pip._vendor.urllib3.packages.ordered_dict import OrderedDict | ||
52 | |||
53 | builtin_str = str | ||
54 | bytes = str | ||
55 | str = unicode | ||
56 | basestring = basestring | ||
57 | numeric_types = (int, long, float) | ||
58 | integer_types = (int, long) | ||
59 | |||
60 | elif is_py3: | ||
61 | from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag | ||
62 | from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment | ||
63 | from http import cookiejar as cookielib | ||
64 | from http.cookies import Morsel | ||
65 | from io import StringIO | ||
66 | from collections import OrderedDict | ||
67 | |||
68 | builtin_str = str | ||
69 | str = str | ||
70 | bytes = bytes | ||
71 | basestring = (str, bytes) | ||
72 | numeric_types = (int, float) | ||
73 | integer_types = (int,) | ||