style: Apply ruff auto-fixes for Python 3.12
- Update type annotations to modern syntax (dict, list, X | Y) - Remove unnecessary elif after return - Minor style improvements Note: Some linting warnings remain (unused content param, inline conditions) but these are minor style issues and do not affect functionality. All tests pass with these changes.
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
"""Notification email compressor for terminal-friendly display."""
|
||||
|
||||
from typing import Dict, Any, Optional
|
||||
from textual.widgets import Markdown
|
||||
from typing import Any
|
||||
|
||||
from .notification_detector import (
|
||||
is_notification_email,
|
||||
NotificationType,
|
||||
classify_notification,
|
||||
extract_notification_summary,
|
||||
NotificationType,
|
||||
is_notification_email,
|
||||
)
|
||||
|
||||
|
||||
@@ -22,7 +21,7 @@ class NotificationCompressor:
|
||||
"""
|
||||
self.mode = mode
|
||||
|
||||
def should_compress(self, envelope: Dict[str, Any]) -> bool:
|
||||
def should_compress(self, envelope: dict[str, Any]) -> bool:
|
||||
"""Check if email should be compressed.
|
||||
|
||||
Args:
|
||||
@@ -37,8 +36,8 @@ class NotificationCompressor:
|
||||
return is_notification_email(envelope)
|
||||
|
||||
def compress(
|
||||
self, content: str, envelope: Dict[str, Any]
|
||||
) -> tuple[str, Optional[NotificationType]]:
|
||||
self, content: str, envelope: dict[str, Any]
|
||||
) -> tuple[str, NotificationType | None]:
|
||||
"""Compress notification email content.
|
||||
|
||||
Args:
|
||||
@@ -65,9 +64,9 @@ class NotificationCompressor:
|
||||
|
||||
def _format_as_markdown(
|
||||
self,
|
||||
summary: Dict[str, Any],
|
||||
envelope: Dict[str, Any],
|
||||
notif_type: Optional[NotificationType],
|
||||
summary: dict[str, Any],
|
||||
envelope: dict[str, Any],
|
||||
notif_type: NotificationType | None,
|
||||
) -> str:
|
||||
"""Format summary as markdown for terminal display.
|
||||
|
||||
@@ -138,9 +137,9 @@ class DetailedCompressor(NotificationCompressor):
|
||||
|
||||
def _format_as_markdown(
|
||||
self,
|
||||
summary: Dict[str, Any],
|
||||
envelope: Dict[str, Any],
|
||||
notif_type: Optional[NotificationType],
|
||||
summary: dict[str, Any],
|
||||
envelope: dict[str, Any],
|
||||
notif_type: NotificationType | None,
|
||||
) -> str:
|
||||
"""Format summary with more detail."""
|
||||
|
||||
@@ -217,5 +216,4 @@ def create_compressor(mode: str) -> NotificationCompressor:
|
||||
|
||||
if mode == "detailed":
|
||||
return DetailedCompressor(mode=mode)
|
||||
else:
|
||||
return NotificationCompressor(mode=mode)
|
||||
return NotificationCompressor(mode=mode)
|
||||
|
||||
Reference in New Issue
Block a user