Files
comfyui_o1key/utils/__init__.py
T
Jony ba920f2b66 Publish current ComfyUI O1Key code baseline
Replace the prior release tree with the current plugin, frontend, tests, and documentation. Document retired node IDs and the public Gitea update source.
2026-09-24 19:56:48 +08:00

34 lines
1.2 KiB
Python

"""Shared helpers exposed through lazy imports."""
from importlib import import_module
_EXPORTS = {
"tensor_to_pil": ("image_utils", "tensor_to_pil"),
"pil_to_tensor": ("image_utils", "pil_to_tensor"),
"encode_image_to_base64": ("image_utils", "encode_image_to_base64"),
"decode_base64_to_pil": ("image_utils", "decode_base64_to_pil"),
"load_config": ("config", "load_config"),
"get_api_key": ("config", "get_api_key"),
"ImageInfo": ("file_utils", "ImageInfo"),
"load_images_from_folder": ("file_utils", "load_images_from_folder"),
"pair_images_indexed": ("file_utils", "pair_images_indexed"),
"pair_images_cartesian": ("file_utils", "pair_images_cartesian"),
"generate_timestamp_filename": ("file_utils", "generate_timestamp_filename"),
"save_image": ("file_utils", "save_image"),
"get_folder_image_count": ("file_utils", "get_folder_image_count"),
}
__all__ = list(_EXPORTS)
def __getattr__(name):
try:
module_name, attribute_name = _EXPORTS[name]
except KeyError as exc:
raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from exc
value = getattr(import_module(f".{module_name}", __name__), attribute_name)
globals()[name] = value
return value