Mercurial > hg-stable
annotate mercurial/pycompat.py @ 29431:80880ad3fccd
py3: conditionalize the urlparse import
The urlparse library is renamed to urllib.parse in python 3
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 27 Jun 2016 16:16:10 +0530 |
parents | 2646fbba4ca7 |
children | 34b914ac573e |
rev | line source |
---|---|
28818
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
1 # pycompat.py - portability shim for python 3 |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
2 # |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
3 # This software may be used and distributed according to the terms of the |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
4 # GNU General Public License version 2 or any later version. |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
5 |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
6 """Mercurial portability shim for python 3. |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
7 |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
8 This contains aliases to hide python version-specific details from the core. |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
9 """ |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
10 |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
11 from __future__ import absolute_import |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
12 |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
13 try: |
29324
b501579147f1
py3: conditionalize cPickle import by adding in util
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28882
diff
changeset
|
14 import cPickle as pickle |
b501579147f1
py3: conditionalize cPickle import by adding in util
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28882
diff
changeset
|
15 pickle.dumps |
b501579147f1
py3: conditionalize cPickle import by adding in util
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28882
diff
changeset
|
16 except ImportError: |
b501579147f1
py3: conditionalize cPickle import by adding in util
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28882
diff
changeset
|
17 import pickle |
29405
fbe380dc227a
pyflakes: use pycompat.pickles to prevent error
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
29324
diff
changeset
|
18 pickle.dumps # silence pyflakes |
29324
b501579147f1
py3: conditionalize cPickle import by adding in util
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28882
diff
changeset
|
19 |
b501579147f1
py3: conditionalize cPickle import by adding in util
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28882
diff
changeset
|
20 try: |
29431
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
21 import urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
22 urlparse.urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
23 except ImportError: |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
24 import urllib.parse as urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
25 urlparse.urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
26 |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
27 try: |
28835
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
28 import cStringIO as io |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
29 stringio = io.StringIO |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
30 except ImportError: |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
31 import io |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
32 stringio = io.StringIO |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
33 |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
34 try: |
28818
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
35 import Queue as _queue |
28833
672fc23bf9cc
pycompat: fix demand import handling of Queue
timeless <timeless@mozdev.org>
parents:
28818
diff
changeset
|
36 _queue.Queue |
28818
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
37 except ImportError: |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
38 import queue as _queue |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
39 empty = _queue.Empty |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
40 queue = _queue.Queue |
28834
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
41 |
28882
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
42 class _pycompatstub(object): |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
43 pass |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
44 |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
45 def _alias(alias, origin, items): |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
46 """ populate a _pycompatstub |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
47 |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
48 copies items from origin to alias |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
49 """ |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
50 def hgcase(item): |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
51 return item.replace('_', '').lower() |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
52 for item in items: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
53 try: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
54 setattr(alias, hgcase(item), getattr(origin, item)) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
55 except AttributeError: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
56 pass |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
57 |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
58 urlreq = _pycompatstub() |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
59 urlerr = _pycompatstub() |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
60 try: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
61 import urllib2 |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
62 import urllib |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
63 _alias(urlreq, urllib, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
64 "addclosehook", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
65 "addinfourl", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
66 "ftpwrapper", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
67 "pathname2url", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
68 "quote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
69 "splitattr", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
70 "splitpasswd", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
71 "splitport", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
72 "splituser", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
73 "unquote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
74 "url2pathname", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
75 "urlencode", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
76 "urlencode", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
77 )) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
78 _alias(urlreq, urllib2, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
79 "AbstractHTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
80 "BaseHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
81 "build_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
82 "FileHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
83 "FTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
84 "HTTPBasicAuthHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
85 "HTTPDigestAuthHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
86 "HTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
87 "HTTPPasswordMgrWithDefaultRealm", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
88 "HTTPSHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
89 "install_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
90 "ProxyHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
91 "Request", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
92 "urlopen", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
93 )) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
94 _alias(urlerr, urllib2, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
95 "HTTPError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
96 "URLError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
97 )) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
98 |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
99 except ImportError: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
100 import urllib.request |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
101 _alias(urlreq, urllib.request, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
102 "AbstractHTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
103 "addclosehook", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
104 "addinfourl", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
105 "BaseHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
106 "build_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
107 "FileHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
108 "FTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
109 "ftpwrapper", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
110 "HTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
111 "HTTPSHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
112 "install_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
113 "pathname2url", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
114 "HTTPBasicAuthHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
115 "HTTPDigestAuthHandler", |
29414
2646fbba4ca7
pycompat: add HTTPPasswordMgrWithDefaultRealm to Python 3 block
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29405
diff
changeset
|
116 "HTTPPasswordMgrWithDefaultRealm", |
28882
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
117 "ProxyHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
118 "quote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
119 "Request", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
120 "splitattr", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
121 "splitpasswd", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
122 "splitport", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
123 "splituser", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
124 "unquote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
125 "url2pathname", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
126 "urlopen", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
127 )) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
128 import urllib.error |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
129 _alias(urlerr, urllib.error, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
130 "HTTPError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
131 "URLError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
132 )) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
133 |
28834
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
134 try: |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
135 xrange |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
136 except NameError: |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
137 import builtins |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
138 builtins.xrange = range |