Skip to content

Commit 040eaee

Browse files
committed
fix: remove unused imports in tests and scripts for CI lint
1 parent 4803c27 commit 040eaee

File tree

6 files changed

+11
-15
lines changed

6 files changed

+11
-15
lines changed

scripts/collect-commits.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import sys
1212
from datetime import datetime
1313
from pathlib import Path
14-
from typing import List, Optional, Tuple
14+
from typing import List, Tuple
1515

1616

1717
def run_command(cmd: List[str]) -> Tuple[bool, str]:
@@ -23,15 +23,15 @@ def run_command(cmd: List[str]) -> Tuple[bool, str]:
2323
return False, e.stderr.strip()
2424

2525

26-
def get_latest_tag() -> Optional[str]:
26+
def get_latest_tag() -> str | None:
2727
"""Get the latest git tag"""
2828
success, output = run_command(["git", "describe", "--tags", "--abbrev=0"])
2929
if success and output:
3030
return output
3131
return None
3232

3333

34-
def get_commits_since_tag(tag: Optional[str] = None, max_count: Optional[int] = None) -> List[dict]:
34+
def get_commits_since_tag(tag: str | None = None, max_count: int | None = None) -> List[dict]:
3535
"""Get all commits since the specified tag (or all commits if no tag)"""
3636
if tag:
3737
cmd = ["git", "log", f"{tag}..HEAD", "--pretty=format:%H|%an|%ae|%ad|%s", "--date=iso"]
@@ -108,7 +108,7 @@ def categorize_commit(message: str) -> str:
108108
return "Other"
109109

110110

111-
def generate_commit_summary(commits: List[dict], latest_tag: Optional[str], max_count: Optional[int] = None) -> str:
111+
def generate_commit_summary(commits: List[dict], latest_tag: str | None, max_count: int | None = None) -> str:
112112
"""Generate a markdown summary of commits for Claude to process"""
113113

114114
if not commits:

scripts/release-wizard.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import subprocess
99
from pathlib import Path
10-
from typing import List, Optional, Tuple
10+
from typing import List, Tuple
1111

1212

1313
# 颜色和格式化
@@ -100,7 +100,7 @@ def ask_string(question: str, default: str = "") -> str:
100100
return response if response else default
101101

102102

103-
def run_command(cmd: List[str], cwd: Optional[str] = None) -> Tuple[bool, str]:
103+
def run_command(cmd: List[str], cwd: str | None = None) -> Tuple[bool, str]:
104104
"""运行命令"""
105105
try:
106106
result = subprocess.run(cmd, capture_output=True, text=True, check=True, cwd=cwd)
@@ -174,7 +174,7 @@ def check_prerequisites() -> bool:
174174
return True
175175

176176

177-
def collect_commits() -> Optional[str]:
177+
def collect_commits() -> str | None:
178178
"""收集提交信息"""
179179
print_step(2, 8, "收集提交信息")
180180

@@ -358,7 +358,7 @@ def edit_changelog() -> bool:
358358
return ask_yes_no("CHANGELOG.md 编辑完成了吗?", True)
359359

360360

361-
def determine_version() -> Optional[str]:
361+
def determine_version() -> str | None:
362362
"""确定版本号"""
363363
print_step(5, 8, "确定版本号")
364364

tests/test_dot_ignore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77

88
from src.repomix.cli.cli_run import create_parser
9-
from src.repomix.config.config_schema import RepomixConfig, RepomixConfigIgnore
9+
from src.repomix.config.config_schema import RepomixConfig
1010
from src.repomix.core.file.file_search import get_ignore_patterns
1111

1212

tests/test_multi_directory.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
import os
66
import tempfile
77
import pytest
8-
from pathlib import Path
98
from unittest.mock import patch, Mock
109

11-
from src.repomix.cli.cli_run import create_parser, execute_action
10+
from src.repomix.cli.cli_run import create_parser
1211
from src.repomix.cli.actions.default_action import run_default_action
1312
from src.repomix.core.repo_processor import RepoProcessor
1413
from src.repomix.config.config_schema import RepomixConfig

tests/test_output_control_flags.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
Test suite for --no-file-summary, --no-directory-structure, --no-files CLI flags (Issue #10)
33
"""
44

5-
import pytest
6-
from unittest.mock import patch, MagicMock
75

86
from src.repomix.cli.cli_run import create_parser
9-
from src.repomix.config.config_schema import RepomixConfig, RepomixConfigOutput
7+
from src.repomix.config.config_schema import RepomixConfig
108
from src.repomix.core.output.output_generate import generate_output
119
from src.repomix.core.file.file_types import ProcessedFile
1210

tests/test_token_count_encoding.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Test suite for --token-count-encoding CLI flag (Issue #14)
33
"""
44

5-
import pytest
65

76
from src.repomix.cli.cli_run import create_parser
87
from src.repomix.config.config_schema import RepomixConfig, RepomixConfigTokenCount

0 commit comments

Comments
 (0)