summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevesh Kumar Singh <deveshkusingh@gmail.com>2020-05-18 20:35:38 +0530
committerDevesh Kumar Singh <deveshkusingh@gmail.com>2020-05-18 21:58:26 +0530
commit60f00b837a7a21cfe2eee161dcbc12966571d8f0 (patch)
tree189ee144ad8dbbe9f813000a4f05be9a74f88570
parentd0ab9bd8bd4d2802e420e315374babca5b3c227c (diff)
downloadpip-60f00b837a7a21cfe2eee161dcbc12966571d8f0.tar.gz
Upgrade flake8 to 3.8.1
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--news/0FD33C4F-0B92-427D-AE3B-93EE33E15621.trivial0
-rw-r--r--src/pip/_internal/commands/show.py2
-rw-r--r--src/pip/_internal/operations/install/wheel.py13
-rw-r--r--src/pip/_internal/utils/misc.py2
-rw-r--r--src/pip/_internal/wheel_builder.py3
-rw-r--r--tests/functional/test_install_reqs.py6
7 files changed, 17 insertions, 11 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3e2c0a2ad..0a7847c13 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -17,7 +17,7 @@ repos:
exclude: .patch
- repo: https://gitlab.com/pycqa/flake8
- rev: 3.7.9
+ rev: 3.8.1
hooks:
- id: flake8
exclude: tests/data
diff --git a/news/0FD33C4F-0B92-427D-AE3B-93EE33E15621.trivial b/news/0FD33C4F-0B92-427D-AE3B-93EE33E15621.trivial
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/news/0FD33C4F-0B92-427D-AE3B-93EE33E15621.trivial
diff --git a/src/pip/_internal/commands/show.py b/src/pip/_internal/commands/show.py
index 8d9fa13fd..97735f2d2 100644
--- a/src/pip/_internal/commands/show.py
+++ b/src/pip/_internal/commands/show.py
@@ -99,7 +99,7 @@ def search_packages_info(query):
# RECORDs should be part of .dist-info metadatas
if dist.has_metadata('RECORD'):
lines = dist.get_metadata_lines('RECORD')
- paths = [l.split(',')[0] for l in lines]
+ paths = [line.split(',')[0] for line in lines]
paths = [os.path.join(dist.location, p) for p in paths]
file_list = [os.path.relpath(p, dist.location) for p in paths]
diff --git a/src/pip/_internal/operations/install/wheel.py b/src/pip/_internal/operations/install/wheel.py
index a0885c48c..8eb938f07 100644
--- a/src/pip/_internal/operations/install/wheel.py
+++ b/src/pip/_internal/operations/install/wheel.py
@@ -32,16 +32,21 @@ from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl
from pip._internal.utils.filesystem import adjacent_tmp_file, replace
from pip._internal.utils.misc import captured_stdout, ensure_dir, hash_file
from pip._internal.utils.temp_dir import TempDirectory
-from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.unpacking import current_umask, unpack_file
from pip._internal.utils.wheel import parse_wheel
-if MYPY_CHECK_RUNNING:
+# Use the custom cast function at runtime to make cast work,
+# and import typing.cast when performing pre-commit and type
+# checks
+if not MYPY_CHECK_RUNNING:
+ from pip._internal.utils.typing import cast
+else:
from email.message import Message
import typing # noqa F401
from typing import (
Dict, List, Optional, Sequence, Tuple, Any,
- Iterable, Iterator, Callable, Set,
+ Iterable, Iterator, Callable, Set, IO, cast
)
from pip._internal.models.scheme import Scheme
@@ -607,7 +612,7 @@ def install_unpacked_wheel(
# Python 2 (typing.BinaryIO), leading us to explicitly
# cast to typing.IO[str] as a workaround
# for bad Python 2 behaviour
- record_file_obj = cast('typing.IO[str]', record_file)
+ record_file_obj = cast('IO[str]', record_file)
writer = csv.writer(record_file_obj)
writer.writerows(sorted_outrows(rows)) # sort to simplify testing
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
index 09031825a..65cd38889 100644
--- a/src/pip/_internal/utils/misc.py
+++ b/src/pip/_internal/utils/misc.py
@@ -541,7 +541,7 @@ class FakeFile(object):
"""Wrap a list of lines in an object with readline() to make
ConfigParser happy."""
def __init__(self, lines):
- self._gen = (l for l in lines)
+ self._gen = iter(lines)
def readline(self):
try:
diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py
index fcaeeb6c3..b6f75aa0b 100644
--- a/src/pip/_internal/wheel_builder.py
+++ b/src/pip/_internal/wheel_builder.py
@@ -36,7 +36,8 @@ logger = logging.getLogger(__name__)
def _contains_egg_info(
- s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
+ s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)',
+ re.IGNORECASE)):
# type: (str, Pattern[str]) -> bool
"""Determine whether the string looks like an egg_info.
diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py
index 0c00060a2..40b0c3c75 100644
--- a/tests/functional/test_install_reqs.py
+++ b/tests/functional/test_install_reqs.py
@@ -420,7 +420,7 @@ def test_install_with_extras_from_install(script, data):
)
result = script.pip_install_local(
'-c', script.scratch_path / 'constraints.txt', 'LocalExtras[baz]')
- assert script.site_packages / 'singlemodule.py'in result.files_created
+ assert script.site_packages / 'singlemodule.py' in result.files_created
def test_install_with_extras_joined(script, data):
@@ -432,7 +432,7 @@ def test_install_with_extras_joined(script, data):
'-c', script.scratch_path / 'constraints.txt', 'LocalExtras[baz]'
)
assert script.site_packages / 'simple' in result.files_created
- assert script.site_packages / 'singlemodule.py'in result.files_created
+ assert script.site_packages / 'singlemodule.py' in result.files_created
def test_install_with_extras_editable_joined(script, data):
@@ -443,7 +443,7 @@ def test_install_with_extras_editable_joined(script, data):
result = script.pip_install_local(
'-c', script.scratch_path / 'constraints.txt', 'LocalExtras[baz]')
assert script.site_packages / 'simple' in result.files_created
- assert script.site_packages / 'singlemodule.py'in result.files_created
+ assert script.site_packages / 'singlemodule.py' in result.files_created
def test_install_distribution_full_union(script, data):