MCPcopy Create free account
hub / github.com/PyTables/PyTables / cache_node

Method cache_node

tables/file.py:407–421  ·  view source on GitHub ↗

Create a node.

(self, node: Node, key: str | None = None)

Source from the content-addressed store, hash-verified

405 self.registry[key] = node
406
407 def cache_node(self, node: Node, key: str | None = None) -> None:
408 """Create a node."""
409 if key is None:
410 key = node._v_pathname
411
412 self.register_node(node, key)
413 if key in self.cache:
414 oldnode = self.cache.pop(key)
415 if oldnode is not node and oldnode._v_isopen:
416 raise RuntimeError(
417 "trying to cache a node with an "
418 "existing key: ``%s``" % key
419 )
420
421 self.cache[key] = node
422
423 def get_node(self, key: str) -> Node:
424 """Return a node matching the input key."""

Callers 2

get_nodeMethod · 0.95
_g_set_locationMethod · 0.80

Calls 2

register_nodeMethod · 0.95
popMethod · 0.80

Tested by

no test coverage detected