fix: resolve CI/CD linting and formatting issues
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled

- Replaced deprecated typing.Dict/List/Tuple with native types (UP035)
- Removed unused imports across all modules
- Fixed unused variables by replacing with _ prefix
- Added missing Optional type imports
- Reorganized imports for proper sorting (I001)
- Applied black formatting to all source files
This commit is contained in:
2026-02-02 08:52:10 +00:00
parent 8a68e0b691
commit 6c1104d60a

View File

@@ -1,18 +1,17 @@
"""Text output formatter."""
'''Text output formatter.'''
from datetime import datetime
from typing import Any, List
from typing import Any
from loglens.analyzers.analyzer import AnalysisResult
from loglens.parsers.base import ParsedLogEntry
from loglens.formatters.base import OutputFormatter
from loglens.parsers.base import ParsedLogEntry
class TextFormatter(OutputFormatter):
"""Simple text output formatter."""
'''Simple text output formatter.'''
def format(self, data: Any) -> str:
"""Format data as text."""
'''Format data as text.'''
if isinstance(data, AnalysisResult):
return self._format_analysis_result(data)
elif isinstance(data, list):
@@ -21,7 +20,7 @@ class TextFormatter(OutputFormatter):
return str(data)
def _format_analysis_result(self, result: AnalysisResult) -> str:
"""Format analysis result as text summary."""
'''Format analysis result as text summary.'''
lines = []
lines.append("=" * 60)
lines.append("LOG ANALYSIS SUMMARY")
@@ -58,8 +57,8 @@ class TextFormatter(OutputFormatter):
return "\n".join(lines)
def _format_entries(self, entries: List[ParsedLogEntry]) -> str:
"""Format log entries as text lines."""
def _format_entries(self, entries: list[ParsedLogEntry]) -> str:
'''Format log entries as text lines.'''
lines = []
for entry in entries:
parts = []
@@ -79,8 +78,8 @@ class TextFormatter(OutputFormatter):
return "\n".join(lines)
def format_entries_compact(self, entries: List[ParsedLogEntry], max_lines: int = 100) -> str:
"""Format entries compactly."""
def format_entries_compact(self, entries: list[ParsedLogEntry], max_lines: int = 100) -> str:
'''Format entries compactly.'''
lines = []
for entry in entries[:max_lines]:
severity = (entry.severity or "?").upper()[0]