From fcf7cc07993bcd1c6ca22e0826a853a4ccc2c8f6 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Thu, 9 Jul 2026 21:44:10 -0700 Subject: [PATCH] refactor: remove dead/vestigial helpers with zero prod usage Removes six internal helpers verified to have zero callers across comfy_cli/ and tests/ (no dynamic dispatch touches them): - workspace_manager.scan_dir_concur (also buggy: hardcoded Path('.'), ignoring self.workspace_path) and its only-caller-of check_file_is_model - workspace_manager.check_file_is_model (only referenced by scan_dir_concur) - commented-out load_yaml block in workspace_manager - renderer.Renderer.flush_throttled - glyphs.glyph_only - branding.cli_footer Also drops the now-orphaned concurrent.futures and pathlib.Path imports that were used only by scan_dir_concur. Pure removal, no behavior change. --- comfy_cli/output/branding.py | 11 -------- comfy_cli/output/glyphs.py | 7 ------ comfy_cli/output/renderer.py | 7 ------ comfy_cli/workspace_manager.py | 46 ---------------------------------- 4 files changed, 71 deletions(-) diff --git a/comfy_cli/output/branding.py b/comfy_cli/output/branding.py index 8376e3d1..787c3045 100644 --- a/comfy_cli/output/branding.py +++ b/comfy_cli/output/branding.py @@ -78,17 +78,6 @@ def branded_panel( ) -def cli_footer(*, version: str, where: str | None = None) -> Text: - """Right-aligned, dim subtitle used as the pretty-mode brand signature. - - Every pretty rendering that *isn't* already a Panel should print this - after its primary output so the human always knows which tool / version / - routing target produced what they're looking at. - """ - suffix = f" · {where}" if where else "" - return Text(f"comfy CLI v{version}{suffix}", style="dim", justify="right") - - # --------------------------------------------------------------------------- # Wordmark — handcrafted 5-row block art, kept narrow enough for an 80-col tty # --------------------------------------------------------------------------- diff --git a/comfy_cli/output/glyphs.py b/comfy_cli/output/glyphs.py index c09cee2f..0d23136b 100644 --- a/comfy_cli/output/glyphs.py +++ b/comfy_cli/output/glyphs.py @@ -49,10 +49,3 @@ def status_glyph(status: str | None) -> str: canonical = _canonical(status) glyph, style = STATUS_STYLE.get(canonical, DEFAULT_STYLE) return f"[{style}]{glyph} {canonical or 'unknown'}[/{style}]" - - -def glyph_only(status: str | None) -> str: - """Return just the colored glyph, no label — handy for tight tables.""" - canonical = _canonical(status) - glyph, style = STATUS_STYLE.get(canonical, DEFAULT_STYLE) - return f"[{style}]{glyph}[/{style}]" diff --git a/comfy_cli/output/renderer.py b/comfy_cli/output/renderer.py index 88767818..a046b6e2 100644 --- a/comfy_cli/output/renderer.py +++ b/comfy_cli/output/renderer.py @@ -317,13 +317,6 @@ def throttled_event(self, token: str, type: str, *, max_hz: float = 10.0, **fiel self.event(type, **fields) return True - def flush_throttled(self, token: str, type: str, **fields: Any) -> None: - """Force-emit one final event for a throttle token (e.g., on completion).""" - if not self.is_stream(): - return - self._throttle[token] = time.monotonic() - self.event(type, **fields) - # ----- internals ----- def _envelope( diff --git a/comfy_cli/workspace_manager.py b/comfy_cli/workspace_manager.py index 119cb61e..85809e55 100644 --- a/comfy_cli/workspace_manager.py +++ b/comfy_cli/workspace_manager.py @@ -1,9 +1,7 @@ -import concurrent.futures import os from dataclasses import dataclass, field from datetime import datetime from enum import Enum -from pathlib import Path import git import typer @@ -120,31 +118,6 @@ def check_comfy_repo(path) -> tuple[bool, str | None]: return False, None -# Generate and update this following method using chatGPT -# def load_yaml(file_path: str) -> ComfyLockYAMLStruct: -# with open(file_path, "r", encoding="utf-8") as file: -# data = yaml.safe_load(file) -# basics = Basics( -# name=data.get("basics", {}).get("name"), -# updated_at=( -# datetime.fromisoformat(data.get("basics", {}).get("updated_at")) -# if data.get("basics", {}).get("updated_at") -# else None -# ), -# ) -# models = [ -# Model( -# name=m.get("model"), -# url=m.get("url"), -# paths=[ModelPath(path=p.get("path")) for p in m.get("paths", [])], -# hash=m.get("hash"), -# type=m.get("type"), -# ) -# for m in data.get("models", []) -# ] -# custom_nodes = [] - - # Generate and update this following method using chatGPT def save_yaml(file_path: str, metadata: ComfyLockYAMLStruct): data = { @@ -168,12 +141,6 @@ def save_yaml(file_path: str, metadata: ComfyLockYAMLStruct): yaml.safe_dump(data, file, default_flow_style=False, allow_unicode=True) -# Function to check if the file is config.json -def check_file_is_model(path): - if path.name.endswith(constants.SUPPORTED_PT_EXTENSIONS): - return str(path) - - class WorkspaceType(Enum): CURRENT_DIR = "current_dir" DEFAULT = "default" @@ -318,19 +285,6 @@ def scan_dir(self): model_files.append(os.path.join(root, file)) return model_files - def scan_dir_concur(self): - base_path = Path(".") - model_files = [] - - # Use ThreadPoolExecutor to manage concurrency - with concurrent.futures.ThreadPoolExecutor() as executor: - futures = [executor.submit(check_file_is_model, p) for p in base_path.rglob("*")] - for future in concurrent.futures.as_completed(futures): - if future.result(): - model_files.append(future.result()) - - return model_files - def load_metadata(self): file_path = os.path.join(self.workspace_path, constants.COMFY_LOCK_YAML_FILE) if os.path.exists(file_path):