fix: resolve CI/CD linting and formatting issues
Some checks failed
Some checks failed
- 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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user