From deededf27886379f609e9636b5b3fabbf9c6641f Mon Sep 17 00:00:00 2001 From: Richard Si Date: Sat, 11 May 2024 14:15:37 -0400 Subject: [PATCH] Bump black, ruff, and mypy pre-commit hooks New mypy are: src/pip/_internal/cli/parser.py:70: error: Argument 1 of "format_description" is incompatible with supertype "HelpFormatter"; supertype defines the argument type as "str | None" [override] def format_description(self, description: str) -> str: ^~~~~~~~~~~~~~~~ src/pip/_internal/cli/parser.py:88: error: Argument 1 of "format_epilog" is incompatible with supertype "HelpFormatter"; supertype defines the argument type as "str | None" [override] def format_epilog(self, epilog: str) -> str: ^~~~~~~~~~~ tests/unit/test_req_uninstall.py:30: error: Missing return statement [return] def iter_declared_entries(self) -> Optional[Iterator[str]]: ^ Found 3 errors in 2 files (checked 296 source files) --- .pre-commit-config.yaml | 8 ++++---- src/pip/_internal/cli/parser.py | 6 +++--- tests/unit/test_req_uninstall.py | 5 +---- tools/codespell-ignore.txt | 1 + 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 922e1440d45..9b08c9bcf24 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,18 +17,18 @@ repos: exclude: .patch - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.4.0 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.1 + rev: v0.4.7 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.0 hooks: - id: mypy exclude: tests/data @@ -55,7 +55,7 @@ repos: exclude: NEWS.rst # The errors flagged in NEWS.rst are old. - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell exclude: AUTHORS.txt|tests/data diff --git a/src/pip/_internal/cli/parser.py b/src/pip/_internal/cli/parser.py index ae554b24cae..b7d7c1f600a 100644 --- a/src/pip/_internal/cli/parser.py +++ b/src/pip/_internal/cli/parser.py @@ -6,7 +6,7 @@ import sys import textwrap from contextlib import suppress -from typing import Any, Dict, Generator, List, Tuple +from typing import Any, Dict, Generator, List, Optional, Tuple from pip._internal.cli.status_codes import UNKNOWN_ERROR from pip._internal.configuration import Configuration, ConfigurationError @@ -67,7 +67,7 @@ def format_usage(self, usage: str) -> str: msg = "\nUsage: {}\n".format(self.indent_lines(textwrap.dedent(usage), " ")) return msg - def format_description(self, description: str) -> str: + def format_description(self, description: Optional[str]) -> str: # leave full control over description to us if description: if hasattr(self.parser, "main"): @@ -85,7 +85,7 @@ def format_description(self, description: str) -> str: else: return "" - def format_epilog(self, epilog: str) -> str: + def format_epilog(self, epilog: Optional[str]) -> str: # leave full control over epilog to us if epilog: return epilog diff --git a/tests/unit/test_req_uninstall.py b/tests/unit/test_req_uninstall.py index 6a846e20272..b61babc343a 100644 --- a/tests/unit/test_req_uninstall.py +++ b/tests/unit/test_req_uninstall.py @@ -28,10 +28,7 @@ def mock_permitted(ups: UninstallPathSet, path: str) -> bool: def test_uninstallation_paths() -> None: class dist: def iter_declared_entries(self) -> Optional[Iterator[str]]: - yield "file.py" - yield "file.pyc" - yield "file.so" - yield "nopyc.py" + return iter(["file.py", "file.pyc", "file.so", "nopyc.py"]) location = "" diff --git a/tools/codespell-ignore.txt b/tools/codespell-ignore.txt index 288f597353b..6856939bf0a 100644 --- a/tools/codespell-ignore.txt +++ b/tools/codespell-ignore.txt @@ -3,6 +3,7 @@ lousily followings # A contributor first name wil +Whit # Codebase variable or class names uptodate afile