Repository: Avaiga/taipy
File: taipy/core/config/checkers/_data_node_config_checker.py (Python)

Code before:
                self._error(
                    ", ".join(properties_to_check_at_least_one),
                    None,
                    f"Either `{DataNodeConfig._OPTIONAL_READ_FUNCTION_GENERIC_PROPERTY}` field or "
                    f"`{DataNodeConfig._OPTIONAL_WRITE_FUNCTION_GENERIC_PROPERTY}` field of "
                    f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
                )

    def _check_class_type(self, data_node_config_id: str, data_node_config: DataNodeConfig):
        if data_node_config.storage_type in self._PROPERTIES_TYPES.keys():
            for class_type, prop_keys in self._PROPERTIES_TYPES[data_node_config.storage_type]:
                for prop_key in prop_keys:
                    prop_value = data_node_config.properties.get(prop_key) if data_node_config.properties else None
                    if prop_value and not isinstance(prop_value, class_type):
                        self._error(
                            prop_key,
                            prop_value,
                            f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be"
                            f" populated with a {'Callable' if class_type == Callable else class_type.__name__}.",
                        )
                    if class_type == Callable and callable(prop_value) and prop_value.__name__ == "<lambda>":
                        self._error(
                            prop_key,
                            prop_value,
                            f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be"
                            f" populated with a Callable and not a lambda.",
                        )

    def _check_exposed_type(self, data_node_config_id: str, data_node_config: DataNodeConfig):
        if not isinstance(data_node_config.exposed_type, str):
            return
        if data_node_config.exposed_type not in DataNodeConfig._ALL_EXPOSED_TYPES:
            self._error(
                data_node_config._EXPOSED_TYPE_KEY,
                data_node_config.exposed_type,
                f"The `{data_node_config._EXPOSED_TYPE_KEY}` of DataNodeConfig `{data_node_config_id}` "
                f'must be either "pandas", "numpy", or a custom type.',
            )


Review comment (suggestion):
The sentence is strange as a lambda is a Callable (can be called with the `()` operator).
```suggestion
                            f" populated with a serializable Callable function but not a lambda.",
```

Code after:
                self._error(
                    ", ".join(properties_to_check_at_least_one),
                    None,
                    f"Either `{DataNodeConfig._OPTIONAL_READ_FUNCTION_GENERIC_PROPERTY}` field or "
                    f"`{DataNodeConfig._OPTIONAL_WRITE_FUNCTION_GENERIC_PROPERTY}` field of "
                    f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
                )

    def _check_class_type(self, data_node_config_id: str, data_node_config: DataNodeConfig):
        if data_node_config.storage_type in self._PROPERTIES_TYPES.keys():
            for class_type, prop_keys in self._PROPERTIES_TYPES[data_node_config.storage_type]:
                for prop_key in prop_keys:
                    prop_value = data_node_config.properties.get(prop_key) if data_node_config.properties else None
                    if prop_value and not isinstance(prop_value, class_type):
                        self._error(
                            prop_key,
                            prop_value,
                            f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be"
                            f" populated with a {'Callable' if class_type == Callable else class_type.__name__}.",
                        )
                    if class_type == Callable and callable(prop_value) and prop_value.__name__ == "<lambda>":
                        self._error(
                            prop_key,
                            prop_value,
                            f"`{prop_key}` of DataNodeConfig `{data_node_config_id}` must be"
                            f" populated with a serializable Callable function but not a lambda.",
                        )

    def _check_exposed_type(self, data_node_config_id: str, data_node_config: DataNodeConfig):
        if not isinstance(data_node_config.exposed_type, str):
            return
        if data_node_config.exposed_type not in DataNodeConfig._ALL_EXPOSED_TYPES:
            self._error(
                data_node_config._EXPOSED_TYPE_KEY,
                data_node_config.exposed_type,
                f"The `{data_node_config._EXPOSED_TYPE_KEY}` of DataNodeConfig `{data_node_config_id}` "
                f'must be either "pandas", "numpy", or a custom type.',
            )