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

Method _update_node_locations

tables/file.py:3015–3032  ·  view source on GitHub ↗

Update location information of nodes under `oldpath`. This only affects *already loaded* nodes.

(self, oldpath: str, newpath: str)

Source from the content-addressed store, hash-verified

3013 return "\n".join(lines) + "\n"
3014
3015 def _update_node_locations(self, oldpath: str, newpath: str) -> None:
3016 """Update location information of nodes under `oldpath`.
3017
3018 This only affects *already loaded* nodes.
3019
3020 """
3021 oldprefix = oldpath + "/" # root node can not be renamed, anyway
3022 oldprefix_len = len(oldprefix)
3023
3024 # Update alive and dead descendents.
3025 for cache in [self._node_manager.cache, self._node_manager.registry]:
3026 for nodepath in list(cache):
3027 if nodepath.startswith(oldprefix) and nodepath != oldprefix:
3028 nodesuffix = nodepath[oldprefix_len:]
3029 newnodepath = join_path(newpath, nodesuffix)
3030 newnodeppath = split_path(newnodepath)[0]
3031 descendent_node = self._get_node(nodepath)
3032 descendent_node._g_update_location(newnodeppath)
3033
3034
3035# If a user hits ^C during a run, it is wise to gracefully close the

Callers 1

_g_moveMethod · 0.80

Calls 4

_get_nodeMethod · 0.95
join_pathFunction · 0.85
split_pathFunction · 0.85
_g_update_locationMethod · 0.80

Tested by

no test coverage detected