Example #1
0
    def __setitem__(self, key, value):
        "Set key value-pair in dictionary"

        if key in self._valid_keys:
            return TransformedDict.__setitem__(self, key, value)
        else:
            raise Exception("Error: Invalid peer attribute '{}'.".format(key))
Example #2
0
    def __delitem__(self, key):
        "Reset key's value."

        if key in self._valid_keys:
            # Delete the item
            TransformedDict.__delitem__(self, key)
            # Re-create key with no value
            TransformedDict.__setitem__(self, key, None)
        else:
            # Delete unauth key
            TransformedDict.__delitem__(self, key)
Example #3
0
    def __getitem__(self, key):
        "Get value from dictionary."

        # Get item
        return TransformedDict.__getitem__(self, key)
Example #4
0
    def __dict__(self):
        "Return dictionary obj"

        return TransformedDict.__dict__()
Example #5
0
    def __repr__(self):
        "Object representation as string."

        return "Store({})".format(TransformedDict.__repr__(self))
Example #6
0
    def __str__(self):
        "String equivalent."

        return TransformedDict.__str__(self)