File: hierarchy_classes.rst

package info (click to toggle)
pytables 3.10.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,228 kB
  • sloc: ansic: 82,212; python: 65,296; cpp: 753; sh: 394; makefile: 100
file content (248 lines) | stat: -rw-r--r-- 5,848 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
.. currentmodule:: tables

Hierarchy definition classes
============================


.. _NodeClassDescr:

The Node class
--------------
.. autoclass:: Node

.. These are defined in class docstring
    .. autoattribute:: Node._v_depth
    .. autoattribute:: Node._v_file
    .. autoattribute:: Node._v_name
    .. autoattribute:: Node._v_pathname
    .. autoattribute:: Node._v_objectid (location independent)

Node instance variables - location dependent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoattribute:: Node._v_parent


Node instance variables - location independent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoattribute:: Node._v_attrs

.. autoattribute:: Node._v_isopen


Node instance variables - attribute shorthands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoattribute:: Node._v_title


Node methods - hierarchy manipulation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. automethod:: Node._f_close

.. automethod:: Node._f_copy

.. automethod:: Node._f_isvisible

.. automethod:: Node._f_move

.. automethod:: Node._f_remove

.. automethod:: Node._f_rename


Node methods - attribute handling
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. automethod:: Node._f_delattr

.. automethod:: Node._f_getattr

.. automethod:: Node._f_setattr


.. _GroupClassDescr:

The Group class
---------------
.. autoclass:: Group

..  These are defined in the class docstring
    Group instance variables
    ~~~~~~~~~~~~~~~~~~~~~~~~
    The following instance variables are provided in addition to those in Node
    (see :ref:`NodeClassDescr`):

    .. autoattribute:: Group._v_children
    .. autoattribute:: Group._v_groups
    .. autoattribute:: Group._v_hidden
    .. autoattribute:: Group._v_leaves
    .. autoattribute:: Group._v_links
    .. autoattribute:: Group._v_unknown

Group properties
~~~~~~~~~~~~~~~~
.. autoattribute:: Group._v_nchildren

.. autoattribute:: Group._v_filters


Group methods
~~~~~~~~~~~~~

.. important::

    *Caveat:* The following methods are documented for completeness, and they
    can be used without any problem. However, you should use the high-level
    counterpart methods in the File class (see :ref:`FileClassDescr`, because
    they are most used in documentation and examples, and are a bit more
    powerful than those exposed here.

The following methods are provided in addition to those in
Node (see :ref:`NodeClassDescr`):


.. automethod:: Group._f_close

.. automethod:: Group._f_copy

.. automethod:: Group._f_copy_children

.. automethod:: Group._f_get_child

.. automethod:: Group._f_iter_nodes

.. automethod:: Group._f_list_nodes

.. automethod:: Group._f_walk_groups

.. automethod:: Group._f_walknodes


Group special methods
~~~~~~~~~~~~~~~~~~~~~
Following are described the methods that automatically trigger actions when a
Group instance is accessed in a special way.

This class defines the :meth:`__setattr__`, :meth:`__getattr__` and
:meth:`__delattr__` methods, and they set, get and delete *ordinary Python
attributes* as normally intended. In addition to that, :meth:`__getattr__`
allows getting *child nodes* by their name for the sake of easy interaction
on the command line, as long as there is no Python attribute with the same
name. Groups also allow the interactive completion (when using readline) of
the names of child nodes. For instance::

    # get a Python attribute
    nchild = group._v_nchildren

    # Add a Table child called 'table' under 'group'.
    h5file.create_table(group, 'table', my_description)
    table = group.table          # get the table child instance
    group.table = 'foo'          # set a Python attribute

    # (PyTables warns you here about using the name of a child node.)
    foo = group.table            # get a Python attribute
    del group.table              # delete a Python attribute
    table = group.table          # get the table child instance again

.. automethod:: Group.__contains__

.. automethod:: Group.__delattr__

.. automethod:: Group.__getattr__

.. automethod:: Group.__iter__

.. automethod:: Group.__repr__

.. automethod:: Group.__setattr__

.. automethod:: Group.__str__


.. _LeafClassDescr:

The Leaf class
--------------
.. autoclass:: Leaf

..  These are defined in the class docstring
    .. _LeafInstanceVariables:

    Leaf instance variables
    ~~~~~~~~~~~~~~~~~~~~~~~
    These instance variables are provided in addition to those in Node
    (see :ref:`NodeClassDescr`):

    .. autoattribute:: Leaf.byteorder
    .. autoattribute:: Leaf.dtype
    .. autoattribute:: Leaf.extdim
    .. autoattribute:: Leaf.nrows
    .. autoattribute:: Leaf.nrowsinbuf
    .. autoattribute:: Leaf.shape


Leaf properties
~~~~~~~~~~~~~~~
.. autoattribute:: Leaf.chunkshape

.. autoattribute:: Leaf.ndim

.. autoattribute:: Leaf.filters

.. autoattribute:: Leaf.maindim

.. autoattribute:: Leaf.flavor

.. attribute:: Leaf.size_in_memory

    The size of this leaf's data in bytes when it is fully loaded into
    memory.

.. autoattribute:: Leaf.size_on_disk


Leaf instance variables - aliases
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following are just easier-to-write aliases to their Node (see
:ref:`NodeClassDescr`) counterparts (indicated between parentheses):

.. autoattribute:: Leaf.attrs

.. autoattribute:: Leaf.name

.. autoattribute:: Leaf.object_id

.. autoattribute:: Leaf.title


Leaf methods
~~~~~~~~~~~~
.. automethod:: Leaf.close

.. automethod:: Leaf.copy

.. automethod:: Leaf.flush

.. automethod:: Leaf.isvisible

.. automethod:: Leaf.move

.. automethod:: Leaf.rename

.. automethod:: Leaf.remove

.. automethod:: Leaf.get_attr

.. automethod:: Leaf.set_attr

.. automethod:: Leaf.del_attr

.. automethod:: Leaf.truncate

.. automethod:: Leaf.chunk_info

.. automethod:: Leaf.read_chunk

.. automethod:: Leaf.write_chunk

.. automethod:: Leaf.__len__

.. automethod:: Leaf._f_close