Migrate imports to SYS package (pipeline/result_table) and update related imports
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
2025-12-29 23:28:15 -08:00
parent 30d3bf480b
commit ef01ca03a0
60 changed files with 162 additions and 149 deletions

View File

@@ -8,15 +8,15 @@ import tempfile
import re
from urllib.parse import urlsplit, parse_qs
import models
import pipeline as ctx
from SYS import models
from SYS import pipeline as ctx
from API import HydrusNetwork as hydrus_wrapper
from SYS.logger import log, debug
from SYS.pipeline_progress import PipelineProgress
from SYS.utils_constant import ALL_SUPPORTED_EXTENSIONS
from Store import Store
from . import _shared as sh
from result_table import ResultTable
from SYS.result_table import ResultTable
Cmdlet = sh.Cmdlet
CmdletArg = sh.CmdletArg
@@ -32,7 +32,7 @@ coerce_to_pipe_object = sh.coerce_to_pipe_object
collapse_namespace_tag = sh.collapse_namespace_tag
from API.folder import read_sidecar, find_sidecar, write_sidecar, API_folder_store
from SYS.utils import sha256_file, unique_path
from metadata import write_metadata
from SYS.metadata import write_metadata
# Canonical supported filetypes for all stores/cmdlets
SUPPORTED_MEDIA_EXTENSIONS = ALL_SUPPORTED_EXTENSIONS
@@ -266,7 +266,7 @@ class Add_File(Cmdlet):
# The user then runs @N (optionally piped), which replays add-file with selected paths.
if dir_scan_mode:
try:
from result_table import ResultTable
from SYS.result_table import ResultTable
from pathlib import Path as _Path
# Build base args to replay: keep everything except the directory -path.
@@ -1071,7 +1071,7 @@ class Add_File(Cmdlet):
)
if not refreshed_items:
# Fallback: at least show the add-file payloads as a display overlay
from result_table import ResultTable
from SYS.result_table import ResultTable
table = ResultTable("Result")
for payload in collected_payloads:
@@ -1578,7 +1578,7 @@ class Add_File(Cmdlet):
# If first item is a PipeObject object
try:
# models.PipeObject is an actual class; check attribute presence
import models as _models
from SYS import models as _models
if isinstance(first_item, _models.PipeObject):
path_candidate = getattr(first_item, "path", None)
@@ -1929,7 +1929,7 @@ class Add_File(Cmdlet):
@staticmethod
def _get_url(result: Any, pipe_obj: models.PipeObject) -> List[str]:
from metadata import normalize_urls
from SYS.metadata import normalize_urls
# Prefer explicit PipeObject.url if present
urls: List[str] = []
@@ -2092,7 +2092,7 @@ class Add_File(Cmdlet):
@staticmethod
def _emit_pipe_object(pipe_obj: models.PipeObject) -> None:
from result_table import format_result
from SYS.result_table import format_result
log(format_result(pipe_obj, title="Result"), file=sys.stderr)
ctx.emit(pipe_obj.to_dict())
@@ -2125,7 +2125,7 @@ class Add_File(Cmdlet):
return
try:
from result_table import ResultTable
from SYS.result_table import ResultTable
table = ResultTable("Result")
table.add_result(payload)
@@ -2518,7 +2518,7 @@ class Add_File(Cmdlet):
_best_subtitle_sidecar,
_read_text_file,
)
from models import DownloadOptions
from SYS.models import DownloadOptions
from tool.ytdlp import YtDlpTool
except Exception:
return []
@@ -2681,7 +2681,7 @@ class Add_File(Cmdlet):
paths = getattr(result_obj, "paths", None)
if isinstance(paths, list) and paths:
# Section downloads: create one result per file.
from models import DownloadMediaResult
from SYS.models import DownloadMediaResult
results = []
for p in paths:
@@ -3012,7 +3012,7 @@ class Add_File(Cmdlet):
ctx.set_current_stage_table(table)
print()
from rich_display import stdout_console
from SYS.rich_display import stdout_console
stdout_console().print(table)
print(
@@ -3142,7 +3142,7 @@ class Add_File(Cmdlet):
# If we're moving/copying from one store to another, also copy the source store's
# existing associated URLs so they aren't lost.
try:
from metadata import normalize_urls
from SYS.metadata import normalize_urls
source_store = None
source_hash = None