def __delattr__(self, attribute):
        """
		This method deletes both key and sibling attribute.

		:param attribute.: Attribute. ( Object )
		"""

        if hasattr(self, "_OrderedDict__root") and hasattr(self, "_OrderedDict__map"):
            if self._OrderedDict__root:
                OrderedDict.__delitem__(self, attribute)
        OrderedDict.__delattr__(self, attribute)
    def __delitem__(self, key, *args, **kwargs):
        """
		This method deletes both key and sibling attribute.

		:param key.: Key. ( Object )
		:param \*args: Arguments. ( \* )
		:param \*\*kwargs: Key / Value pairs. ( Key / Value pairs )
		"""

        OrderedDict.__delitem__(self, key, *args, **kwargs)
        OrderedDict.__delattr__(self, key)
Example #3
0
 def __delattr__(self, attr):
     """Implement basic functionality:
        Keys can be referenced as in dictionary methods, or as an attribute.
     """
     # print '>> in __delattr__', attr
     # preserve OrderedDict implementation attributes
     if attr in self.__dict__.keys():
         OrderedDict.__delattr__(self, attr)
     else:
         del (self[attr])
Example #4
0
 def __delattr__(self, key):
     try:
         self.pop(key)
     except KeyError:
         OrderedDict.__delattr__(self, key)
Example #5
0
 def __delattr__(self, name):
     try:
         del self[name]
     except KeyError:
         OrderedDict.__delattr__(self, name)
Example #6
0
 def __delattr__(self, item):
     if self.__dict__.has_key(item):
         OrderedDict.__delattr__(self, item)
     else:
         self.__delitem__(item)