Skip to content

Commit 13a3f1d

Browse files
committed
Upgrade requests
1 parent 46eca28 commit 13a3f1d

File tree

125 files changed

+6188
-1240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+6188
-1240
lines changed

news/certifi.vendor

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Vendored certifi at 2017.7.27.1.

news/chardet.vendor

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Vendored chardet at 3.0.4.

news/idna.vendor

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Vendored idna at idna==2.6.

news/requests.vendor

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Upgraded requests to 2.14.2.
1+
Upgraded requests to 2.18.4.

news/urllib3.vendor

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Vendored urllib3 at 1.22.

src/pip/_internal/__init__.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# to add socks as yet another dependency for pip, nor do I want to allow-stder
1818
# in the DEP-8 tests, so just suppress the warning. pdb tells me this has to
1919
# be done before the import of pip.vcs.
20-
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
20+
from pip._vendor.urllib3.exceptions import DependencyWarning
2121
warnings.filterwarnings("ignore", category=DependencyWarning) # noqa
2222

2323
# We want to inject the use of SecureTransport as early as possible so that any
@@ -32,9 +32,7 @@
3232
if (sys.platform == "darwin" and
3333
ssl.OPENSSL_VERSION_NUMBER < 0x1000100f): # OpenSSL 1.0.1
3434
try:
35-
from pip._vendor.requests.packages.urllib3.contrib import (
36-
securetransport,
37-
)
35+
from pip._vendor.urllib3.contrib import securetransport
3836
except (ImportError, OSError):
3937
pass
4038
else:
@@ -51,9 +49,7 @@
5149
)
5250
from pip._internal.commands import get_summaries, get_similar_commands
5351
from pip._internal.commands import commands_dict
54-
from pip._vendor.requests.packages.urllib3.exceptions import (
55-
InsecureRequestWarning,
56-
)
52+
from pip._vendor.urllib3.exceptions import InsecureRequestWarning
5753

5854
logger = logging.getLogger(__name__)
5955

src/pip/_internal/download.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
import shutil
1313
import sys
1414

15-
from pip._vendor import requests, six
15+
from pip._vendor import requests, six, urllib3
1616
from pip._vendor.cachecontrol import CacheControlAdapter
1717
from pip._vendor.cachecontrol.caches import FileCache
1818
from pip._vendor.lockfile import LockError
1919
from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
2020
from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth
2121
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
22-
from pip._vendor.requests.packages import urllib3
2322
from pip._vendor.requests.structures import CaseInsensitiveDict
2423
from pip._vendor.requests.utils import get_netrc_auth
2524
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is

src/pip/_vendor/cachecontrol/compat.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@
1010
import pickle
1111

1212

13-
from pip._vendor.requests.packages.urllib3.response import HTTPResponse
14-
from pip._vendor.requests.packages.urllib3.util import is_fp_closed
13+
# Handle the case where the requests module has been patched to not have
14+
# urllib3 bundled as part of its source.
15+
try:
16+
from pip._vendor.requests.packages.urllib3.response import HTTPResponse
17+
except ImportError:
18+
from pip._vendor.urllib3.response import HTTPResponse
19+
20+
try:
21+
from pip._vendor.requests.packages.urllib3.util import is_fp_closed
22+
except ImportError:
23+
from pip._vendor.urllib3.util import is_fp_closed
1524

1625
# Replicate some six behaviour
1726
try:

src/pip/_vendor/certifi.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from certifi import *

src/pip/_vendor/certifi/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .core import where, old_where
2+
3+
__version__ = "2017.07.27.1"

src/pip/_vendor/certifi/__main__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from certifi import where
2+
print(where())

src/pip/_vendor/requests/cacert.pem renamed to src/pip/_vendor/certifi/cacert.pem

-826
Large diffs are not rendered by default.

