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

Method close_subtree

tables/file.py:552–582  ·  view source on GitHub ↗

Close a sub-tree of nodes.

(self, prefix: str = "/")

Source from the content-addressed store, hash-verified

550 pass
551
552 def close_subtree(self, prefix: str = "/") -> None:
553 """Close a sub-tree of nodes."""
554 if not prefix.endswith("/"):
555 prefix = prefix + "/"
556
557 cache = self.cache
558 registry = self.registry
559
560 # Ensure tables are closed before their indices
561 paths = [
562 path
563 for path in cache
564 if path.startswith(prefix) and "/_i_" not in path
565 ]
566 self._close_nodes(paths, cache.pop)
567
568 # Close everything else (i.e. indices)
569 paths = [path for path in cache if path.startswith(prefix)]
570 self._close_nodes(paths, cache.pop)
571
572 # Ensure tables are closed before their indices
573 paths = [
574 path
575 for path in registry
576 if path.startswith(prefix) and "/_i_" not in path
577 ]
578 self._close_nodes(paths, registry.pop)
579
580 # Close everything else (i.e. indices)
581 paths = [path for path in registry if path.startswith(prefix)]
582 self._close_nodes(paths, registry.pop)
583
584 def shutdown(self) -> None:
585 """Shutdown the node manager."""

Callers 1

_g_close_descendentsMethod · 0.80

Calls 1

_close_nodesMethod · 0.95

Tested by

no test coverage detected