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

Method _get_node

dns/btree.py:117–131  ·  view source on GitHub ↗

Get the node associated with key and its index, doing copy-on-write if we have to descend. Returns a tuple of the node and the index, or the tuple ``(None, 0)`` if the key was not found.

(self, key: KT)

Source from the content-addressed store, hash-verified

115 return child
116
117 def _get_node(self, key: KT) -> Tuple[Optional["_Node[KT, ET]"], int]:
118 """Get the node associated with key and its index, doing
119 copy-on-write if we have to descend.
120
121 Returns a tuple of the node and the index, or the tuple ``(None, 0)``
122 if the key was not found.
123 """
124 i, equal = self.search_in_node(key)
125 if equal:
126 return (self, i)
127 elif self.is_leaf:
128 return (None, 0)
129 else:
130 child = self.maybe_cow_child(i)
131 return child._get_node(key)
132
133 def get(self, key: KT) -> ET | None:
134 """Get the element associated with *key* or return ``None``"""

Callers 2

deleteMethod · 0.95

Calls 2

search_in_nodeMethod · 0.95
maybe_cow_childMethod · 0.95

Tested by 1