refactor(download): remove ProviderCore/download.py, move sanitize_filename to SYS.utils, replace callers to use API.HTTP.HTTPClient

This commit is contained in:
2026-01-06 01:38:59 -08:00
parent 3b363dd536
commit 41c11d39fd
38 changed files with 2640 additions and 526 deletions

View File

@@ -359,6 +359,8 @@ class ResultRow:
columns: List[ResultColumn] = field(default_factory=list)
selection_args: Optional[List[str]] = None
"""Arguments to use for this row when selected via @N syntax (e.g., ['-item', '3'])"""
selection_action: Optional[List[str]] = None
"""Full expanded stage tokens that should run when this row is selected."""
source_index: Optional[int] = None
"""Original insertion order index (used to map sorted views back to source items)."""
payload: Optional[Any] = None
@@ -648,6 +650,11 @@ class ResultTable:
if 0 <= row_index < len(self.rows):
self.rows[row_index].selection_args = selection_args
def set_row_selection_action(self, row_index: int, selection_action: List[str]) -> None:
"""Specify the entire stage tokens to run for this row on @N."""
if 0 <= row_index < len(self.rows):
self.rows[row_index].selection_action = selection_action
def set_header_lines(self, lines: List[str]) -> "ResultTable":
"""Attach metadata lines that render beneath the title."""
self.header_lines = [line for line in lines if line]
@@ -827,6 +834,30 @@ class ResultTable:
if hasattr(result, "annotations") and result.annotations:
row.add_column("Annotations", ", ".join(str(a) for a in result.annotations))
try:
md = getattr(result, "full_metadata", None)
md_dict = dict(md) if isinstance(md, dict) else {}
except Exception:
md_dict = {}
try:
selection_args = getattr(result, "selection_args", None)
except Exception:
selection_args = None
if selection_args is None:
selection_args = md_dict.get("_selection_args") or md_dict.get("selection_args")
if selection_args:
row.selection_args = [str(a) for a in selection_args if a is not None]
try:
selection_action = getattr(result, "selection_action", None)
except Exception:
selection_action = None
if selection_action is None:
selection_action = md_dict.get("_selection_action") or md_dict.get("selection_action")
if selection_action:
row.selection_action = [str(a) for a in selection_action if a is not None]
def _add_result_item(self, row: ResultRow, item: Any) -> None:
"""Extract and add ResultItem fields to row (compact display for search results).