How to use the munch.Munch.__setattr__ function in munch

To help you get started, we’ve selected a few munch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ponty / confduino / confduino / util.py View on Github external
def __setattr__(self, k, v):
        """Recursive.

        >>> x=AutoBunch()
        >>> setattr(x, 'mega.name', 'xy')

        """
        k2, _, k3 = k.partition('.')
        if k3:
            self.__getattr__(k2).__setattr__(k3, v)
        else:
            Munch.__setattr__(self, k, v)