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

Code before:
        )

    @property
    def config_resolver(self) -> CatalogConfigResolver:
        return self._config_resolver

    def __repr__(self) -> str:
        return repr(self._datasets)

    def __contains__(self, dataset_name: str) -> bool:
        """Check if an item is in the catalog as a materialised dataset or pattern"""
        return (
            dataset_name in self._datasets
            or self._config_resolver.match_pattern(dataset_name) is not None
        )

    def __eq__(self, other) -> bool:  # type: ignore[no-untyped-def]
        return (self._datasets, self._config_resolver.list_patterns()) == (
            other._datasets,
            other.config_resolver.list_patterns(),
        )

    def keys(self, regex_search: str | None = None) -> List[str]:  # noqa: UP006
        return self._filter_keys(regex_search)

    def values(self, regex_search: str | None = None) -> List[AbstractDataset]:  # noqa: UP006
        return [self._datasets[key] for key in self._filter_keys(regex_search)]

    def items(
        self, regex_search: str | None = None
    ) -> List[tuple[str, AbstractDataset]]:  # noqa: UP006
        return [(key, self._datasets[key]) for key in self._filter_keys(regex_search)]

    def __iter__(self) -> str:
        yield from self._datasets.keys()

    def __getitem__(self, ds_name: str) -> AbstractDataset | None:
        return self.get(ds_name)

    def __setitem__(self, key: str, value: Any) -> None:
        if key in self._datasets:
            self._logger.warning("Replacing dataset '%s'", key)
        if isinstance(value, AbstractDataset):
            self._datasets[key] = value
        else:
            self._datasets[key] = MemoryDataset(data=value)  # type: ignore[abstract]

    def __len__(self) -> int:
        return len(self.keys())

    def get(

Review comment (refactor):
```suggestion
    def values(self, regex_search: str | None = None) -> list[AbstractDataset]:
```

Code after:
        )

    @property
    def config_resolver(self) -> CatalogConfigResolver:
        return self._config_resolver

    def __repr__(self) -> str:
        return repr(self._datasets)

    def __contains__(self, dataset_name: str) -> bool:
        """Check if an item is in the catalog as a materialised dataset or pattern"""
        return (
            dataset_name in self._datasets
            or self._config_resolver.match_pattern(dataset_name) is not None
        )

    def __eq__(self, other) -> bool:  # type: ignore[no-untyped-def]
        return (self._datasets, self._config_resolver.list_patterns()) == (
            other._datasets,
            other.config_resolver.list_patterns(),
        )

    def keys(self) -> List[str]:  # noqa: UP006
        return list(self.__iter__())

    def values(self) -> List[AbstractDataset]:  # noqa: UP006
        return [self._datasets[key] for key in self]

    def items(self) -> List[tuple[str, AbstractDataset]]:  # noqa: UP006
        return [(key, self._datasets[key]) for key in self]

    def __iter__(self) -> Iterator[str]:
        yield from self._datasets.keys()

    def __getitem__(self, ds_name: str) -> AbstractDataset:
        return self.get_dataset(ds_name)

    def __setitem__(self, key: str, value: Any) -> None:
        if key in self._datasets:
            self._logger.warning("Replacing dataset '%s'", key)
        if isinstance(value, AbstractDataset):
            self._datasets[key] = value
        else:
            self._logger.info(f"Adding input data as a MemoryDataset - {key}")
            self._datasets[key] = MemoryDataset(data=value)  # type: ignore[abstract]

    def __len__(self) -> int:
        return len(self.keys())

    def get(
        self, key: str, default: AbstractDataset | None = None