mirror of https://github.com/pypa/pip
Merge pull request #8261 from deveshks/upgrade-flake8
This commit is contained in:
commit
d4cd5b9d5d
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue