<!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>Link 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="Declarative classes" href="declarative_classes.html" /> <link rel="prev" title="Homogenous storage classes" href="homogenous_storage.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="declarative_classes.html" title="Declarative classes" accesskey="N">next</a> </li> <li class="right" > <a href="homogenous_storage.html" title="Homogenous storage 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="link-classes"> <h1>Link classes<a class="headerlink" href="#link-classes" title="Permalink to this headline">¶</a></h1> <div class="section" id="the-link-class"> <span id="linkclassdescr"></span><h2>The Link class<a class="headerlink" href="#the-link-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.link.Link"> <em class="property">class </em><tt class="descclassname">tables.link.</tt><tt class="descname">Link</tt><big>(</big><em>parentnode</em>, <em>name</em>, <em>target=None</em>, <em>_log=False</em><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#Link"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.Link" title="Permalink to this definition">¶</a></dt> <dd><p>Abstract base class for all PyTables links.</p> <p>A link is a node that refers to another node. The Link class inherits from Node class and the links that inherits from Link are SoftLink and ExternalLink. There is not a HardLink subclass because hard links behave like a regular Group or Leaf. Contrarily to other nodes, links cannot have HDF5 attributes. This is an HDF5 library limitation that might be solved in future releases.</p> <p>See <a class="reference internal" href="../tutorials.html#linkstutorial"><em>Using links for more convenient access to nodes</em></a> for a small tutorial on how to work with links.</p> <p class="rubric">Link attributes</p> <dl class="attribute"> <dt id="tables.Link.target"> <tt class="descname">target</tt><a class="headerlink" href="#tables.Link.target" title="Permalink to this definition">¶</a></dt> <dd><p>The path string to the pointed node.</p> </dd></dl> </dd></dl> <div class="section" id="link-instance-variables"> <h3>Link instance variables<a class="headerlink" href="#link-instance-variables" title="Permalink to this headline">¶</a></h3> <dl class="attribute"> <dt id="tables.link.Link._v_attrs"> <tt class="descclassname">Link.</tt><tt class="descname">_v_attrs</tt><a class="reference internal" href="../../_modules/tables/link.html#Link._v_attrs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.Link._v_attrs" title="Permalink to this definition">¶</a></dt> <dd><p>A <em>NoAttrs</em> instance replacing the typical <em>AttributeSet</em> instance of other node objects. The purpose of <em>NoAttrs</em> is to make clear that HDF5 attributes are not supported in link nodes.</p> </dd></dl> </div> <div class="section" id="link-methods"> <h3>Link methods<a class="headerlink" href="#link-methods" title="Permalink to this headline">¶</a></h3> <p>The following methods are useful for copying, moving, renaming and removing links.</p> <dl class="method"> <dt id="tables.link.Link.copy"> <tt class="descclassname">Link.</tt><tt class="descname">copy</tt><big>(</big><em>newparent=None</em>, <em>newname=None</em>, <em>overwrite=False</em>, <em>createparents=False</em><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#Link.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.Link.copy" title="Permalink to this definition">¶</a></dt> <dd><p>Copy this link and return the new one.</p> <p>See <a class="reference internal" href="hierarchy_classes.html#tables.Node._f_copy" title="tables.Node._f_copy"><tt class="xref py py-meth docutils literal"><span class="pre">Node._f_copy()</span></tt></a> for a complete explanation of the arguments. Please note that there is no recursive flag since links do not have child nodes.</p> </dd></dl> <dl class="method"> <dt id="tables.link.Link.move"> <tt class="descclassname">Link.</tt><tt class="descname">move</tt><big>(</big><em>newparent=None</em>, <em>newname=None</em>, <em>overwrite=False</em><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#Link.move"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.Link.move" title="Permalink to this definition">¶</a></dt> <dd><p>Move or rename this link.</p> <p>See <a class="reference internal" href="hierarchy_classes.html#tables.Node._f_move" title="tables.Node._f_move"><tt class="xref py py-meth docutils literal"><span class="pre">Node._f_move()</span></tt></a> for a complete explanation of the arguments.</p> </dd></dl> <dl class="method"> <dt id="tables.link.Link.remove"> <tt class="descclassname">Link.</tt><tt class="descname">remove</tt><big>(</big><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#Link.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.Link.remove" title="Permalink to this definition">¶</a></dt> <dd><p>Remove this link from the hierarchy.</p> </dd></dl> <dl class="method"> <dt id="tables.link.Link.rename"> <tt class="descclassname">Link.</tt><tt class="descname">rename</tt><big>(</big><em>newname=None</em>, <em>overwrite=False</em><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#Link.rename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.Link.rename" title="Permalink to this definition">¶</a></dt> <dd><p>Rename this link in place.</p> <p>See <a class="reference internal" href="hierarchy_classes.html#tables.Node._f_rename" title="tables.Node._f_rename"><tt class="xref py py-meth docutils literal"><span class="pre">Node._f_rename()</span></tt></a> for a complete explanation of the arguments.</p> </dd></dl> </div> </div> <div class="section" id="the-softlink-class"> <span id="softlinkclassdescr"></span><h2>The SoftLink class<a class="headerlink" href="#the-softlink-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.link.SoftLink"> <em class="property">class </em><tt class="descclassname">tables.link.</tt><tt class="descname">SoftLink</tt><big>(</big><em>parentnode</em>, <em>name</em>, <em>target=None</em>, <em>_log=False</em><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#SoftLink"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.SoftLink" title="Permalink to this definition">¶</a></dt> <dd><p>Represents a soft link (aka symbolic link).</p> <p>A soft link is a reference to another node in the <em>same</em> file hierarchy. Getting access to the pointed node (this action is called <em>dereferrencing</em>) is done via the __call__ special method (see below).</p> </dd></dl> <div class="section" id="softlink-special-methods"> <h3>SoftLink special methods<a class="headerlink" href="#softlink-special-methods" title="Permalink to this headline">¶</a></h3> <p>The following methods are specific for dereferrencing and representing soft links.</p> <dl class="method"> <dt id="tables.link.SoftLink.__call__"> <tt class="descclassname">SoftLink.</tt><tt class="descname">__call__</tt><big>(</big><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#SoftLink.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.SoftLink.__call__" title="Permalink to this definition">¶</a></dt> <dd><p>Dereference <cite>self.target</cite> and return the object.</p> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">f</span><span class="o">=</span><span class="n">tables</span><span class="o">.</span><span class="n">open_file</span><span class="p">(</span><span class="s">'data/test.h5'</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">link0</span> <span class="go">/link0 (SoftLink) -> /another/path</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">link0</span><span class="p">()</span> <span class="go">/another/path (Group) ''</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.link.SoftLink.__str__"> <tt class="descclassname">SoftLink.</tt><tt class="descname">__str__</tt><big>(</big><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#SoftLink.__str__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.SoftLink.__str__" title="Permalink to this definition">¶</a></dt> <dd><p>Return a short string representation of the link.</p> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">f</span><span class="o">=</span><span class="n">tables</span><span class="o">.</span><span class="n">open_file</span><span class="p">(</span><span class="s">'data/test.h5'</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">link0</span> <span class="go">/link0 (SoftLink) -> /path/to/node</span> </pre></div> </div> </dd></dl> </div> </div> <div class="section" id="the-externallink-class"> <h2>The ExternalLink class<a class="headerlink" href="#the-externallink-class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="tables.link.ExternalLink"> <em class="property">class </em><tt class="descclassname">tables.link.</tt><tt class="descname">ExternalLink</tt><big>(</big><em>parentnode</em>, <em>name</em>, <em>target=None</em>, <em>_log=False</em><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#ExternalLink"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.ExternalLink" title="Permalink to this definition">¶</a></dt> <dd><p>Represents an external link.</p> <p>An external link is a reference to a node in <em>another</em> file. Getting access to the pointed node (this action is called <em>dereferencing</em>) is done via the <tt class="xref py py-meth docutils literal"><span class="pre">__call__()</span></tt> special method (see below).</p> <p class="rubric">ExternalLink attributes</p> <dl class="attribute"> <dt id="tables.ExternalLink.extfile"> <tt class="descname">extfile</tt><a class="headerlink" href="#tables.ExternalLink.extfile" title="Permalink to this definition">¶</a></dt> <dd><p>The external file handler, if the link has been dereferenced. In case the link has not been dereferenced yet, its value is None.</p> </dd></dl> </dd></dl> <div class="section" id="externallink-methods"> <h3>ExternalLink methods<a class="headerlink" href="#externallink-methods" title="Permalink to this headline">¶</a></h3> <dl class="method"> <dt id="tables.link.ExternalLink.umount"> <tt class="descclassname">ExternalLink.</tt><tt class="descname">umount</tt><big>(</big><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#ExternalLink.umount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.ExternalLink.umount" title="Permalink to this definition">¶</a></dt> <dd><p>Safely unmount self.extfile, if opened.</p> </dd></dl> </div> <div class="section" id="externallink-special-methods"> <h3>ExternalLink special methods<a class="headerlink" href="#externallink-special-methods" title="Permalink to this headline">¶</a></h3> <p>The following methods are specific for dereferrencing and representing external links.</p> <dl class="method"> <dt id="tables.link.ExternalLink.__call__"> <tt class="descclassname">ExternalLink.</tt><tt class="descname">__call__</tt><big>(</big><em>**kwargs</em><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#ExternalLink.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.ExternalLink.__call__" title="Permalink to this definition">¶</a></dt> <dd><p>Dereference self.target and return the object.</p> <p>You can pass all the arguments supported by the <a class="reference internal" href="top_level.html#tables.open_file" title="tables.open_file"><tt class="xref py py-func docutils literal"><span class="pre">open_file()</span></tt></a> function (except filename, of course) so as to open the referenced external file.</p> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">f</span><span class="o">=</span><span class="n">tables</span><span class="o">.</span><span class="n">open_file</span><span class="p">(</span><span class="s">'data1/test1.h5'</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">link2</span> <span class="go">/link2 (ExternalLink) -> data2/test2.h5:/path/to/node</span> <span class="gp">>>> </span><span class="n">plink2</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">link2</span><span class="p">(</span><span class="s">'a'</span><span class="p">)</span> <span class="c"># open in 'a'ppend mode</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">plink2</span> <span class="go">/path/to/node (Group) ''</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">plink2</span><span class="o">.</span><span class="n">_v_filename</span> <span class="go">'data2/test2.h5' # belongs to referenced file</span> </pre></div> </div> </dd></dl> <dl class="method"> <dt id="tables.link.ExternalLink.__str__"> <tt class="descclassname">ExternalLink.</tt><tt class="descname">__str__</tt><big>(</big><big>)</big><a class="reference internal" href="../../_modules/tables/link.html#ExternalLink.__str__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tables.link.ExternalLink.__str__" title="Permalink to this definition">¶</a></dt> <dd><p>Return a short string representation of the link.</p> <p class="rubric">Examples</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">f</span><span class="o">=</span><span class="n">tables</span><span class="o">.</span><span class="n">open_file</span><span class="p">(</span><span class="s">'data1/test1.h5'</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">f</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">link2</span> <span class="go">/link2 (ExternalLink) -> data2/test2.h5:/path/to/node</span> </pre></div> </div> </dd></dl> </div> </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="#">Link classes</a><ul> <li><a class="reference internal" href="#the-link-class">The Link class</a><ul> <li><a class="reference internal" href="#link-instance-variables">Link instance variables</a></li> <li><a class="reference internal" href="#link-methods">Link methods</a></li> </ul> </li> <li><a class="reference internal" href="#the-softlink-class">The SoftLink class</a><ul> <li><a class="reference internal" href="#softlink-special-methods">SoftLink special methods</a></li> </ul> </li> <li><a class="reference internal" href="#the-externallink-class">The ExternalLink class</a><ul> <li><a class="reference internal" href="#externallink-methods">ExternalLink methods</a></li> <li><a class="reference internal" href="#externallink-special-methods">ExternalLink special methods</a></li> </ul> </li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="homogenous_storage.html" title="previous chapter">Homogenous storage classes</a></p> <h4>Next topic</h4> <p class="topless"><a href="declarative_classes.html" title="next chapter">Declarative classes</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/usersguide/libref/link_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="declarative_classes.html" title="Declarative classes" >next</a> </li> <li class="right" > <a href="homogenous_storage.html" title="Homogenous storage 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>