4.5. The Leaf class

The goal of this class is to provide a place to put common functionality of all its descendants as well as provide a way to help classifying objects on the tree. A Leaf object is an end-node, that is, a node that can hang directly from a group object, but that is not a group itself and, thus, it can not have descendants. Right now, the set of end-nodes is composed by Table, Array, CArray, EArray, VLArray and UnImplemented class instances. In fact, all the previous classes inherit from the Leaf class.

4.5.1. Leaf instance variables

These instance variables are provided in addition to those in Node (see 4.3).

shape

The shape of data in the leaf.

byteorder

The byte ordering of data in the leaf.

filters

Filter properties for this leaf —see 4.17.1.

name

The name of this node in its parent group (a string). An alias for Node._v_name.

hdf5name

The name of this node in the hosting HDF5 file (a string). An alias for Node._v_hdf5name.

objectID

The identifier of this node in the hosting HDF5 file. An alias for Node._v_objectID.

attrs

The associated AttributeSet instance (see 4.15). An alias for Node._v_attrs.

title

A description for this node. An alias for Node._v_title.

4.5.2. Leaf methods

4.5.2.1. flush()

Flush pending data to disk.

Saves whatever remaining buffered data to disk. It also releases I/O buffers, so, if you are filling many objects (i.e. tables) in the same PyTables session, please, call flush() extensively so as to help PyTables to keep memory requirements low.

4.5.2.2. _f_close(flush=True)

Close this node in the tree.

This method has the behavior described in Node._f_close() (see [here]). Besides that, the optional argument flush tells whether to flush pending data to disk or not before closing.

4.5.2.3. close(flush=True)

Close this node in the tree.

This method is completely equivalent to _f_close().

4.5.2.4. isOpen()

Is this node open?

This method is completely equivalent to _f_isOpen().

4.5.2.5. remove()

Remove this node from the hierarchy.

This method has the behavior described in Node._f_remove() (see [here]). Please, note that there is no recursive flag since leaves do not have child nodes.

4.5.2.6. copy(newparent, newname, overwrite=False, **kwargs)

Copy this node and return the new one.

This method has the behavior described in Node._f_copy() (see [here]). Please, note that there is no recursive flag since leaves do not have child nodes. In addition, this method recognizes the following keyword arguments:

title

The new title for the destination. If omitted or None, the original title is used.

filters

Specifying this parameter overrides the original filter properties in the source node. If specified, it must be an instance of the Filters class (see section 4.17.1). The default is to copy the filter properties from the source node.

copyuserattrs

You can prevent the user attributes from being copied by setting this parameter to False. The default is to copy them.

start, stop, step

Specify the range of rows in child leaves to be copied; the default is to copy all the rows.

stats

This argument may be used to collect statistics on the copy process. When used, it should be a dictionary with keys 'groups', 'leaves' and 'bytes' having a numeric value. Their values will be incremented to reflect the number of groups, leaves and bytes, respectively, that have been copied during the operation.

4.5.2.7. rename(newname)

Rename this node in place.

This method has the behavior described in Node._f_rename() (see [here]).

4.5.2.8. move(newparent=None, newname=None, overwrite=False)

Move or rename this node.

This method has the behavior described in Node._f_move() (see [here]).

4.5.2.9. _f_isVisible()

Is this node visible?

This method has the behavior described in Node._f_isVisible() (see [here]).

4.5.2.10. getAttr(name)

Get a PyTables attribute from this node.

This method has the behavior described in Node._f_getAttr() (see [here]).

4.5.2.11. setAttr(name, value)

Set a PyTables attribute for this node.

This method has the behavior described in Node._f_setAttr() (see [here]).

4.5.2.12. delAttr(name)

Delete a PyTables attribute from this node.

This method has the behavior described in Node._f_delAttr() (see [here]).