Skip to content

Commit

Permalink
refactor: clean up unused code
Browse files Browse the repository at this point in the history
These changes remove commented-out code and redundant methods that are no longer needed, improving code readability and maintainability.
  • Loading branch information
runner committed Dec 24, 2024
1 parent 7979127 commit 1eafc31
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions aicmt/git_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ def get_staged_changes(self) -> List[Change]:
for diff in diff_index:
status = "error"
content = ""
# insertions = diff.insertions if hasattr(diff, "insertions") else 0
# deletions = diff.deletions if hasattr(diff, "deletions") else 0
insertions = 0
deletions = 0

Expand Down Expand Up @@ -253,18 +251,6 @@ def _handle_untracked_file(self, file_path: str,
except UnicodeDecodeError:
return "new file (binary)", "[Binary file]"

def _handle_file_content(self, file_path: Path) -> Tuple[str, str]:
if not file_path.exists():
return "deleted", "[文件已删除]"

try:
content = file_path.read_bytes()
if b"\0" in content[:1024]:
return "new file (binary)", "[二进制文件]"
return "new file", file_path.read_text(encoding="utf-8")
except UnicodeDecodeError:
return "new file (binary)", "[二进制文件]"

def stage_files(self, files: List[str]) -> None:
"""Stage specified files
Expand Down Expand Up @@ -410,9 +396,6 @@ def get_commit_changes(self, commit_hash: str) -> List[Change]:
for diff in diff_index:
status = "error"
content = ""
# insertions = diff.insertions if hasattr(diff,
# "insertions") else 0
# deletions = diff.deletions if hasattr(diff, "deletions") else 0
insertions = 0
deletions = 0
try:
Expand Down

0 comments on commit 1eafc31

Please sign in to comment.