MCPcopy Create free account
hub / github.com/rthalley/dnspython / _delete

Method _delete

dns/btree.py:694–709  ·  view source on GitHub ↗
(self, key: KT, exact: ET | None)

Source from the content-addressed store, hash-verified

692 return self.root.get(key)
693
694 def _delete(self, key: KT, exact: ET | None) -> ET | None:
695 self._check_mutable_and_park()
696 cloned = self.root.maybe_cow(self.creator)
697 if cloned:
698 self.root = cloned
699 elt = self.root.delete(key, None, exact)
700 if elt is not None:
701 # We deleted something
702 self.size -= 1
703 if len(self.root.elts) == 0:
704 # The root is now empty. If there is a child, then collapse this root
705 # level and make the child the new root.
706 if not self.root.is_leaf:
707 assert len(self.root.children) == 1
708 self.root = self.root.children[0]
709 return elt
710
711 def delete_key(self, key: KT) -> ET | None:
712 """Delete the element matching *key* from the BTree.

Callers 2

delete_keyMethod · 0.95
delete_exactMethod · 0.95

Calls 3

maybe_cowMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected