<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Helper classes — PyTables 3.0.0 documentation</title> <link rel="stylesheet" href="../../_static/cloud.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../../" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '3.0.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../../_static/toggle_sections.js"></script> <script type="text/javascript" src="../../_static/toggle_sidebar.js"></script> <link rel="shortcut icon" href="../../_static/favicon.ico"/> <link rel="top" title="PyTables 3.0.0 documentation" href="../../index.html" /> <link rel="up" title="Library Reference" href="../libref.html" /> <link rel="next" title="General purpose expression evaluator class" href="expr_class.html" /> <link rel="prev" title="Declarative classes" href="declarative_classes.html" /> </head> <body> <div class="relbar-top"> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> </li> <li class="right" > <a href="../../np-modindex.html" title="Python Module Index" >modules</a> </li> <li class="right" > <a href="expr_class.html" title="General purpose expression evaluator class" accesskey="N">next</a> </li> <li class="right" > <a href="declarative_classes.html" title="Declarative classes" accesskey="P">previous</a> </li> <li><a href="../../index.html">PyTables 3.0.0 documentation</a> »</li> <li><a href="../index.html" >PyTables User’s Guide</a> »</li> <li><a href="../libref.html" accesskey="U">Library Reference</a> »</li> </ul> </div> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="helper-classes"> <h1>Helper classes<a class="headerlink" href="#helper-classes" title="Permalink to this headline">¶</a></h1> <p>This section describes some classes that do not fit in any other section and that mainly serve for ancillary purposes.</p> <div class="section" id="the-filters-class"> <span id="filtersclassdescr"></span><h2>The Filters class<a class="headerlink" href="#the-filters-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.Filters"> <em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Filters</tt><big>(</big><em>complevel=0</em>, <em>complib='zlib'</em>, <em>shuffle=True</em>, <em>fletcher32=False</em>, <em>_new=True</em><big>)</big><a class="headerlink" href="#tables.Filters" title="Permalink to this definition">¶</a></dt> <dd><p>Container for filter properties.</p> <p>This class is meant to serve as a container that keeps information about the filter properties associated with the chunked leaves, that is Table, CArray, EArray and VLArray.</p> <p>Instances of this class can be directly compared for equality.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>complevel</strong> : int</p> <blockquote> <div><p>Specifies a compression level for data. The allowed range is 0-9. A value of 0 (the default) disables compression.</p> </div></blockquote> <p><strong>complib</strong> : str</p> <blockquote> <div><p>Specifies the compression library to be used. Right now, ‘zlib’ (the default), ‘lzo’, ‘bzip2’ and ‘blosc’ are supported. Specifying a compression library which is not available in the system issues a FiltersWarning and sets the library to the default one.</p> </div></blockquote> <p><strong>shuffle</strong> : bool</p> <blockquote> <div><p>Whether or not to use the <em>Shuffle</em> filter in the HDF5 library. This is normally used to improve the compression ratio. A false value disables shuffling and a true one enables it. The default value depends on whether compression is enabled or not; if compression is enabled, shuffling defaults to be enabled, else shuffling is disabled. Shuffling can only be used when compression is enabled.</p> </div></blockquote> <p><strong>fletcher32</strong> : bool</p> <blockquote class="last"> <div><p>Whether or not to use the <em>Fletcher32</em> filter in the HDF5 library. This is used to add a checksum on each data chunk. A false value (the default) disables the checksum.</p> </div></blockquote> </td> </tr> </tbody> </table> <p class="rubric">Examples</p> <p>This is a small example on using the Filters class:</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">from</span> <span class="nn">tables</span> <span class="kn">import</span> <span class="o">*</span> <span class="n">fileh</span> <span class="o">=</span> <span class="n">open_file</span><span class="p">(</span><span class="s">'test5.h5'</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'w'</span><span class="p">)</span> <span class="n">atom</span> <span class="o">=</span> <span class="n">Float32Atom</span><span class="p">()</span> <span class="n">filters</span> <span class="o">=</span> <span class="n">Filters</span><span class="p">(</span><span class="n">complevel</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">complib</span><span class="o">=</span><span class="s">'blosc'</span><span class="p">,</span> <span class="n">fletcher32</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> <span class="n">arr</span> <span class="o">=</span> <span class="n">fileh</span><span class="o">.</span><span class="n">create_earray</span><span class="p">(</span><span class="n">fileh</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="s">'earray'</span><span class="p">,</span> <span class="n">atom</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="s">"A growable array"</span><span class="p">,</span> <span class="n">filters</span><span class="o">=</span><span class="n">filters</span><span class="p">)</span> <span class="c"># Append several rows in only one call</span> <span class="n">arr</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span> <span class="p">[</span><span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">],</span> <span class="p">[</span><span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">float32</span><span class="p">))</span> <span class="c"># Print information on that enlargeable array</span> <span class="k">print</span><span class="p">(</span><span class="s">"Result Array:"</span><span class="p">)</span> <span class="k">print</span><span class="p">(</span><span class="nb">repr</span><span class="p">(</span><span class="n">arr</span><span class="p">))</span> <span class="n">fileh</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> </pre></div> </div> <p>This enforces the use of the Blosc library, a compression level of 1 and a Fletcher32 checksum filter as well. See the output of this example:</p> <div class="highlight-python"><pre>Result Array: /earray (EArray(3, 2), fletcher32, shuffle, blosc(1)) 'A growable array' type = float32 shape = (3, 2) itemsize = 4 nrows = 3 extdim = 0 flavor = 'numpy' byteorder = 'little'</pre> </div> <p class="rubric">Filters attributes</p> <dl class="attribute"> <dt id="tables.Filters.fletcher32"> <tt class="descname">fletcher32</tt><a class="headerlink" href="#tables.Filters.fletcher32" title="Permalink to this definition">¶</a></dt> <dd><p>Whether the <em>Fletcher32</em> filter is active or not.</p> </dd></dl> <dl class="attribute"> <dt id="tables.Filters.complevel"> <tt class="descname">complevel</tt><a class="headerlink" href="#tables.Filters.complevel" title="Permalink to this definition">¶</a></dt> <dd><p>The compression level (0 disables compression).</p> </dd></dl> <dl class="attribute"> <dt id="tables.Filters.complib"> <tt class="descname">complib</tt><a class="headerlink" href="#tables.Filters.complib" title="Permalink to this definition">¶</a></dt> <dd><p>The compression filter used (irrelevant when compression is not enabled).</p> </dd></dl> <dl class="attribute"> <dt id="tables.Filters.shuffle"> <tt class="descname">shuffle</tt><a class="headerlink" href="#tables.Filters.shuffle" title="Permalink to this definition">¶</a></dt> <dd><p>Whether the <em>Shuffle</em> filter is active or not.</p> </dd></dl> </dd></dl> <div class="section" id="filters-methods"> <h3>Filters methods<a class="headerlink" href="#filters-methods" title="Permalink to this headline">¶</a></h3> <dl class="method"> <dt id="tables.Filters.copy"> <tt class="descclassname">Filters.</tt><tt class="descname">copy</tt><big>(</big><em>**override</em><big>)</big><a class="headerlink" href="#tables.Filters.copy" title="Permalink to this definition">¶</a></dt> <dd><p>Get a copy of the filters, possibly overriding some arguments.</p> <p>Constructor arguments to be overridden must be passed as keyword arguments.</p> <p>Using this method is recommended over replacing the attributes of an instance, since instances of this class may become immutable in the future:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">filters1</span> <span class="o">=</span> <span class="n">Filters</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">filters2</span> <span class="o">=</span> <span class="n">filters1</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">filters1</span> <span class="o">==</span> <span class="n">filters2</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">filters1</span> <span class="ow">is</span> <span class="n">filters2</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">filters3</span> <span class="o">=</span> <span class="n">filters1</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">complevel</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">ValueError</span>: <span class="n">compression library ``None`` is not supported...</span> <span class="gp">>>> </span><span class="n">filters3</span> <span class="o">=</span> <span class="n">filters1</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">complevel</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">complib</span><span class="o">=</span><span class="s">'zlib'</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">filters1</span><span class="p">)</span> <span class="go">Filters(complevel=0, shuffle=False, fletcher32=False)</span> <span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">filters3</span><span class="p">)</span> <span class="go">Filters(complevel=1, complib='zlib', shuffle=False, fletcher32=False)</span> <span class="gp">>>> </span><span class="n">filters1</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">foobar</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">TypeError</span>: <span class="n">__init__() got an unexpected keyword argument 'foobar'</span> </pre></div> </div> </dd></dl> </div> </div> <div class="section" id="the-index-class"> <span id="indexclassdescr"></span><h2>The Index class<a class="headerlink" href="#the-index-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.index.Index"> <em class="property">class </em><tt class="descclassname">tables.index.</tt><tt class="descname">Index</tt><big>(</big><em>parentnode</em>, <em>name</em>, <em>atom=None</em>, <em>title=''</em>, <em>kind=None</em>, <em>optlevel=None</em>, <em>filters=None</em>, <em>tmp_dir=None</em>, <em>expectedrows=0</em>, <em>byteorder=None</em>, <em>blocksizes=None</em>, <em>new=True</em><big>)</big><a class="reference internal" href="../../_modules/tables/index.html#Index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.index.Index" title="Permalink to this definition">¶</a></dt> <dd><p>Represents the index of a column in a table.</p> <p>This class is used to keep the indexing information for columns in a Table dataset (see <a class="reference internal" href="structured_storage.html#tableclassdescr"><em>The Table class</em></a>). It is actually a descendant of the Group class (see <a class="reference internal" href="hierarchy_classes.html#groupclassdescr"><em>The Group class</em></a>), with some added functionality. An Index is always associated with one and only one column in the table.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">This class is mainly intended for internal use, but some of its documented attributes and methods may be interesting for the programmer.</p> </div> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>parentnode</strong> :</p> <blockquote> <div><p>The parent <a class="reference internal" href="hierarchy_classes.html#tables.Group" title="tables.Group"><tt class="xref py py-class docutils literal"><span class="pre">Group</span></tt></a> object.</p> <p class="versionchanged"> <span class="versionmodified">Changed in version 3.0: </span>Renamed from <em>parentNode</em> to <em>parentnode</em>.</p> </div></blockquote> <p><strong>name</strong> : str</p> <blockquote> <div><p>The name of this node in its parent group.</p> </div></blockquote> <p><strong>atom</strong> : Atom</p> <blockquote> <div><p>An Atom object representing the shape and type of the atomic objects to be saved. Only scalar atoms are supported.</p> </div></blockquote> <p><strong>title</strong> :</p> <blockquote> <div><p>Sets a TITLE attribute of the Index entity.</p> </div></blockquote> <p><strong>kind</strong> :</p> <blockquote> <div><p>The desired kind for this index. The ‘full’ kind specifies a complete track of the row position (64-bit), while the ‘medium’, ‘light’ or ‘ultralight’ kinds only specify in which chunk the row is (using 32-bit, 16-bit and 8-bit respectively).</p> </div></blockquote> <p><strong>optlevel</strong> :</p> <blockquote> <div><p>The desired optimization level for this index.</p> </div></blockquote> <p><strong>filters</strong> : Filters</p> <blockquote> <div><p>An instance of the Filters class that provides information about the desired I/O filters to be applied during the life of this object.</p> </div></blockquote> <p><strong>tmp_dir</strong> :</p> <blockquote> <div><p>The directory for the temporary files.</p> </div></blockquote> <p><strong>expectedrows</strong> :</p> <blockquote> <div><p>Represents an user estimate about the number of row slices that will be added to the growable dimension in the IndexArray object.</p> </div></blockquote> <p><strong>byteorder</strong> :</p> <blockquote> <div><p>The byteorder of the index datasets <em>on-disk</em>.</p> </div></blockquote> <p><strong>blocksizes</strong> :</p> <blockquote class="last"> <div><p>The four main sizes of the compound blocks in index datasets (a low level parameter).</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <div class="section" id="index-instance-variables"> <h3>Index instance variables<a class="headerlink" href="#index-instance-variables" title="Permalink to this headline">¶</a></h3> <dl class="attribute"> <dt id="tables.index.Index.column"> <tt class="descclassname">Index.</tt><tt class="descname">column</tt><a class="headerlink" href="#tables.index.Index.column" title="Permalink to this definition">¶</a></dt> <dd><p>The Column (see <a class="reference internal" href="structured_storage.html#columnclassdescr"><em>The Column class</em></a>) instance for the indexed column.</p> </dd></dl> <dl class="attribute"> <dt id="tables.index.Index.dirty"> <tt class="descclassname">Index.</tt><tt class="descname">dirty</tt><a class="headerlink" href="#tables.index.Index.dirty" title="Permalink to this definition">¶</a></dt> <dd><p>Whether the index is dirty or not.</p> <p>Dirty indexes are out of sync with column data, so they exist but they are not usable.</p> </dd></dl> <dl class="attribute"> <dt id="tables.index.Index.filters"> <tt class="descclassname">Index.</tt><tt class="descname">filters</tt><a class="headerlink" href="#tables.index.Index.filters" title="Permalink to this definition">¶</a></dt> <dd><p>Filter properties for this index - see Filters in <a class="reference internal" href="#filtersclassdescr"><em>The Filters class</em></a>.</p> </dd></dl> <dl class="attribute"> <dt id="tables.index.Index.is_csi"> <tt class="descclassname">Index.</tt><tt class="descname">is_csi</tt><a class="headerlink" href="#tables.index.Index.is_csi" title="Permalink to this definition">¶</a></dt> <dd><p>Whether the index is completely sorted or not.</p> <p class="versionchanged"> <span class="versionmodified">Changed in version 3.0: </span>The <em>is_CSI</em> property has been renamed into <em>is_csi</em>.</p> </dd></dl> <dl class="attribute"> <dt id="tables.tables.index.Index.nelements"> <tt class="descclassname">tables.index.Index.</tt><tt class="descname">nelements</tt><a class="headerlink" href="#tables.tables.index.Index.nelements" title="Permalink to this definition">¶</a></dt> <dd><p>The number of currently indexed rows for this column.</p> </dd></dl> </div> <div class="section" id="index-methods"> <h3>Index methods<a class="headerlink" href="#index-methods" title="Permalink to this headline">¶</a></h3> <dl class="method"> <dt id="tables.index.Index.read_sorted"> <tt class="descclassname">Index.</tt><tt class="descname">read_sorted</tt><big>(</big><em>start=None</em>, <em>stop=None</em>, <em>step=None</em><big>)</big><a class="reference internal" href="../../_modules/tables/index.html#Index.read_sorted"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.index.Index.read_sorted" title="Permalink to this definition">¶</a></dt> <dd><p>Return the sorted values of index in the specified range.</p> <p>The meaning of the start, stop and step arguments is the same as in <a class="reference internal" href="structured_storage.html#tables.Table.read_sorted" title="tables.Table.read_sorted"><tt class="xref py py-meth docutils literal"><span class="pre">Table.read_sorted()</span></tt></a>.</p> </dd></dl> <dl class="method"> <dt id="tables.index.Index.read_indices"> <tt class="descclassname">Index.</tt><tt class="descname">read_indices</tt><big>(</big><em>start=None</em>, <em>stop=None</em>, <em>step=None</em><big>)</big><a class="reference internal" href="../../_modules/tables/index.html#Index.read_indices"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.index.Index.read_indices" title="Permalink to this definition">¶</a></dt> <dd><p>Return the indices values of index in the specified range.</p> <p>The meaning of the start, stop and step arguments is the same as in <a class="reference internal" href="structured_storage.html#tables.Table.read_sorted" title="tables.Table.read_sorted"><tt class="xref py py-meth docutils literal"><span class="pre">Table.read_sorted()</span></tt></a>.</p> </dd></dl> </div> <div class="section" id="index-special-methods"> <h3>Index special methods<a class="headerlink" href="#index-special-methods" title="Permalink to this headline">¶</a></h3> <dl class="method"> <dt id="tables.index.Index.__getitem__"> <tt class="descclassname">Index.</tt><tt class="descname">__getitem__</tt><big>(</big><em>key</em><big>)</big><a class="reference internal" href="../../_modules/tables/index.html#Index.__getitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.index.Index.__getitem__" title="Permalink to this definition">¶</a></dt> <dd><p>Return the indices values of index in the specified range.</p> <p>If key argument is an integer, the corresponding index is returned. If key is a slice, the range of indices determined by it is returned. A negative value of step in slice is supported, meaning that the results will be returned in reverse order.</p> <p>This method is equivalent to <tt class="xref py py-meth docutils literal"><span class="pre">Index.read_indices()</span></tt>.</p> </dd></dl> </div> </div> <div class="section" id="the-indexarray-class"> <h2>The IndexArray class<a class="headerlink" href="#the-indexarray-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.indexes.IndexArray"> <em class="property">class </em><tt class="descclassname">tables.indexes.</tt><tt class="descname">IndexArray</tt><big>(</big><em>parentnode</em>, <em>name</em>, <em>atom=None</em>, <em>title=''</em>, <em>filters=None</em>, <em>byteorder=None</em><big>)</big><a class="reference internal" href="../../_modules/tables/indexes.html#IndexArray"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.indexes.IndexArray" title="Permalink to this definition">¶</a></dt> <dd><p>Represent the index (sorted or reverse index) dataset in HDF5 file.</p> <p>All NumPy typecodes are supported except for complex datatypes.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>parentnode</strong> :</p> <blockquote> <div><p>The Index class from which this object will hang off.</p> <p class="versionchanged"> <span class="versionmodified">Changed in version 3.0: </span>Renamed from <em>parentNode</em> to <em>parentnode</em>.</p> </div></blockquote> <p><strong>name</strong> : str</p> <blockquote> <div><p>The name of this node in its parent group.</p> </div></blockquote> <p><strong>atom</strong> :</p> <blockquote> <div><p>An Atom object representing the shape and type of the atomic objects to be saved. Only scalar atoms are supported.</p> </div></blockquote> <p><strong>title</strong> :</p> <blockquote> <div><p>Sets a TITLE attribute on the array entity.</p> </div></blockquote> <p><strong>filters</strong> : Filters</p> <blockquote> <div><p>An instance of the Filters class that provides information about the desired I/O filters to be applied during the life of this object.</p> </div></blockquote> <p><strong>byteorder</strong> :</p> <blockquote class="last"> <div><p>The byteroder of the data on-disk.</p> </div></blockquote> </td> </tr> </tbody> </table> <dl class="attribute"> <dt id="tables.indexes.IndexArray.chunksize"> <tt class="descname">chunksize</tt><a class="headerlink" href="#tables.indexes.IndexArray.chunksize" title="Permalink to this definition">¶</a></dt> <dd><p>The chunksize for this object.</p> </dd></dl> <dl class="attribute"> <dt id="tables.indexes.IndexArray.slicesize"> <tt class="descname">slicesize</tt><a class="headerlink" href="#tables.indexes.IndexArray.slicesize" title="Permalink to this definition">¶</a></dt> <dd><p>The slicesize for this object.</p> </dd></dl> </dd></dl> </div> <div class="section" id="the-enum-class"> <span id="enumclassdescr"></span><h2>The Enum class<a class="headerlink" href="#the-enum-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.misc.enum.Enum"> <em class="property">class </em><tt class="descclassname">tables.misc.enum.</tt><tt class="descname">Enum</tt><big>(</big><em>enum</em><big>)</big><a class="reference internal" href="../../_modules/tables/misc/enum.html#Enum"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.misc.enum.Enum" title="Permalink to this definition">¶</a></dt> <dd><p>Enumerated type.</p> <p>Each instance of this class represents an enumerated type. The values of the type must be declared <em>exhaustively</em> and named with <em>strings</em>, and they might be given explicit concrete values, though this is not compulsory. Once the type is defined, it can not be modified.</p> <p>There are three ways of defining an enumerated type. Each one of them corresponds to the type of the only argument in the constructor of Enum:</p> <ul> <li><p class="first"><em>Sequence of names</em>: each enumerated value is named using a string, and its order is determined by its position in the sequence; the concrete value is assigned automatically:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">boolEnum</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">([</span><span class="s">'True'</span><span class="p">,</span> <span class="s">'False'</span><span class="p">])</span> </pre></div> </div> </li> <li><p class="first"><em>Mapping of names</em>: each enumerated value is named by a string and given an explicit concrete value. All of the concrete values must be different, or a ValueError will be raised:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">priority</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'red'</span><span class="p">:</span> <span class="mi">20</span><span class="p">,</span> <span class="s">'orange'</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span> <span class="s">'green'</span><span class="p">:</span> <span class="mi">0</span><span class="p">})</span> <span class="gp">>>> </span><span class="n">colors</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'red'</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s">'blue'</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">ValueError</span>: <span class="n">enumerated values contain duplicate concrete values: 1</span> </pre></div> </div> </li> <li><p class="first"><em>Enumerated type</em>: in that case, a copy of the original enumerated type is created. Both enumerated types are considered equal:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">prio2</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">(</span><span class="n">priority</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">priority</span> <span class="o">==</span> <span class="n">prio2</span> <span class="go">True</span> </pre></div> </div> </li> </ul> <p>Please note that names starting with _ are not allowed, since they are reserved for internal usage:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">prio2</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">([</span><span class="s">'_xx'</span><span class="p">])</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">ValueError</span>: <span class="n">name of enumerated value can not start with ``_``: '_xx'</span> </pre></div> </div> <p>The concrete value of an enumerated value is obtained by getting its name as an attribute of the Enum instance (see __getattr__()) or as an item (see __getitem__()). This allows comparisons between enumerated values and assigning them to ordinary Python variables:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">redv</span> <span class="o">=</span> <span class="n">priority</span><span class="o">.</span><span class="n">red</span> <span class="gp">>>> </span><span class="n">redv</span> <span class="o">==</span> <span class="n">priority</span><span class="p">[</span><span class="s">'red'</span><span class="p">]</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">redv</span> <span class="o">></span> <span class="n">priority</span><span class="o">.</span><span class="n">green</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">priority</span><span class="o">.</span><span class="n">red</span> <span class="o">==</span> <span class="n">priority</span><span class="o">.</span><span class="n">orange</span> <span class="go">False</span> </pre></div> </div> <p>The name of the enumerated value corresponding to a concrete value can also be obtained by using the __call__() method of the enumerated type. In this way you get the symbolic name to use it later with __getitem__():</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">priority</span><span class="p">(</span><span class="n">redv</span><span class="p">)</span> <span class="go">'red'</span> <span class="gp">>>> </span><span class="n">priority</span><span class="o">.</span><span class="n">red</span> <span class="o">==</span> <span class="n">priority</span><span class="p">[</span><span class="n">priority</span><span class="p">(</span><span class="n">priority</span><span class="o">.</span><span class="n">red</span><span class="p">)]</span> <span class="go">True</span> </pre></div> </div> <p>(If you ask, the __getitem__() method is not used for this purpose to avoid ambiguity in the case of using strings as concrete values.)</p> </dd></dl> <div class="section" id="enum-special-methods"> <h3>Enum special methods<a class="headerlink" href="#enum-special-methods" title="Permalink to this headline">¶</a></h3> <dl class="method"> <dt id="tables.Enum.__call__"> <tt class="descclassname">Enum.</tt><tt class="descname">__call__</tt><big>(</big><em>value</em>, <em>*default</em><big>)</big><a class="headerlink" href="#tables.Enum.__call__" title="Permalink to this definition">¶</a></dt> <dd><p>Get the name of the enumerated value with that concrete value.</p> <p>If there is no value with that concrete value in the enumeration and a second argument is given as a default, this is returned. Else, a ValueError is raised.</p> <p>This method can be used for checking that a concrete value belongs to the set of concrete values in an enumerated type.</p> <p class="rubric">Examples</p> <p>Let <tt class="docutils literal"><span class="pre">enum</span></tt> be an enumerated type defined as:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'T2'</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span> </pre></div> </div> <p>then:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="go">'T2'</span> <span class="gp">>>> </span><span class="n">enum</span><span class="p">(</span><span class="mi">42</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="bp">None</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">enum</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">ValueError</span>: <span class="n">no enumerated value with that concrete value: 42</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.Enum.__contains__"> <tt class="descclassname">Enum.</tt><tt class="descname">__contains__</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#tables.Enum.__contains__" title="Permalink to this definition">¶</a></dt> <dd><p>Is there an enumerated value with that name in the type?</p> <p>If the enumerated type has an enumerated value with that name, True is returned. Otherwise, False is returned. The name must be a string.</p> <p>This method does <em>not</em> check for concrete values matching a value in an enumerated type. For that, please use the <a class="reference internal" href="#tables.Enum.__call__" title="tables.Enum.__call__"><tt class="xref py py-meth docutils literal"><span class="pre">Enum.__call__()</span></tt></a> method.</p> <p class="rubric">Examples</p> <p>Let <tt class="docutils literal"><span class="pre">enum</span></tt> be an enumerated type defined as:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'T2'</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span> </pre></div> </div> <p>then:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="s">'T1'</span> <span class="ow">in</span> <span class="n">enum</span> <span class="go">True</span> <span class="gp">>>> </span><span class="s">'foo'</span> <span class="ow">in</span> <span class="n">enum</span> <span class="go">False</span> <span class="gp">>>> </span><span class="mi">0</span> <span class="ow">in</span> <span class="n">enum</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">TypeError</span>: <span class="n">name of enumerated value is not a string: 0</span> <span class="gp">>>> </span><span class="n">enum</span><span class="o">.</span><span class="n">T1</span> <span class="ow">in</span> <span class="n">enum</span> <span class="c"># Be careful with this!</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">TypeError</span>: <span class="n">name of enumerated value is not a string: 2</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.Enum.__eq__"> <tt class="descclassname">Enum.</tt><tt class="descname">__eq__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#tables.Enum.__eq__" title="Permalink to this definition">¶</a></dt> <dd><p>Is the other enumerated type equivalent to this one?</p> <p>Two enumerated types are equivalent if they have exactly the same enumerated values (i.e. with the same names and concrete values).</p> <p class="rubric">Examples</p> <p>Let <tt class="docutils literal"><span class="pre">enum*</span></tt> be enumerated types defined as:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum1</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">})</span> <span class="gp">>>> </span><span class="n">enum2</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">(</span><span class="n">enum1</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">enum3</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">})</span> <span class="gp">>>> </span><span class="n">enum4</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'T2'</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span> <span class="gp">>>> </span><span class="n">enum5</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">})</span> <span class="gp">>>> </span><span class="n">enum6</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">20</span><span class="p">})</span> </pre></div> </div> <p>then:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum1</span> <span class="o">==</span> <span class="n">enum1</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">enum1</span> <span class="o">==</span> <span class="n">enum2</span> <span class="o">==</span> <span class="n">enum3</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">enum1</span> <span class="o">==</span> <span class="n">enum4</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">enum5</span> <span class="o">==</span> <span class="n">enum1</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">enum1</span> <span class="o">==</span> <span class="n">enum6</span> <span class="go">False</span> </pre></div> </div> <p>Comparing enumerated types with other kinds of objects produces a false result:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum1</span> <span class="o">==</span> <span class="p">{</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">}</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">enum1</span> <span class="o">==</span> <span class="p">[</span><span class="s">'T0'</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">]</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">enum1</span> <span class="o">==</span> <span class="mi">2</span> <span class="go">False</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.Enum.__getattr__"> <tt class="descclassname">Enum.</tt><tt class="descname">__getattr__</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#tables.Enum.__getattr__" title="Permalink to this definition">¶</a></dt> <dd><p>Get the concrete value of the enumerated value with that name.</p> <p>The name of the enumerated value must be a string. If there is no value with that name in the enumeration, an AttributeError is raised.</p> <p class="rubric">Examples</p> <p>Let <tt class="docutils literal"><span class="pre">enum</span></tt> be an enumerated type defined as:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'T2'</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span> </pre></div> </div> <p>then:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum</span><span class="o">.</span><span class="n">T1</span> <span class="go">2</span> <span class="gp">>>> </span><span class="n">enum</span><span class="o">.</span><span class="n">foo</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">AttributeError</span>: <span class="n">no enumerated value with that name: 'foo'</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.Enum.__getitem__"> <tt class="descclassname">Enum.</tt><tt class="descname">__getitem__</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#tables.Enum.__getitem__" title="Permalink to this definition">¶</a></dt> <dd><p>Get the concrete value of the enumerated value with that name.</p> <p>The name of the enumerated value must be a string. If there is no value with that name in the enumeration, a KeyError is raised.</p> <p class="rubric">Examples</p> <p>Let <tt class="docutils literal"><span class="pre">enum</span></tt> be an enumerated type defined as:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">({</span><span class="s">'T0'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'T1'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'T2'</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span> </pre></div> </div> <p>then:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enum</span><span class="p">[</span><span class="s">'T1'</span><span class="p">]</span> <span class="go">2</span> <span class="gp">>>> </span><span class="n">enum</span><span class="p">[</span><span class="s">'foo'</span><span class="p">]</span> <span class="gt">Traceback (most recent call last):</span> <span class="c">...</span> <span class="gr">KeyError</span>: <span class="n">"no enumerated value with that name: 'foo'"</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.Enum.__iter__"> <tt class="descclassname">Enum.</tt><tt class="descname">__iter__</tt><big>(</big><big>)</big><a class="headerlink" href="#tables.Enum.__iter__" title="Permalink to this definition">¶</a></dt> <dd><p>Iterate over the enumerated values.</p> <p>Enumerated values are returned as (name, value) pairs <em>in no particular order</em>.</p> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">enumvals</span> <span class="o">=</span> <span class="p">{</span><span class="s">'red'</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span> <span class="s">'green'</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'blue'</span><span class="p">:</span> <span class="mi">1</span><span class="p">}</span> <span class="gp">>>> </span><span class="n">enum</span> <span class="o">=</span> <span class="n">Enum</span><span class="p">(</span><span class="n">enumvals</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">enumdict</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">([(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="ow">in</span> <span class="n">enum</span><span class="p">])</span> <span class="gp">>>> </span><span class="n">enumvals</span> <span class="o">==</span> <span class="n">enumdict</span> <span class="go">True</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.Enum.__len__"> <tt class="descclassname">Enum.</tt><tt class="descname">__len__</tt><big>(</big><big>)</big><a class="headerlink" href="#tables.Enum.__len__" title="Permalink to this definition">¶</a></dt> <dd><p>Return the number of enumerated values in the enumerated type.</p> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">Enum</span><span class="p">([</span><span class="s">'e</span><span class="si">%d</span><span class="s">'</span> <span class="o">%</span> <span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">)]))</span> <span class="go">10</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.Enum.__repr__"> <tt class="descclassname">Enum.</tt><tt class="descname">__repr__</tt><big>(</big><big>)</big><a class="headerlink" href="#tables.Enum.__repr__" title="Permalink to this definition">¶</a></dt> <dd><p>Return the canonical string representation of the enumeration. The output of this method can be evaluated to give a new enumeration object that will compare equal to this one.</p> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="nb">repr</span><span class="p">(</span><span class="n">Enum</span><span class="p">({</span><span class="s">'name'</span><span class="p">:</span> <span class="mi">10</span><span class="p">}))</span> <span class="go">"Enum({'name': 10})"</span> </pre></div> </div> </dd></dl> </div> </div> <div class="section" id="the-unimplemented-class"> <span id="unimplementedclassdescr"></span><h2>The UnImplemented class<a class="headerlink" href="#the-unimplemented-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.UnImplemented"> <em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">UnImplemented</tt><big>(</big><em>parentnode</em>, <em>name</em><big>)</big><a class="headerlink" href="#tables.UnImplemented" title="Permalink to this definition">¶</a></dt> <dd><p>This class represents datasets not supported by PyTables in an HDF5 file.</p> <p>When reading a generic HDF5 file (i.e. one that has not been created with PyTables, but with some other HDF5 library based tool), chances are that the specific combination of datatypes or dataspaces in some dataset might not be supported by PyTables yet. In such a case, this dataset will be mapped into an UnImplemented instance and the user will still be able to access the complete object tree of the generic HDF5 file. The user will also be able to <em>read and write the attributes</em> of the dataset, <em>access some of its metadata</em>, and perform <em>certain hierarchy manipulation operations</em> like deleting or moving (but not copying) the node. Of course, the user will not be able to read the actual data on it.</p> <p>This is an elegant way to allow users to work with generic HDF5 files despite the fact that some of its datasets are not supported by PyTables. However, if you are really interested in having full access to an unimplemented dataset, please get in contact with the developer team.</p> <p>This class does not have any public instance variables or methods, except those inherited from the Leaf class (see <a class="reference internal" href="hierarchy_classes.html#leafclassdescr"><em>The Leaf class</em></a>).</p> <dl class="attribute"> <dt id="tables.UnImplemented.byteorder"> <tt class="descname">byteorder</tt><em class="property"> = None</em><a class="headerlink" href="#tables.UnImplemented.byteorder" title="Permalink to this definition">¶</a></dt> <dd><p>The endianness of data in memory (‘big’, ‘little’ or ‘irrelevant’).</p> </dd></dl> <dl class="attribute"> <dt id="tables.UnImplemented.nrows"> <tt class="descname">nrows</tt><em class="property"> = None</em><a class="headerlink" href="#tables.UnImplemented.nrows" title="Permalink to this definition">¶</a></dt> <dd><p>The length of the first dimension of the data.</p> </dd></dl> <dl class="attribute"> <dt id="tables.UnImplemented.shape"> <tt class="descname">shape</tt><em class="property"> = None</em><a class="headerlink" href="#tables.UnImplemented.shape" title="Permalink to this definition">¶</a></dt> <dd><p>The shape of the stored data.</p> </dd></dl> </dd></dl> </div> <div class="section" id="the-unknown-class"> <h2>The Unknown class<a class="headerlink" href="#the-unknown-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.Unknown"> <em class="property">class </em><tt class="descclassname">tables.</tt><tt class="descname">Unknown</tt><big>(</big><em>parentnode</em>, <em>name</em><big>)</big><a class="headerlink" href="#tables.Unknown" title="Permalink to this definition">¶</a></dt> <dd><p>This class represents nodes reported as <em>unknown</em> by the underlying HDF5 library.</p> <p>This class does not have any public instance variables or methods, except those inherited from the Node class.</p> </dd></dl> </div> <div class="section" id="exceptions-module"> <span id="exceptionsdescr"></span><h2>Exceptions module<a class="headerlink" href="#exceptions-module" title="Permalink to this headline">¶</a></h2> <p>In the <tt class="xref py py-mod docutils literal"><span class="pre">exceptions</span></tt> module exceptions and warnings that are specific to PyTables are declared.</p> <dl class="exception"> <dt id="tables.HDF5ExtError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">HDF5ExtError</tt><big>(</big><em>*args</em>, <em>**kargs</em><big>)</big><a class="headerlink" href="#tables.HDF5ExtError" title="Permalink to this definition">¶</a></dt> <dd><p>A low level HDF5 operation failed.</p> <p>This exception is raised the low level PyTables components used for accessing HDF5 files. It usually signals that something is not going well in the HDF5 library or even at the Input/Output level.</p> <p>Errors in the HDF5 C library may be accompanied by an extensive HDF5 back trace on standard error (see also <a class="reference internal" href="top_level.html#tables.silence_hdf5_messages" title="tables.silence_hdf5_messages"><tt class="xref py py-func docutils literal"><span class="pre">tables.silence_hdf5_messages()</span></tt></a>).</p> <p class="versionchanged"> <span class="versionmodified">Changed in version 2.4.</span></p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>message</strong> :</p> <blockquote> <div><p>error message</p> </div></blockquote> <p><strong>h5bt</strong> :</p> <blockquote class="last"> <div><p>This parameter (keyword only) controls the HDF5 back trace handling. Any keyword arguments other than h5bt is ignored.</p> <ul class="simple"> <li>if set to False the HDF5 back trace is ignored and the <a class="reference internal" href="#tables.HDF5ExtError.h5backtrace" title="tables.HDF5ExtError.h5backtrace"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.h5backtrace</span></tt></a> attribute is set to None</li> <li>if set to True the back trace is retrieved from the HDF5 library and stored in the <a class="reference internal" href="#tables.HDF5ExtError.h5backtrace" title="tables.HDF5ExtError.h5backtrace"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.h5backtrace</span></tt></a> attribute as a list of tuples</li> <li>if set to “VERBOSE” (default) the HDF5 back trace is stored in the <a class="reference internal" href="#tables.HDF5ExtError.h5backtrace" title="tables.HDF5ExtError.h5backtrace"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.h5backtrace</span></tt></a> attribute and also included in the string representation of the exception</li> <li>if not set (or set to None) the default policy is used (see <a class="reference internal" href="#tables.HDF5ExtError.DEFAULT_H5_BACKTRACE_POLICY" title="tables.HDF5ExtError.DEFAULT_H5_BACKTRACE_POLICY"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.DEFAULT_H5_BACKTRACE_POLICY</span></tt></a>)</li> </ul> </div></blockquote> </td> </tr> </tbody> </table> <dl class="method"> <dt id="tables.HDF5ExtError.format_h5_backtrace"> <tt class="descname">format_h5_backtrace</tt><big>(</big><em>backtrace=None</em><big>)</big><a class="headerlink" href="#tables.HDF5ExtError.format_h5_backtrace" title="Permalink to this definition">¶</a></dt> <dd><p>Convert the HDF5 trace back represented as a list of tuples (see <a class="reference internal" href="#tables.HDF5ExtError.h5backtrace" title="tables.HDF5ExtError.h5backtrace"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.h5backtrace</span></tt></a>) into a string.</p> <p class="versionadded"> <span class="versionmodified">New in version 2.4.</span></p> </dd></dl> <dl class="attribute"> <dt id="tables.HDF5ExtError.DEFAULT_H5_BACKTRACE_POLICY"> <tt class="descname">DEFAULT_H5_BACKTRACE_POLICY</tt><em class="property"> = 'VERBOSE'</em><a class="headerlink" href="#tables.HDF5ExtError.DEFAULT_H5_BACKTRACE_POLICY" title="Permalink to this definition">¶</a></dt> <dd><p>Default policy for HDF5 backtrace handling</p> <ul class="simple"> <li>if set to False the HDF5 back trace is ignored and the <a class="reference internal" href="#tables.HDF5ExtError.h5backtrace" title="tables.HDF5ExtError.h5backtrace"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.h5backtrace</span></tt></a> attribute is set to None</li> <li>if set to True the back trace is retrieved from the HDF5 library and stored in the <a class="reference internal" href="#tables.HDF5ExtError.h5backtrace" title="tables.HDF5ExtError.h5backtrace"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.h5backtrace</span></tt></a> attribute as a list of tuples</li> <li>if set to “VERBOSE” (default) the HDF5 back trace is stored in the <a class="reference internal" href="#tables.HDF5ExtError.h5backtrace" title="tables.HDF5ExtError.h5backtrace"><tt class="xref py py-attr docutils literal"><span class="pre">HDF5ExtError.h5backtrace</span></tt></a> attribute and also included in the string representation of the exception</li> </ul> <p>This parameter can be set using the <span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">PT_DEFAULT_H5_BACKTRACE_POLICY</span></tt> environment variable. Allowed values are “IGNORE” (or “FALSE”), “SAVE” (or “TRUE”) and “VERBOSE” to set the policy to False, True and “VERBOSE” respectively. The special value “DEFAULT” can be used to reset the policy to the default value</p> <p class="versionadded"> <span class="versionmodified">New in version 2.4.</span></p> </dd></dl> <dl class="attribute"> <dt id="tables.HDF5ExtError.h5backtrace"> <tt class="descname">h5backtrace</tt><em class="property"> = None</em><a class="headerlink" href="#tables.HDF5ExtError.h5backtrace" title="Permalink to this definition">¶</a></dt> <dd><p>HDF5 back trace.</p> <p>Contains the HDF5 back trace as a (possibly empty) list of tuples. Each tuple has the following format:</p> <div class="highlight-python"><pre>(filename, line number, function name, text)</pre> </div> <p>Depending on the value of the <em>h5bt</em> parameter passed to the initializer the h5backtrace attribute can be set to None. This means that the HDF5 back trace has been simply ignored (not retrieved from the HDF5 C library error stack) or that there has been an error (silently ignored) during the HDF5 back trace retrieval.</p> <p class="versionadded"> <span class="versionmodified">New in version 2.4.</span></p> <div class="admonition-see-also admonition seealso"> <p class="first admonition-title">See also</p> <dl class="last docutils"> <dt><tt class="xref py py-obj docutils literal"><span class="pre">traceback.format_list</span></tt></dt> <dd><tt class="xref py py-func docutils literal"><span class="pre">traceback.format_list()</span></tt></dd> </dl> </div> </dd></dl> </dd></dl> <dl class="exception"> <dt id="tables.ClosedNodeError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">ClosedNodeError</tt><a class="headerlink" href="#tables.ClosedNodeError" title="Permalink to this definition">¶</a></dt> <dd><p>The operation can not be completed because the node is closed.</p> <p>For instance, listing the children of a closed group is not allowed.</p> </dd></dl> <dl class="exception"> <dt id="tables.ClosedFileError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">ClosedFileError</tt><a class="headerlink" href="#tables.ClosedFileError" title="Permalink to this definition">¶</a></dt> <dd><p>The operation can not be completed because the hosting file is closed.</p> <p>For instance, getting an existing node from a closed file is not allowed.</p> </dd></dl> <dl class="exception"> <dt id="tables.FileModeError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">FileModeError</tt><a class="headerlink" href="#tables.FileModeError" title="Permalink to this definition">¶</a></dt> <dd><p>The operation can not be carried out because the mode in which the hosting file is opened is not adequate.</p> <p>For instance, removing an existing leaf from a read-only file is not allowed.</p> </dd></dl> <dl class="exception"> <dt id="tables.NodeError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">NodeError</tt><a class="headerlink" href="#tables.NodeError" title="Permalink to this definition">¶</a></dt> <dd><p>Invalid hierarchy manipulation operation requested.</p> <p>This exception is raised when the user requests an operation on the hierarchy which can not be run because of the current layout of the tree. This includes accessing nonexistent nodes, moving or copying or creating over an existing node, non-recursively removing groups with children, and other similarly invalid operations.</p> <p>A node in a PyTables database cannot be simply overwritten by replacing it. Instead, the old node must be removed explicitely before another one can take its place. This is done to protect interactive users from inadvertedly deleting whole trees of data by a single erroneous command.</p> </dd></dl> <dl class="exception"> <dt id="tables.NoSuchNodeError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">NoSuchNodeError</tt><a class="headerlink" href="#tables.NoSuchNodeError" title="Permalink to this definition">¶</a></dt> <dd><p>An operation was requested on a node that does not exist.</p> <p>This exception is raised when an operation gets a path name or a <tt class="docutils literal"><span class="pre">(where,</span> <span class="pre">name)</span></tt> pair leading to a nonexistent node.</p> </dd></dl> <dl class="exception"> <dt id="tables.UndoRedoError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">UndoRedoError</tt><a class="headerlink" href="#tables.UndoRedoError" title="Permalink to this definition">¶</a></dt> <dd><p>Problems with doing/redoing actions with Undo/Redo feature.</p> <p>This exception indicates a problem related to the Undo/Redo mechanism, such as trying to undo or redo actions with this mechanism disabled, or going to a nonexistent mark.</p> </dd></dl> <dl class="exception"> <dt id="tables.UndoRedoWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">UndoRedoWarning</tt><a class="headerlink" href="#tables.UndoRedoWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Issued when an action not supporting Undo/Redo is run.</p> <p>This warning is only shown when the Undo/Redo mechanism is enabled.</p> </dd></dl> <dl class="exception"> <dt id="tables.NaturalNameWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">NaturalNameWarning</tt><a class="headerlink" href="#tables.NaturalNameWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Issued when a non-pythonic name is given for a node.</p> <p>This is not an error and may even be very useful in certain contexts, but one should be aware that such nodes cannot be accessed using natural naming (instead, <tt class="docutils literal"><span class="pre">getattr()</span></tt> must be used explicitly).</p> </dd></dl> <dl class="exception"> <dt id="tables.PerformanceWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">PerformanceWarning</tt><a class="headerlink" href="#tables.PerformanceWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Warning for operations which may cause a performance drop.</p> <p>This warning is issued when an operation is made on the database which may cause it to slow down on future operations (i.e. making the node tree grow too much).</p> </dd></dl> <dl class="exception"> <dt id="tables.FlavorError"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">FlavorError</tt><a class="headerlink" href="#tables.FlavorError" title="Permalink to this definition">¶</a></dt> <dd><p>Unsupported or unavailable flavor or flavor conversion.</p> <p>This exception is raised when an unsupported or unavailable flavor is given to a dataset, or when a conversion of data between two given flavors is not supported nor available.</p> </dd></dl> <dl class="exception"> <dt id="tables.FlavorWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">FlavorWarning</tt><a class="headerlink" href="#tables.FlavorWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Unsupported or unavailable flavor conversion.</p> <p>This warning is issued when a conversion of data between two given flavors is not supported nor available, and raising an error would render the data inaccessible (e.g. on a dataset of an unavailable flavor in a read-only file).</p> <p>See the <cite>FlavorError</cite> class for more information.</p> </dd></dl> <dl class="exception"> <dt id="tables.FiltersWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">FiltersWarning</tt><a class="headerlink" href="#tables.FiltersWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Unavailable filters.</p> <p>This warning is issued when a valid filter is specified but it is not available in the system. It may mean that an available default filter is to be used instead.</p> </dd></dl> <dl class="exception"> <dt id="tables.OldIndexWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">OldIndexWarning</tt><a class="headerlink" href="#tables.OldIndexWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Unsupported index format.</p> <p>This warning is issued when an index in an unsupported format is found. The index will be marked as invalid and will behave as if doesn’t exist.</p> </dd></dl> <dl class="exception"> <dt id="tables.DataTypeWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">DataTypeWarning</tt><a class="headerlink" href="#tables.DataTypeWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Unsupported data type.</p> <p>This warning is issued when an unsupported HDF5 data type is found (normally in a file created with other tool than PyTables).</p> </dd></dl> <dl class="exception"> <dt id="tables.ExperimentalFeatureWarning"> <em class="property">exception </em><tt class="descclassname">tables.</tt><tt class="descname">ExperimentalFeatureWarning</tt><a class="headerlink" href="#tables.ExperimentalFeatureWarning" title="Permalink to this definition">¶</a></dt> <dd><p>Generic warning for experimental features.</p> <p>This warning is issued when using a functionality that is still experimental and that users have to use with care.</p> </dd></dl> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <p class="logo"><a href="../../index.html"> <img class="logo" src="../../_static/logo-pytables-small.png" alt="Logo"/> </a></p> <h3><a href="../../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Helper classes</a><ul> <li><a class="reference internal" href="#the-filters-class">The Filters class</a><ul> <li><a class="reference internal" href="#filters-methods">Filters methods</a></li> </ul> </li> <li><a class="reference internal" href="#the-index-class">The Index class</a><ul> <li><a class="reference internal" href="#index-instance-variables">Index instance variables</a></li> <li><a class="reference internal" href="#index-methods">Index methods</a></li> <li><a class="reference internal" href="#index-special-methods">Index special methods</a></li> </ul> </li> <li><a class="reference internal" href="#the-indexarray-class">The IndexArray class</a></li> <li><a class="reference internal" href="#the-enum-class">The Enum class</a><ul> <li><a class="reference internal" href="#enum-special-methods">Enum special methods</a></li> </ul> </li> <li><a class="reference internal" href="#the-unimplemented-class">The UnImplemented class</a></li> <li><a class="reference internal" href="#the-unknown-class">The Unknown class</a></li> <li><a class="reference internal" href="#exceptions-module">Exceptions module</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="declarative_classes.html" title="previous chapter">Declarative classes</a></p> <h4>Next topic</h4> <p class="topless"><a href="expr_class.html" title="next chapter">General purpose expression evaluator class</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/usersguide/libref/helper_classes.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="relbar-bottom"> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> </li> <li class="right" > <a href="../../np-modindex.html" title="Python Module Index" >modules</a> </li> <li class="right" > <a href="expr_class.html" title="General purpose expression evaluator class" >next</a> </li> <li class="right" > <a href="declarative_classes.html" title="Declarative classes" >previous</a> </li> <li><a href="../../index.html">PyTables 3.0.0 documentation</a> »</li> <li><a href="../index.html" >PyTables User’s Guide</a> »</li> <li><a href="../libref.html" >Library Reference</a> »</li> </ul> </div> </div> <div class="footer"> © Copyright 2011-2013, PyTables maintainers. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> <!-- cloud_sptheme 1.3 --> </body> </html>