src/pip/_vendor/certifi/core.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""
5+
certifi.py
6+
~~~~~~~~~~
7+
8+
This module returns the installation location of cacert.pem.
9+
"""
10+
import os
11+
import warnings
12+
13+
14+
class DeprecatedBundleWarning(DeprecationWarning):
15+
"""
16+
The weak security bundle is being deprecated. Please bother your service
17+
provider to get them to stop using cross-signed roots.
18+
"""
19+
20+
21+
def where():
22+
f = os.path.dirname(__file__)
23+
24+
return os.path.join(f, 'cacert.pem')
25+
26+
27+
def old_where():
28+
warnings.warn(
29+
"The weak security bundle is being deprecated.",
30+
DeprecatedBundleWarning
31+
)
32+
f = os.path.dirname(__file__)
33+
return os.path.join(f, 'weak.pem')
34+
35+
if __name__ == '__main__':
36+
print(where())

src/pip/_vendor/certifi/old_root.pem

+414
Large diffs are not rendered by default.

src/pip/_vendor/certifi/weak.pem

+5,248
Large diffs are not rendered by default.

src/pip/_vendor/chardet.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from chardet import *

src/pip/_vendor/requests/packages/chardet/cli/chardetect.py renamed to src/pip/_vendor/chardet/cli/chardetect.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import argparse
1919
import sys
2020

21-
from chardet import __version__
22-
from chardet.compat import PY2
23-
from chardet.universaldetector import UniversalDetector
21+
from pip._vendor.chardet import __version__
22+
from pip._vendor.chardet.compat import PY2
23+
from pip._vendor.chardet.universaldetector import UniversalDetector
2424

2525

2626
def description_of(lines, name='stdin'):

src/pip/_vendor/requests/packages/chardet/universaldetector.py renamed to src/pip/_vendor/chardet/universaldetector.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class a user of ``chardet`` should use.
4040
import logging
4141
import re
4242

43+
from .charsetgroupprober import CharSetGroupProber
4344
from .enums import InputState, LanguageFilter, ProbingState
4445
from .escprober import EscCharSetProber
4546
from .latin1prober import Latin1Prober
@@ -268,11 +269,18 @@ def close(self):
268269
if self.logger.getEffectiveLevel() == logging.DEBUG:
269270
if self.result['encoding'] is None:
270271
self.logger.debug('no probers hit minimum threshold')
271-
for prober in self._charset_probers[0].probers:
272-
if not prober:
272+
for group_prober in self._charset_probers:
273+
if not group_prober:
273274
continue
274-
self.logger.debug('%s %s confidence = %s',
275-
prober.charset_name,
276-
prober.language,
277-
prober.get_confidence())
275+
if isinstance(group_prober, CharSetGroupProber):
276+
for prober in group_prober.probers:
277+
self.logger.debug('%s %s confidence = %s',
278+
prober.charset_name,
279+
prober.language,
280+
prober.get_confidence())
281+
else:
282+
self.logger.debug('%s %s confidence = %s',
283+
prober.charset_name,
284+
prober.language,
285+
prober.get_confidence())
278286
return self.result

src/pip/_vendor/requests/packages/chardet/version.py renamed to src/pip/_vendor/chardet/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
:author: Dan Blanchard ([email protected])
66
"""
77

8-
__version__ = "3.0.2"
8+
__version__ = "3.0.4"
99
VERSION = __version__.split('.')

src/pip/_vendor/html5lib/_inputstream.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def determineEncoding(self, chardet=True):
489489
# Guess with chardet, if available
490490
if chardet:
491491
try:
492-
from chardet.universaldetector import UniversalDetector
492+
from pip._vendor.chardet.universaldetector import UniversalDetector
493493
except ImportError:
494494
pass
495495
else:

src/pip/_vendor/idna.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from idna import *

src/pip/_vendor/idna/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .package_data import __version__
2+
from .core import *

src/pip/_vendor/requests/packages/idna/idnadata.py renamed to src/pip/_vendor/idna/idnadata.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# This file is automatically generated by build-idnadata.py
1+
# This file is automatically generated by tools/idna-data
22

