def moveFromShadow(file_, path): (shparent, shname) = file_._shadowName() node = shparent._f_getChild(shname) (pname, name) = splitPath(path) parent = file_._getNode(pname) node._g_move(parent, name)
def _g_setLocation(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 rootUEP = file_.rootUEP if name.startswith(rootUEP): # This has been called from File._getNode() assert parentDepth == 0 if rootUEP == "/": self._v_pathname = name else: self._v_pathname = name[len(rootUEP):] _, self._v_name = splitPath(name) self._v_depth = name.count("/") - rootUEP.count("/") + 1 else: # If we enter here is because this has been called elsewhere self._v_name = name self._v_pathname = joinPath(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) file_._refNode(self, self._v_pathname)
def _g_setLocation(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 rootUEP = file_.rootUEP if name.startswith(rootUEP): # This has been called from File._getNode() assert parentDepth == 0 if rootUEP == "/": self._v_pathname = name else: self._v_pathname = name[len(rootUEP):] _, self._v_name = splitPath(name) self._v_depth = name.count("/") - rootUEP.count("/") + 1 else: # If we enter here is because this has been called elsewhere self._v_name = name self._v_pathname = joinPath(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) file_._refNode(self, self._v_pathname)
def redoMove(file_, origpath, destpath): (destpname, destname) = splitPath(destpath) node = file_._getNode(origpath) destparent = file_._getNode(destpname) node._g_move(destparent, destname)
def undoMove(file_, origpath, destpath): (origpname, origname) = splitPath(origpath) node = file_._getNode(destpath) origparent = file_._getNode(origpname) node._g_move(origparent, origname)
def _g_getparent(self): (parentPath, nodeName) = splitPath(self._v_pathname) return self._v_file._getNode(parentPath)
def _indexPathnameOf_(nodePath): nodeParentPath, nodeName = splitPath(nodePath) return joinPath(nodeParentPath, _indexNameOf_(nodeName))
def _indexPathnameOf(node): nodeParentPath = splitPath(node._v_pathname)[0] return joinPath(nodeParentPath, _indexNameOf(node))