INNER CODE UNIT · Python

_parse

gokayfem/ComfyUI-fal-API · nodes/builder_node.py:690

    def _parse(side: str, text: str) -> Any:
        stripped = (text or "").strip()
        if not stripped:
            return None
        try:
            parsed = json.loads(stripped)
        except ValueError as err:
            raise FalApiError("FalJSONMerge", f"'{side}' is not valid JSON: {err}") from err
        if not isinstance(parsed, (list, dict)):
            raise FalApiError(
                "FalJSONMerge",
                f"'{side}' must be a JSON array or object, got {type(parsed).__name__}",
            )
        return parsed

    def merge(self, a: str, b: str) -> tuple[str]:
        parsed_a = self._parse("a", a)
        parsed_b = self._parse("b", b)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…