def move_from_shadow(file_, path): (shparent, shname) = file_._shadow_name() node = shparent._f_get_child(shname) (pname, name) = split_path(path) parent = file_._get_node(pname) node._g_move(parent, name)
def _g_set_location(self, parentnode, name): """Set location-dependent attributes. Sets the location-dependent attributes of this node to reflect that it is placed under the specified `parentnode`, with the specified `name`. This also triggers the insertion of file references to this node. If the maximum recommended tree depth is exceeded, a `PerformanceWarning` is issued. """ file_ = parentnode._v_file parentdepth = parentnode._v_depth self._v_file = file_ self._v_isopen = True root_uep = file_.root_uep if name.startswith(root_uep): # This has been called from File._get_node() assert parentdepth == 0 if root_uep == "/": self._v_pathname = name else: self._v_pathname = name[len(root_uep) :] _, self._v_name = split_path(name) self._v_depth = name.count("/") - root_uep.count("/") + 1 else: # If we enter here is because this has been called elsewhere self._v_name = name self._v_pathname = join_path(parentnode._v_pathname, name) self._v_depth = parentdepth + 1 # Check if the node is too deep in the tree. if parentdepth >= self._v_maxtreedepth: warnings.warn( """\ node ``%s`` is exceeding the recommended maximum depth (%d);\ be ready to see PyTables asking for *lots* of memory and possibly slow I/O""" % (self._v_pathname, self._v_maxtreedepth), PerformanceWarning, ) if self._v_pathname != "/": file_._node_manager.cache_node(self, self._v_pathname)
def _g_set_location(self, parentnode, name): """Set location-dependent attributes. Sets the location-dependent attributes of this node to reflect that it is placed under the specified `parentnode`, with the specified `name`. This also triggers the insertion of file references to this node. If the maximum recommended tree depth is exceeded, a `PerformanceWarning` is issued. """ file_ = parentnode._v_file parentdepth = parentnode._v_depth self._v_file = file_ self._v_isopen = True root_uep = file_.root_uep if name.startswith(root_uep): # This has been called from File._get_node() assert parentdepth == 0 if root_uep == "/": self._v_pathname = name else: self._v_pathname = name[len(root_uep):] _, self._v_name = split_path(name) self._v_depth = name.count("/") - root_uep.count("/") + 1 else: # If we enter here is because this has been called elsewhere self._v_name = name self._v_pathname = join_path(parentnode._v_pathname, name) self._v_depth = parentdepth + 1 # Check if the node is too deep in the tree. if parentdepth >= self._v_maxtreedepth: warnings.warn( """\ node ``%s`` is exceeding the recommended maximum depth (%d);\ be ready to see PyTables asking for *lots* of memory and possibly slow I/O""" % (self._v_pathname, self._v_maxtreedepth), PerformanceWarning) if self._v_pathname != '/': file_._node_manager.cache_node(self, self._v_pathname)
def redo_move(file_, origpath, destpath): (destpname, destname) = split_path(destpath) node = file_._get_node(origpath) destparent = file_._get_node(destpname) node._g_move(destparent, destname)
def undo_move(file_, origpath, destpath): (origpname, origname) = split_path(origpath) node = file_._get_node(destpath) origparent = file_._get_node(origpname) node._g_move(origparent, origname)
def _g_getparent(self): (parentpath, nodename) = split_path(self._v_pathname) return self._v_file._get_node(parentpath)