-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump vendored six
to 1.11.0
#1602
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# pylint: skip-file | ||
"""Utilities for writing code that runs on Python 2 and 3""" | ||
|
||
# Copyright (c) 2010-2015 Benjamin Peterson | ||
# Copyright (c) 2010-2017 Benjamin Peterson | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -21,6 +20,8 @@ | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
"""Utilities for writing code that runs on Python 2 and 3""" | ||
|
||
from __future__ import absolute_import | ||
|
||
import functools | ||
|
@@ -30,7 +31,7 @@ | |
import types | ||
|
||
__author__ = "Benjamin Peterson <[email protected]>" | ||
__version__ = "1.10.0" | ||
__version__ = "1.11.0" | ||
|
||
|
||
# Useful for very coarse version differentiation. | ||
|
@@ -71,7 +72,9 @@ def __len__(self): | |
# 64-bit | ||
MAXSIZE = int((1 << 63) - 1) | ||
|
||
# Don't del it here, cause with gc disabled this "leaks" to garbage | ||
# Don't del it here, cause with gc disabled this "leaks" to garbage. | ||
# Note: This is a kafka-python customization, details at: | ||
# https://github.com/dpkp/kafka-python/pull/979#discussion_r100403389 | ||
# del X | ||
|
||
|
||
|
@@ -244,6 +247,7 @@ class _MovedItems(_LazyModule): | |
MovedAttribute("map", "itertools", "builtins", "imap", "map"), | ||
MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), | ||
MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), | ||
MovedAttribute("getoutput", "commands", "subprocess"), | ||
MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), | ||
MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"), | ||
MovedAttribute("reduce", "__builtin__", "functools"), | ||
|
@@ -265,10 +269,11 @@ class _MovedItems(_LazyModule): | |
MovedModule("html_entities", "htmlentitydefs", "html.entities"), | ||
MovedModule("html_parser", "HTMLParser", "html.parser"), | ||
MovedModule("http_client", "httplib", "http.client"), | ||
MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), | ||
MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"), | ||
MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), | ||
MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"), | ||
MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), | ||
MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), | ||
MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), | ||
MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), | ||
MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), | ||
|
@@ -340,10 +345,12 @@ class Module_six_moves_urllib_parse(_LazyModule): | |
MovedAttribute("quote_plus", "urllib", "urllib.parse"), | ||
MovedAttribute("unquote", "urllib", "urllib.parse"), | ||
MovedAttribute("unquote_plus", "urllib", "urllib.parse"), | ||
MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"), | ||
MovedAttribute("urlencode", "urllib", "urllib.parse"), | ||
MovedAttribute("splitquery", "urllib", "urllib.parse"), | ||
MovedAttribute("splittag", "urllib", "urllib.parse"), | ||
MovedAttribute("splituser", "urllib", "urllib.parse"), | ||
MovedAttribute("splitvalue", "urllib", "urllib.parse"), | ||
MovedAttribute("uses_fragment", "urlparse", "urllib.parse"), | ||
MovedAttribute("uses_netloc", "urlparse", "urllib.parse"), | ||
MovedAttribute("uses_params", "urlparse", "urllib.parse"), | ||
|
@@ -419,6 +426,8 @@ class Module_six_moves_urllib_request(_LazyModule): | |
MovedAttribute("URLopener", "urllib", "urllib.request"), | ||
MovedAttribute("FancyURLopener", "urllib", "urllib.request"), | ||
MovedAttribute("proxy_bypass", "urllib", "urllib.request"), | ||
MovedAttribute("parse_http_list", "urllib2", "urllib.request"), | ||
MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"), | ||
] | ||
for attr in _urllib_request_moved_attributes: | ||
setattr(Module_six_moves_urllib_request, attr.name, attr) | ||
|
@@ -682,11 +691,15 @@ def assertRegex(self, *args, **kwargs): | |
exec_ = getattr(moves.builtins, "exec") | ||
|
||
def reraise(tp, value, tb=None): | ||
if value is None: | ||
value = tp() | ||
if value.__traceback__ is not tb: | ||
raise value.with_traceback(tb) | ||
raise value | ||
try: | ||
if value is None: | ||
value = tp() | ||
if value.__traceback__ is not tb: | ||
raise value.with_traceback(tb) | ||
raise value | ||
finally: | ||
value = None | ||
tb = None | ||
|
||
else: | ||
def exec_(_code_, _globs_=None, _locs_=None): | ||
|
@@ -702,19 +715,28 @@ def exec_(_code_, _globs_=None, _locs_=None): | |
exec("""exec _code_ in _globs_, _locs_""") | ||
|
||
exec_("""def reraise(tp, value, tb=None): | ||
raise tp, value, tb | ||
try: | ||
raise tp, value, tb | ||
finally: | ||
tb = None | ||
""") | ||
|
||
|
||
if sys.version_info[:2] == (3, 2): | ||
exec_("""def raise_from(value, from_value): | ||
if from_value is None: | ||
raise value | ||
raise value from from_value | ||
try: | ||
if from_value is None: | ||
raise value | ||
raise value from from_value | ||
finally: | ||
value = None | ||
""") | ||
elif sys.version_info[:2] > (3, 2): | ||
exec_("""def raise_from(value, from_value): | ||
raise value from from_value | ||
try: | ||
raise value from from_value | ||
finally: | ||
value = None | ||
""") | ||
else: | ||
def raise_from(value, from_value): | ||
|
@@ -805,10 +827,14 @@ def with_metaclass(meta, *bases): | |
# This requires a bit of explanation: the basic idea is to make a dummy | ||
# metaclass for one level of class instantiation that replaces itself with | ||
# the actual metaclass. | ||
class metaclass(meta): | ||
class metaclass(type): | ||
|
||
def __new__(cls, name, this_bases, d): | ||
return meta(name, bases, d) | ||
|
||
@classmethod | ||
def __prepare__(cls, name, this_bases): | ||
return meta.__prepare__(name, bases) | ||
return type.__new__(metaclass, 'temporary_class', (), {}) | ||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw -- if upstream doesn't want to merge this change, I don't think we should keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I left a comment on the upstream PR to bump it so we'll see what happens...