author | Gregory Szorc <gregory.szorc@gmail.com> |
Wed, 29 Jun 2016 19:43:27 -0700 | |
changeset 29449 | 5b71a8d7f7ff |
parent 29433 | 33770d2b6cf9 |
child 29455 | 0c741fd6158a |
permissions | -rw-r--r-- |
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: |
29433
33770d2b6cf9
py3: conditionalize SocketServer import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29432
diff
changeset
|
21 |
import SocketServer as socketserver |
33770d2b6cf9
py3: conditionalize SocketServer import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29432
diff
changeset
|
22 |
socketserver.ThreadingMixIn |
33770d2b6cf9
py3: conditionalize SocketServer import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29432
diff
changeset
|
23 |
except ImportError: |
33770d2b6cf9
py3: conditionalize SocketServer import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29432
diff
changeset
|
24 |
import socketserver |
33770d2b6cf9
py3: conditionalize SocketServer import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29432
diff
changeset
|
25 |
socketserver.ThreadingMixIn |
33770d2b6cf9
py3: conditionalize SocketServer import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29432
diff
changeset
|
26 |
|
33770d2b6cf9
py3: conditionalize SocketServer import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29432
diff
changeset
|
27 |
try: |
29432
34b914ac573e
py3: conditionalize xmlrpclib import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29431
diff
changeset
|
28 |
import xmlrpclib |
34b914ac573e
py3: conditionalize xmlrpclib import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29431
diff
changeset
|
29 |
xmlrpclib.Transport |
34b914ac573e
py3: conditionalize xmlrpclib import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29431
diff
changeset
|
30 |
except ImportError: |
34b914ac573e
py3: conditionalize xmlrpclib import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29431
diff
changeset
|
31 |
import xmlrpc.client as xmlrpclib |
34b914ac573e
py3: conditionalize xmlrpclib import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29431
diff
changeset
|
32 |
xmlrpclib.Transport |
34b914ac573e
py3: conditionalize xmlrpclib import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29431
diff
changeset
|
33 |
|
34b914ac573e
py3: conditionalize xmlrpclib import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29431
diff
changeset
|
34 |
try: |
29431
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
35 |
import urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
36 |
urlparse.urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
37 |
except ImportError: |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
38 |
import urllib.parse as urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
39 |
urlparse.urlparse |
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
40 |
|
80880ad3fccd
py3: conditionalize the urlparse import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29414
diff
changeset
|
41 |
try: |
28835
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
42 |
import cStringIO as io |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
43 |
stringio = io.StringIO |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
44 |
except ImportError: |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
45 |
import io |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
46 |
stringio = io.StringIO |
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
47 |
|
68a946e83188
pycompat: add util.stringio to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
28834
diff
changeset
|
48 |
try: |
28818
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
49 |
import Queue as _queue |
28833
672fc23bf9cc
pycompat: fix demand import handling of Queue
timeless <timeless@mozdev.org>
parents:
28818
diff
changeset
|
50 |
_queue.Queue |
28818
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
51 |
except ImportError: |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
52 |
import queue as _queue |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
53 |
empty = _queue.Empty |
6041fb8f2da8
pycompat: add empty and queue to handle py3 divergence
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
54 |
queue = _queue.Queue |
28834
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
55 |
|
28882
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
56 |
class _pycompatstub(object): |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
57 |
pass |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
58 |
|
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
59 |
def _alias(alias, origin, items): |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
60 |
""" populate a _pycompatstub |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
61 |
|
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
62 |
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
|
63 |
""" |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
64 |
def hgcase(item): |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
65 |
return item.replace('_', '').lower() |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
66 |
for item in items: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
67 |
try: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
68 |
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
|
69 |
except AttributeError: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
70 |
pass |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
71 |
|
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
72 |
urlreq = _pycompatstub() |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
73 |
urlerr = _pycompatstub() |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
74 |
try: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
75 |
import urllib2 |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
76 |
import urllib |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
77 |
_alias(urlreq, urllib, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
78 |
"addclosehook", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
79 |
"addinfourl", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
80 |
"ftpwrapper", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
81 |
"pathname2url", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
82 |
"quote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
83 |
"splitattr", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
84 |
"splitpasswd", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
85 |
"splitport", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
86 |
"splituser", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
87 |
"unquote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
88 |
"url2pathname", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
89 |
"urlencode", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
90 |
"urlencode", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
91 |
)) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
92 |
_alias(urlreq, urllib2, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
93 |
"AbstractHTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
94 |
"BaseHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
95 |
"build_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
96 |
"FileHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
97 |
"FTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
98 |
"HTTPBasicAuthHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
99 |
"HTTPDigestAuthHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
100 |
"HTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
101 |
"HTTPPasswordMgrWithDefaultRealm", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
102 |
"HTTPSHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
103 |
"install_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
104 |
"ProxyHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
105 |
"Request", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
106 |
"urlopen", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
107 |
)) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
108 |
_alias(urlerr, urllib2, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
109 |
"HTTPError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
110 |
"URLError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
111 |
)) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
112 |
|
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
113 |
except ImportError: |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
114 |
import urllib.request |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
115 |
_alias(urlreq, urllib.request, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
116 |
"AbstractHTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
117 |
"addclosehook", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
118 |
"addinfourl", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
119 |
"BaseHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
120 |
"build_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
121 |
"FileHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
122 |
"FTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
123 |
"ftpwrapper", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
124 |
"HTTPHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
125 |
"HTTPSHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
126 |
"install_opener", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
127 |
"pathname2url", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
128 |
"HTTPBasicAuthHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
129 |
"HTTPDigestAuthHandler", |
29414
2646fbba4ca7
pycompat: add HTTPPasswordMgrWithDefaultRealm to Python 3 block
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29405
diff
changeset
|
130 |
"HTTPPasswordMgrWithDefaultRealm", |
28882
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
131 |
"ProxyHandler", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
132 |
"quote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
133 |
"Request", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
134 |
"splitattr", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
135 |
"splitpasswd", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
136 |
"splitport", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
137 |
"splituser", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
138 |
"unquote", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
139 |
"url2pathname", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
140 |
"urlopen", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
141 |
)) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
142 |
import urllib.error |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
143 |
_alias(urlerr, urllib.error, ( |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
144 |
"HTTPError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
145 |
"URLError", |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
146 |
)) |
800ec7c048b0
pycompat: add util.urlerr util.urlreq classes for py3 compat
timeless <timeless@mozdev.org>
parents:
28835
diff
changeset
|
147 |
|
28834
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
148 |
try: |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
149 |
xrange |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
150 |
except NameError: |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
151 |
import builtins |
2fac032c1269
pycompat: alias xrange to range in py3
timeless <timeless@mozdev.org>
parents:
28833
diff
changeset
|
152 |
builtins.xrange = range |