- Removed `INPUT_IS_LIST = True` to prevent ComfyUI from implicitly converting input values to lists and expecting lists as outputs. - Refactored `calculate` to handle list inputs natively using `isinstance` while correctly interacting with the standard Text Reader's native Python lists. - Changed the return signature to emit native primitive values (`str`, `int`) instead of wrapping them in lists, correctly accommodating downstream integration with TTS models (e.g. Fish Speech) that expect pure strings.
27 lines
744 B
Python
27 lines
744 B
Python
import sys
|
|
from unittest.mock import MagicMock
|
|
|
|
sys.modules['torch'] = MagicMock()
|
|
sys.modules['comfy'] = MagicMock()
|
|
sys.modules['comfy.model_management'] = MagicMock()
|
|
|
|
# Mocking relative import
|
|
class MockRegisterNode:
|
|
def __call__(self, cls):
|
|
return cls
|
|
|
|
import builtins
|
|
real_import = builtins.__import__
|
|
|
|
def mocked_import(name, globals=None, locals=None, fromlist=(), level=0):
|
|
if name == '' and level > 0 and 'register_node' in fromlist:
|
|
mock_module = MagicMock()
|
|
mock_module.register_node = MockRegisterNode()
|
|
return mock_module
|
|
return real_import(name, globals, locals, fromlist, level)
|
|
|
|
builtins.__import__ = mocked_import
|
|
|
|
import loop
|
|
print("Sintaxis de loop.py verificada correctamente.")
|