# Buggy code
def from_config(
    cls: Type,
    catalog: Optional[Dict[str, Dict[str, Any]]],
    credentials: Dict[str, Dict[str, Any]] = None,
    load_versions: Dict[str, str] = None,
    save_version: str = None,
    journal: Journal = None,
) -> "DataCatalog":
    """Create a ``DataCatalog`` instance from configuration. This is a
    factory method used to provide developers with a way to instantiate
    ``DataCatalog`` with configuration parsed from configuration files.

    Args:
        catalog: A dictionary whose keys are the data set names and
            the values are dictionaries with the constructor arguments
            for classes implementing ``AbstractDataSet``. The data set
            class to be loaded is specified with the key ``type`` and their
            fully qualified class name. All ``kedro.io`` data set can be
            specified by their class name only, i.e. their module name
            can be omitted.
        credentials: A dictionary containing credentials for different
            data sets. Use the ``credentials`` key in a ``AbstractDataSet``
            to refer to the appropriate credentials as shown in the example
            below.
        load_versions: A mapping between dataset names and versions
            to load. Has no effect on data sets without enabled versioning.
        save_version: Version string to be used for ``save`` operations
            by all data sets with enabled versioning. It must: a) be a
            case-insensitive string that conforms with operating system
            filename limitations, b) always return the latest version when
            sorted in lexicographical order.
        journal: Instance of Journal.

    Returns:
        An instantiated ``DataCatalog`` containing all specified
        data sets, created and ready to use.

    Raises:
        DataSetError: When the method fails to create any of the data
            sets from their config.

    Example:
    ::

        >>> config = {
        >>>     "cars": {
        >>>         "type": "CSVLocalDataSet",
        >>>         "filepath": "cars.csv",
        >>>         "save_args": {
        >>>             "index": False
        >>>         }
        >>>     },
        >>>     "boats": {
        >>>         "type": "CSVS3DataSet",
        >>>         "filepath": "boats.csv",
        >>>         "bucket_name": "mck-147789798-bucket",
        >>>         "credentials": "boats_credentials"
        >>>         "save_args": {
        >>>             "index": False
        >>>         }
        >>>     }
        >>> }
        >>>
        >>> credentials = {
        >>>     "boats_credentials": {
        >>>         "aws_access_key_id": "<your key id>",
        >>>         "aws_secret_access_key": "<your secret>"
        >>>      }
        >>> }
        >>>
        >>> catalog = DataCatalog.from_config(config, credentials)
        >>>
        >>> df = catalog.load("cars")
        >>> catalog.save("boats", df)
    """
    data_sets = {}
    catalog = copy.deepcopy(catalog) or {}
    credentials = copy.deepcopy(credentials) or {}
    run_id = journal.run_id if journal else None
    save_version = save_version or run_id or generate_timestamp()
    load_versions = copy.deepcopy(load_versions) or {}

    missing_keys = load_versions.keys() - catalog.keys()
    if missing_keys:
        warn(
            "`load_versions` keys [{}] are not found in the catalog.".format(
                ", ".join(sorted(missing_keys))
            )
        )

    for ds_name, ds_config in catalog.items():
        if CREDENTIALS_KEY in ds_config:
            ds_config[CREDENTIALS_KEY] = _get_credentials(
                ds_config.pop(CREDENTIALS_KEY),
                credentials,  # credentials name
            )
        data_sets[ds_name] = AbstractDataSet.from_config(
            ds_name, ds_config, load_versions.get(ds_name), save_version
        )
    return cls(data_sets=data_sets, journal=journal)


