fix: resolve CI linting errors - remove unused imports and update type annotations
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"""Diff parser for unified git diff format."""
|
||||
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
from gdiffer.models import DiffFile, DiffHunk
|
||||
|
||||
@@ -16,6 +15,7 @@ class DiffParser:
|
||||
self.errors: list[str] = []
|
||||
|
||||
def parse(self, diff_content: str) -> list[DiffFile]:
|
||||
"""Parse diff content and return list of DiffFile objects."""
|
||||
self.files = []
|
||||
self.errors = []
|
||||
|
||||
@@ -42,7 +42,7 @@ class DiffParser:
|
||||
|
||||
i += 1
|
||||
|
||||
def _parse_file(self, lines: list[str], start: int) -> Optional[DiffFile]:
|
||||
def _parse_file(self, lines: list[str], start: int) -> DiffFile | None:
|
||||
if start >= len(lines):
|
||||
return None
|
||||
|
||||
@@ -120,7 +120,7 @@ class DiffParser:
|
||||
|
||||
return file_obj
|
||||
|
||||
def _parse_hunk(self, lines: list[str], start: int) -> tuple[Optional[DiffHunk], int]:
|
||||
def _parse_hunk(self, lines: list[str], start: int) -> tuple[DiffHunk | None, int]:
|
||||
if start >= len(lines):
|
||||
return None, 0
|
||||
|
||||
@@ -198,6 +198,6 @@ def parse_diff(diff_content: str) -> list[DiffFile]:
|
||||
|
||||
def parse_diff_from_file(filepath: str) -> list[DiffFile]:
|
||||
"""Read a diff file and parse its contents."""
|
||||
with open(filepath, 'r') as f:
|
||||
with open(filepath) as f:
|
||||
content = f.read()
|
||||
return parse_diff(content)
|
||||
|
||||
Reference in New Issue
Block a user