# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/utils/DictDot.ipynb.

# %% auto 0
__all__ = ['DictDot']

# %% ../../nbs/utils/DictDot.ipynb 2
from types import SimpleNamespace

# %% ../../nbs/utils/DictDot.ipynb 3
class DictDot(SimpleNamespace):
    """a utility class that converts json into an object that supports data retrieval with dot notation"""

    def __init__(self, dictionary: dict,  # dictionary to convert
                 **kwargs):
        super().__init__(**kwargs)

        for key, value in dictionary.items():
            if isinstance(value, dict):
                self.__setattr__(key, DictDot(value))
            elif isinstance(value, list):
                new_list = []
                for item in value:
                    if isinstance(item, dict):
                        new_list.append(DictDot(item))
                    else:
                        new_list.append(item)
                self.__setattr__(key, new_list)
            else:
                self.__setattr__(key, value)

    def __getattr__(self, item):
        return None

