How to use the immutables.map.MapMutation function in immutables

To help you get started, we’ve selected a few immutables 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 MagicStack / immutables / immutables / map.py View on Github external
def __eq__(self, other):
        if not isinstance(other, MapMutation):
            return NotImplemented

        if len(self) != len(other):
            return False

        for key, val in self.__root.items():
            try:
                oval = other.__root.find(0, map_hash(key), key)
            except KeyError:
                return False
            else:
                if oval != val:
                    return False

        return True
github MagicStack / immutables / immutables / map.py View on Github external
def mutate(self):
        return MapMutation(self.__count, self.__root)