Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: swarm_client/third_party/requests/compat.py

Issue 69143004: Delete swarm_client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # -*- coding: utf-8 -*-
2
3 """
4 pythoncompat
5 """
6
7 from .packages import charade as chardet
8
9 import sys
10
11 # -------
12 # Pythons
13 # -------
14
15 # Syntax sugar.
16 _ver = sys.version_info
17
18 #: Python 2.x?
19 is_py2 = (_ver[0] == 2)
20
21 #: Python 3.x?
22 is_py3 = (_ver[0] == 3)
23
24 #: Python 3.0.x
25 is_py30 = (is_py3 and _ver[1] == 0)
26
27 #: Python 3.1.x
28 is_py31 = (is_py3 and _ver[1] == 1)
29
30 #: Python 3.2.x
31 is_py32 = (is_py3 and _ver[1] == 2)
32
33 #: Python 3.3.x
34 is_py33 = (is_py3 and _ver[1] == 3)
35
36 #: Python 3.4.x
37 is_py34 = (is_py3 and _ver[1] == 4)
38
39 #: Python 2.7.x
40 is_py27 = (is_py2 and _ver[1] == 7)
41
42 #: Python 2.6.x
43 is_py26 = (is_py2 and _ver[1] == 6)
44
45 #: Python 2.5.x
46 is_py25 = (is_py2 and _ver[1] == 5)
47
48 #: Python 2.4.x
49 is_py24 = (is_py2 and _ver[1] == 4) # I'm assuming this is not by choice.
50
51
52 # ---------
53 # Platforms
54 # ---------
55
56
57 # Syntax sugar.
58 _ver = sys.version.lower()
59
60 is_pypy = ('pypy' in _ver)
61 is_jython = ('jython' in _ver)
62 is_ironpython = ('iron' in _ver)
63
64 # Assume CPython, if nothing else.
65 is_cpython = not any((is_pypy, is_jython, is_ironpython))
66
67 # Windows-based system.
68 is_windows = 'win32' in str(sys.platform).lower()
69
70 # Standard Linux 2+ system.
71 is_linux = ('linux' in str(sys.platform).lower())
72 is_osx = ('darwin' in str(sys.platform).lower())
73 is_hpux = ('hpux' in str(sys.platform).lower()) # Complete guess.
74 is_solaris = ('solar==' in str(sys.platform).lower()) # Complete guess.
75
76 try:
77 import simplejson as json
78 except ImportError:
79 import json
80
81 # ---------
82 # Specifics
83 # ---------
84
85 if is_py2:
86 from urllib import quote, unquote, quote_plus, unquote_plus, urlencode, getp roxies, proxy_bypass
87 from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag
88 from urllib2 import parse_http_list
89 import cookielib
90 from Cookie import Morsel
91 from StringIO import StringIO
92 from .packages.urllib3.packages.ordered_dict import OrderedDict
93 from httplib import IncompleteRead
94
95 builtin_str = str
96 bytes = str
97 str = unicode
98 basestring = basestring
99 numeric_types = (int, long, float)
100
101
102 elif is_py3:
103 from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag
104 from urllib.request import parse_http_list, getproxies, proxy_bypass
105 from http import cookiejar as cookielib
106 from http.cookies import Morsel
107 from io import StringIO
108 from collections import OrderedDict
109 from http.client import IncompleteRead
110
111 builtin_str = str
112 str = str
113 bytes = bytes
114 basestring = (str, bytes)
115 numeric_types = (int, float)
OLDNEW
« no previous file with comments | « swarm_client/third_party/requests/certs.py ('k') | swarm_client/third_party/requests/cookies.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698