How to use the frozendict.frozendict.__getitem__ function in frozendict

To help you get started, we’ve selected a few frozendict 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 erigones / esdc-ce / vms / utils.py View on Github external
class AttrDict(dict):
    """
    Dict with class style attribute access.
    """
    __getattr__ = dict.__getitem__
    __setattr__ = dict.__setitem__
    __delattr__ = dict.__delitem__


class FrozenAttrDict(frozendict):
    """
    Frozendict with class style attribute access.
    """
    __getattr__ = frozendict.__getitem__


class DefAttrDict(AttrDict):
    """
    AttrDict with support for default values, which must be a AttrDict.
    """
    def __init__(self, data, defaults=None):
        super(DefAttrDict, self).__init__(data)
        if defaults is None:
            defaults = AttrDict()
        self.__defaults__ = defaults

    def __getattr__(self, key):
        try:
            return super(DefAttrDict, self).__getattr__(key)
        except KeyError:

frozendict

A simple immutable dictionary

LGPL-3.0
Latest version published 2 months ago

Package Health Score

82 / 100
Full package analysis

Similar packages