diff --git a/pyproject.toml b/pyproject.toml index 658a1b5b66..32bc4637a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,7 @@ lint.extend-select = [ "C9", "I", "ISC", + "PGH", "PLC", "PLE", "PLW", diff --git a/scripts/generate_man.py b/scripts/generate_man.py index e322348fed..ce689c3fb3 100644 --- a/scripts/generate_man.py +++ b/scripts/generate_man.py @@ -5,7 +5,7 @@ import textwrap from typing import cast -from build_manpages.manpage import Manpage # type: ignore +from build_manpages.manpage import Manpage # type: ignore[import-not-found] from pipx.main import get_command_parser diff --git a/src/pipx/colors.py b/src/pipx/colors.py index 4408878725..a695054d6e 100644 --- a/src/pipx/colors.py +++ b/src/pipx/colors.py @@ -2,7 +2,7 @@ from typing import Callable try: - import colorama # type: ignore + import colorama # type: ignore[import-untyped] except ImportError: # Colorama is Windows only package colorama = None diff --git a/src/pipx/commands/common.py b/src/pipx/commands/common.py index 6f27a9daf6..094e238eaf 100644 --- a/src/pipx/commands/common.py +++ b/src/pipx/commands/common.py @@ -10,7 +10,7 @@ from tempfile import TemporaryDirectory from typing import Dict, List, Optional, Set, Tuple -import userpath # type: ignore +import userpath # type: ignore[import-not-found] from packaging.utils import canonicalize_name from pipx import paths diff --git a/src/pipx/commands/ensure_path.py b/src/pipx/commands/ensure_path.py index 5976a5d138..fe2d5930cb 100644 --- a/src/pipx/commands/ensure_path.py +++ b/src/pipx/commands/ensure_path.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import Optional, Tuple -import userpath # type: ignore +import userpath # type: ignore[import-not-found] from pipx import paths from pipx.constants import EXIT_CODE_OK, ExitCode diff --git a/src/pipx/main.py b/src/pipx/main.py index a7c606db8e..e1dfc7a6e3 100644 --- a/src/pipx/main.py +++ b/src/pipx/main.py @@ -905,7 +905,7 @@ def get_command_parser() -> Tuple[argparse.ArgumentParser, Dict[str, argparse.Ar description=PIPX_DESCRIPTION, parents=[shared_parser], ) - parser.man_short_description = PIPX_DESCRIPTION.splitlines()[1] # type: ignore + parser.man_short_description = PIPX_DESCRIPTION.splitlines()[1] # type: ignore[attr-defined] subparsers = parser.add_subparsers(dest="command", description="Get help for commands with pipx COMMAND --help") diff --git a/src/pipx/venv.py b/src/pipx/venv.py index d4201c20eb..2549204bb6 100644 --- a/src/pipx/venv.py +++ b/src/pipx/venv.py @@ -10,7 +10,7 @@ try: from importlib.metadata import Distribution, EntryPoint except ImportError: - from importlib_metadata import Distribution, EntryPoint # type: ignore + from importlib_metadata import Distribution, EntryPoint # type: ignore[import-not-found,no-redef] from packaging.utils import canonicalize_name diff --git a/src/pipx/venv_inspect.py b/src/pipx/venv_inspect.py index db1eba0b13..465f83ecca 100644 --- a/src/pipx/venv_inspect.py +++ b/src/pipx/venv_inspect.py @@ -10,7 +10,7 @@ try: from importlib import metadata except ImportError: - import importlib_metadata as metadata # type: ignore + import importlib_metadata as metadata # type: ignore[import-not-found,no-redef] from pipx.constants import MAN_SECTIONS, WINDOWS from pipx.util import PipxError, run_subprocess diff --git a/tests/conftest.py b/tests/conftest.py index 7b3b250d2c..5b546b4c49 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,7 @@ from urllib.error import HTTPError, URLError from urllib.request import urlopen -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import WIN from pipx import commands, interpreter, paths, shared_libs, standalone_python, venv diff --git a/tests/helpers.py b/tests/helpers.py index c2d2cb875f..aed4c6413a 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -6,7 +6,7 @@ from typing import Any, Dict, List, Optional from unittest import mock -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from packaging.utils import canonicalize_name from package_info import PKG diff --git a/tests/test_animate.py b/tests/test_animate.py index 683bf24ac7..d70e0b2e36 100644 --- a/tests/test_animate.py +++ b/tests/test_animate.py @@ -1,6 +1,6 @@ import time -import pytest # type: ignore +import pytest # type: ignore[import-not-found] import pipx.animate from pipx.animate import ( diff --git a/tests/test_emojis.py b/tests/test_emojis.py index 854ca8b418..1e5090747e 100644 --- a/tests/test_emojis.py +++ b/tests/test_emojis.py @@ -2,7 +2,7 @@ from io import BytesIO, TextIOWrapper from unittest import mock -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from pipx.emojis import use_emojis diff --git a/tests/test_inject.py b/tests/test_inject.py index 55a7779d50..625fa79e1b 100644 --- a/tests/test_inject.py +++ b/tests/test_inject.py @@ -2,7 +2,7 @@ import re import textwrap -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli, skip_if_windows from package_info import PKG diff --git a/tests/test_install.py b/tests/test_install.py index 21ad5b9850..a4fc3b29f7 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -5,7 +5,7 @@ from pathlib import Path from unittest import mock -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import app_name, run_pipx_cli, skip_if_windows, unwrap_log_text from package_info import PKG diff --git a/tests/test_install_all_packages.py b/tests/test_install_all_packages.py index 1da8e4dd3c..b7d406035d 100644 --- a/tests/test_install_all_packages.py +++ b/tests/test_install_all_packages.py @@ -24,7 +24,7 @@ from pathlib import Path from typing import List, Optional, Tuple -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import run_pipx_cli from package_info import PKG diff --git a/tests/test_interpreter.py b/tests/test_interpreter.py index 70d9f557f2..c1f76b7509 100644 --- a/tests/test_interpreter.py +++ b/tests/test_interpreter.py @@ -3,7 +3,7 @@ import sys from unittest.mock import Mock -import pytest # type: ignore +import pytest # type: ignore[import-not-found] import pipx.interpreter import pipx.paths diff --git a/tests/test_list.py b/tests/test_list.py index 1e0c6fcd67..c74f9b50a5 100644 --- a/tests/test_list.py +++ b/tests/test_list.py @@ -5,7 +5,7 @@ import sys import time -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import ( PIPX_METADATA_LEGACY_VERSIONS, diff --git a/tests/test_main.py b/tests/test_main.py index a8e2a43277..7ffec93343 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,7 +1,7 @@ import sys from unittest import mock -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import run_pipx_cli from pipx import main diff --git a/tests/test_package_specifier.py b/tests/test_package_specifier.py index 2dcdeabc10..96af1a499c 100644 --- a/tests/test_package_specifier.py +++ b/tests/test_package_specifier.py @@ -1,6 +1,6 @@ from pathlib import Path -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from pipx.package_specifier import ( fix_package_name, diff --git a/tests/test_pipx_metadata_file.py b/tests/test_pipx_metadata_file.py index 9e1cc78412..0a0f253a09 100644 --- a/tests/test_pipx_metadata_file.py +++ b/tests/test_pipx_metadata_file.py @@ -1,7 +1,7 @@ import sys from pathlib import Path -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import assert_package_metadata, create_package_info_ref, run_pipx_cli from package_info import PKG diff --git a/tests/test_reinstall.py b/tests/test_reinstall.py index 175918a0be..6c7886680f 100644 --- a/tests/test_reinstall.py +++ b/tests/test_reinstall.py @@ -1,6 +1,6 @@ import sys -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli, skip_if_windows diff --git a/tests/test_reinstall_all.py b/tests/test_reinstall_all.py index d930c5e038..441ee7eb51 100644 --- a/tests/test_reinstall_all.py +++ b/tests/test_reinstall_all.py @@ -1,6 +1,6 @@ import sys -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli from pipx import shared_libs diff --git a/tests/test_run.py b/tests/test_run.py index 489ee65c1d..f084f0da1a 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -5,7 +5,7 @@ import textwrap from unittest import mock -import pytest # type: ignore +import pytest # type: ignore[import-not-found] import pipx.main import pipx.util diff --git a/tests/test_shared_libs.py b/tests/test_shared_libs.py index c92170c152..b645d5b483 100644 --- a/tests/test_shared_libs.py +++ b/tests/test_shared_libs.py @@ -1,7 +1,7 @@ import os import time -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from pipx import shared_libs diff --git a/tests/test_uninstall.py b/tests/test_uninstall.py index 236dcca750..3ab46a15a0 100644 --- a/tests/test_uninstall.py +++ b/tests/test_uninstall.py @@ -1,6 +1,6 @@ import sys -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import ( PIPX_METADATA_LEGACY_VERSIONS, diff --git a/tests/test_uninstall_all.py b/tests/test_uninstall_all.py index 74a2b09c45..5fa7b60c84 100644 --- a/tests/test_uninstall_all.py +++ b/tests/test_uninstall_all.py @@ -1,4 +1,4 @@ -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli diff --git a/tests/test_upgrade.py b/tests/test_upgrade.py index 54c18f59d7..b95bc687ef 100644 --- a/tests/test_upgrade.py +++ b/tests/test_upgrade.py @@ -1,4 +1,4 @@ -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli, skip_if_windows from package_info import PKG diff --git a/tests/test_upgrade_all.py b/tests/test_upgrade_all.py index acdd06b419..4c65021825 100644 --- a/tests/test_upgrade_all.py +++ b/tests/test_upgrade_all.py @@ -1,4 +1,4 @@ -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli diff --git a/tests/test_upgrade_shared.py b/tests/test_upgrade_shared.py index 391dcdf855..6e9179fd8f 100644 --- a/tests/test_upgrade_shared.py +++ b/tests/test_upgrade_shared.py @@ -1,6 +1,6 @@ import subprocess -import pytest # type: ignore +import pytest # type: ignore[import-not-found] from helpers import run_pipx_cli