Skip to content

Commit 78ab4cf

Browse files
authored
Bump all linters other than mypy (#11901)
1 parent 4a8693a commit 78ab4cf

27 files changed

+13
-35
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: 'src/pip/_vendor/'
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
5+
rev: v4.4.0
66
hooks:
77
- id: check-builtin-literals
88
- id: check-added-large-files
@@ -17,18 +17,18 @@ repos:
1717
exclude: .patch
1818

1919
- repo: https://github.com/psf/black
20-
rev: 22.6.0
20+
rev: 23.1.0
2121
hooks:
2222
- id: black
2323

2424
- repo: https://github.com/PyCQA/flake8
25-
rev: 4.0.1
25+
rev: 6.0.0
2626
hooks:
2727
- id: flake8
2828
additional_dependencies: [
29-
'flake8-bugbear==22.10.27',
30-
'flake8-logging-format==0.9.0',
31-
'flake8-implicit-str-concat==0.3.0',
29+
'flake8-bugbear',
30+
'flake8-logging-format',
31+
'flake8-implicit-str-concat',
3232
]
3333
exclude: tests/data
3434

@@ -56,7 +56,7 @@ repos:
5656
]
5757

5858
- repo: https://github.com/pre-commit/pygrep-hooks
59-
rev: v1.9.0
59+
rev: v1.10.0
6060
hooks:
6161
- id: python-no-log-warn
6262
- id: python-no-eval

docs/pip_sphinxext.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ def run(self) -> List[nodes.Node]:
254254
lines = []
255255
# Create a tab for each OS
256256
for os, variant in os_variants.items():
257-
258257
# Unpack the values
259258
prompt = variant["prompt"]
260259
highlighter = variant["highlighter"]

src/pip/_internal/commands/cache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class CacheCommand(Command):
3737
"""
3838

3939
def add_options(self) -> None:
40-
4140
self.cmd_opts.add_option(
4241
"--format",
4342
action="store",

src/pip/_internal/commands/check.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class CheckCommand(Command):
2020
%prog [options]"""
2121

2222
def run(self, options: Values, args: List[str]) -> int:
23-
2423
package_set, parsing_probs = create_package_set_from_installed()
2524
missing, conflicting = check_package_set(package_set)
2625

src/pip/_internal/commands/download.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def add_options(self) -> None:
7676

7777
@with_cleanup
7878
def run(self, options: Values, args: List[str]) -> int:
79-
8079
options.ignore_installed = True
8180
# editable doesn't really make sense for `pip download`, but the bowels
8281
# of the RequirementSet code require that property.

src/pip/_internal/commands/wheel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class WheelCommand(RequirementCommand):
4343
%prog [options] <archive url/path> ..."""
4444

4545
def add_options(self) -> None:
46-
4746
self.cmd_opts.add_option(
4847
"-w",
4948
"--wheel-dir",

src/pip/_internal/index/sources.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ def build_source(
171171
expand_dir: bool,
172172
cache_link_parsing: bool,
173173
) -> Tuple[Optional[str], Optional[LinkSource]]:
174-
175174
path: Optional[str] = None
176175
url: Optional[str] = None
177176
if os.path.exists(location): # Is a local path.

src/pip/_internal/models/search_scope.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def get_formatted_locations(self) -> str:
7979
redacted_index_urls = []
8080
if self.index_urls and self.index_urls != [PyPI.simple_url]:
8181
for url in self.index_urls:
82-
8382
redacted_index_url = redact_auth_from_url(url)
8483

8584
# Parse the URL

src/pip/_internal/network/session.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ def cert_verify(
316316

317317

318318
class PipSession(requests.Session):
319-
320319
timeout: Optional[int] = None
321320

322321
def __init__(

src/pip/_internal/operations/install/legacy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def install(
6969
unpacked_source_directory: str,
7070
req_description: str,
7171
) -> bool:
72-
7372
header_dir = scheme.headers
7473

7574
with TempDirectory(kind="record") as temp_dir:

src/pip/_internal/req/constructors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ def install_req_from_editable(
211211
permit_editable_wheels: bool = False,
212212
config_settings: Optional[Dict[str, Union[str, List[str]]]] = None,
213213
) -> InstallRequirement:
214-
215214
parts = parse_req_from_editable(editable_req)
216215

217216
return InstallRequirement(

src/pip/_internal/req/req_file.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ def handle_requirement_line(
165165
line: ParsedLine,
166166
options: Optional[optparse.Values] = None,
167167
) -> ParsedRequirement:
168-
169168
# preserve for the nested code path
170169
line_comes_from = "{} {} (line {})".format(
171170
"-c" if line.constraint else "-r",
@@ -210,7 +209,6 @@ def handle_option_line(
210209
options: Optional[optparse.Values] = None,
211210
session: Optional[PipSession] = None,
212211
) -> None:
213-
214212
if options:
215213
# percolate options upward
216214
if opts.require_hashes:

src/pip/_internal/req/req_install.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,6 @@ def install(
850850

851851

852852
def check_invalid_constraint_type(req: InstallRequirement) -> str:
853-
854853
# Check for unsupported forms
855854
problem = ""
856855
if not req.name:

src/pip/_internal/resolution/resolvelib/factory.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ def get_installation_error(
632632
e: "ResolutionImpossible[Requirement, Candidate]",
633633
constraints: Dict[str, Constraint],
634634
) -> InstallationError:
635-
636635
assert e.causes, "Installation error reported with no cause"
637636

638637
# If one of the things we can't solve is "we need Python X.Y",

src/pip/_internal/resolution/resolvelib/requirements.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def name(self) -> str:
6464
return format_name(self.project_name, self._extras)
6565

6666
def format_for_error(self) -> str:
67-
6867
# Convert comma-separated specifiers into "A, B, ..., F and G"
6968
# This makes the specifier a bit more "human readable", without
7069
# risking a change in meaning. (Hopefully! Not all edge cases have

tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ def virtualenv_template(
432432
wheel_install: Path,
433433
coverage_install: Path,
434434
) -> Iterator[VirtualEnvironment]:
435-
436435
venv_type: VirtualEnvironmentType
437436
if request.config.getoption("--use-venv"):
438437
venv_type = "venv"

tests/functional/test_build_env.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def test_build_env_allow_only_one_install(script: PipTestEnvironment) -> None:
106106

107107

108108
def test_build_env_requirements_check(script: PipTestEnvironment) -> None:
109-
110109
create_basic_wheel_for_package(script, "foo", "2.0")
111110
create_basic_wheel_for_package(script, "bar", "1.0")
112111
create_basic_wheel_for_package(script, "bar", "3.0")
@@ -206,7 +205,6 @@ def test_build_env_overlay_prefix_has_priority(script: PipTestEnvironment) -> No
206205

207206
@pytest.mark.usefixtures("enable_user_site")
208207
def test_build_env_isolation(script: PipTestEnvironment) -> None:
209-
210208
# Create dummy `pkg` wheel.
211209
pkg_whl = create_basic_wheel_for_package(script, "pkg", "1.0")
212210

tests/functional/test_cache.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def list_matches_wheel(wheel_name: str, result: TestPipResult) -> bool:
107107
`- foo-1.2.3-py3-none-any.whl `."""
108108
lines = result.stdout.splitlines()
109109
expected = f" - {wheel_name}-py3-none-any.whl "
110-
return any(map(lambda l: l.startswith(expected), lines))
110+
return any(map(lambda line: line.startswith(expected), lines))
111111

