Skip to content
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

Update vendored dependencies #9813

Merged
merged 3 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/idna.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade idna to 3.1
1 change: 1 addition & 0 deletions news/pep517.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade pep517 to 0.10.0
2 changes: 1 addition & 1 deletion news/tenacity.vendor.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Switch from retrying to tenacity
Upgrade tenacity to 7.0.0
29 changes: 29 additions & 0 deletions src/pip/_vendor/idna/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2013-2021, Kim Davies
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 changes: 0 additions & 34 deletions src/pip/_vendor/idna/LICENSE.rst

This file was deleted.

40 changes: 16 additions & 24 deletions src/pip/_vendor/idna/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import codecs
import re

_unicode_dots_re = re.compile(u'[\u002e\u3002\uff0e\uff61]')
_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]')

class Codec(codecs.Codec):

def encode(self, data, errors='strict'):

if errors != 'strict':
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))

if not data:
return "", 0
Expand All @@ -19,23 +19,23 @@ def encode(self, data, errors='strict'):
def decode(self, data, errors='strict'):

if errors != 'strict':
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))

if not data:
return u"", 0
return '', 0

return decode(data), len(data)

class IncrementalEncoder(codecs.BufferedIncrementalEncoder):
def _buffer_encode(self, data, errors, final):
if errors != 'strict':
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))

if not data:
return ("", 0)
return ('', 0)

labels = _unicode_dots_re.split(data)
trailing_dot = u''
trailing_dot = ''
if labels:
if not labels[-1]:
trailing_dot = '.'
Expand All @@ -55,37 +55,29 @@ def _buffer_encode(self, data, errors, final):
size += len(label)

# Join with U+002E
result = ".".join(result) + trailing_dot
result = '.'.join(result) + trailing_dot
size += len(trailing_dot)
return (result, size)

class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
def _buffer_decode(self, data, errors, final):
if errors != 'strict':
raise IDNAError("Unsupported error handling \"{0}\"".format(errors))
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))

if not data:
return (u"", 0)

# IDNA allows decoding to operate on Unicode strings, too.
if isinstance(data, unicode):
labels = _unicode_dots_re.split(data)
else:
# Must be ASCII string
data = str(data)
unicode(data, "ascii")
labels = data.split(".")

trailing_dot = u''
return ('', 0)

labels = _unicode_dots_re.split(data)
trailing_dot = ''
if labels:
if not labels[-1]:
trailing_dot = u'.'
trailing_dot = '.'
del labels[-1]
elif not final:
# Keep potentially unfinished label until the next call
del labels[-1]
if labels:
trailing_dot = u'.'
trailing_dot = '.'

result = []
size = 0
Expand All @@ -95,7 +87,7 @@ def _buffer_decode(self, data, errors, final):
size += 1
size += len(label)

result = u".".join(result) + trailing_dot
result = '.'.join(result) + trailing_dot
size += len(trailing_dot)
return (result, size)

Expand Down
2 changes: 1 addition & 1 deletion src/pip/_vendor/idna/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ def ToUnicode(label):
return decode(label)

def nameprep(s):
raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol")
raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol')

66 changes: 31 additions & 35 deletions src/pip/_vendor/idna/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

_virama_combining_class = 9
_alabel_prefix = b'xn--'
_unicode_dots_re = re.compile(u'[\u002e\u3002\uff0e\uff61]')

if sys.version_info[0] >= 3:
unicode = str
unichr = chr
_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]')

class IDNAError(UnicodeError):
""" Base exception for all IDNA-encoding related problems """
Expand All @@ -34,10 +30,10 @@ class InvalidCodepointContext(IDNAError):


def _combining_class(cp):
v = unicodedata.combining(unichr(cp))
v = unicodedata.combining(chr(cp))
if v == 0:
if not unicodedata.name(unichr(cp)):
raise ValueError("Unknown character in unicodedata")
if not unicodedata.name(chr(cp)):
raise ValueError('Unknown character in unicodedata')
return v

def _is_script(cp, script):
Expand All @@ -47,7 +43,7 @@ def _punycode(s):
return s.encode('punycode')

def _unot(s):
return 'U+{0:04X}'.format(s)
return 'U+{:04X}'.format(s)


def valid_label_length(label):
Expand All @@ -72,7 +68,7 @@ def check_bidi(label, check_ltr=False):
direction = unicodedata.bidirectional(cp)
if direction == '':
# String likely comes from a newer version of Unicode
raise IDNABidiError('Unknown directionality in label {0} at position {1}'.format(repr(label), idx))
raise IDNABidiError('Unknown directionality in label {} at position {}'.format(repr(label), idx))
if direction in ['R', 'AL', 'AN']:
bidi_label = True
if not bidi_label and not check_ltr:
Expand All @@ -85,7 +81,7 @@ def check_bidi(label, check_ltr=False):
elif direction == 'L':
rtl = False
else:
raise IDNABidiError('First codepoint in label {0} must be directionality L, R or AL'.format(repr(label)))
raise IDNABidiError('First codepoint in label {} must be directionality L, R or AL'.format(repr(label)))

valid_ending = False
number_type = False
Expand All @@ -95,7 +91,7 @@ def check_bidi(label, check_ltr=False):
if rtl:
# Bidi rule 2
if not direction in ['R', 'AL', 'AN', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']:
raise IDNABidiError('Invalid direction for codepoint at position {0} in a right-to-left label'.format(idx))
raise IDNABidiError('Invalid direction for codepoint at position {} in a right-to-left label'.format(idx))
# Bidi rule 3
if direction in ['R', 'AL', 'EN', 'AN']:
valid_ending = True
Expand All @@ -111,7 +107,7 @@ def check_bidi(label, check_ltr=False):
else:
# Bidi rule 5
if not direction in ['L', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']:
raise IDNABidiError('Invalid direction for codepoint at position {0} in a left-to-right label'.format(idx))
raise IDNABidiError('Invalid direction for codepoint at position {} in a left-to-right label'.format(idx))
# Bidi rule 6
if direction in ['L', 'EN']:
valid_ending = True
Expand Down Expand Up @@ -212,7 +208,7 @@ def valid_contexto(label, pos, exception=False):

elif cp_value == 0x30fb:
for cp in label:
if cp == u'\u30fb':
if cp == '\u30fb':
continue
if _is_script(cp, 'Hiragana') or _is_script(cp, 'Katakana') or _is_script(cp, 'Han'):
return True
Expand Down Expand Up @@ -249,16 +245,16 @@ def check_label(label):
elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']):
try:
if not valid_contextj(label, pos):
raise InvalidCodepointContext('Joiner {0} not allowed at position {1} in {2}'.format(
raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format(
_unot(cp_value), pos+1, repr(label)))
except ValueError:
raise IDNAError('Unknown codepoint adjacent to joiner {0} at position {1} in {2}'.format(
raise IDNAError('Unknown codepoint adjacent to joiner {} at position {} in {}'.format(
_unot(cp_value), pos+1, repr(label)))
elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']):
if not valid_contexto(label, pos):
raise InvalidCodepointContext('Codepoint {0} not allowed at position {1} in {2}'.format(_unot(cp_value), pos+1, repr(label)))
raise InvalidCodepointContext('Codepoint {} not allowed at position {} in {}'.format(_unot(cp_value), pos+1, repr(label)))
else:
raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label)))
raise InvalidCodepoint('Codepoint {} at position {} of {} not allowed'.format(_unot(cp_value), pos+1, repr(label)))

check_bidi(label)

Expand All @@ -277,7 +273,7 @@ def alabel(label):
if not label:
raise IDNAError('No Input')

label = unicode(label)
label = str(label)
check_label(label)
label = _punycode(label)
label = _alabel_prefix + label
Expand Down Expand Up @@ -316,35 +312,35 @@ def ulabel(label):
def uts46_remap(domain, std3_rules=True, transitional=False):
"""Re-map the characters in the string according to UTS46 processing."""
from .uts46data import uts46data
output = u""
output = ''
try:
for pos, char in enumerate(domain):
code_point = ord(char)
uts46row = uts46data[code_point if code_point < 256 else
bisect.bisect_left(uts46data, (code_point, "Z")) - 1]
bisect.bisect_left(uts46data, (code_point, 'Z')) - 1]
status = uts46row[1]
replacement = uts46row[2] if len(uts46row) == 3 else None
if (status == "V" or
(status == "D" and not transitional) or
(status == "3" and not std3_rules and replacement is None)):
if (status == 'V' or
(status == 'D' and not transitional) or
(status == '3' and not std3_rules and replacement is None)):
output += char
elif replacement is not None and (status == "M" or
(status == "3" and not std3_rules) or
(status == "D" and transitional)):
elif replacement is not None and (status == 'M' or
(status == '3' and not std3_rules) or
(status == 'D' and transitional)):
output += replacement
elif status != "I":
elif status != 'I':
raise IndexError()
return unicodedata.normalize("NFC", output)
return unicodedata.normalize('NFC', output)
except IndexError:
raise InvalidCodepoint(
"Codepoint {0} not allowed at position {1} in {2}".format(
'Codepoint {} not allowed at position {} in {}'.format(
_unot(code_point), pos + 1, repr(domain)))


def encode(s, strict=False, uts46=False, std3_rules=False, transitional=False):

if isinstance(s, (bytes, bytearray)):
s = s.decode("ascii")
s = s.decode('ascii')
if uts46:
s = uts46_remap(s, std3_rules, transitional)
trailing_dot = False
Expand Down Expand Up @@ -375,15 +371,15 @@ def encode(s, strict=False, uts46=False, std3_rules=False, transitional=False):
def decode(s, strict=False, uts46=False, std3_rules=False):

if isinstance(s, (bytes, bytearray)):
s = s.decode("ascii")
s = s.decode('ascii')
if uts46:
s = uts46_remap(s, std3_rules, False)
trailing_dot = False
result = []
if not strict:
labels = _unicode_dots_re.split(s)
else:
labels = s.split(u'.')
labels = s.split('.')
if not labels or labels == ['']:
raise IDNAError('Empty domain')
if not labels[-1]:
Expand All @@ -396,5 +392,5 @@ def decode(s, strict=False, uts46=False, std3_rules=False):
else:
raise IDNAError('Empty label')
if trailing_dot:
result.append(u'')
return u'.'.join(result)
result.append('')
return '.'.join(result)
2 changes: 1 addition & 1 deletion src/pip/_vendor/idna/idnadata.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is automatically generated by tools/idna-data

__version__ = "13.0.0"
__version__ = '13.0.0'
scripts = {
'Greek': (
0x37000000374,
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_vendor/idna/package_data.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '2.10'
__version__ = '3.1'

Loading