Skip to content

Commit

Permalink
Apply ruff/pygrep-hooks rule PGH003 (#1417)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos authored May 20, 2024
1 parent e32dbf8 commit 014130d
Show file tree
Hide file tree
Showing 29 changed files with 29 additions and 28 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ lint.extend-select = [
"C9",
"I",
"ISC",
"PGH",
"PLC",
"PLE",
"PLW",
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_man.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/pipx/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/pipx/commands/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pipx/commands/ensure_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pipx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion src/pipx/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/pipx/venv_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_animate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time

import pytest # type: ignore
import pytest # type: ignore[import-not-found]

import pipx.animate
from pipx.animate import (
Expand Down
2 changes: 1 addition & 1 deletion tests/test_emojis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_install_all_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_package_specifier.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pipx_metadata_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dataclasses import replace
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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_reinstall.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_reinstall_all.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_shared_libs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import time

import pytest # type: ignore
import pytest # type: ignore[import-not-found]

from pipx import shared_libs

Expand Down
2 changes: 1 addition & 1 deletion tests/test_uninstall.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

import pytest # type: ignore
import pytest # type: ignore[import-not-found]

from helpers import (
PIPX_METADATA_LEGACY_VERSIONS,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_uninstall_all.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_upgrade.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_upgrade_all.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_upgrade_shared.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import subprocess

import pytest # type: ignore
import pytest # type: ignore[import-not-found]

from helpers import run_pipx_cli

Expand Down

0 comments on commit 014130d

Please sign in to comment.