112112

113113
def list_matches_wheel_abspath(wheel_name: str, result: TestPipResult) -> bool:
@@ -121,7 +121,9 @@ def list_matches_wheel_abspath(wheel_name: str, result: TestPipResult) -> bool:
121121
expected = f"{wheel_name}-py3-none-any.whl"
122122
return any(
123123
map(
124-
lambda l: os.path.basename(l).startswith(expected) and os.path.exists(l),
124+
lambda line: (
125+
os.path.basename(line).startswith(expected) and os.path.exists(line)
126+
),
125127
lines,
126128
)
127129
)

tests/functional/test_install.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,6 @@ def test_install_skip_work_dir_pkg(script: PipTestEnvironment, data: TestData) -
22172217
def test_install_verify_package_name_normalization(
22182218
script: PipTestEnvironment, package_name: str
22192219
) -> None:
2220-
22212220
"""
22222221
Test that install of a package again using a name which
22232222
normalizes to the original package name, is a no-op

tests/unit/test_base_command.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def fixed_time() -> Iterator[None]:
2222

2323

2424
class FakeCommand(Command):
25-
2625
_name = "fake"
2726

2827
def __init__(

tests/unit/test_collector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ def test_link_collector_create_find_links_expansion(
10141014
"""
10151015
Test "~" expansion in --find-links paths.
10161016
"""
1017+
10171018
# This is a mock version of expanduser() that expands "~" to the tmpdir.
10181019
def expand_path(path: str) -> str:
10191020
if path.startswith("~/"):

tests/unit/test_link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_fragments(self) -> None:
108108
)
109109
def test_invalid_egg_fragments(self, fragment: str) -> None:
110110
url = f"git+https://example.com/package#egg={fragment}"
111-
with pytest.raises(Exception):
111+
with pytest.raises(ValueError):
112112
Link(url)
113113

114114
@pytest.mark.parametrize(

tests/unit/test_network_cache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class TestSafeFileCache:
2424
"""
2525

2626
def test_cache_roundtrip(self, cache_tmpdir: Path) -> None:
27-
2827
cache = SafeFileCache(os.fspath(cache_tmpdir))
2928
assert cache.get("test key") is None
3029
cache.set("test key", b"a test string")

tests/unit/test_options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ def test_config_file_true(
454454

455455

456456
class TestGeneralOptions(AddFakeCommandMixin):
457-
458457
# the reason to specifically test general options is due to the
459458
# extra processing they receive, and the number of bugs we've had
460459

tests/unit/test_req_file.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ def test_args_long_options(self) -> None:
613613

614614

615615
class TestOptionVariants:
616-
617616
# this suite is really just testing optparse, but added it anyway
618617

619618
def test_variant1(

tests/unit/test_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class Tests_EgglinkPath:
5353
"util.egg_link_path_from_location() tests"
5454

5555
def setup_method(self) -> None:
56-
5756
project = "foo"
5857

5958
self.mock_dist = Mock(project_name=project)

tests/unit/test_wheel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,6 @@ def test_invalid_entrypoints_fail(
518518

519519

520520
class TestMessageAboutScriptsNotOnPATH:
521-
522521
tilde_warning_msg = (
523522
"NOTE: The current PATH contains path(s) starting with `~`, "
524523
"which may not be expanded by all applications."

0 commit comments

Comments
 (0)