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

Code before:
    def values(self) -> List[AbstractDataset]:  # noqa: UP006
        """List all datasets registered in the catalog."""
        return [self._datasets[key] for key in self]

    def items(self) -> List[tuple[str, AbstractDataset]]:  # noqa: UP006
        """List all dataset names and datasets registered in the catalog."""
        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:
        """Get a dataset by name from an internal collection of datasets.

        If a dataset is not in the collection but matches any pattern
        it is instantiated and added to the collection first, then returned.

        Args:
            ds_name: A dataset name.

        Returns:
            An instance of AbstractDataset.

        Raises:
            DatasetNotFoundError: When a dataset with the given name
                is not in the collection and do not match patterns.
        """
        return self.get_dataset(ds_name)

    def __setitem__(self, key: str, value: Any) -> None:
        """Add dataset to the ``KedroDataCatalog`` using the given key as a datsets name
        and the provided data as the value.

        The value can either be raw data or a Kedro dataset (i.e., an instance of a class
        inheriting from ``AbstractDataset``). If raw data is provided, it will be automatically
        wrapped in a ``MemoryDataset`` before being added to the catalog.

        Args:
            key: Name of the dataset.
            value: Raw data or an instance of a class inheriting from ``AbstractDataset``.

        Example:
        ::

            >>> from kedro_datasets.pandas import CSVDataset
            >>> import pandas as pd
            >>>
            >>> df = pd.DataFrame({"col1": [1, 2],
            >>>                    "col2": [4, 5],
            >>>                    "col3": [5, 6]})
            >>>

Review comment (suggestion):
```suggestion
                is not in the collection and does not match patterns.
```

Code after:
    def values(self) -> List[AbstractDataset]:  # noqa: UP006
        """List all datasets registered in the catalog."""
        return [self._datasets[key] for key in self]

    def items(self) -> List[tuple[str, AbstractDataset]]:  # noqa: UP006
        """List all dataset names and datasets registered in the catalog."""
        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:
        """Get a dataset by name from an internal collection of datasets.

        If a dataset is not in the collection but matches any pattern
        it is instantiated and added to the collection first, then returned.

        Args:
            ds_name: A dataset name.

        Returns:
            An instance of AbstractDataset.

        Raises:
            DatasetNotFoundError: When a dataset with the given name
                is not in the collection and does not match patterns.
        """
        return self.get_dataset(ds_name)

    def __setitem__(self, key: str, value: Any) -> None:
        """Add dataset to the ``KedroDataCatalog`` using the given key as a datsets name
        and the provided data as the value.

        The value can either be raw data or a Kedro dataset (i.e., an instance of a class
        inheriting from ``AbstractDataset``). If raw data is provided, it will be automatically
        wrapped in a ``MemoryDataset`` before being added to the catalog.

        Args:
            key: Name of the dataset.
            value: Raw data or an instance of a class inheriting from ``AbstractDataset``.

        Example:
        ::

            >>> from kedro_datasets.pandas import CSVDataset
            >>> import pandas as pd
            >>>
            >>> df = pd.DataFrame({"col1": [1, 2],
            >>>                    "col2": [4, 5],
            >>>                    "col3": [5, 6]})
            >>>