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

Code before:
            >>>                    "col2": [4, 5],
            >>>                    "col3": [5, 6]})
            >>>
            >>> catalog = DataCatalog()
            >>> catalog.add_feed_dict({
            >>>     "data_df": df
            >>> }, replace=True)
            >>>
            >>> assert catalog.load("data_df").equals(df)
            >>>
            >>> csv_dataset = CSVDataset(filepath="test.csv")
            >>> csv_dataset.save(df)
            >>> catalog.add_feed_dict({"data_csv_dataset": csv_dataset})
            >>>
            >>> assert catalog.load("data_csv_dataset").equals(df)
        """
        for dataset_name in feed_dict:
            if isinstance(feed_dict[dataset_name], AbstractDataset):
                dataset = feed_dict[dataset_name]
            else:
                dataset = MemoryDataset(data=feed_dict[dataset_name])

            self.add(dataset_name, dataset, replace)

    # Alias for add_feed_dict method
    from_dict = add_feed_dict

    def list(self, regex_search: str | None = None) -> list[str]:
        """
        List of all dataset names registered in the catalog.
        This can be filtered by providing an optional regular expression
        which will only return matching keys.

        Args:
            regex_search: An optional regular expression which can be provided
                to limit the data sets returned by a particular pattern.
        Returns:
            A list of dataset names available which match the
            `regex_search` criteria (if provided). All data set names are returned
            by default.

        Raises:
            SyntaxError: When an invalid regex filter is provided.

        Example:
        ::

            >>> io = DataCatalog()
            >>> # get data sets where the substring 'raw' is present
            >>> raw_data = io.list(regex_search='raw')
            >>> # get data sets which start with 'prm' or 'feat'

Review comment (refactor):
Pedantic nitpick, but when I read `from_dict` I assume it's a classmethod, like

```python
class DataCatalog:
  @classmethod
  def from_dict(cls, data_dict: dict[str, AbstractDataset]):
    ...
    return cls
```

So not sure if I'd add this alias.

(I know this comes from https://github.com/kedro-org/kedro/issues/3612#issuecomment-2034961020 and that I asserted, but my response there is incomplete)

Code after:
            >>>
            >>> catalog = DataCatalog()
            >>> catalog.add_feed_dict({
            >>>     "data_df": df
            >>> }, replace=True)
            >>>
            >>> assert catalog.load("data_df").equals(df)
            >>>
            >>> csv_dataset = CSVDataset(filepath="test.csv")
            >>> csv_dataset.save(df)
            >>> catalog.add_feed_dict({"data_csv_dataset": csv_dataset})
            >>>
            >>> assert catalog.load("data_csv_dataset").equals(df)
        """
        for dataset_name in feed_dict:
            if isinstance(feed_dict[dataset_name], AbstractDataset):
                dataset = feed_dict[dataset_name]
            else:
                dataset = MemoryDataset(data=feed_dict[dataset_name])

            self.add(dataset_name, dataset, replace)

    def list(self, regex_search: str | None = None) -> list[str]:
        """
        List of all dataset names registered in the catalog.
        This can be filtered by providing an optional regular expression
        which will only return matching keys.

        Args:
            regex_search: An optional regular expression which can be provided
                to limit the data sets returned by a particular pattern.
        Returns:
            A list of dataset names available which match the
            `regex_search` criteria (if provided). All data set names are returned
            by default.

        Raises:
            SyntaxError: When an invalid regex filter is provided.

        Example:
        ::

            >>> io = DataCatalog()
            >>> # get data sets where the substring 'raw' is present
            >>> raw_data = io.list(regex_search='raw')
            >>> # get data sets which start with 'prm' or 'feat'
            >>> feat_eng_data = io.list(regex_search='^(prm|feat)')
            >>> # get data sets which end with 'time_series'
            >>> models = io.list(regex_search='.+time_series$')
        """