PyTables User's Guide: Hierarchical datasets in Python - Release 1.3.2 | ||
---|---|---|
Prev | Chapter 4. Library Reference | Next |
This is the base class for all nodes in a PyTables hierarchy. It is an abstract class, i.e. it may not be directly instantiated; however, every node in the hierarchy is an instance of this class.
A PyTables node is always hosted in a PyTables file, under a parent group, at a certain depth in the node hierarchy. A node knows its own name in the parent group and its own path name in the file. When using a translation map (see 4.2), its HDF5 name might differ from its PyTables name.
All the previous information is location-dependent, i.e. it may change when moving or renaming a node in the hierarchy. A node also has location-independent information, such as its HDF5 object identifier and its attribute set.
This class gathers the operations and attributes (both location-dependent and independent) which are common to all PyTables nodes, whatever their type is. Nonetheless, due to natural naming restrictions, the names of all of these members start with a reserved prefix (see 4.4).
Sub-classes with no children (i.e. leaf nodes) may define new methods, attributes and properties to avoid natural naming restrictions. For instance, _v_attrs may be shortened to attrs and _f_rename to rename. However, the original methods and attributes should still be available.
The hosting File instance (see 4.2).
The parent Group instance (see 4.4).
The depth of this node in the tree (an non-negative integer value).
The name of this node in its parent group (a string).
The name of this node in the hosting HDF5 file (a string).
The path of this node in the tree (a string).
The root group instance. This is deprecated; please use node._v_file.root.
The identifier of this node in the hosting HDF5 file.
The associated AttributeSet instance (see 4.15).
A description of this node. A shorthand for TITLE attribute.
Close this node in the tree.
This releases all resources held by the node, so it should not be used again. On nodes with data, it may be flushed to disk.
The closing operation is not recursive, i.e. closing a group does not close its children.
Is this node open?
Remove this node from the hierarchy.
If the node has children, recursive removal must be stated by giving recursive a true value; otherwise, a NodeError will be raised.
Rename this node in place.
Changes the name of a node to newname (a string).
Move or rename this node.
Moves a node into a new parent group, or changes the name of the node. newparent can be a Group object or a pathname in string form. If it is not specified or None, the current parent group is chosen as the new parent. newname must be a string with a new name. If it is not specified or None, the current name is chosen as the new name.
Moving a node across databases is not allowed, nor it is moving a node into itself. These result in a NodeError. However, moving a node over itself is allowed and simply does nothing. Moving over another existing node is similarly not allowed, unless the optional overwrite argument is true, in which case that node is recursively removed before moving.
Usually, only the first argument will be used, effectively moving the node to a new location without changing its name. Using only the second argument is equivalent to renaming the node in place.
Copy this node and return the new node.
Creates and returns a copy of the node, maybe in a different place in the hierarchy. newparent can be a Group object or a pathname in string form. If it is not specified or None, the current parent group is chosen as the new parent. newname must be a string with a new name. If it is not specified or None, the current name is chosen as the new name. If recursive copy is stated, all descendants are copied as well.
Copying a node across databases is supported but can not be undone. Copying a node over itself is not allowed, nor it is recursively copying a node into itself. These result in a NodeError. Copying over another existing node is similarly not allowed, unless the optional overwrite argument is true, in which case that node is recursively removed before copying.
Additional keyword arguments may be passed to customize the copying process. For instance, title and filters may be changed, user attributes may be or may not be copied, data may be sub-sampled, stats may be collected, etc. See the documentation for the particular node type.
Using only the first argument is equivalent to copying the node to a new location without changing its name. Using only the second argument is equivalent to making a copy of the node in the same group.
Is this node visible?
Get a PyTables attribute from this node.
If the named attribute does not exist, an AttributeError is raised.
Set a PyTables attribute for this node.
If the node already has a large number of attributes, a PerformanceWarning is issued.
Delete a PyTables attribute from this node.
If the named attribute does not exist, an AttributeError is raised.