# Traceback (ImportError)
~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/context/__init__.py:46: DeprecationWarning: All the modules in `kedro.context` have been moved to `kedro.framework.context`, and `kedro.context` will be removed in Kedro 0.17.0. Please update import paths from `kedro.context` to `kedro.framework.context` in your Kedro project.
DeprecationWarning,
~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/cli/__init__.py:44: DeprecationWarning: All the modules in `kedro.cli` have been moved to `kedro.framework.cli`, and `kedro.cli` will be removed in Kedro 0.17.0. Please update import paths from `kedro.cli` to `kedro.framework.cli` in your Kedro project.
DeprecationWarning,
Traceback (most recent call last):
File "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 619, in main
kedro_cli = importlib.import_module("kedro_cli")
File "~/.pyenv/versions/3.6.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/myProject/kedro_cli.py", line 54, in <module>
from kedro.context import KEDRO_ENV_VAR, load_context
ImportError: cannot import name 'KEDRO_ENV_VAR'
Traceback (most recent call last):
File "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 619, in main
kedro_cli = importlib.import_module("kedro_cli")
File "~/.pyenv/versions/3.6.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/myProject/kedro_cli.py", line 54, in <module>
from kedro.context import KEDRO_ENV_VAR, load_context
ImportError: cannot import name 'KEDRO_ENV_VAR'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/bin/kedro", line 8, in <module>
sys.exit(main())
File "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 623, in main
_handle_exception(f"Cannot load commands from {kedro_cli_path}")
File "~/.pyenv/versions/3.6.6/envs/kedro-mlflow/lib/python3.6/site-packages/kedro/framework/cli/cli.py", line 643, in _handle_exception
raise KedroCliError(msg)
kedro.framework.cli.utils.KedroCliError: Cannot load commands from /myProject/kedro_cli.py

# Fixed code
def from_config(
    cls: Type,
    catalog: Optional[Dict[str, Dict[str, Any]]],
    credentials: Dict[str, Dict[str, Any]] = None,
    load_versions: Dict[str, str] = None,
    save_version: str = None,
    journal: Journal = None,
) -> "DataCatalog":
    """Create a ``DataCatalog`` instance from configuration. This is a
    factory method used to provide developers with a way to instantiate
    ``DataCatalog`` with configuration parsed from configuration files.

    Args:
        catalog: A dictionary whose keys are the data set names and
            the values are dictionaries with the constructor arguments
            for classes implementing ``AbstractDataSet``. The data set
            class to be loaded is specified with the key ``type`` and their
            fully qualified class name. All ``kedro.io`` data set can be
            specified by their class name only, i.e. their module name
            can be omitted.
        credentials: A dictionary containing credentials for different
            data sets. Use the ``credentials`` key in a ``AbstractDataSet``
            to refer to the appropriate credentials as shown in the example
            below.
        load_versions: A mapping between dataset names and versions
            to load. Has no effect on data sets without enabled versioning.
        save_version: Version string to be used for ``save`` operations
            by all data sets with enabled versioning. It must: a) be a
            case-insensitive string that conforms with operating system
            filename limitations, b) always return the latest version when
            sorted in lexicographical order.
        journal: Instance of Journal.

    Returns:
        An instantiated ``DataCatalog`` containing all specified
        data sets, created and ready to use.

    Raises:
        DataSetError: When the method fails to create any of the data
            sets from their config.

    Example:
    ::

        >>> config = {
        >>>     "cars": {
        >>>         "type": "CSVLocalDataSet",
        >>>         "filepath": "cars.csv",
        >>>         "save_args": {
        >>>             "index": False
        >>>         }
        >>>     },
        >>>     "boats": {
        >>>         "type": "CSVS3DataSet",
        >>>         "filepath": "boats.csv",
        >>>         "bucket_name": "mck-147789798-bucket",
        >>>         "credentials": "boats_credentials"
        >>>         "save_args": {
        >>>             "index": False
        >>>         }
        >>>     }
        >>> }
        >>>
        >>> credentials = {
        >>>     "boats_credentials": {
        >>>         "aws_access_key_id": "<your key id>",
        >>>         "aws_secret_access_key": "<your secret>"
        >>>      }
        >>> }
        >>>
        >>> catalog = DataCatalog.from_config(config, credentials)
        >>>
        >>> df = catalog.load("cars")
        >>> catalog.save("boats", df)
    """
    data_sets = {}
    catalog = copy.deepcopy(catalog) or {}
    credentials = copy.deepcopy(credentials) or {}
    run_id = journal.run_id if journal else None
    save_version = save_version or run_id or generate_timestamp()
    load_versions = copy.deepcopy(load_versions) or {}

    missing_keys = load_versions.keys() - catalog.keys()
    if missing_keys:
        warn(
            "`load_versions` keys [{}] are not found in the catalog.".format(
                ", ".join(sorted(missing_keys))
            )
        )

    for ds_name, ds_config in catalog.items():
        ds_config = _resolve_credentials(ds_config, credentials)
        data_sets[ds_name] = AbstractDataSet.from_config(
            ds_name, ds_config, load_versions.get(ds_name), save_version
        )
    return cls(data_sets=data_sets, journal=journal)