From ef01ca03a0cd596ed252f33670199e7173906e31 Mon Sep 17 00:00:00 2001 From: Nose Date: Mon, 29 Dec 2025 23:28:15 -0800 Subject: [PATCH] Migrate imports to SYS package (pipeline/result_table) and update related imports --- .gitignore | 6 +++++- API/HydrusNetwork.py | 4 ++-- API/alldebrid.py | 2 +- CLI.py | 30 +++++++++++++------------- Provider/bandcamp.py | 4 ++-- Provider/fileio.py | 2 +- Provider/libgen.py | 2 +- Provider/matrix.py | 2 +- Provider/soulseek.py | 2 +- Provider/telegram.py | 2 +- Provider/zeroxzero.py | 2 +- ProviderCore/download.py | 2 +- SYS/download.py | 4 ++-- SYS/logger.py | 2 +- metadata.py => SYS/metadata.py | 4 ++-- models.py => SYS/models.py | 8 +++---- pipeline.py => SYS/pipeline.py | 2 +- SYS/pipeline_progress.py | 2 +- SYS/progress.py | 2 +- result_table.py => SYS/result_table.py | 6 +++--- rich_display.py => SYS/rich_display.py | 0 Store/Folder.py | 14 ++++++------ TUI/modalscreen/search.py | 2 +- TUI/pipeline_runner.py | 6 +++--- TUI/tui.py | 2 +- cmdlet/_shared.py | 12 +++++------ cmdlet/add_file.py | 28 ++++++++++++------------ cmdlet/add_note.py | 2 +- cmdlet/add_relationship.py | 2 +- cmdlet/add_tag.py | 4 ++-- cmdlet/add_url.py | 2 +- cmdlet/archive_file.py | 2 +- cmdlet/delete_file.py | 6 +++--- cmdlet/delete_note.py | 2 +- cmdlet/delete_relationship.py | 2 +- cmdlet/delete_tag.py | 4 ++-- cmdlet/delete_url.py | 4 ++-- cmdlet/download_file.py | 4 ++-- cmdlet/download_media.py | 18 ++++++++-------- cmdlet/get_file.py | 2 +- cmdlet/get_metadata.py | 4 ++-- cmdlet/get_note.py | 2 +- cmdlet/get_relationship.py | 10 ++++----- cmdlet/get_tag.py | 16 +++++++------- cmdlet/get_url.py | 7 +++--- cmdlet/merge_file.py | 4 ++-- cmdlet/screen_shot.py | 2 +- cmdlet/search_provider.py | 4 ++-- cmdlet/search_store.py | 4 ++-- cmdlet/trim_file.py | 2 +- cmdnat/adjective.py | 8 +++---- cmdnat/config.py | 2 +- cmdnat/help.py | 8 +++---- cmdnat/matrix.py | 4 ++-- cmdnat/out_table.py | 2 +- cmdnat/pipe.py | 6 +++--- cmdnat/telegram.py | 4 ++-- cmdnat/worker.py | 2 +- scripts/check_imports.py | 10 +++++++++ tool/ytdlp.py | 2 +- 60 files changed, 162 insertions(+), 149 deletions(-) rename metadata.py => SYS/metadata.py (99%) rename models.py => SYS/models.py (99%) rename pipeline.py => SYS/pipeline.py (99%) rename result_table.py => SYS/result_table.py (99%) rename rich_display.py => SYS/rich_display.py (100%) create mode 100644 scripts/check_imports.py diff --git a/.gitignore b/.gitignore index a234a38..ac3795d 100644 --- a/.gitignore +++ b/.gitignore @@ -228,4 +228,8 @@ Log/medeia_macina/telegram.session example.py test* MPV/portable_config/watch_later* -hydrusnetwork \ No newline at end of file +hydrusnetwork +.style.yapf +.yapfignore + + diff --git a/API/HydrusNetwork.py b/API/HydrusNetwork.py index a0d8354..28d8e0b 100644 --- a/API/HydrusNetwork.py +++ b/API/HydrusNetwork.py @@ -166,7 +166,7 @@ class HydrusNetwork: ) # Stream upload body with a stderr progress bar (pipeline-safe). - from models import ProgressBar + from SYS.models import ProgressBar bar = ProgressBar() # Keep the PipelineLiveProgress transfer line clean: show the file name. @@ -1087,7 +1087,7 @@ def hydrus_request(args, parser) -> int: def hydrus_export(args, _parser) -> int: - from metadata import apply_mutagen_metadata, build_ffmpeg_command, prepare_ffmpeg_metadata + from SYS.metadata import apply_mutagen_metadata, build_ffmpeg_command, prepare_ffmpeg_metadata output_path: Path = args.output original_suffix = output_path.suffix diff --git a/API/alldebrid.py b/API/alldebrid.py index d31a673..05d3e73 100644 --- a/API/alldebrid.py +++ b/API/alldebrid.py @@ -1077,7 +1077,7 @@ def _register_unlock_link(): Any] ) -> int: """Wrapper to make unlock_link_cmdlet available as cmdlet.""" - import pipeline as ctx + from SYS import pipeline as ctx ret_code = unlock_link_cmdlet(result, args, config) diff --git a/CLI.py b/CLI.py index 105f866..5643936 100644 --- a/CLI.py +++ b/CLI.py @@ -32,7 +32,7 @@ from rich.panel import Panel from rich.markdown import Markdown from rich.bar import Bar from rich.table import Table -from rich_display import stderr_console, stdout_console +from SYS.rich_display import stderr_console, stdout_console def _install_rich_traceback(*, show_locals: bool = False) -> None: @@ -66,7 +66,7 @@ from SYS.cmdlet_catalog import ( list_cmdlet_names, ) from SYS.config import get_local_storage_path, load_config -from result_table import ResultTable +from SYS.result_table import ResultTable class SelectionSyntax: @@ -1134,7 +1134,7 @@ class CmdletExecutor: return "Results" def execute(self, cmd_name: str, args: List[str]) -> None: - import pipeline as ctx + from SYS import pipeline as ctx from cmdlet import REGISTRY ensure_registry_loaded() @@ -1241,7 +1241,7 @@ class CmdletExecutor: return try: - from models import PipelineLiveProgress + from SYS.models import PipelineLiveProgress progress_ui = PipelineLiveProgress([cmd_name_norm], enabled=True) progress_ui.start() @@ -2436,7 +2436,7 @@ class PipelineExecutor: if (not quiet_mode) and bool(getattr(_sys.stderr, "isatty", lambda: False)()): - from models import PipelineLiveProgress + from SYS.models import PipelineLiveProgress pipe_stage_indices: List[int] = [] pipe_labels: List[str] = [] @@ -2502,7 +2502,7 @@ class PipelineExecutor: progress_ui = PipelineLiveProgress(pipe_labels, enabled=True) progress_ui.start() try: - import pipeline as _pipeline_ctx + from SYS import pipeline as _pipeline_ctx if hasattr(_pipeline_ctx, "set_live_progress"): _pipeline_ctx.set_live_progress(progress_ui) @@ -2520,7 +2520,7 @@ class PipelineExecutor: def execute_tokens(self, tokens: List[str]) -> None: from cmdlet import REGISTRY - import pipeline as ctx + from SYS import pipeline as ctx try: self._try_clear_pipeline_stop(ctx) @@ -2999,7 +2999,7 @@ class PipelineExecutor: except Exception: pass try: - import pipeline as _pipeline_ctx + from SYS import pipeline as _pipeline_ctx if hasattr(_pipeline_ctx, "set_live_progress"): _pipeline_ctx.set_live_progress(None) @@ -3142,7 +3142,7 @@ class PipelineExecutor: except Exception: pass try: - import pipeline as _pipeline_ctx + from SYS import pipeline as _pipeline_ctx if hasattr(_pipeline_ctx, "set_live_progress"): @@ -3199,7 +3199,7 @@ class PipelineExecutor: except Exception: pass try: - import pipeline as _pipeline_ctx + from SYS import pipeline as _pipeline_ctx if hasattr(_pipeline_ctx, "set_live_progress"): _pipeline_ctx.set_live_progress(None) @@ -3354,7 +3354,7 @@ class PipelineExecutor: except Exception: pass try: - import pipeline as _pipeline_ctx + from SYS import pipeline as _pipeline_ctx if hasattr(_pipeline_ctx, "set_live_progress"): _pipeline_ctx.set_live_progress(None) @@ -3485,7 +3485,7 @@ class MedeiaCLI: help="JSON string of seed items" ), ) -> None: - import pipeline as ctx + from SYS import pipeline as ctx config = self._config_loader.load() debug_enabled = bool(config.get("debug", False)) @@ -4229,7 +4229,7 @@ Come to love it when others take what you share, as there is no greater joy pipeline_ctx_ref = None try: - import pipeline as ctx + from SYS import pipeline as ctx ctx.set_current_command_text(user_input) pipeline_ctx_ref = ctx @@ -4257,7 +4257,7 @@ Come to love it when others take what you share, as there is no greater joy if len(tokens) == 1 and tokens[0] == "@,,": try: - import pipeline as ctx + from SYS import pipeline as ctx if ctx.restore_next_result_table(): last_table = ( @@ -4286,7 +4286,7 @@ Come to love it when others take what you share, as there is no greater joy if len(tokens) == 1 and tokens[0] == "@..": try: - import pipeline as ctx + from SYS import pipeline as ctx if ctx.restore_previous_result_table(): last_table = ( diff --git a/Provider/bandcamp.py b/Provider/bandcamp.py index 1598605..4ef7f61 100644 --- a/Provider/bandcamp.py +++ b/Provider/bandcamp.py @@ -206,8 +206,8 @@ class Bandcamp(Provider): # Build a new table from artist discography. try: - from result_table import ResultTable - from rich_display import stdout_console + from SYS.result_table import ResultTable + from SYS.rich_display import stdout_console except Exception: return False diff --git a/Provider/fileio.py b/Provider/fileio.py index b43560b..a06b635 100644 --- a/Provider/fileio.py +++ b/Provider/fileio.py @@ -70,7 +70,7 @@ class FileIO(Provider): def upload(self, file_path: str, **kwargs: Any) -> str: from API.HTTP import HTTPClient - from models import ProgressFileReader + from SYS.models import ProgressFileReader if not os.path.exists(file_path): raise FileNotFoundError(f"File not found: {file_path}") diff --git a/Provider/libgen.py b/Provider/libgen.py index 8719866..d049aed 100644 --- a/Provider/libgen.py +++ b/Provider/libgen.py @@ -13,7 +13,7 @@ from urllib.parse import urljoin, urlparse, unquote from ProviderCore.base import Provider, SearchResult from ProviderCore.download import sanitize_filename from SYS.logger import log -from models import ProgressBar +from SYS.models import ProgressBar # Optional dependency for HTML scraping fallbacks try: diff --git a/Provider/matrix.py b/Provider/matrix.py index 5f24523..26bf6f7 100644 --- a/Provider/matrix.py +++ b/Provider/matrix.py @@ -359,7 +359,7 @@ class Matrix(Provider): def upload_to_room(self, file_path: str, room_id: str, **kwargs: Any) -> str: """Upload a file and send it to a specific room.""" - from models import ProgressFileReader + from SYS.models import ProgressFileReader path = Path(file_path) if not path.exists(): diff --git a/Provider/soulseek.py b/Provider/soulseek.py index 07fe83b..12da283 100644 --- a/Provider/soulseek.py +++ b/Provider/soulseek.py @@ -13,7 +13,7 @@ from typing import Any, Dict, List, Optional from ProviderCore.base import Provider, SearchResult from SYS.logger import log, debug -from models import ProgressBar +from SYS.models import ProgressBar _SOULSEEK_NOISE_SUBSTRINGS = ( "search reply ticket does not match any search request", diff --git a/Provider/telegram.py b/Provider/telegram.py index e70d359..fffe3c0 100644 --- a/Provider/telegram.py +++ b/Provider/telegram.py @@ -1058,7 +1058,7 @@ class Telegram(Provider): except Exception: pass - from models import ProgressBar + from SYS.models import ProgressBar progress_bar = ProgressBar() last_print = { diff --git a/Provider/zeroxzero.py b/Provider/zeroxzero.py index 77c4caf..658f0e7 100644 --- a/Provider/zeroxzero.py +++ b/Provider/zeroxzero.py @@ -13,7 +13,7 @@ class ZeroXZero(Provider): def upload(self, file_path: str, **kwargs: Any) -> str: from API.HTTP import HTTPClient - from models import ProgressFileReader + from SYS.models import ProgressFileReader if not os.path.exists(file_path): raise FileNotFoundError(f"File not found: {file_path}") diff --git a/ProviderCore/download.py b/ProviderCore/download.py index e256dfd..04ec43f 100644 --- a/ProviderCore/download.py +++ b/ProviderCore/download.py @@ -6,7 +6,7 @@ import sys import requests -from models import ProgressBar +from SYS.models import ProgressBar def sanitize_filename(name: str, *, max_len: int = 150) -> str: diff --git a/SYS/download.py b/SYS/download.py index 38dafbe..b66e2c4 100644 --- a/SYS/download.py +++ b/SYS/download.py @@ -28,7 +28,7 @@ import httpx from SYS.logger import log, debug from SYS.utils import ensure_directory, sha256_file from API.HTTP import HTTPClient -from models import DownloadError, DownloadOptions, DownloadMediaResult, DebugLogger, ProgressBar +from SYS.models import DownloadError, DownloadOptions, DownloadMediaResult, DebugLogger, ProgressBar try: import yt_dlp # type: ignore @@ -40,7 +40,7 @@ else: YTDLP_IMPORT_ERROR = None try: - from metadata import extract_ytdlp_tags + from SYS.metadata import extract_ytdlp_tags except ImportError: extract_ytdlp_tags = None diff --git a/SYS/logger.py b/SYS/logger.py index e0a5117..0ca8c89 100644 --- a/SYS/logger.py +++ b/SYS/logger.py @@ -5,7 +5,7 @@ import inspect import threading from pathlib import Path -from rich_display import console_for +from SYS.rich_display import console_for _DEBUG_ENABLED = False _thread_local = threading.local() diff --git a/metadata.py b/SYS/metadata.py similarity index 99% rename from metadata.py rename to SYS/metadata.py index d392de3..c2d4ba9 100644 --- a/metadata.py +++ b/SYS/metadata.py @@ -8,7 +8,7 @@ from urllib.parse import urlsplit, urlunsplit, unquote from collections import deque from pathlib import Path from typing import Any, Dict, Iterable, List, Optional, Sequence, Set, Tuple -from models import FileRelationshipTracker +from SYS.models import FileRelationshipTracker try: import musicbrainzngs # type: ignore @@ -3874,7 +3874,7 @@ def scrape_url_metadata( import json as json_module try: - from metadata import extract_ytdlp_tags + from SYS.metadata import extract_ytdlp_tags except ImportError: extract_ytdlp_tags = None diff --git a/models.py b/SYS/models.py similarity index 99% rename from models.py rename to SYS/models.py index a255148..375d9e6 100644 --- a/models.py +++ b/SYS/models.py @@ -114,7 +114,7 @@ class PipeObject: cmdlet_name = "PipeObject" try: - import pipeline as ctx + from SYS import pipeline as ctx current = ( ctx.get_current_cmdlet_name("") @@ -482,7 +482,7 @@ class ProgressBar: # Prefer integrating with the pipeline Live UI to avoid nested Rich Live instances. try: - import pipeline as pipeline_context + from SYS import pipeline as pipeline_context ui = pipeline_context.get_live_progress() if ui is not None and hasattr(ui, @@ -510,7 +510,7 @@ class ProgressBar: # Use shared stderr console when rendering to stderr (cooperates with PipelineLiveProgress). if stream is sys.stderr: try: - from rich_display import stderr_console + from SYS.rich_display import stderr_console console = stderr_console() except Exception: @@ -878,7 +878,7 @@ class PipelineLiveProgress: # tables/prompts in download-media) cooperate with Rich Live rendering. # If we create a separate Console(file=sys.stderr), output will fight for # terminal cursor control and appear "blocked"/truncated. - from rich_display import stderr_console + from SYS.rich_display import stderr_console self._console = stderr_console() diff --git a/pipeline.py b/SYS/pipeline.py similarity index 99% rename from pipeline.py rename to SYS/pipeline.py index 4c03127..b934555 100644 --- a/pipeline.py +++ b/SYS/pipeline.py @@ -23,7 +23,7 @@ import shlex from contextlib import contextmanager from typing import Any, Dict, List, Optional, Sequence -from models import PipelineStageContext +from SYS.models import PipelineStageContext from SYS.logger import log # Live progress UI instance (optional). Set by the pipeline runner. diff --git a/SYS/pipeline_progress.py b/SYS/pipeline_progress.py index c31bf3a..e7d27f2 100644 --- a/SYS/pipeline_progress.py +++ b/SYS/pipeline_progress.py @@ -184,7 +184,7 @@ class PipelineProgress: return False try: - from models import PipelineLiveProgress + from SYS.models import PipelineLiveProgress ui = PipelineLiveProgress([str(label or "pipeline")], enabled=True) ui.start() diff --git a/SYS/progress.py b/SYS/progress.py index c82c7a3..a11b1af 100644 --- a/SYS/progress.py +++ b/SYS/progress.py @@ -8,7 +8,7 @@ from __future__ import annotations import sys -from models import ProgressBar +from SYS.models import ProgressBar _BAR = ProgressBar() diff --git a/result_table.py b/SYS/result_table.py similarity index 99% rename from result_table.py rename to SYS/result_table.py index 4ba3512..a21cb96 100644 --- a/result_table.py +++ b/SYS/result_table.py @@ -441,7 +441,7 @@ class ResultTable: """ self.title = title try: - import pipeline as ctx + from SYS import pipeline as ctx cmdlet_name = "" try: @@ -1277,14 +1277,14 @@ class ResultTable: If accept_args=True: Dict with "indices" and "args" keys, or None if cancelled """ if self.no_choice: - from rich_display import stdout_console + from SYS.rich_display import stdout_console stdout_console().print(self) stdout_console().print(Panel(Text("Selection is disabled for this table."))) return None # Display the table - from rich_display import stdout_console + from SYS.rich_display import stdout_console stdout_console().print(self) diff --git a/rich_display.py b/SYS/rich_display.py similarity index 100% rename from rich_display.py rename to SYS/rich_display.py diff --git a/Store/Folder.py b/Store/Folder.py index db13dfd..95a7674 100644 --- a/Store/Folder.py +++ b/Store/Folder.py @@ -419,7 +419,7 @@ class Folder(Store): # Move or copy file (with progress bar on actual byte transfer). # Note: a same-volume move may be a fast rename and won't show progress. def _copy_with_progress(src: Path, dst: Path, *, label: str) -> None: - from models import ProgressFileReader + from SYS.models import ProgressFileReader total_bytes = None try: @@ -1421,7 +1421,7 @@ class Folder(Store): if isinstance(t, str) and t.strip() ] - from metadata import compute_namespaced_tag_overwrite + from SYS.metadata import compute_namespaced_tag_overwrite _to_remove, _to_add, merged = compute_namespaced_tag_overwrite( existing_tags, tag or [] @@ -1488,7 +1488,7 @@ class Folder(Store): file_hash = file_identifier if self._location: try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls with API_folder_store(Path(self._location)) as db: meta = db.get_metadata(file_hash) or {} @@ -1509,7 +1509,7 @@ class Folder(Store): file_hash = file_identifier if self._location: try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls with API_folder_store(Path(self._location)) as db: meta = db.get_metadata(file_hash) or {} @@ -1550,7 +1550,7 @@ class Folder(Store): # Normalize + coalesce duplicates per hash. try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls except Exception: normalize_urls = None # type: ignore @@ -1689,7 +1689,7 @@ class Folder(Store): file_hash = file_identifier if self._location: try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls with API_folder_store(Path(self._location)) as db: meta = db.get_metadata(file_hash) or {} @@ -1726,7 +1726,7 @@ class Folder(Store): return False try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls except Exception: normalize_urls = None # type: ignore diff --git a/TUI/modalscreen/search.py b/TUI/modalscreen/search.py index 56f9dbb..bf5451b 100644 --- a/TUI/modalscreen/search.py +++ b/TUI/modalscreen/search.py @@ -15,7 +15,7 @@ import asyncio # Add parent directory to path for imports sys.path.insert(0, str(Path(__file__).parent.parent)) from SYS.config import load_config, resolve_output_dir -from result_table import ResultTable +from SYS.result_table import ResultTable from ProviderCore.registry import get_search_provider logger = logging.getLogger(__name__) diff --git a/TUI/pipeline_runner.py b/TUI/pipeline_runner.py index 3ccc231..bfaf1a3 100644 --- a/TUI/pipeline_runner.py +++ b/TUI/pipeline_runner.py @@ -21,11 +21,11 @@ for path in (ROOT_DIR, BASE_DIR): if str_path not in sys.path: sys.path.insert(0, str_path) -import pipeline as ctx +from SYS import pipeline as ctx from CLI import ConfigLoader, PipelineExecutor as CLIPipelineExecutor, WorkerManagerRegistry from SYS.logger import set_debug -from rich_display import capture_rich_output -from result_table import ResultTable +from SYS.rich_display import capture_rich_output +from SYS.result_table import ResultTable @dataclass(slots=True) diff --git a/TUI/tui.py b/TUI/tui.py index 979f15a..58edfad 100644 --- a/TUI/tui.py +++ b/TUI/tui.py @@ -36,7 +36,7 @@ for path in (BASE_DIR, ROOT_DIR): sys.path.insert(0, str_path) from pipeline_runner import PipelineRunResult # type: ignore # noqa: E402 -from result_table import ResultTable # type: ignore # noqa: E402 +from SYS.result_table import ResultTable # type: ignore # noqa: E402 from SYS.config import load_config # type: ignore # noqa: E402 from Store.registry import Store as StoreRegistry # type: ignore # noqa: E402 diff --git a/cmdlet/_shared.py b/cmdlet/_shared.py index 01822c5..21d11d5 100644 --- a/cmdlet/_shared.py +++ b/cmdlet/_shared.py @@ -11,7 +11,7 @@ from SYS.logger import log from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Set from dataclasses import dataclass, field -import models +from SYS import models @dataclass @@ -1519,13 +1519,13 @@ def _unique_destination_path(dest: Path) -> Path: def _print_live_safe_stderr(message: str) -> None: """Print to stderr without breaking Rich Live progress output.""" try: - from rich_display import stderr_console # type: ignore + from SYS.rich_display import stderr_console # type: ignore except Exception: return cm = None try: - import pipeline as _pipeline_ctx # type: ignore + from SYS import pipeline as _pipeline_ctx # type: ignore suspend = getattr(_pipeline_ctx, "suspend_live_progress", None) cm = suspend() if callable(suspend) else None @@ -1714,14 +1714,14 @@ def _print_saved_output_panel(item: Any, final_path: Path) -> None: try: from rich.panel import Panel # type: ignore from rich.table import Table # type: ignore - from rich_display import stderr_console # type: ignore + from SYS.rich_display import stderr_console # type: ignore except Exception: return # If Rich Live progress is active, pause it while printing so the panel # doesn't get overwritten/truncated by Live's cursor control. try: - import pipeline as _pipeline_ctx # type: ignore + from SYS import pipeline as _pipeline_ctx # type: ignore suspend = getattr(_pipeline_ctx, "suspend_live_progress", None) cm = suspend() if callable(suspend) else None @@ -2255,7 +2255,7 @@ def coerce_to_pipe_object( } # Extract URL: prefer direct url field, then url list - from metadata import normalize_urls + from SYS.metadata import normalize_urls url_list = normalize_urls(value.get("url")) url_val = url_list[0] if url_list else None diff --git a/cmdlet/add_file.py b/cmdlet/add_file.py index 847f693..75885ca 100644 --- a/cmdlet/add_file.py +++ b/cmdlet/add_file.py @@ -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 diff --git a/cmdlet/add_note.py b/cmdlet/add_note.py index 8ccabbd..3ff4458 100644 --- a/cmdlet/add_note.py +++ b/cmdlet/add_note.py @@ -7,7 +7,7 @@ import re from SYS.logger import log -import pipeline as ctx +from SYS import pipeline as ctx from . import _shared as sh Cmdlet = sh.Cmdlet diff --git a/cmdlet/add_relationship.py b/cmdlet/add_relationship.py index e9a82c5..b0adc69 100644 --- a/cmdlet/add_relationship.py +++ b/cmdlet/add_relationship.py @@ -9,7 +9,7 @@ import sys from SYS.logger import log -import pipeline as ctx +from SYS import pipeline as ctx from API import HydrusNetwork as hydrus_wrapper from . import _shared as sh diff --git a/cmdlet/add_tag.py b/cmdlet/add_tag.py index fb13a63..12b374d 100644 --- a/cmdlet/add_tag.py +++ b/cmdlet/add_tag.py @@ -7,8 +7,8 @@ import re from SYS.logger import log -import models -import pipeline as ctx +from SYS import models +from SYS import pipeline as ctx from . import _shared as sh normalize_result_input = sh.normalize_result_input diff --git a/cmdlet/add_url.py b/cmdlet/add_url.py index 3ead535..8ea5dc4 100644 --- a/cmdlet/add_url.py +++ b/cmdlet/add_url.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Any, Dict, List, Optional, Sequence, Tuple import sys -import pipeline as ctx +from SYS import pipeline as ctx from . import _shared as sh from SYS.logger import log from Store import Store diff --git a/cmdlet/archive_file.py b/cmdlet/archive_file.py index 319a779..95a1d3a 100644 --- a/cmdlet/archive_file.py +++ b/cmdlet/archive_file.py @@ -14,7 +14,7 @@ from urllib.parse import parse_qs, urlparse from SYS.logger import log -import pipeline as ctx +from SYS import pipeline as ctx from SYS.config import resolve_output_dir from . import _shared as sh diff --git a/cmdlet/delete_file.py b/cmdlet/delete_file.py index 9468ab2..a26e476 100644 --- a/cmdlet/delete_file.py +++ b/cmdlet/delete_file.py @@ -12,9 +12,9 @@ from Store.Folder import Folder from Store import Store from . import _shared as sh from API import HydrusNetwork as hydrus_wrapper -import pipeline as ctx -from result_table import ResultTable, _format_size -from rich_display import stdout_console +from SYS import pipeline as ctx +from SYS.result_table import ResultTable, _format_size +from SYS.rich_display import stdout_console class Delete_File(sh.Cmdlet): diff --git a/cmdlet/delete_note.py b/cmdlet/delete_note.py index 055b9cb..cda7795 100644 --- a/cmdlet/delete_note.py +++ b/cmdlet/delete_note.py @@ -6,7 +6,7 @@ import sys from SYS.logger import log -import pipeline as ctx +from SYS import pipeline as ctx from . import _shared as sh Cmdlet = sh.Cmdlet diff --git a/cmdlet/delete_relationship.py b/cmdlet/delete_relationship.py index 2592181..a88ae0a 100644 --- a/cmdlet/delete_relationship.py +++ b/cmdlet/delete_relationship.py @@ -9,7 +9,7 @@ import sys from SYS.logger import log -import pipeline as ctx +from SYS import pipeline as ctx from . import _shared as sh Cmdlet = sh.Cmdlet diff --git a/cmdlet/delete_tag.py b/cmdlet/delete_tag.py index 06b07c7..f92434f 100644 --- a/cmdlet/delete_tag.py +++ b/cmdlet/delete_tag.py @@ -5,8 +5,8 @@ from pathlib import Path import json import sys -import models -import pipeline as ctx +from SYS import models +from SYS import pipeline as ctx from . import _shared as sh Cmdlet = sh.Cmdlet diff --git a/cmdlet/delete_url.py b/cmdlet/delete_url.py index 125b9a9..b9b1fe9 100644 --- a/cmdlet/delete_url.py +++ b/cmdlet/delete_url.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Any, Dict, List, Optional, Sequence, Tuple import sys -import pipeline as ctx +from SYS import pipeline as ctx from . import _shared as sh Cmdlet, CmdletArg, SharedArgs, parse_cmdlet_args, get_field, normalize_hash = ( @@ -91,7 +91,7 @@ class Delete_Url(Cmdlet): log("Error: Invalid hash format") return 1 - from metadata import normalize_urls + from SYS.metadata import normalize_urls def _urls_from_arg(raw: Any) -> List[str]: if raw is None: diff --git a/cmdlet/download_file.py b/cmdlet/download_file.py index e0a2919..877be90 100644 --- a/cmdlet/download_file.py +++ b/cmdlet/download_file.py @@ -17,7 +17,7 @@ from urllib.parse import urlparse from SYS.download import DownloadError, _download_direct_file from SYS.logger import log, debug from SYS.pipeline_progress import PipelineProgress -import pipeline as pipeline_context +from SYS import pipeline as pipeline_context from . import _shared as sh @@ -243,7 +243,7 @@ class Download_File(Cmdlet): ) try: - from result_table import ResultTable + from SYS.result_table import ResultTable except Exception as exc: log(f"download-file: ResultTable unavailable: {exc}", file=sys.stderr) return 1 diff --git a/cmdlet/download_media.py b/cmdlet/download_media.py index 84c06e8..59a0c0f 100644 --- a/cmdlet/download_media.py +++ b/cmdlet/download_media.py @@ -30,11 +30,11 @@ from urllib.parse import urlparse from SYS.logger import log, debug from SYS.pipeline_progress import PipelineProgress from SYS.utils import sha256_file -from models import DownloadError, DownloadOptions, DownloadMediaResult, DebugLogger, ProgressBar -import pipeline as pipeline_context -from result_table import ResultTable +from SYS.models import DownloadError, DownloadOptions, DownloadMediaResult, DebugLogger, ProgressBar +from SYS import pipeline as pipeline_context +from SYS.result_table import ResultTable from rich.prompt import Confirm -from rich_display import stderr_console as get_stderr_console +from SYS.rich_display import stderr_console as get_stderr_console from . import _shared as sh QueryArg = sh.QueryArg @@ -150,7 +150,7 @@ else: YTDLP_IMPORT_ERROR = None try: - from metadata import extract_ytdlp_tags + from SYS.metadata import extract_ytdlp_tags except ImportError: extract_ytdlp_tags = None @@ -1718,7 +1718,7 @@ class Download_Media(Cmdlet): debug(f"Preflight URL check: candidate={candidate_url}") try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls except Exception: normalize_urls = None # type: ignore[assignment] @@ -1879,7 +1879,7 @@ class Download_Media(Cmdlet): # Keep the full payload for history/inspection, but display a focused table. # Use shared extractors so Ext/Size/Store/Hash remain consistent everywhere. try: - from result_table import build_display_row + from SYS.result_table import build_display_row except Exception: build_display_row = None # type: ignore @@ -2032,7 +2032,7 @@ class Download_Media(Cmdlet): return True try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls except Exception: normalize_urls = None # type: ignore[assignment] @@ -2236,7 +2236,7 @@ class Download_Media(Cmdlet): ) or hit.get("sha256") or "" try: - from result_table import build_display_row + from SYS.result_table import build_display_row except Exception: build_display_row = None # type: ignore diff --git a/cmdlet/get_file.py b/cmdlet/get_file.py index 6ffd45a..158dfb9 100644 --- a/cmdlet/get_file.py +++ b/cmdlet/get_file.py @@ -15,7 +15,7 @@ import webbrowser from urllib.parse import urljoin from urllib.request import pathname2url -import pipeline as ctx +from SYS import pipeline as ctx from . import _shared as sh from SYS.logger import log, debug from Store import Store diff --git a/cmdlet/get_metadata.py b/cmdlet/get_metadata.py index 48e77bf..5186a12 100644 --- a/cmdlet/get_metadata.py +++ b/cmdlet/get_metadata.py @@ -14,8 +14,8 @@ CmdletArg = sh.CmdletArg SharedArgs = sh.SharedArgs parse_cmdlet_args = sh.parse_cmdlet_args get_field = sh.get_field -import pipeline as ctx -from result_table import ResultTable +from SYS import pipeline as ctx +from SYS.result_table import ResultTable class Get_Metadata(Cmdlet): diff --git a/cmdlet/get_note.py b/cmdlet/get_note.py index 82e32bd..9878d9f 100644 --- a/cmdlet/get_note.py +++ b/cmdlet/get_note.py @@ -6,7 +6,7 @@ import sys from SYS.logger import log -import pipeline as ctx +from SYS import pipeline as ctx from . import _shared as sh Cmdlet = sh.Cmdlet diff --git a/cmdlet/get_relationship.py b/cmdlet/get_relationship.py index b5e2574..fa1b2ea 100644 --- a/cmdlet/get_relationship.py +++ b/cmdlet/get_relationship.py @@ -7,8 +7,8 @@ from pathlib import Path from SYS.logger import log -import models -import pipeline as ctx +from SYS import models +from SYS import pipeline as ctx from API import HydrusNetwork as hydrus_wrapper from . import _shared as sh @@ -23,7 +23,7 @@ should_show_help = sh.should_show_help get_field = sh.get_field from API.folder import API_folder_store from SYS.config import get_local_storage_path -from result_table import ResultTable +from SYS.result_table import ResultTable from Store import Store CMDLET = Cmdlet( @@ -502,7 +502,7 @@ def _run(result: Any, _args: Sequence[str], config: Dict[str, Any]) -> int: if not found_relationships: try: from rich.panel import Panel - from rich_display import stdout_console + from SYS.rich_display import stdout_console title = source_title or (hash_hex[:16] + "..." if hash_hex else "Item") stdout_console().print( @@ -569,7 +569,7 @@ def _run(result: Any, _args: Sequence[str], config: Dict[str, Any]) -> int: ) ctx.set_last_result_table(table, pipeline_results) - from rich_display import stdout_console + from SYS.rich_display import stdout_console stdout_console().print(table) diff --git a/cmdlet/get_tag.py b/cmdlet/get_tag.py index 139cf5b..901fa48 100644 --- a/cmdlet/get_tag.py +++ b/cmdlet/get_tag.py @@ -27,7 +27,7 @@ import subprocess from pathlib import Path from typing import Any, Dict, List, Optional, Sequence, Tuple -import pipeline as ctx +from SYS import pipeline as ctx from API import HydrusNetwork from API.folder import read_sidecar, write_sidecar, find_sidecar, API_folder_store from . import _shared as sh @@ -42,7 +42,7 @@ get_field = sh.get_field from SYS.config import get_local_storage_path try: - from metadata import extract_title + from SYS.metadata import extract_title except ImportError: extract_title = None @@ -152,7 +152,7 @@ def _resolve_candidate_urls_for_item( ) -> List[str]: """Get candidate URLs from backend and/or piped result.""" try: - from metadata import normalize_urls + from SYS.metadata import normalize_urls except Exception: normalize_urls = None # type: ignore[assignment] @@ -328,7 +328,7 @@ def _emit_tags_as_table( This replaces _print_tag_list to make tags pipe-able. Stores the table in ctx._LAST_RESULT_TABLE for downstream @ selection. """ - from result_table import ResultTable + from SYS.result_table import ResultTable # Create ResultTable with just tag column (no title) # Keep the title stable and avoid including hash fragments. @@ -776,7 +776,7 @@ def _scrape_url_metadata( import json as json_module try: - from metadata import extract_ytdlp_tags + from SYS.metadata import extract_ytdlp_tags except ImportError: extract_ytdlp_tags = None @@ -956,7 +956,7 @@ def _scrape_url_metadata( # Deduplicate tags by namespace to prevent duplicate title:, artist:, etc. try: - from metadata import dedup_tags_by_namespace as _dedup + from SYS.metadata import dedup_tags_by_namespace as _dedup if _dedup: tags = _dedup(tags, keep_first=True) @@ -1265,7 +1265,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int: return 1 try: - from metadata import extract_ytdlp_tags + from SYS.metadata import extract_ytdlp_tags except Exception: extract_ytdlp_tags = None # type: ignore[assignment] @@ -1554,7 +1554,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int: ) return 0 - from result_table import ResultTable + from SYS.result_table import ResultTable table = ResultTable(f"Metadata: {provider.name}") table.set_source_command("get-tag", []) diff --git a/cmdlet/get_url.py b/cmdlet/get_url.py index 2861759..8c2bff5 100644 --- a/cmdlet/get_url.py +++ b/cmdlet/get_url.py @@ -6,8 +6,6 @@ import sys import re from fnmatch import fnmatch from urllib.parse import urlparse - -import pipeline as ctx from . import _shared as sh Cmdlet, SharedArgs, parse_cmdlet_args, get_field, normalize_hash = ( @@ -19,6 +17,7 @@ Cmdlet, SharedArgs, parse_cmdlet_args, get_field, normalize_hash = ( ) from SYS.logger import log from Store import Store +from SYS import pipeline as ctx @dataclass @@ -172,7 +171,7 @@ class Get_Url(Cmdlet): return 1 # Create result table - from result_table import ResultTable + from SYS.result_table import ResultTable table = ( ResultTable( @@ -244,7 +243,7 @@ class Get_Url(Cmdlet): urls = backend.get_url(file_hash) - from result_table import ResultTable + from SYS.result_table import ResultTable title = str(get_field(result, "title") or "").strip() table_title = "Title" diff --git a/cmdlet/merge_file.py b/cmdlet/merge_file.py index e032605..cc94c67 100644 --- a/cmdlet/merge_file.py +++ b/cmdlet/merge_file.py @@ -26,7 +26,7 @@ normalize_result_input = sh.normalize_result_input parse_cmdlet_args = sh.parse_cmdlet_args should_show_help = sh.should_show_help -import pipeline as ctx +from SYS import pipeline as ctx try: from pypdf import PdfWriter, PdfReader @@ -38,7 +38,7 @@ except ImportError: PdfReader = None try: - from metadata import ( + from SYS.metadata import ( read_tags_from_file, merge_multiple_tag_lists, ) diff --git a/cmdlet/screen_shot.py b/cmdlet/screen_shot.py index 9a26f9e..47b185a 100644 --- a/cmdlet/screen_shot.py +++ b/cmdlet/screen_shot.py @@ -30,7 +30,7 @@ normalize_result_input = sh.normalize_result_input should_show_help = sh.should_show_help get_field = sh.get_field parse_cmdlet_args = sh.parse_cmdlet_args -import pipeline as pipeline_context +from SYS import pipeline as pipeline_context # ============================================================================ # CMDLET Metadata Declaration diff --git a/cmdlet/search_provider.py b/cmdlet/search_provider.py index fa6d815..8d5329f 100644 --- a/cmdlet/search_provider.py +++ b/cmdlet/search_provider.py @@ -18,7 +18,7 @@ Cmdlet, CmdletArg, should_show_help = ( sh.CmdletArg, sh.should_show_help, ) -import pipeline as ctx +from SYS import pipeline as ctx # Optional dependencies try: @@ -226,7 +226,7 @@ class Search_Provider(Cmdlet): import result_table importlib.reload(result_table) - from result_table import ResultTable + from SYS.result_table import ResultTable provider_text = str(provider_name or "").strip() provider_lower = provider_text.lower() diff --git a/cmdlet/search_store.py b/cmdlet/search_store.py index 3553999..c06d771 100644 --- a/cmdlet/search_store.py +++ b/cmdlet/search_store.py @@ -32,7 +32,7 @@ from . import _shared as sh sh.first_title_tag, sh.parse_hash_query, ) -import pipeline as ctx +from SYS import pipeline as ctx STORAGE_ORIGINS = {"local", "hydrus", @@ -257,7 +257,7 @@ class Search_Store(Cmdlet): import importlib importlib.reload(result_table) - from result_table import ResultTable + from SYS.result_table import ResultTable table = ResultTable(command_title) try: diff --git a/cmdlet/trim_file.py b/cmdlet/trim_file.py index 2a840e3..c54da54 100644 --- a/cmdlet/trim_file.py +++ b/cmdlet/trim_file.py @@ -23,7 +23,7 @@ normalize_result_input = sh.normalize_result_input extract_title_from_result = sh.extract_title_from_result extract_url_from_result = sh.extract_url_from_result get_field = sh.get_field -import pipeline as ctx +from SYS import pipeline as ctx CMDLET = Cmdlet( name="trim-file", diff --git a/cmdnat/adjective.py b/cmdnat/adjective.py index d10b689..684d77b 100644 --- a/cmdnat/adjective.py +++ b/cmdnat/adjective.py @@ -4,8 +4,8 @@ import sys from typing import List, Dict, Any, Optional, Sequence from cmdlet._shared import Cmdlet, CmdletArg, parse_cmdlet_args from SYS.logger import log -from result_table import ResultTable -import pipeline as ctx +from SYS.result_table import ResultTable +from SYS import pipeline as ctx ADJECTIVE_FILE = os.path.join( os.path.dirname(os.path.dirname(__file__)), @@ -55,7 +55,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int: table.set_source_command(".adjective") ctx.set_last_result_table_overlay(table, list(data.keys())) ctx.set_current_stage_table(table) - from rich_display import stdout_console + from SYS.rich_display import stdout_console stdout_console().print(table) return 0 @@ -138,7 +138,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int: table.set_source_command(".adjective") ctx.set_last_result_table_overlay(table, tags) ctx.set_current_stage_table(table) - from rich_display import stdout_console + from SYS.rich_display import stdout_console stdout_console().print(table) diff --git a/cmdnat/config.py b/cmdnat/config.py index 97eb305..380e7b8 100644 --- a/cmdnat/config.py +++ b/cmdnat/config.py @@ -118,7 +118,7 @@ def _run(piped_result: Any, args: List[str], config: Dict[str, Any]) -> int: items.sort(key=lambda x: x["Key"]) # Emit items for ResultTable - import pipeline as ctx + from SYS import pipeline as ctx for item in items: ctx.emit(item) diff --git a/cmdnat/help.py b/cmdnat/help.py index 291ca00..8b8bcdf 100644 --- a/cmdnat/help.py +++ b/cmdnat/help.py @@ -6,8 +6,8 @@ import sys from cmdlet._shared import Cmdlet, CmdletArg, parse_cmdlet_args from SYS.logger import log -from result_table import ResultTable -import pipeline as ctx +from SYS.result_table import ResultTable +from SYS import pipeline as ctx def _normalize_choice_list(arg_names: Optional[List[str]]) -> List[str]: @@ -72,7 +72,7 @@ def _render_list( ctx.set_last_result_table(table, items) ctx.set_current_stage_table(table) - from rich_display import stdout_console + from SYS.rich_display import stdout_console stdout_console().print(table) @@ -142,7 +142,7 @@ def _render_detail(meta: Dict[str, Any], args: Sequence[str]) -> None: ctx.set_last_result_table_overlay(table, [meta]) ctx.set_current_stage_table(table) - from rich_display import stdout_console + from SYS.rich_display import stdout_console stdout_console().print(table) diff --git a/cmdnat/matrix.py b/cmdnat/matrix.py index d1021f3..fe6fcc6 100644 --- a/cmdnat/matrix.py +++ b/cmdnat/matrix.py @@ -10,8 +10,8 @@ from urllib.parse import parse_qs, urlparse from cmdlet._shared import Cmdlet, CmdletArg from SYS.logger import log, debug -from result_table import ResultTable -import pipeline as ctx +from SYS.result_table import ResultTable +from SYS import pipeline as ctx _MATRIX_PENDING_ITEMS_KEY = "matrix_pending_items" _MATRIX_PENDING_TEXT_KEY = "matrix_pending_text" diff --git a/cmdnat/out_table.py b/cmdnat/out_table.py index c46373b..029e87e 100644 --- a/cmdnat/out_table.py +++ b/cmdnat/out_table.py @@ -8,7 +8,7 @@ from typing import Any, Dict, Sequence, Optional from cmdlet._shared import Cmdlet, CmdletArg from SYS.logger import log -import pipeline as ctx +from SYS import pipeline as ctx CMDLET = Cmdlet( name=".out-table", diff --git a/cmdnat/pipe.py b/cmdnat/pipe.py index 406caaa..c09236f 100644 --- a/cmdnat/pipe.py +++ b/cmdnat/pipe.py @@ -9,10 +9,10 @@ from urllib.parse import urlparse, parse_qs from pathlib import Path from cmdlet._shared import Cmdlet, CmdletArg, parse_cmdlet_args from SYS.logger import debug, get_thread_stream, is_debug_enabled, set_debug, set_thread_stream -from result_table import ResultTable +from SYS.result_table import ResultTable from MPV.mpv_ipc import MPV -import pipeline as ctx -from models import PipeObject +from SYS import pipeline as ctx +from SYS.models import PipeObject from API.folder import LocalLibrarySearchOptimizer from SYS.config import get_local_storage_path, get_hydrus_access_key, get_hydrus_url diff --git a/cmdnat/telegram.py b/cmdnat/telegram.py index a0a8f62..7ec9a1b 100644 --- a/cmdnat/telegram.py +++ b/cmdnat/telegram.py @@ -6,8 +6,8 @@ from typing import Any, Dict, List, Optional, Sequence from cmdlet._shared import Cmdlet, CmdletArg from SYS.logger import log -from result_table import ResultTable -import pipeline as ctx +from SYS.result_table import ResultTable +from SYS import pipeline as ctx _TELEGRAM_PENDING_ITEMS_KEY = "telegram_pending_items" diff --git a/cmdnat/worker.py b/cmdnat/worker.py index d675fe1..2b218b6 100644 --- a/cmdnat/worker.py +++ b/cmdnat/worker.py @@ -9,7 +9,7 @@ from typing import Any, Dict, Sequence, List from cmdlet import register from cmdlet._shared import Cmdlet, CmdletArg -import pipeline as ctx +from SYS import pipeline as ctx from SYS.logger import log from SYS.config import get_local_storage_path diff --git a/scripts/check_imports.py b/scripts/check_imports.py new file mode 100644 index 0000000..3505f41 --- /dev/null +++ b/scripts/check_imports.py @@ -0,0 +1,10 @@ +import importlib +import sys +import traceback + +try: + importlib.import_module("CLI") + print("CLI imported OK") +except Exception as e: + traceback.print_exc() + sys.exit(1) diff --git a/tool/ytdlp.py b/tool/ytdlp.py index a0d6d6e..f751834 100644 --- a/tool/ytdlp.py +++ b/tool/ytdlp.py @@ -8,7 +8,7 @@ from typing import Any, Dict, List, Optional, Sequence from SYS.logger import debug from SYS.utils import ensure_directory -from models import DownloadOptions +from SYS.models import DownloadOptions def _get_nested(config: Dict[str, Any], *path: str) -> Any: