Merge lp:~ede123/inkscape-devlibs/devlibs into lp:inkscape-devlibs

Proposed by Patrick Storz
Status: Merged
Merged at revision: 59
Proposed branch: lp:~ede123/inkscape-devlibs/devlibs
Merge into: lp:inkscape-devlibs
Diff against target: 970 lines (+922/-4)
8 files modified
python/Lib/site-packages/easy-install.pth (+4/-3)
python/Lib/site-packages/setuptools.pth (+0/-1)
python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/PKG-INFO (+32/-0)
python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/SOURCES.txt (+15/-0)
python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/dependency_links.txt (+1/-0)
python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/not-zip-safe (+1/-0)
python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/top_level.txt (+1/-0)
python/Lib/site-packages/six-1.10.0-py2.6.egg/six.py (+868/-0)
To merge this branch: bzr merge lp:~ede123/inkscape-devlibs/devlibs
Reviewer Review Type Date Requested Status
Inkscape Developers Pending
Review via email: mp+282688@code.launchpad.net

Description of the change

Python modules required for Scour extension, see http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/14577

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/Lib/site-packages/easy-install.pth'
2--- python/Lib/site-packages/easy-install.pth 2010-01-16 00:05:33 +0000
3+++ python/Lib/site-packages/easy-install.pth 2016-01-15 04:34:59 +0000
4@@ -1,3 +1,4 @@
5-import sys; sys.__plen = len(sys.path)
6-.\setuptools-0.6c3-py2.5.egg
7-import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
8+import sys; sys.__plen = len(sys.path)
9+./scour-0.32-py2.6.egg
10+./six-1.10.0-py2.6.egg
11+import sys; new = sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p = getattr(sys, '__egginsert', 0); sys.path[p:p] = new; sys.__egginsert = p + len(new)
12
13=== added file 'python/Lib/site-packages/scour-0.32-py2.6.egg'
14Binary files python/Lib/site-packages/scour-0.32-py2.6.egg 1970-01-01 00:00:00 +0000 and python/Lib/site-packages/scour-0.32-py2.6.egg 2016-01-15 04:34:59 +0000 differ
15=== removed file 'python/Lib/site-packages/setuptools.pth'
16--- python/Lib/site-packages/setuptools.pth 2010-01-16 00:05:33 +0000
17+++ python/Lib/site-packages/setuptools.pth 1970-01-01 00:00:00 +0000
18@@ -1,1 +0,0 @@
19-.\setuptools-0.6c3-py2.5.egg
20
21=== added directory 'python/Lib/site-packages/six-1.10.0-py2.6.egg'
22=== added directory 'python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO'
23=== added file 'python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/PKG-INFO'
24--- python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/PKG-INFO 1970-01-01 00:00:00 +0000
25+++ python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/PKG-INFO 2016-01-15 04:34:59 +0000
26@@ -0,0 +1,32 @@
27+Metadata-Version: 1.0
28+Name: six
29+Version: 1.10.0
30+Summary: Python 2 and 3 compatibility utilities
31+Home-page: http://pypi.python.org/pypi/six/
32+Author: Benjamin Peterson
33+Author-email: benjamin@python.org
34+License: MIT
35+Description: Six is a Python 2 and 3 compatibility library. It provides utility functions
36+ for smoothing over the differences between the Python versions with the goal of
37+ writing Python code that is compatible on both Python versions. See the
38+ documentation for more information on what is provided.
39+
40+ Six supports every Python version since 2.6. It is contained in only one Python
41+ file, so it can be easily copied into your project. (The copyright and license
42+ notice must be retained.)
43+
44+ Online documentation is at https://pythonhosted.org/six/.
45+
46+ Bugs can be reported to https://bitbucket.org/gutworth/six. The code can also
47+ be found there.
48+
49+ For questions about six or porting in general, email the python-porting mailing
50+ list: https://mail.python.org/mailman/listinfo/python-porting
51+
52+Platform: UNKNOWN
53+Classifier: Programming Language :: Python :: 2
54+Classifier: Programming Language :: Python :: 3
55+Classifier: Intended Audience :: Developers
56+Classifier: License :: OSI Approved :: MIT License
57+Classifier: Topic :: Software Development :: Libraries
58+Classifier: Topic :: Utilities
59
60=== added file 'python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/SOURCES.txt'
61--- python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/SOURCES.txt 1970-01-01 00:00:00 +0000
62+++ python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/SOURCES.txt 2016-01-15 04:34:59 +0000
63@@ -0,0 +1,15 @@
64+CHANGES
65+LICENSE
66+MANIFEST.in
67+README
68+setup.cfg
69+setup.py
70+six.py
71+test_six.py
72+documentation/Makefile
73+documentation/conf.py
74+documentation/index.rst
75+six.egg-info/PKG-INFO
76+six.egg-info/SOURCES.txt
77+six.egg-info/dependency_links.txt
78+six.egg-info/top_level.txt
79\ No newline at end of file
80
81=== added file 'python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/dependency_links.txt'
82--- python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/dependency_links.txt 1970-01-01 00:00:00 +0000
83+++ python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/dependency_links.txt 2016-01-15 04:34:59 +0000
84@@ -0,0 +1,1 @@
85+
86
87=== added file 'python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/not-zip-safe'
88--- python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/not-zip-safe 1970-01-01 00:00:00 +0000
89+++ python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/not-zip-safe 2016-01-15 04:34:59 +0000
90@@ -0,0 +1,1 @@
91+
92
93=== added file 'python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/top_level.txt'
94--- python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/top_level.txt 1970-01-01 00:00:00 +0000
95+++ python/Lib/site-packages/six-1.10.0-py2.6.egg/EGG-INFO/top_level.txt 2016-01-15 04:34:59 +0000
96@@ -0,0 +1,1 @@
97+six
98
99=== added file 'python/Lib/site-packages/six-1.10.0-py2.6.egg/six.py'
100--- python/Lib/site-packages/six-1.10.0-py2.6.egg/six.py 1970-01-01 00:00:00 +0000
101+++ python/Lib/site-packages/six-1.10.0-py2.6.egg/six.py 2016-01-15 04:34:59 +0000
102@@ -0,0 +1,868 @@
103+"""Utilities for writing code that runs on Python 2 and 3"""
104+
105+# Copyright (c) 2010-2015 Benjamin Peterson
106+#
107+# Permission is hereby granted, free of charge, to any person obtaining a copy
108+# of this software and associated documentation files (the "Software"), to deal
109+# in the Software without restriction, including without limitation the rights
110+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
111+# copies of the Software, and to permit persons to whom the Software is
112+# furnished to do so, subject to the following conditions:
113+#
114+# The above copyright notice and this permission notice shall be included in all
115+# copies or substantial portions of the Software.
116+#
117+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
118+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
120+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
122+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
123+# SOFTWARE.
124+
125+from __future__ import absolute_import
126+
127+import functools
128+import itertools
129+import operator
130+import sys
131+import types
132+
133+__author__ = "Benjamin Peterson <benjamin@python.org>"
134+__version__ = "1.10.0"
135+
136+
137+# Useful for very coarse version differentiation.
138+PY2 = sys.version_info[0] == 2
139+PY3 = sys.version_info[0] == 3
140+PY34 = sys.version_info[0:2] >= (3, 4)
141+
142+if PY3:
143+ string_types = str,
144+ integer_types = int,
145+ class_types = type,
146+ text_type = str
147+ binary_type = bytes
148+
149+ MAXSIZE = sys.maxsize
150+else:
151+ string_types = basestring,
152+ integer_types = (int, long)
153+ class_types = (type, types.ClassType)
154+ text_type = unicode
155+ binary_type = str
156+
157+ if sys.platform.startswith("java"):
158+ # Jython always uses 32 bits.
159+ MAXSIZE = int((1 << 31) - 1)
160+ else:
161+ # It's possible to have sizeof(long) != sizeof(Py_ssize_t).
162+ class X(object):
163+
164+ def __len__(self):
165+ return 1 << 31
166+ try:
167+ len(X())
168+ except OverflowError:
169+ # 32-bit
170+ MAXSIZE = int((1 << 31) - 1)
171+ else:
172+ # 64-bit
173+ MAXSIZE = int((1 << 63) - 1)
174+ del X
175+
176+
177+def _add_doc(func, doc):
178+ """Add documentation to a function."""
179+ func.__doc__ = doc
180+
181+
182+def _import_module(name):
183+ """Import module, returning the module after the last dot."""
184+ __import__(name)
185+ return sys.modules[name]
186+
187+
188+class _LazyDescr(object):
189+
190+ def __init__(self, name):
191+ self.name = name
192+
193+ def __get__(self, obj, tp):
194+ result = self._resolve()
195+ setattr(obj, self.name, result) # Invokes __set__.
196+ try:
197+ # This is a bit ugly, but it avoids running this again by
198+ # removing this descriptor.
199+ delattr(obj.__class__, self.name)
200+ except AttributeError:
201+ pass
202+ return result
203+
204+
205+class MovedModule(_LazyDescr):
206+
207+ def __init__(self, name, old, new=None):
208+ super(MovedModule, self).__init__(name)
209+ if PY3:
210+ if new is None:
211+ new = name
212+ self.mod = new
213+ else:
214+ self.mod = old
215+
216+ def _resolve(self):
217+ return _import_module(self.mod)
218+
219+ def __getattr__(self, attr):
220+ _module = self._resolve()
221+ value = getattr(_module, attr)
222+ setattr(self, attr, value)
223+ return value
224+
225+
226+class _LazyModule(types.ModuleType):
227+
228+ def __init__(self, name):
229+ super(_LazyModule, self).__init__(name)
230+ self.__doc__ = self.__class__.__doc__
231+
232+ def __dir__(self):
233+ attrs = ["__doc__", "__name__"]
234+ attrs += [attr.name for attr in self._moved_attributes]
235+ return attrs
236+
237+ # Subclasses should override this
238+ _moved_attributes = []
239+
240+
241+class MovedAttribute(_LazyDescr):
242+
243+ def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
244+ super(MovedAttribute, self).__init__(name)
245+ if PY3:
246+ if new_mod is None:
247+ new_mod = name
248+ self.mod = new_mod
249+ if new_attr is None:
250+ if old_attr is None:
251+ new_attr = name
252+ else:
253+ new_attr = old_attr
254+ self.attr = new_attr
255+ else:
256+ self.mod = old_mod
257+ if old_attr is None:
258+ old_attr = name
259+ self.attr = old_attr
260+
261+ def _resolve(self):
262+ module = _import_module(self.mod)
263+ return getattr(module, self.attr)
264+
265+
266+class _SixMetaPathImporter(object):
267+
268+ """
269+ A meta path importer to import six.moves and its submodules.
270+
271+ This class implements a PEP302 finder and loader. It should be compatible
272+ with Python 2.5 and all existing versions of Python3
273+ """
274+
275+ def __init__(self, six_module_name):
276+ self.name = six_module_name
277+ self.known_modules = {}
278+
279+ def _add_module(self, mod, *fullnames):
280+ for fullname in fullnames:
281+ self.known_modules[self.name + "." + fullname] = mod
282+
283+ def _get_module(self, fullname):
284+ return self.known_modules[self.name + "." + fullname]
285+
286+ def find_module(self, fullname, path=None):
287+ if fullname in self.known_modules:
288+ return self
289+ return None
290+
291+ def __get_module(self, fullname):
292+ try:
293+ return self.known_modules[fullname]
294+ except KeyError:
295+ raise ImportError("This loader does not know module " + fullname)
296+
297+ def load_module(self, fullname):
298+ try:
299+ # in case of a reload
300+ return sys.modules[fullname]
301+ except KeyError:
302+ pass
303+ mod = self.__get_module(fullname)
304+ if isinstance(mod, MovedModule):
305+ mod = mod._resolve()
306+ else:
307+ mod.__loader__ = self
308+ sys.modules[fullname] = mod
309+ return mod
310+
311+ def is_package(self, fullname):
312+ """
313+ Return true, if the named module is a package.
314+
315+ We need this method to get correct spec objects with
316+ Python 3.4 (see PEP451)
317+ """
318+ return hasattr(self.__get_module(fullname), "__path__")
319+
320+ def get_code(self, fullname):
321+ """Return None
322+
323+ Required, if is_package is implemented"""
324+ self.__get_module(fullname) # eventually raises ImportError
325+ return None
326+ get_source = get_code # same as get_code
327+
328+_importer = _SixMetaPathImporter(__name__)
329+
330+
331+class _MovedItems(_LazyModule):
332+
333+ """Lazy loading of moved objects"""
334+ __path__ = [] # mark as package
335+
336+
337+_moved_attributes = [
338+ MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
339+ MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
340+ MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"),
341+ MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
342+ MovedAttribute("intern", "__builtin__", "sys"),
343+ MovedAttribute("map", "itertools", "builtins", "imap", "map"),
344+ MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"),
345+ MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"),
346+ MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
347+ MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"),
348+ MovedAttribute("reduce", "__builtin__", "functools"),
349+ MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
350+ MovedAttribute("StringIO", "StringIO", "io"),
351+ MovedAttribute("UserDict", "UserDict", "collections"),
352+ MovedAttribute("UserList", "UserList", "collections"),
353+ MovedAttribute("UserString", "UserString", "collections"),
354+ MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
355+ MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
356+ MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
357+ MovedModule("builtins", "__builtin__"),
358+ MovedModule("configparser", "ConfigParser"),
359+ MovedModule("copyreg", "copy_reg"),
360+ MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
361+ MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"),
362+ MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
363+ MovedModule("http_cookies", "Cookie", "http.cookies"),
364+ MovedModule("html_entities", "htmlentitydefs", "html.entities"),
365+ MovedModule("html_parser", "HTMLParser", "html.parser"),
366+ MovedModule("http_client", "httplib", "http.client"),
367+ MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
368+ MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
369+ MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
370+ MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
371+ MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
372+ MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
373+ MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
374+ MovedModule("cPickle", "cPickle", "pickle"),
375+ MovedModule("queue", "Queue"),
376+ MovedModule("reprlib", "repr"),
377+ MovedModule("socketserver", "SocketServer"),
378+ MovedModule("_thread", "thread", "_thread"),
379+ MovedModule("tkinter", "Tkinter"),
380+ MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
381+ MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
382+ MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
383+ MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
384+ MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
385+ MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"),
386+ MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
387+ MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
388+ MovedModule("tkinter_colorchooser", "tkColorChooser",
389+ "tkinter.colorchooser"),
390+ MovedModule("tkinter_commondialog", "tkCommonDialog",
391+ "tkinter.commondialog"),
392+ MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
393+ MovedModule("tkinter_font", "tkFont", "tkinter.font"),
394+ MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
395+ MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
396+ "tkinter.simpledialog"),
397+ MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"),
398+ MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"),
399+ MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"),
400+ MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
401+ MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"),
402+ MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),
403+]
404+# Add windows specific modules.
405+if sys.platform == "win32":
406+ _moved_attributes += [
407+ MovedModule("winreg", "_winreg"),
408+ ]
409+
410+for attr in _moved_attributes:
411+ setattr(_MovedItems, attr.name, attr)
412+ if isinstance(attr, MovedModule):
413+ _importer._add_module(attr, "moves." + attr.name)
414+del attr
415+
416+_MovedItems._moved_attributes = _moved_attributes
417+
418+moves = _MovedItems(__name__ + ".moves")
419+_importer._add_module(moves, "moves")
420+
421+
422+class Module_six_moves_urllib_parse(_LazyModule):
423+
424+ """Lazy loading of moved objects in six.moves.urllib_parse"""
425+
426+
427+_urllib_parse_moved_attributes = [
428+ MovedAttribute("ParseResult", "urlparse", "urllib.parse"),
429+ MovedAttribute("SplitResult", "urlparse", "urllib.parse"),
430+ MovedAttribute("parse_qs", "urlparse", "urllib.parse"),
431+ MovedAttribute("parse_qsl", "urlparse", "urllib.parse"),
432+ MovedAttribute("urldefrag", "urlparse", "urllib.parse"),
433+ MovedAttribute("urljoin", "urlparse", "urllib.parse"),
434+ MovedAttribute("urlparse", "urlparse", "urllib.parse"),
435+ MovedAttribute("urlsplit", "urlparse", "urllib.parse"),
436+ MovedAttribute("urlunparse", "urlparse", "urllib.parse"),
437+ MovedAttribute("urlunsplit", "urlparse", "urllib.parse"),
438+ MovedAttribute("quote", "urllib", "urllib.parse"),
439+ MovedAttribute("quote_plus", "urllib", "urllib.parse"),
440+ MovedAttribute("unquote", "urllib", "urllib.parse"),
441+ MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
442+ MovedAttribute("urlencode", "urllib", "urllib.parse"),
443+ MovedAttribute("splitquery", "urllib", "urllib.parse"),
444+ MovedAttribute("splittag", "urllib", "urllib.parse"),
445+ MovedAttribute("splituser", "urllib", "urllib.parse"),
446+ MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
447+ MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
448+ MovedAttribute("uses_params", "urlparse", "urllib.parse"),
449+ MovedAttribute("uses_query", "urlparse", "urllib.parse"),
450+ MovedAttribute("uses_relative", "urlparse", "urllib.parse"),
451+]
452+for attr in _urllib_parse_moved_attributes:
453+ setattr(Module_six_moves_urllib_parse, attr.name, attr)
454+del attr
455+
456+Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
457+
458+_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"),
459+ "moves.urllib_parse", "moves.urllib.parse")
460+
461+
462+class Module_six_moves_urllib_error(_LazyModule):
463+
464+ """Lazy loading of moved objects in six.moves.urllib_error"""
465+
466+
467+_urllib_error_moved_attributes = [
468+ MovedAttribute("URLError", "urllib2", "urllib.error"),
469+ MovedAttribute("HTTPError", "urllib2", "urllib.error"),
470+ MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),
471+]
472+for attr in _urllib_error_moved_attributes:
473+ setattr(Module_six_moves_urllib_error, attr.name, attr)
474+del attr
475+
476+Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
477+
478+_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"),
479+ "moves.urllib_error", "moves.urllib.error")
480+
481+
482+class Module_six_moves_urllib_request(_LazyModule):
483+
484+ """Lazy loading of moved objects in six.moves.urllib_request"""
485+
486+
487+_urllib_request_moved_attributes = [
488+ MovedAttribute("urlopen", "urllib2", "urllib.request"),
489+ MovedAttribute("install_opener", "urllib2", "urllib.request"),
490+ MovedAttribute("build_opener", "urllib2", "urllib.request"),
491+ MovedAttribute("pathname2url", "urllib", "urllib.request"),
492+ MovedAttribute("url2pathname", "urllib", "urllib.request"),
493+ MovedAttribute("getproxies", "urllib", "urllib.request"),
494+ MovedAttribute("Request", "urllib2", "urllib.request"),
495+ MovedAttribute("OpenerDirector", "urllib2", "urllib.request"),
496+ MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"),
497+ MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"),
498+ MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"),
499+ MovedAttribute("ProxyHandler", "urllib2", "urllib.request"),
500+ MovedAttribute("BaseHandler", "urllib2", "urllib.request"),
501+ MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"),
502+ MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"),
503+ MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"),
504+ MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"),
505+ MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"),
506+ MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"),
507+ MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"),
508+ MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"),
509+ MovedAttribute("HTTPHandler", "urllib2", "urllib.request"),
510+ MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"),
511+ MovedAttribute("FileHandler", "urllib2", "urllib.request"),
512+ MovedAttribute("FTPHandler", "urllib2", "urllib.request"),
513+ MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"),
514+ MovedAttribute("UnknownHandler", "urllib2", "urllib.request"),
515+ MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
516+ MovedAttribute("urlretrieve", "urllib", "urllib.request"),
517+ MovedAttribute("urlcleanup", "urllib", "urllib.request"),
518+ MovedAttribute("URLopener", "urllib", "urllib.request"),
519+ MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
520+ MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
521+]
522+for attr in _urllib_request_moved_attributes:
523+ setattr(Module_six_moves_urllib_request, attr.name, attr)
524+del attr
525+
526+Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
527+
528+_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"),
529+ "moves.urllib_request", "moves.urllib.request")
530+
531+
532+class Module_six_moves_urllib_response(_LazyModule):
533+
534+ """Lazy loading of moved objects in six.moves.urllib_response"""
535+
536+
537+_urllib_response_moved_attributes = [
538+ MovedAttribute("addbase", "urllib", "urllib.response"),
539+ MovedAttribute("addclosehook", "urllib", "urllib.response"),
540+ MovedAttribute("addinfo", "urllib", "urllib.response"),
541+ MovedAttribute("addinfourl", "urllib", "urllib.response"),
542+]
543+for attr in _urllib_response_moved_attributes:
544+ setattr(Module_six_moves_urllib_response, attr.name, attr)
545+del attr
546+
547+Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
548+
549+_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"),
550+ "moves.urllib_response", "moves.urllib.response")
551+
552+
553+class Module_six_moves_urllib_robotparser(_LazyModule):
554+
555+ """Lazy loading of moved objects in six.moves.urllib_robotparser"""
556+
557+
558+_urllib_robotparser_moved_attributes = [
559+ MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),
560+]
561+for attr in _urllib_robotparser_moved_attributes:
562+ setattr(Module_six_moves_urllib_robotparser, attr.name, attr)
563+del attr
564+
565+Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
566+
567+_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"),
568+ "moves.urllib_robotparser", "moves.urllib.robotparser")
569+
570+
571+class Module_six_moves_urllib(types.ModuleType):
572+
573+ """Create a six.moves.urllib namespace that resembles the Python 3 namespace"""
574+ __path__ = [] # mark as package
575+ parse = _importer._get_module("moves.urllib_parse")
576+ error = _importer._get_module("moves.urllib_error")
577+ request = _importer._get_module("moves.urllib_request")
578+ response = _importer._get_module("moves.urllib_response")
579+ robotparser = _importer._get_module("moves.urllib_robotparser")
580+
581+ def __dir__(self):
582+ return ['parse', 'error', 'request', 'response', 'robotparser']
583+
584+_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
585+ "moves.urllib")
586+
587+
588+def add_move(move):
589+ """Add an item to six.moves."""
590+ setattr(_MovedItems, move.name, move)
591+
592+
593+def remove_move(name):
594+ """Remove item from six.moves."""
595+ try:
596+ delattr(_MovedItems, name)
597+ except AttributeError:
598+ try:
599+ del moves.__dict__[name]
600+ except KeyError:
601+ raise AttributeError("no such move, %r" % (name,))
602+
603+
604+if PY3:
605+ _meth_func = "__func__"
606+ _meth_self = "__self__"
607+
608+ _func_closure = "__closure__"
609+ _func_code = "__code__"
610+ _func_defaults = "__defaults__"
611+ _func_globals = "__globals__"
612+else:
613+ _meth_func = "im_func"
614+ _meth_self = "im_self"
615+
616+ _func_closure = "func_closure"
617+ _func_code = "func_code"
618+ _func_defaults = "func_defaults"
619+ _func_globals = "func_globals"
620+
621+
622+try:
623+ advance_iterator = next
624+except NameError:
625+ def advance_iterator(it):
626+ return it.next()
627+next = advance_iterator
628+
629+
630+try:
631+ callable = callable
632+except NameError:
633+ def callable(obj):
634+ return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
635+
636+
637+if PY3:
638+ def get_unbound_function(unbound):
639+ return unbound
640+
641+ create_bound_method = types.MethodType
642+
643+ def create_unbound_method(func, cls):
644+ return func
645+
646+ Iterator = object
647+else:
648+ def get_unbound_function(unbound):
649+ return unbound.im_func
650+
651+ def create_bound_method(func, obj):
652+ return types.MethodType(func, obj, obj.__class__)
653+
654+ def create_unbound_method(func, cls):
655+ return types.MethodType(func, None, cls)
656+
657+ class Iterator(object):
658+
659+ def next(self):
660+ return type(self).__next__(self)
661+
662+ callable = callable
663+_add_doc(get_unbound_function,
664+ """Get the function out of a possibly unbound function""")
665+
666+
667+get_method_function = operator.attrgetter(_meth_func)
668+get_method_self = operator.attrgetter(_meth_self)
669+get_function_closure = operator.attrgetter(_func_closure)
670+get_function_code = operator.attrgetter(_func_code)
671+get_function_defaults = operator.attrgetter(_func_defaults)
672+get_function_globals = operator.attrgetter(_func_globals)
673+
674+
675+if PY3:
676+ def iterkeys(d, **kw):
677+ return iter(d.keys(**kw))
678+
679+ def itervalues(d, **kw):
680+ return iter(d.values(**kw))
681+
682+ def iteritems(d, **kw):
683+ return iter(d.items(**kw))
684+
685+ def iterlists(d, **kw):
686+ return iter(d.lists(**kw))
687+
688+ viewkeys = operator.methodcaller("keys")
689+
690+ viewvalues = operator.methodcaller("values")
691+
692+ viewitems = operator.methodcaller("items")
693+else:
694+ def iterkeys(d, **kw):
695+ return d.iterkeys(**kw)
696+
697+ def itervalues(d, **kw):
698+ return d.itervalues(**kw)
699+
700+ def iteritems(d, **kw):
701+ return d.iteritems(**kw)
702+
703+ def iterlists(d, **kw):
704+ return d.iterlists(**kw)
705+
706+ viewkeys = operator.methodcaller("viewkeys")
707+
708+ viewvalues = operator.methodcaller("viewvalues")
709+
710+ viewitems = operator.methodcaller("viewitems")
711+
712+_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.")
713+_add_doc(itervalues, "Return an iterator over the values of a dictionary.")
714+_add_doc(iteritems,
715+ "Return an iterator over the (key, value) pairs of a dictionary.")
716+_add_doc(iterlists,
717+ "Return an iterator over the (key, [values]) pairs of a dictionary.")
718+
719+
720+if PY3:
721+ def b(s):
722+ return s.encode("latin-1")
723+
724+ def u(s):
725+ return s
726+ unichr = chr
727+ import struct
728+ int2byte = struct.Struct(">B").pack
729+ del struct
730+ byte2int = operator.itemgetter(0)
731+ indexbytes = operator.getitem
732+ iterbytes = iter
733+ import io
734+ StringIO = io.StringIO
735+ BytesIO = io.BytesIO
736+ _assertCountEqual = "assertCountEqual"
737+ if sys.version_info[1] <= 1:
738+ _assertRaisesRegex = "assertRaisesRegexp"
739+ _assertRegex = "assertRegexpMatches"
740+ else:
741+ _assertRaisesRegex = "assertRaisesRegex"
742+ _assertRegex = "assertRegex"
743+else:
744+ def b(s):
745+ return s
746+ # Workaround for standalone backslash
747+
748+ def u(s):
749+ return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
750+ unichr = unichr
751+ int2byte = chr
752+
753+ def byte2int(bs):
754+ return ord(bs[0])
755+
756+ def indexbytes(buf, i):
757+ return ord(buf[i])
758+ iterbytes = functools.partial(itertools.imap, ord)
759+ import StringIO
760+ StringIO = BytesIO = StringIO.StringIO
761+ _assertCountEqual = "assertItemsEqual"
762+ _assertRaisesRegex = "assertRaisesRegexp"
763+ _assertRegex = "assertRegexpMatches"
764+_add_doc(b, """Byte literal""")
765+_add_doc(u, """Text literal""")
766+
767+
768+def assertCountEqual(self, *args, **kwargs):
769+ return getattr(self, _assertCountEqual)(*args, **kwargs)
770+
771+
772+def assertRaisesRegex(self, *args, **kwargs):
773+ return getattr(self, _assertRaisesRegex)(*args, **kwargs)
774+
775+
776+def assertRegex(self, *args, **kwargs):
777+ return getattr(self, _assertRegex)(*args, **kwargs)
778+
779+
780+if PY3:
781+ exec_ = getattr(moves.builtins, "exec")
782+
783+ def reraise(tp, value, tb=None):
784+ if value is None:
785+ value = tp()
786+ if value.__traceback__ is not tb:
787+ raise value.with_traceback(tb)
788+ raise value
789+
790+else:
791+ def exec_(_code_, _globs_=None, _locs_=None):
792+ """Execute code in a namespace."""
793+ if _globs_ is None:
794+ frame = sys._getframe(1)
795+ _globs_ = frame.f_globals
796+ if _locs_ is None:
797+ _locs_ = frame.f_locals
798+ del frame
799+ elif _locs_ is None:
800+ _locs_ = _globs_
801+ exec("""exec _code_ in _globs_, _locs_""")
802+
803+ exec_("""def reraise(tp, value, tb=None):
804+ raise tp, value, tb
805+""")
806+
807+
808+if sys.version_info[:2] == (3, 2):
809+ exec_("""def raise_from(value, from_value):
810+ if from_value is None:
811+ raise value
812+ raise value from from_value
813+""")
814+elif sys.version_info[:2] > (3, 2):
815+ exec_("""def raise_from(value, from_value):
816+ raise value from from_value
817+""")
818+else:
819+ def raise_from(value, from_value):
820+ raise value
821+
822+
823+print_ = getattr(moves.builtins, "print", None)
824+if print_ is None:
825+ def print_(*args, **kwargs):
826+ """The new-style print function for Python 2.4 and 2.5."""
827+ fp = kwargs.pop("file", sys.stdout)
828+ if fp is None:
829+ return
830+
831+ def write(data):
832+ if not isinstance(data, basestring):
833+ data = str(data)
834+ # If the file has an encoding, encode unicode with it.
835+ if (isinstance(fp, file) and
836+ isinstance(data, unicode) and
837+ fp.encoding is not None):
838+ errors = getattr(fp, "errors", None)
839+ if errors is None:
840+ errors = "strict"
841+ data = data.encode(fp.encoding, errors)
842+ fp.write(data)
843+ want_unicode = False
844+ sep = kwargs.pop("sep", None)
845+ if sep is not None:
846+ if isinstance(sep, unicode):
847+ want_unicode = True
848+ elif not isinstance(sep, str):
849+ raise TypeError("sep must be None or a string")
850+ end = kwargs.pop("end", None)
851+ if end is not None:
852+ if isinstance(end, unicode):
853+ want_unicode = True
854+ elif not isinstance(end, str):
855+ raise TypeError("end must be None or a string")
856+ if kwargs:
857+ raise TypeError("invalid keyword arguments to print()")
858+ if not want_unicode:
859+ for arg in args:
860+ if isinstance(arg, unicode):
861+ want_unicode = True
862+ break
863+ if want_unicode:
864+ newline = unicode("\n")
865+ space = unicode(" ")
866+ else:
867+ newline = "\n"
868+ space = " "
869+ if sep is None:
870+ sep = space
871+ if end is None:
872+ end = newline
873+ for i, arg in enumerate(args):
874+ if i:
875+ write(sep)
876+ write(arg)
877+ write(end)
878+if sys.version_info[:2] < (3, 3):
879+ _print = print_
880+
881+ def print_(*args, **kwargs):
882+ fp = kwargs.get("file", sys.stdout)
883+ flush = kwargs.pop("flush", False)
884+ _print(*args, **kwargs)
885+ if flush and fp is not None:
886+ fp.flush()
887+
888+_add_doc(reraise, """Reraise an exception.""")
889+
890+if sys.version_info[0:2] < (3, 4):
891+ def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
892+ updated=functools.WRAPPER_UPDATES):
893+ def wrapper(f):
894+ f = functools.wraps(wrapped, assigned, updated)(f)
895+ f.__wrapped__ = wrapped
896+ return f
897+ return wrapper
898+else:
899+ wraps = functools.wraps
900+
901+
902+def with_metaclass(meta, *bases):
903+ """Create a base class with a metaclass."""
904+ # This requires a bit of explanation: the basic idea is to make a dummy
905+ # metaclass for one level of class instantiation that replaces itself with
906+ # the actual metaclass.
907+ class metaclass(meta):
908+
909+ def __new__(cls, name, this_bases, d):
910+ return meta(name, bases, d)
911+ return type.__new__(metaclass, 'temporary_class', (), {})
912+
913+
914+def add_metaclass(metaclass):
915+ """Class decorator for creating a class with a metaclass."""
916+ def wrapper(cls):
917+ orig_vars = cls.__dict__.copy()
918+ slots = orig_vars.get('__slots__')
919+ if slots is not None:
920+ if isinstance(slots, str):
921+ slots = [slots]
922+ for slots_var in slots:
923+ orig_vars.pop(slots_var)
924+ orig_vars.pop('__dict__', None)
925+ orig_vars.pop('__weakref__', None)
926+ return metaclass(cls.__name__, cls.__bases__, orig_vars)
927+ return wrapper
928+
929+
930+def python_2_unicode_compatible(klass):
931+ """
932+ A decorator that defines __unicode__ and __str__ methods under Python 2.
933+ Under Python 3 it does nothing.
934+
935+ To support Python 2 and 3 with a single code base, define a __str__ method
936+ returning text and apply this decorator to the class.
937+ """
938+ if PY2:
939+ if '__str__' not in klass.__dict__:
940+ raise ValueError("@python_2_unicode_compatible cannot be applied "
941+ "to %s because it doesn't define __str__()." %
942+ klass.__name__)
943+ klass.__unicode__ = klass.__str__
944+ klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
945+ return klass
946+
947+
948+# Complete the moves implementation.
949+# This code is at the end of this module to speed up module loading.
950+# Turn this module into a package.
951+__path__ = [] # required for PEP 302 and PEP 451
952+__package__ = __name__ # see PEP 366 @ReservedAssignment
953+if globals().get("__spec__") is not None:
954+ __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable
955+# Remove other six meta path importers, since they cause problems. This can
956+# happen if six is removed from sys.modules and then reloaded. (Setuptools does
957+# this for some reason.)
958+if sys.meta_path:
959+ for i, importer in enumerate(sys.meta_path):
960+ # Here's some real nastiness: Another "instance" of the six module might
961+ # be floating around. Therefore, we can't use isinstance() to check for
962+ # the six meta path importer, since the other six instance will have
963+ # inserted an importer with different class.
964+ if (type(importer).__name__ == "_SixMetaPathImporter" and
965+ importer.name == __name__):
966+ del sys.meta_path[i]
967+ break
968+ del i, importer
969+# Finally, add the importer to the meta path import hook.
970+sys.meta_path.append(_importer)

Subscribers

People subscribed via source and target branches

to status/vote changes: