Compare commits

...
2 Commits
Author SHA1 Message Date
m0rtus59 36ab9e1946 Merge pull request #6 from m0rtus59/chore/cleanup-prompt-search
Clean up leftovers from prompt search change
2026-11-11 07:03:00 +05:00
Claude 2db8592267 Remove unused prompt scan helper and stale test reference 2026-11-10 20:06:51 +00:00
+2 -27
View File
@@ -1,7 +1,6 @@
"""Extract searchable prompt text from ComfyUI prompt graphs and PNG outputs.
This module has no ComfyUI imports so it can be unit-tested on its own
(``python -m unittest discover tests``).
This module has no ComfyUI imports, so it can be used and tested on its own.
How it works
------------
@@ -160,7 +159,7 @@ def read_png_prompt(fileobj):
# --------------------------------------------------------------------------- #
# Cached per-file text + directory scan
# Cached per-file text
# --------------------------------------------------------------------------- #
def get_prompt_search_text(path):
@@ -198,27 +197,3 @@ def get_prompt_search_text(path):
def clear_cache():
with _cache_lock:
_cache.clear()
def iter_prompt_matches(target_dir, needle, cancel=None):
"""Yield ``(path, os.stat_result)`` for PNGs under `target_dir` whose prompt
text contains `needle` (case-insensitive). Hidden files/folders are skipped.
`cancel` may be a ``threading.Event``; the scan stops soon after it is set.
"""
needle = needle.lower()
if not needle:
return
for root, dirs, fnames in os.walk(target_dir):
dirs[:] = [d for d in dirs if not d.startswith(".")]
for fname in fnames:
if cancel is not None and cancel.is_set():
return
if fname.startswith(".") or not fname.lower().endswith(".png"):
continue
path = os.path.join(root, fname)
if needle in get_prompt_search_text(path):
try:
yield path, os.stat(path)
except OSError:
continue