3+
__version__ = "6.3.0"
34
scripts = {
45
'Greek': (
56
0x37000000374,

src/pip/_vendor/idna/package_data.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version__ = '2.6'
2+

src/pip/_vendor/requests/packages/idna/uts46data.py renamed to src/pip/_vendor/idna/uts46data.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# This file is automatically generated by tools/build-uts46data.py
1+
# This file is automatically generated by tools/idna-data
22
# vim: set fileencoding=utf-8 :
33

44
"""IDNA Mapping Table from UTS46."""
55

66

7+
__version__ = "6.3.0"
78
def _seg_0():
89
return [
910
(0x0, '3'),

src/pip/_vendor/requests/__init__.py

+47-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# /
77

88
"""
9-
Requests HTTP library
9+
Requests HTTP Library
1010
~~~~~~~~~~~~~~~~~~~~~
1111
1212
Requests is an HTTP library, written in Python, for human beings. Basic GET
@@ -36,33 +36,68 @@
3636
The other HTTP methods are supported - see `requests.api`. Full documentation
3737
is at <http://python-requests.org>.
3838
39-
:copyright: (c) 2016 by Kenneth Reitz.
39+
:copyright: (c) 2017 by Kenneth Reitz.
4040
:license: Apache 2.0, see LICENSE for more details.
4141
"""
4242

43-
__title__ = 'requests'
44-
__version__ = '2.14.2'
45-
__build__ = 0x021402
46-
__author__ = 'Kenneth Reitz'
47-
__license__ = 'Apache 2.0'
48-
__copyright__ = 'Copyright 2016 Kenneth Reitz'
43+
from pip._vendor import urllib3
44+
from pip._vendor import chardet
45+
import warnings
46+
from .exceptions import RequestsDependencyWarning
47+
48+
49+
def check_compatibility(urllib3_version, chardet_version):
50+
urllib3_version = urllib3_version.split('.')
51+
assert urllib3_version != ['dev'] # Verify urllib3 isn't installed from git.
52+
53+
# Sometimes, urllib3 only reports its version as 16.1.
54+
if len(urllib3_version) == 2:
55+
urllib3_version.append('0')
56+
57+
# Check urllib3 for compatibility.
58+
major, minor, patch = urllib3_version # noqa: F811
59+
major, minor, patch = int(major), int(minor), int(patch)
60+
# urllib3 >= 1.21.1, <= 1.22
61+
assert major == 1
62+
assert minor >= 21
63+
assert minor <= 22
64+
65+
# Check chardet for compatibility.
66+
major, minor, patch = chardet_version.split('.')[:3]
67+
major, minor, patch = int(major), int(minor), int(patch)
68+
# chardet >= 3.0.2, < 3.1.0
69+
assert major == 3
70+
assert minor < 1
71+
assert patch >= 2
72+
73+
74+
# Check imported dependencies for compatibility.
75+
try:
76+
check_compatibility(urllib3.__version__, chardet.__version__)
77+
except (AssertionError, ValueError):
78+
warnings.warn("urllib3 ({0}) or chardet ({1}) doesn't match a supported "
79+
"version!".format(urllib3.__version__, chardet.__version__),
80+
RequestsDependencyWarning)
4981

5082
# Attempt to enable urllib3's SNI support, if possible
5183
# Note: Patched by pip to prevent using the PyOpenSSL module. On Windows this
5284
# prevents upgrading cryptography.
5385
# try:
54-
# from .packages.urllib3.contrib import pyopenssl
86+
# from pip._vendor.urllib3.contrib import pyopenssl
5587
# pyopenssl.inject_into_urllib3()
5688
# except ImportError:
5789
# pass
5890

59-
import warnings
60-
6191
# urllib3's DependencyWarnings should be silenced.
62-
from .packages.urllib3.exceptions import DependencyWarning
92+
from pip._vendor.urllib3.exceptions import DependencyWarning
6393
warnings.simplefilter('ignore', DependencyWarning)
6494

95+
from .__version__ import __title__, __description__, __url__, __version__
96+
from .__version__ import __build__, __author__, __author_email__, __license__
97+
from .__version__ import __copyright__, __cake__
98+
6599
from . import utils
100+
from . import packages
66101
from .models import Request, Response, PreparedRequest
67102
from .api import request, get, head, post, patch, put, delete, options
68103
from .sessions import session, Session
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# .-. .-. .-. . . .-. .-. .-. .-.
2+
# |( |- |.| | | |- `-. | `-.
3+
# ' ' `-' `-`.`-' `-' `-' ' `-'
4+
5+
__title__ = 'requests'
6+
__description__ = 'Python HTTP for Humans.'
7+
__url__ = 'http://python-requests.org'
8+
__version__ = '2.18.4'
9+
__build__ = 0x021804
10+
__author__ = 'Kenneth Reitz'
11+
__author_email__ = '[email protected]'
12+
__license__ = 'Apache 2.0'
13+
__copyright__ = 'Copyright 2017 Kenneth Reitz'
14+
__cake__ = u'\u2728 \U0001f370 \u2728'

0 commit comments

Comments
 (0)