MCPcopy Create free account
hub / github.com/cdgriffith/Box / __delitem__

Method __delitem__

box/box.py:707–726  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

705 self.__setitem__(key, value)
706
707 def __delitem__(self, key):
708 if self._box_config["frozen_box"]:
709 raise BoxError("Box is frozen")
710 if key not in self.keys() and self.__process_dotted_key(key):
711 try:
712 first_item, children = _parse_box_dots(self, key)
713 except BoxError:
714 raise BoxKeyError(str(key)) from None
715 if hasattr(self[first_item], "__delitem__"):
716 return self[first_item].__delitem__(children)
717 if key not in self.keys() and self._box_config["camel_killer_box"]:
718 if self._box_config["camel_killer_box"] and isinstance(key, str):
719 for each_key in self:
720 if _camel_killer(key) == each_key:
721 key = each_key
722 break
723 try:
724 super().__delitem__(key)
725 except KeyError as err:
726 raise BoxKeyError(str(err)) from _exception_cause(err)
727
728 def __delattr__(self, item):
729 if self._box_config["frozen_box"]:

Callers 1

__delattr__Method · 0.95

Calls 7

keysMethod · 0.95
__process_dotted_keyMethod · 0.95
BoxErrorClass · 0.90
BoxKeyErrorClass · 0.90
_parse_box_dotsFunction · 0.85
_camel_killerFunction · 0.85
_exception_causeFunction · 0.85

Tested by

no test coverage detected