Repository: kedro-org/kedro
File: kedro/io/kedro_data_catalog.py (Python)

Code before:
            >>> catalog = KedroDataCatalog(datasets={'cars': cars})
            >>>
            >>> config, credentials, load_versions, save_version = catalog.to_config()
            >>>
            >>> new_catalog = KedroDataCatalog.from_config(config, credentials, load_versions, save_version)
        """
        catalog: dict[str, dict[str, Any]] = {}
        credentials: dict[str, dict[str, Any]] = {}
        load_versions: dict[str, str | None] = {}

        for ds_name, ds in self._lazy_datasets.items():
            if _is_memory_dataset(ds.config.get(TYPE_KEY, "")):
                continue
            unresolved_config, unresolved_credentials = (
                self._config_resolver.unresolve_credentials(ds_name, ds.config)
            )
            catalog[ds_name] = unresolved_config
            credentials.update(unresolved_credentials)
            load_versions[ds_name] = self._load_versions.get(ds_name, None)

        for ds_name, ds in self._datasets.items():  # type: ignore[assignment]
            if _is_memory_dataset(ds):  # type: ignore[arg-type]
                continue
            resolved_config = ds.to_config()  # type: ignore[attr-defined]
            unresolved_config, unresolved_credentials = (
                self._config_resolver.unresolve_credentials(ds_name, resolved_config)
            )
            catalog[ds_name] = unresolved_config
            credentials.update(unresolved_credentials)
            load_versions[ds_name] = self._load_versions.get(ds_name, None)

        return catalog, credentials, load_versions, self._save_version

    @staticmethod
    def _validate_dataset_config(ds_name: str, ds_config: Any) -> None:
        if not isinstance(ds_config, dict):
            raise DatasetError(
                f"Catalog entry '{ds_name}' is not a valid dataset configuration. "
                "\nHint: If this catalog entry is intended for variable interpolation, "
                "make sure that the key is preceded by an underscore."
            )

        if "type" not in ds_config:
            raise DatasetError(
                f"An exception occurred when parsing config for dataset '{ds_name}':\n"
                "'type' is missing from dataset catalog configuration."
                "\nHint: If this catalog entry is intended for variable interpolation, "
                "make sure that the top level key is preceded by an underscore."
            )

    def _add_from_config(self, ds_name: str, ds_config: dict[str, Any]) -> None:

Review comment (security):
I think here `_unresolve_credentials` naming make sense as we are passing resolved_config as input. My earlier [comment](https://github.com/kedro-org/kedro/pull/4717/files#r2083878857) was based on the doc string. If team feels it is clear, please ignore the comment. Thank you

Code after:
            >>> catalog = KedroDataCatalog(datasets={'cars': cars})
            >>>
            >>> config, credentials, load_versions, save_version = catalog.to_config()
            >>>
            >>> new_catalog = KedroDataCatalog.from_config(config, credentials, load_versions, save_version)
        """
        catalog: dict[str, dict[str, Any]] = {}
        credentials: dict[str, dict[str, Any]] = {}
        load_versions: dict[str, str | None] = {}

        for ds_name, ds in self._lazy_datasets.items():
            if _is_memory_dataset(ds.config.get(TYPE_KEY, "")):
                continue
            unresolved_config, unresolved_credentials = (
                self._config_resolver._unresolve_credentials(ds_name, ds.config)
            )
            catalog[ds_name] = unresolved_config
            credentials.update(unresolved_credentials)
            load_versions[ds_name] = self._load_versions.get(ds_name, None)

        for ds_name, ds in self._datasets.items():  # type: ignore[assignment]
            if _is_memory_dataset(ds):  # type: ignore[arg-type]
                continue
            resolved_config = ds.to_config()  # type: ignore[attr-defined]
            unresolved_config, unresolved_credentials = (
                self._config_resolver._unresolve_credentials(ds_name, resolved_config)
            )
            catalog[ds_name] = unresolved_config
            credentials.update(unresolved_credentials)
            load_versions[ds_name] = self._load_versions.get(ds_name, None)

        return catalog, credentials, load_versions, self._save_version

    @staticmethod
    def _validate_dataset_config(ds_name: str, ds_config: Any) -> None:
        if not isinstance(ds_config, dict):
            raise DatasetError(
                f"Catalog entry '{ds_name}' is not a valid dataset configuration. "
                "\nHint: If this catalog entry is intended for variable interpolation, "
                "make sure that the key is preceded by an underscore."
            )

        if "type" not in ds_config:
            raise DatasetError(
                f"An exception occurred when parsing config for dataset '{ds_name}':\n"
                "'type' is missing from dataset catalog configuration."
                "\nHint: If this catalog entry is intended for variable interpolation, "
                "make sure that the top level key is preceded by an underscore."
            )

    def _add_from_config(self, ds_name: str, ds_config: dict[str, Any]) -> None: