Update location-dependent attributes. Updates location data when an ancestor node has changed its location in the hierarchy to `newparentpath`. In fact, this method is expected to be called by an ancestor of this node. This also triggers the update of file referenc
(self, newparentpath: str)
| 394 | file_._node_manager.cache_node(self, self._v_pathname) |
| 395 | |
| 396 | def _g_update_location(self, newparentpath: str) -> None: |
| 397 | """Update location-dependent attributes. |
| 398 | |
| 399 | Updates location data when an ancestor node has changed its |
| 400 | location in the hierarchy to `newparentpath`. In fact, this |
| 401 | method is expected to be called by an ancestor of this node. |
| 402 | |
| 403 | This also triggers the update of file references to this node. |
| 404 | If the maximum recommended node depth is exceeded, a |
| 405 | `PerformanceWarning` is issued. This warning is assured to be |
| 406 | unique. |
| 407 | |
| 408 | """ |
| 409 | oldpath = self._v_pathname |
| 410 | newpath = join_path(newparentpath, self._v_name) |
| 411 | newdepth = newpath.count("/") |
| 412 | |
| 413 | self._v_pathname = newpath |
| 414 | self._v_depth = newdepth |
| 415 | |
| 416 | # Check if the node is too deep in the tree. |
| 417 | if newdepth > self._v_maxtreedepth: |
| 418 | warnings.warn( |
| 419 | """\ |
| 420 | moved descendent node is exceeding the recommended maximum depth (%d);\ |
| 421 | be ready to see PyTables asking for *lots* of memory and possibly slow I/O""" |
| 422 | % (self._v_maxtreedepth,), |
| 423 | PerformanceWarning, |
| 424 | ) |
| 425 | |
| 426 | node_manager = self._v_file._node_manager |
| 427 | node_manager.rename_node(oldpath, newpath) |
| 428 | |
| 429 | # Tell dependent objects about the new location of this node. |
| 430 | self._g_update_dependent() |
| 431 | |
| 432 | def _g_del_location(self) -> None: |
| 433 | """Clear location-dependent attributes. |
no test coverage detected