Skip to content

Commit 13bc7cf

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0793175 commit 13bc7cf

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/pipx/commands/clean_cmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from pathlib import Path
5+
from typing import TYPE_CHECKING
66

77
from pipx.colors import bold, red
88
from pipx.constants import (
@@ -19,6 +19,9 @@
1919
from pipx.util import rmdir
2020
from pipx.venv import VenvContainer
2121

22+
if TYPE_CHECKING:
23+
from pathlib import Path
24+
2225

2326
def _cleanup_directory(
2427
path: Path,

src/pipx/main.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -742,16 +742,14 @@ def _add_reinstall(subparsers, venv_completer: VenvCompleter, shared_parser: arg
742742
p.add_argument("package").completer = venv_completer
743743
add_python_options(p)
744744

745-
def _add_clean(
746-
subparsers: argparse._SubParsersAction,
747-
shared_parser: argparse.ArgumentParser
748-
) -> None:
745+
746+
def _add_clean(subparsers: argparse._SubParsersAction, shared_parser: argparse.ArgumentParser) -> None:
749747
"""Add the clean command to the parser."""
750748
p = subparsers.add_parser(
751749
"clean",
752750
help="Completely reset pipx to first installation state",
753751
description=textwrap.dedent(
754-
f"""
752+
"""
755753
Removes all installed packages, temporary virtual environments,
756754
and cached data, effectively resetting pipx to its initial state.
757755
The granularity of the cleanup can be controlled using the following options:
@@ -792,7 +790,6 @@ def _add_clean(
792790
p.set_defaults(subparser=p)
793791

794792

795-
796793
def _add_reinstall_all(subparsers: argparse._SubParsersAction, shared_parser: argparse.ArgumentParser) -> None:
797794
p = subparsers.add_parser(
798795
"reinstall-all",

tests/test_clean.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import annotations
44

5-
from pathlib import Path
65
from unittest.mock import patch
76

87
import pytest
@@ -22,7 +21,6 @@
2221
EXIT_CODE_FULL_CLEANUP_FAIL,
2322
EXIT_CODE_LOGS_CLEANUP_FAIL,
2423
EXIT_CODE_OK,
25-
EXIT_CODE_TRASH_CLEANUP_FAIL,
2624
EXIT_CODE_VENVS_CLEANUP_FAIL,
2725
)
2826
from pipx.paths import ctx
@@ -406,7 +404,7 @@ class TestFullCleanup:
406404

407405
def test_full_cleanup_success(self, pipx_temp_env, capsys):
408406
"""Test full cleanup removes everything."""
409-
venv_dir = ctx.venvs / "package1"
407+
ctx.venvs / "package1"
410408
ctx.venv_cache.mkdir(parents=True, exist_ok=True)
411409
ctx.logs.mkdir(parents=True, exist_ok=True)
412410
(ctx.venv_cache / "cache_file").touch()

0 commit comments

Comments
 (0)