Skip to content

Commit 014130d

Browse files
Apply ruff/pygrep-hooks rule PGH003 (#1417)
1 parent e32dbf8 commit 014130d

29 files changed

+29
-28
lines changed

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ lint.extend-select = [
7272
"C9",
7373
"I",
7474
"ISC",
75+
"PGH",
7576
"PLC",
7677
"PLE",
7778
"PLW",

scripts/generate_man.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import textwrap
66
from typing import cast
77

8-
from build_manpages.manpage import Manpage # type: ignore
8+
from build_manpages.manpage import Manpage # type: ignore[import-not-found]
99

1010
from pipx.main import get_command_parser
1111

src/pipx/colors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Callable
33

44
try:
5-
import colorama # type: ignore
5+
import colorama # type: ignore[import-untyped]
66
except ImportError: # Colorama is Windows only package
77
colorama = None
88

src/pipx/commands/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from tempfile import TemporaryDirectory
1111
from typing import Dict, List, Optional, Set, Tuple
1212

13-
import userpath # type: ignore
13+
import userpath # type: ignore[import-not-found]
1414
from packaging.utils import canonicalize_name
1515

1616
from pipx import paths

src/pipx/commands/ensure_path.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pathlib import Path
55
from typing import Optional, Tuple
66

7-
import userpath # type: ignore
7+
import userpath # type: ignore[import-not-found]
88

99
from pipx import paths
1010
from pipx.constants import EXIT_CODE_OK, ExitCode

src/pipx/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ def get_command_parser() -> Tuple[argparse.ArgumentParser, Dict[str, argparse.Ar
905905
description=PIPX_DESCRIPTION,
906906
parents=[shared_parser],
907907
)
908-
parser.man_short_description = PIPX_DESCRIPTION.splitlines()[1] # type: ignore
908+
parser.man_short_description = PIPX_DESCRIPTION.splitlines()[1] # type: ignore[attr-defined]
909909

910910
subparsers = parser.add_subparsers(dest="command", description="Get help for commands with pipx COMMAND --help")
911911

src/pipx/venv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
try:
1111
from importlib.metadata import Distribution, EntryPoint
1212
except ImportError:
13-
from importlib_metadata import Distribution, EntryPoint # type: ignore
13+
from importlib_metadata import Distribution, EntryPoint # type: ignore[import-not-found,no-redef]
1414

1515
from packaging.utils import canonicalize_name
1616

src/pipx/venv_inspect.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
try:
1111
from importlib import metadata
1212
except ImportError:
13-
import importlib_metadata as metadata # type: ignore
13+
import importlib_metadata as metadata # type: ignore[import-not-found,no-redef]
1414

1515
from pipx.constants import MAN_SECTIONS, WINDOWS
1616
from pipx.util import PipxError, run_subprocess

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from urllib.error import HTTPError, URLError
1212
from urllib.request import urlopen
1313

14-
import pytest # type: ignore
14+
import pytest # type: ignore[import-not-found]
1515

1616
from helpers import WIN
1717
from pipx import commands, interpreter, paths, shared_libs, standalone_python, venv

tests/helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Any, Dict, List, Optional
88
from unittest import mock
99

10-
import pytest # type: ignore
10+
import pytest # type: ignore[import-not-found]
1111
from packaging.utils import canonicalize_name
1212

1313
from package_info import PKG

tests/test_animate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22

3-
import pytest # type: ignore
3+
import pytest # type: ignore[import-not-found]
44

55
import pipx.animate
66
from pipx.animate import (

tests/test_emojis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from io import BytesIO, TextIOWrapper
33
from unittest import mock
44

5-
import pytest # type: ignore
5+
import pytest # type: ignore[import-not-found]
66

77
from pipx.emojis import use_emojis
88

tests/test_inject.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33
import textwrap
44

5-
import pytest # type: ignore
5+
import pytest # type: ignore[import-not-found]
66

77
from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli, skip_if_windows
88
from package_info import PKG

tests/test_install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66
from unittest import mock
77

8-
import pytest # type: ignore
8+
import pytest # type: ignore[import-not-found]
99

1010
from helpers import app_name, run_pipx_cli, skip_if_windows, unwrap_log_text
1111
from package_info import PKG

tests/test_install_all_packages.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from pathlib import Path
2525
from typing import List, Optional, Tuple
2626

27-
import pytest # type: ignore
27+
import pytest # type: ignore[import-not-found]
2828

2929
from helpers import run_pipx_cli
3030
from package_info import PKG

tests/test_interpreter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
from unittest.mock import Mock
55

6-
import pytest # type: ignore
6+
import pytest # type: ignore[import-not-found]
77

88
import pipx.interpreter
99
import pipx.paths

tests/test_list.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
import time
77

8-
import pytest # type: ignore
8+
import pytest # type: ignore[import-not-found]
99

1010
from helpers import (
1111
PIPX_METADATA_LEGACY_VERSIONS,

tests/test_main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
from unittest import mock
33

4-
import pytest # type: ignore
4+
import pytest # type: ignore[import-not-found]
55

66
from helpers import run_pipx_cli
77
from pipx import main

tests/test_package_specifier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
22

3-
import pytest # type: ignore
3+
import pytest # type: ignore[import-not-found]
44

55
from pipx.package_specifier import (
66
fix_package_name,

tests/test_pipx_metadata_file.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from dataclasses import replace
33
from pathlib import Path
44

5-
import pytest # type: ignore
5+
import pytest # type: ignore[import-not-found]
66

77
from helpers import assert_package_metadata, create_package_info_ref, run_pipx_cli
88
from package_info import PKG

tests/test_reinstall.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
import pytest # type: ignore
3+
import pytest # type: ignore[import-not-found]
44

55
from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli, skip_if_windows
66

tests/test_reinstall_all.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
import pytest # type: ignore
3+
import pytest # type: ignore[import-not-found]
44

55
from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli
66
from pipx import shared_libs

tests/test_run.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import textwrap
66
from unittest import mock
77

8-
import pytest # type: ignore
8+
import pytest # type: ignore[import-not-found]
99

1010
import pipx.main
1111
import pipx.util

tests/test_shared_libs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import time
33

4-
import pytest # type: ignore
4+
import pytest # type: ignore[import-not-found]
55

66
from pipx import shared_libs
77

tests/test_uninstall.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
import pytest # type: ignore
3+
import pytest # type: ignore[import-not-found]
44

55
from helpers import (
66
PIPX_METADATA_LEGACY_VERSIONS,

tests/test_uninstall_all.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pytest # type: ignore
1+
import pytest # type: ignore[import-not-found]
22

33
from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli
44

tests/test_upgrade.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pytest # type: ignore
1+
import pytest # type: ignore[import-not-found]
22

33
from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli, skip_if_windows
44
from package_info import PKG

tests/test_upgrade_all.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pytest # type: ignore
1+
import pytest # type: ignore[import-not-found]
22

33
from helpers import PIPX_METADATA_LEGACY_VERSIONS, mock_legacy_venv, run_pipx_cli
44

tests/test_upgrade_shared.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import subprocess
22

3-
import pytest # type: ignore
3+
import pytest # type: ignore[import-not-found]
44

55
from helpers import run_pipx_cli
66

0 commit comments

Comments
 (0)