Repository: kedro-org/kedro
File: kedro/pipeline/node.py (Python)

Code before:
                    f"The node definition contains a list of "
                    f"outputs {self._outputs}, whereas the node function "
                    f"returned a '{type(result).__name__}'."
                )
            if len(result) != len(self._outputs):
                raise ValueError(
                    f"Failed to save outputs of node {self!s}.\n"
                    f"The node function returned {len(result)} output(s), "
                    f"whereas the node definition contains {len(self._outputs)} "
                    f"output(s)."
                )

            if iterator:
                result = unzip(iterator)
            return dict(zip(self._outputs, result))

        if self._outputs is None:
            if outputs is not None:
                node_name = self._name or self._func_name
                warnings.warn(
                    f"Node '{node_name}' returned a value of type "
                    f"'{type(outputs).__name__}', but outputs=None. "
                    f"This value will not be included in the pipeline outputs. "
                    f"To keep it, specify outputs in the node definition.",
                    UserWarning,
                )
            return {}
        if isinstance(self._outputs, str):
            return {self._outputs: outputs}
        if isinstance(self._outputs, dict):
            return _from_dict()
        return _from_list()

    def _validate_inputs(
        self, func: Callable, inputs: None | str | list[str] | dict[str, str]
    ) -> None:
        # inspect does not support built-in Python functions written in C.
        # Thus we only validate func if it is not built-in.
        if not inspect.isbuiltin(func):
            args, kwargs = self._process_inputs_for_bind(inputs)
            try:
                inspect.signature(func, follow_wrapped=False).bind(*args, **kwargs)
            except Exception as exc:
                func_args = inspect.signature(
                    func, follow_wrapped=False
                ).parameters.keys()
                func_name = _get_readable_func_name(func)

                raise TypeError(
                    f"Inputs of '{func_name}' function expected {list(func_args)}, "
                    f"but got {inputs}"

Review comment (suggestion):
> but outputs=None.

This part of the message is a bit hard to follow. [Nit] suggestion -

```py
(
    f"Node '{node_name}' returned a value of type "
    f"'{type(outputs).__name__}', but the node is defined with outputs=None. "
    "As a result, this value will be discarded and not included in the "
    "pipeline outputs. To persist the result, specify one or more outputs "
    "in the node definition."
)

```

or

```py
(
    f"Node '{node_name}' returned a value of type "
    f"'{type(outputs).__name__}', but the node is defined with outputs=None. "
    "Kedro ignores return values for nodes without declared outputs. "
    "If this return value is intentional, declare outputs in the node "
    "definition to include it in the pipeline."
)

```
Thank you

Code after:
                    f"The node definition contains a list of "
                    f"outputs {self._outputs}, whereas the node function "
                    f"returned a '{type(result).__name__}'."
                )
            if len(result) != len(self._outputs):
                raise ValueError(
                    f"Failed to save outputs of node {self!s}.\n"
                    f"The node function returned {len(result)} output(s), "
                    f"whereas the node definition contains {len(self._outputs)} "
                    f"output(s)."
                )

            if iterator:
                result = unzip(iterator)
            return dict(zip(self._outputs, result))

        if self._outputs is None:
            if outputs is not None:
                node_name = self._name or self._func_name
                warnings.warn(
                    f"Node '{node_name}' returned a value of type "
                    f"'{type(outputs).__name__}', but the node is defined with outputs=None. "
                    "Kedro ignores return values for nodes without declared outputs. "
                    "If this return value is intentional, declare outputs in the node "
                    "definition to include it in the pipeline.",
                    UserWarning,
                )
            return {}
        if isinstance(self._outputs, str):
            return {self._outputs: outputs}
        if isinstance(self._outputs, dict):
            return _from_dict()
        return _from_list()

    def _validate_inputs(
        self, func: Callable, inputs: None | str | list[str] | dict[str, str]
    ) -> None:
        # inspect does not support built-in Python functions written in C.
        # Thus we only validate func if it is not built-in.
        if not inspect.isbuiltin(func):
            args, kwargs = self._process_inputs_for_bind(inputs)
            try:
                inspect.signature(func, follow_wrapped=False).bind(*args, **kwargs)
            except Exception as exc:
                func_args = inspect.signature(
                    func, follow_wrapped=False
                ).parameters.keys()
                func_name = _get_readable_func_name(func)

                raise TypeError(
                    f"Inputs of '{func_name}' function expected {list(func_args)}, "