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