Skip to content

Commit 7b7469b

Browse files
authored
Merge pull request #9460 from pfmoore/vendor_21_0
Vendoring changes for release 21.0 (excluding setuptools)
2 parents aa08988 + a79758c commit 7b7469b

30 files changed

+33052
-1962
lines changed

news/msgpack.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade msgpack to 1.0.2.

news/requests.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade requests to 2.25.1.

src/pip/_vendor/certifi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .core import contents, where
22

3-
__version__ = "2020.11.08"
3+
__version__ = "2020.12.05"

src/pip/_vendor/certifi/cacert.pem

Lines changed: 41 additions & 322 deletions
Large diffs are not rendered by default.

src/pip/_vendor/chardet/__init__.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
######################### END LICENSE BLOCK #########################
1717

1818

19-
from .compat import PY2, PY3
2019
from .universaldetector import UniversalDetector
20+
from .enums import InputState
2121
from .version import __version__, VERSION
2222

2323

24+
__all__ = ['UniversalDetector', 'detect', 'detect_all', '__version__', 'VERSION']
25+
26+
2427
def detect(byte_str):
2528
"""
2629
Detect the encoding of the given byte string.
@@ -31,9 +34,50 @@ def detect(byte_str):
3134
if not isinstance(byte_str, bytearray):
3235
if not isinstance(byte_str, bytes):
3336
raise TypeError('Expected object of type bytes or bytearray, got: '
34-
'{0}'.format(type(byte_str)))
37+
'{}'.format(type(byte_str)))
3538
else:
3639
byte_str = bytearray(byte_str)
3740
detector = UniversalDetector()
3841
detector.feed(byte_str)
3942
return detector.close()
43+
44+
45+
def detect_all(byte_str):
46+
"""
47+
Detect all the possible encodings of the given byte string.
48+
49+
:param byte_str: The byte sequence to examine.
50+
:type byte_str: ``bytes`` or ``bytearray``
51+
"""
52+
if not isinstance(byte_str, bytearray):
53+
if not isinstance(byte_str, bytes):
54+
raise TypeError('Expected object of type bytes or bytearray, got: '
55+
'{}'.format(type(byte_str)))
56+
else:
57+
byte_str = bytearray(byte_str)
58+
59+
detector = UniversalDetector()
60+
detector.feed(byte_str)
61+
detector.close()
62+
63+
if detector._input_state == InputState.HIGH_BYTE:
64+
results = []
65+
for prober in detector._charset_probers:
66+
if prober.get_confidence() > detector.MINIMUM_THRESHOLD:
67+
charset_name = prober.charset_name
68+
lower_charset_name = prober.charset_name.lower()
69+
# Use Windows encoding name instead of ISO-8859 if we saw any
70+
# extra Windows-specific bytes
71+
if lower_charset_name.startswith('iso-8859'):
72+
if detector._has_win_bytes:
73+
charset_name = detector.ISO_WIN_MAP.get(lower_charset_name,
74+
charset_name)
75+
results.append({
76+
'encoding': charset_name,
77+
'confidence': prober.get_confidence(),
78+
'language': prober.language,
79+
})
80+
if len(results) > 0:
81+
return sorted(results, key=lambda result: -result['confidence'])
82+
83+
return [detector.result]

src/pip/_vendor/chardet/charsetgroupprober.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def feed(self, byte_str):
7373
continue
7474
if state == ProbingState.FOUND_IT:
7575
self._best_guess_prober = prober
76+
self._state = ProbingState.FOUND_IT
7677
return self.state
7778
elif state == ProbingState.NOT_ME:
7879
prober.active = False

src/pip/_vendor/chardet/cli/chardetect.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
"""
32
Script which takes one or more file paths and reports on their detected
43
encodings
@@ -45,10 +44,10 @@ def description_of(lines, name='stdin'):
4544
if PY2:
4645
name = name.decode(sys.getfilesystemencoding(), 'ignore')
4746
if result['encoding']:
48-
return '{0}: {1} with confidence {2}'.format(name, result['encoding'],
47+
return '{}: {} with confidence {}'.format(name, result['encoding'],
4948
result['confidence'])
5049
else:
51-
return '{0}: no result'.format(name)
50+
return '{}: no result'.format(name)
5251

5352

5453
def main(argv=None):
@@ -69,7 +68,7 @@ def main(argv=None):
6968
type=argparse.FileType('rb'), nargs='*',
7069
default=[sys.stdin if PY2 else sys.stdin.buffer])
7170
parser.add_argument('--version', action='version',
72-
version='%(prog)s {0}'.format(__version__))
71+
version='%(prog)s {}'.format(__version__))
7372
args = parser.parse_args(argv)
7473

7574
for f in args.input:

src/pip/_vendor/chardet/compat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
if sys.version_info < (3, 0):
2626
PY2 = True
2727
PY3 = False
28-
base_str = (str, unicode)
28+
string_types = (str, unicode)
2929
text_type = unicode
30+
iteritems = dict.iteritems
3031
else:
3132
PY2 = False
3233
PY3 = True
33-
base_str = (bytes, str)
34+
string_types = (bytes, str)
3435
text_type = str
36+
iteritems = dict.items

0 commit comments

Comments
 (0)