Replace the prior release tree with the current plugin, frontend, tests, and documentation. Document retired node IDs and the public Gitea update source.
34 lines
1.2 KiB
Python
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
|