docs in progress

This commit is contained in:
ftg 2024-04-07 17:00:29 +02:00
parent 82cb7cf320
commit f19ab0e8c0
50 changed files with 3933 additions and 817 deletions

BIN
docs/build/doctrees/api.doctree vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/build/doctrees/usage.doctree vendored Normal file

Binary file not shown.

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f163178657211e96cbf2c6fd362c54f7
config: e4274c969fa060e752467936197fbf11
tags: 645f666f9bcd5a90fca523b33c5a78b7

View File

@ -1,95 +1,100 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &mdash; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=19f00094" />
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=12dfc556" />
<script src="../_static/documentation_options.js?v=2709fde1"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="../_static/documentation_options.js?v=2709fde1"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<link rel="search" title="Search" href="../search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<a href="../index.html" class="icon icon-home">
pynodes
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">API</a></li>
</ul>
<div class="body" role="main">
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">pynodes</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Overview: module code</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>All modules for which code is available</h1>
<ul><li><a href="pynodes.html">pynodes</a></li>
</ul>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, fabthegreat.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">pynodes</a></h1>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, fabthegreat.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
</div>
</body>
</body>
</html>

View File

@ -1,43 +1,81 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pynodes &mdash; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=19f00094" />
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pynodes &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=12dfc556" />
<script src="../_static/documentation_options.js?v=2709fde1"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="../_static/documentation_options.js?v=2709fde1"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<link rel="search" title="Search" href="../search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<a href="../index.html" class="icon icon-home">
pynodes
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">API</a></li>
</ul>
<div class="body" role="main">
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">pynodes</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="index.html">Module code</a></li>
<li class="breadcrumb-item active">pynodes</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Source code for pynodes</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> <span class="c1"># for Class forward reference</span>
<span class="kn">import</span> <span class="nn">random</span>
<span class="kn">import</span> <span class="nn">uuid</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">ClassVar</span>
<div class="viewcode-block" id="Node">
<a class="viewcode-back" href="../index.html#pynodes.Node">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node">[docs]</a>
<span class="k">class</span> <span class="nc">Node</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Should be subclassed only</span>
@ -57,6 +95,10 @@
<span class="k">return</span> <span class="bp">cls</span>
<span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">parent</span><span class="p">:</span> <span class="n">Node</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> prevent the user to set the same name for 2 nodes</span>
<span class="sd"> ??? better to do it with uuid?</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">all_nodes</span><span class="p">:</span>
<span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="n">n</span><span class="o">.</span><span class="n">name</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">AttributeError</span><span class="p">(</span><span class="s1">&#39;Node with this name already exists&#39;</span><span class="p">)</span>
@ -67,12 +109,17 @@
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
<span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> <span class="c1"># is set with add_child</span>
<span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="n">Node</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">uuid</span><span class="o">.</span><span class="n">uuid4</span><span class="p">()</span>
<span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">all_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<div class="viewcode-block" id="Node.add_child">
<a class="viewcode-back" href="../index.html#pynodes.Node.add_child">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.add_child">[docs]</a>
<span class="k">def</span> <span class="nf">add_child</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">child</span><span class="p">:</span> <span class="n">Node</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; add new child node to current instance &quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; </span>
<span class="sd"> Add new child node to current instance </span>
<span class="sd"> :param child: Node object</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">child</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span>
<span class="k">if</span> <span class="n">child</span><span class="o">.</span><span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="n">c</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="p">]:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">child</span><span class="p">)</span>
@ -84,7 +131,6 @@
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s1">&#39;Child with same name already exists&#39;</span><span class="p">)</span></div>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">siblings</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">[</span><span class="n">Node</span><span class="p">]:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; returns all the siblings of the Node object &quot;&quot;&quot;</span>
@ -123,9 +169,13 @@
<span class="k">return</span> <span class="n">path</span>
<div class="viewcode-block" id="Node.is_sibling">
<a class="viewcode-back" href="../index.html#pynodes.Node.is_sibling">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.is_sibling">[docs]</a>
<span class="k">def</span> <span class="nf">is_sibling</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; check if Node object is a sibling of the other Node object &quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Check if Node object is a sibling of the other Node object</span>
<span class="sd"> :param other: Other Node object to be compared with</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">other</span> <span class="ow">in</span> <span class="p">[</span><span class="n">s</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">siblings</span><span class="p">]:</span>
<span class="k">return</span> <span class="kc">True</span>
<span class="k">else</span><span class="p">:</span>
@ -133,7 +183,7 @@
<div class="viewcode-block" id="Node.is_child">
<a class="viewcode-back" href="../index.html#pynodes.Node.is_child">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.is_child">[docs]</a>
<span class="k">def</span> <span class="nf">is_child</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; check if Node object is a child of the other Node object &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">other</span> <span class="ow">in</span> <span class="p">[</span><span class="n">s</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="p">]:</span>
@ -143,17 +193,19 @@
<div class="viewcode-block" id="Node.pretty_print">
<a class="viewcode-back" href="../index.html#pynodes.Node.pretty_print">[docs]</a>
<span class="k">def</span> <span class="nf">pretty_print</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<a class="viewcode-back" href="../api.html#pynodes.Node.pretty_print">[docs]</a>
<span class="k">def</span> <span class="nf">pretty_print</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">option</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;default&#39;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; print children tree from current instance &quot;&quot;&quot;</span>
<span class="n">dashes</span> <span class="o">=</span> <span class="s1">&#39; &#39;</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">level</span><span class="o">+</span><span class="s1">&#39;|&#39;</span><span class="o">+</span><span class="s1">&#39;--&#39;</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">level</span><span class="o">+</span><span class="s1">&#39; &#39;</span>
<span class="k">if</span> <span class="n">option</span> <span class="o">==</span> <span class="s1">&#39;id&#39;</span><span class="p">:</span>
<span class="n">dashes</span> <span class="o">+=</span> <span class="sa">f</span><span class="s1">&#39;[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s1">] &#39;</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="n">dashes</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="p">:</span>
<span class="n">c</span><span class="o">.</span><span class="n">pretty_print</span><span class="p">()</span></div>
<span class="n">c</span><span class="o">.</span><span class="n">pretty_print</span><span class="p">(</span><span class="n">option</span><span class="p">)</span></div>
<div class="viewcode-block" id="Node.has_parent">
<a class="viewcode-back" href="../index.html#pynodes.Node.has_parent">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.has_parent">[docs]</a>
<span class="k">def</span> <span class="nf">has_parent</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; check if Node object has a parent or not &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
@ -162,7 +214,7 @@
<div class="viewcode-block" id="Node.has_children">
<a class="viewcode-back" href="../index.html#pynodes.Node.has_children">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.has_children">[docs]</a>
<span class="k">def</span> <span class="nf">has_children</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; check if Node object has one child at least &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
@ -171,7 +223,7 @@
<div class="viewcode-block" id="Node.has_siblings">
<a class="viewcode-back" href="../index.html#pynodes.Node.has_siblings">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.has_siblings">[docs]</a>
<span class="k">def</span> <span class="nf">has_siblings</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; check if Node object has one sibling at least &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">has_parent</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">has_children</span><span class="p">()</span> \
@ -181,7 +233,7 @@
<div class="viewcode-block" id="Node.get_child">
<a class="viewcode-back" href="../index.html#pynodes.Node.get_child">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.get_child">[docs]</a>
<span class="k">def</span> <span class="nf">get_child</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Node</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; find and returns a child with specified name. None if nothing found &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="p">:</span>
@ -191,7 +243,7 @@
<div class="viewcode-block" id="Node.get_sibling">
<a class="viewcode-back" href="../index.html#pynodes.Node.get_sibling">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.get_sibling">[docs]</a>
<span class="k">def</span> <span class="nf">get_sibling</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Node</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; find and returns a sibling with specified name. None if nothing</span>
<span class="sd"> found &quot;&quot;&quot;</span>
@ -211,7 +263,7 @@
<span class="k">return</span> <span class="n">results</span>
<div class="viewcode-block" id="Node.check_lineage">
<a class="viewcode-back" href="../index.html#pynodes.Node.check_lineage">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.check_lineage">[docs]</a>
<span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">check_lineage</span><span class="p">(</span><span class="n">nodes</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="n">Node</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
@ -228,7 +280,7 @@
<div class="viewcode-block" id="Node.reset_stats">
<a class="viewcode-back" href="../index.html#pynodes.Node.reset_stats">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.reset_stats">[docs]</a>
<span class="nd">@classmethod</span>
<span class="k">def</span> <span class="nf">reset_stats</span><span class="p">(</span><span class="bp">cls</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
@ -240,7 +292,7 @@
<div class="viewcode-block" id="Node.create_random_nodes">
<a class="viewcode-back" href="../index.html#pynodes.Node.create_random_nodes">[docs]</a>
<a class="viewcode-back" href="../api.html#pynodes.Node.create_random_nodes">[docs]</a>
<span class="nd">@classmethod</span>
<span class="k">def</span> <span class="nf">create_random_nodes</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">type_</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">&#39;cmd&#39;</span><span class="p">,</span> <span class="n">depth</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Node</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
@ -249,20 +301,16 @@
<span class="k">def</span> <span class="nf">create_node</span><span class="p">(</span><span class="n">level</span><span class="p">,</span> <span class="n">i</span><span class="p">):</span>
<span class="n">id_</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">cls</span><span class="o">.</span><span class="n">all_nodes</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;</span><span class="si">{</span><span class="n">type_</span><span class="si">}</span><span class="s1">_&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">id_</span><span class="p">))</span>
<span class="k">def</span> <span class="nf">create_node_list</span><span class="p">(</span><span class="n">level</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">width</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">5</span><span class="p">):</span>
<span class="k">return</span> <span class="p">[</span><span class="n">create_node</span><span class="p">(</span><span class="n">level</span><span class="p">,</span> <span class="n">i</span><span class="p">)</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="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">width</span><span class="p">))]</span>
<span class="k">def</span> <span class="nf">create_arg_tree</span><span class="p">(</span><span class="n">arg</span><span class="p">:</span> <span class="bp">cls</span><span class="p">):</span>
<span class="k">if</span> <span class="n">arg</span><span class="o">.</span><span class="n">level</span> <span class="o">&lt;</span> <span class="n">depth</span><span class="p">:</span>
<span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">create_node_list</span><span class="p">(</span><span class="n">arg</span><span class="o">.</span><span class="n">level</span><span class="p">):</span>
<span class="n">arg</span><span class="o">.</span><span class="n">add_child</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="n">create_arg_tree</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="k">return</span> <span class="n">arg</span>
<span class="n">arg</span> <span class="o">=</span> <span class="bp">cls</span><span class="p">(</span><span class="s1">&#39;parser&#39;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">create_arg_tree</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span></div>
@ -282,7 +330,6 @@
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span></div>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<span class="c1"># while True:</span>
@ -293,69 +340,47 @@
<span class="c1"># print([n.name for n in node_list])</span>
<span class="c1"># print(Node.check_lineage(node_list))</span>
<span class="c1"># input(&#39;pause&#39;)</span>
<span class="n">n0</span> <span class="o">=</span> <span class="n">Node</span><span class="p">(</span><span class="s1">&#39;name0&#39;</span><span class="p">)</span>
<span class="n">n1</span> <span class="o">=</span> <span class="n">Node</span><span class="p">(</span><span class="s1">&#39;name0&#39;</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">Person</span><span class="p">(</span><span class="n">Node</span><span class="p">):</span>
<span class="k">pass</span>
<span class="n">bob</span> <span class="o">=</span> <span class="n">Person</span><span class="p">(</span><span class="s1">&#39;Bob&#39;</span><span class="p">)</span>
<span class="n">eve</span> <span class="o">=</span> <span class="n">Person</span><span class="p">(</span><span class="s1">&#39;Eve&#39;</span><span class="p">)</span>
<span class="n">alice</span> <span class="o">=</span> <span class="n">Person</span><span class="p">(</span><span class="s1">&#39;Alice&#39;</span><span class="p">)</span>
<span class="c1"># Alice is parent of bob and eve</span>
<span class="n">alice</span><span class="o">.</span><span class="n">add_child</span><span class="p">(</span><span class="n">bob</span><span class="p">)</span>
<span class="n">alice</span><span class="o">.</span><span class="n">add_child</span><span class="p">(</span><span class="n">eve</span><span class="p">)</span>
<span class="n">alice</span><span class="o">.</span><span class="n">pretty_print</span><span class="p">(</span><span class="n">option</span> <span class="o">=</span> <span class="s1">&#39;id&#39;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">alice</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
</pre></div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, fabthegreat.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">pynodes</a></h1>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li><a href="index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, fabthegreat.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
</div>
</body>
</body>
</html>

8
docs/build/html/_sources/api.rst.txt vendored Normal file
View File

@ -0,0 +1,8 @@
API
=====
**pynodes** is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.
.. automodule:: pynodes
:members:

View File

@ -6,34 +6,57 @@
Welcome to pynodes's documentation!
===================================
**pynodes** is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.
.. note::
.. code-block:: console
This project is under active development.
(venv) $ pip install pynodes
Source code is hosted on my own instance of `gitea <https://gitea.lutix.org/nodes>`_.
Content:
--------
.. toctree::
:maxdepth: 2
:caption: Contents:
api
Installation:
-------------
.. code-block:: console
(venv) $ git clone https://gitea.lutix.org/ftg/nodes.git
Source code is hosted on my own instance of `gitea <https://gitea.lutix.org/ftg/nodes>`_.
Basic Usage:
------------
Basic Usage
===========
.. code-block:: python
import pynodes
node = pynodes.Node()
.. autoclass:: pynodes.Node
:members:
class Person(pynodes.Node):
pass
bob = Person('Bob')
eve = Person('Eve')
alice = Person('Alice')
alice_again = Person('Alice') # will raise an error
# Alice is parent of bob and eve
alice.add_child(bob)
alice.add_child(eve)
alice.pretty_print()
.. code-block::
:caption: Pretty print of the tree
Alice
-- Bob
-- Eve
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -0,0 +1,7 @@
API
=====
**pynodes** is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.

View File

@ -222,7 +222,7 @@ table.modindextable td {
/* -- general body styles --------------------------------------------------- */
div.body {
min-width: inherit;
min-width: 360px;
max-width: 800px;
}

View File

@ -0,0 +1 @@
.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

4
docs/build/html/_static/css/theme.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}});

View File

@ -0,0 +1,4 @@
/**
* @preserve HTML5 Shiv 3.7.3-pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.3",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b),"object"==typeof module&&module.exports&&(module.exports=y)}("undefined"!=typeof window?window:this,document);

View File

@ -0,0 +1,4 @@
/**
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);

1
docs/build/html/_static/js/theme.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,80 +5,71 @@ td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f8f8f8; }
.highlight .c { color: #8f5902; font-style: italic } /* Comment */
.highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
.highlight .g { color: #000000 } /* Generic */
.highlight .k { color: #004461; font-weight: bold } /* Keyword */
.highlight .l { color: #000000 } /* Literal */
.highlight .n { color: #000000 } /* Name */
.highlight .o { color: #582800 } /* Operator */
.highlight .x { color: #000000 } /* Other */
.highlight .p { color: #000000; font-weight: bold } /* Punctuation */
.highlight .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #8f5902 } /* Comment.Preproc */
.highlight .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
.highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */
.highlight .gd { color: #a40000 } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
.highlight .ges { color: #000000 } /* Generic.EmphStrong */
.highlight .gr { color: #ef2929 } /* Generic.Error */
.highlight .c { color: #3D7B7B; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #9C6500 } /* Comment.Preproc */
.highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
.highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #E40000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #745334 } /* Generic.Prompt */
.highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */
.highlight .gi { color: #008400 } /* Generic.Inserted */
.highlight .go { color: #717171 } /* Generic.Output */
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
.highlight .kc { color: #004461; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #004461; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #004461; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #004461; font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { color: #004461; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #004461; font-weight: bold } /* Keyword.Type */
.highlight .ld { color: #000000 } /* Literal.Date */
.highlight .m { color: #990000 } /* Literal.Number */
.highlight .s { color: #4e9a06 } /* Literal.String */
.highlight .na { color: #c4a000 } /* Name.Attribute */
.highlight .nb { color: #004461 } /* Name.Builtin */
.highlight .nc { color: #000000 } /* Name.Class */
.highlight .no { color: #000000 } /* Name.Constant */
.highlight .nd { color: #888888 } /* Name.Decorator */
.highlight .ni { color: #ce5c00 } /* Name.Entity */
.highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #000000 } /* Name.Function */
.highlight .nl { color: #f57900 } /* Name.Label */
.highlight .nn { color: #000000 } /* Name.Namespace */
.highlight .nx { color: #000000 } /* Name.Other */
.highlight .py { color: #000000 } /* Name.Property */
.highlight .nt { color: #004461; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #000000 } /* Name.Variable */
.highlight .ow { color: #004461; font-weight: bold } /* Operator.Word */
.highlight .pm { color: #000000; font-weight: bold } /* Punctuation.Marker */
.highlight .w { color: #f8f8f8 } /* Text.Whitespace */
.highlight .mb { color: #990000 } /* Literal.Number.Bin */
.highlight .mf { color: #990000 } /* Literal.Number.Float */
.highlight .mh { color: #990000 } /* Literal.Number.Hex */
.highlight .mi { color: #990000 } /* Literal.Number.Integer */
.highlight .mo { color: #990000 } /* Literal.Number.Oct */
.highlight .sa { color: #4e9a06 } /* Literal.String.Affix */
.highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */
.highlight .sc { color: #4e9a06 } /* Literal.String.Char */
.highlight .dl { color: #4e9a06 } /* Literal.String.Delimiter */
.highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #4e9a06 } /* Literal.String.Double */
.highlight .se { color: #4e9a06 } /* Literal.String.Escape */
.highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */
.highlight .si { color: #4e9a06 } /* Literal.String.Interpol */
.highlight .sx { color: #4e9a06 } /* Literal.String.Other */
.highlight .sr { color: #4e9a06 } /* Literal.String.Regex */
.highlight .s1 { color: #4e9a06 } /* Literal.String.Single */
.highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */
.highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #000000 } /* Name.Function.Magic */
.highlight .vc { color: #000000 } /* Name.Variable.Class */
.highlight .vg { color: #000000 } /* Name.Variable.Global */
.highlight .vi { color: #000000 } /* Name.Variable.Instance */
.highlight .vm { color: #000000 } /* Name.Variable.Magic */
.highlight .il { color: #990000 } /* Literal.Number.Integer.Long */
.highlight .gt { color: #0044DD } /* Generic.Traceback */
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #B00040 } /* Keyword.Type */
.highlight .m { color: #666666 } /* Literal.Number */
.highlight .s { color: #BA2121 } /* Literal.String */
.highlight .na { color: #687822 } /* Name.Attribute */
.highlight .nb { color: #008000 } /* Name.Builtin */
.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.highlight .no { color: #880000 } /* Name.Constant */
.highlight .nd { color: #AA22FF } /* Name.Decorator */
.highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0000FF } /* Name.Function */
.highlight .nl { color: #767600 } /* Name.Label */
.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #19177C } /* Name.Variable */
.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #666666 } /* Literal.Number.Bin */
.highlight .mf { color: #666666 } /* Literal.Number.Float */
.highlight .mh { color: #666666 } /* Literal.Number.Hex */
.highlight .mi { color: #666666 } /* Literal.Number.Integer */
.highlight .mo { color: #666666 } /* Literal.Number.Oct */
.highlight .sa { color: #BA2121 } /* Literal.String.Affix */
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
.highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
.highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
.highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
.highlight .sx { color: #008000 } /* Literal.String.Other */
.highlight .sr { color: #A45A77 } /* Literal.String.Regex */
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0000FF } /* Name.Function.Magic */
.highlight .vc { color: #19177C } /* Name.Variable.Class */
.highlight .vg { color: #19177C } /* Name.Variable.Global */
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
.highlight .vm { color: #19177C } /* Name.Variable.Magic */
.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */

246
docs/build/html/api.html vendored Normal file
View File

@ -0,0 +1,246 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>API &mdash; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Welcome to pynodess documentation!" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
pynodes
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#pynodes.Node"><code class="docutils literal notranslate"><span class="pre">Node</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.add_child"><code class="docutils literal notranslate"><span class="pre">Node.add_child()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.check_lineage"><code class="docutils literal notranslate"><span class="pre">Node.check_lineage()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.create_random_nodes"><code class="docutils literal notranslate"><span class="pre">Node.create_random_nodes()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.get_child"><code class="docutils literal notranslate"><span class="pre">Node.get_child()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.get_sibling"><code class="docutils literal notranslate"><span class="pre">Node.get_sibling()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.has_children"><code class="docutils literal notranslate"><span class="pre">Node.has_children()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.has_parent"><code class="docutils literal notranslate"><span class="pre">Node.has_parent()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.has_siblings"><code class="docutils literal notranslate"><span class="pre">Node.has_siblings()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.is_child"><code class="docutils literal notranslate"><span class="pre">Node.is_child()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.is_sibling"><code class="docutils literal notranslate"><span class="pre">Node.is_sibling()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.level"><code class="docutils literal notranslate"><span class="pre">Node.level</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.parents"><code class="docutils literal notranslate"><span class="pre">Node.parents</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.path"><code class="docutils literal notranslate"><span class="pre">Node.path</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.pretty_print"><code class="docutils literal notranslate"><span class="pre">Node.pretty_print()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.reset_stats"><code class="docutils literal notranslate"><span class="pre">Node.reset_stats()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#pynodes.Node.siblings"><code class="docutils literal notranslate"><span class="pre">Node.siblings</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">pynodes</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">API</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/api.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="api">
<h1>API<a class="headerlink" href="#api" title="Link to this heading"></a></h1>
<p><strong>pynodes</strong> is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.</p>
<dl class="py class" id="module-pynodes">
<dt class="sig sig-object py" id="pynodes.Node">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pynodes.</span></span><span class="sig-name descname"><span class="pre">Node</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">parent</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pynodes.html#Node"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node" title="Link to this definition"></a></dt>
<dd><p>Should be subclassed only</p>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.add_child">
<span class="sig-name descname"><span class="pre">add_child</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">child</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.add_child"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.add_child" title="Link to this definition"></a></dt>
<dd><p>Add new child node to current instance</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>child</strong> Node object</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.check_lineage">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">check_lineage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nodes</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.check_lineage"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.check_lineage" title="Link to this definition"></a></dt>
<dd><dl class="simple">
<dt>check if the list of nodes is a straight lineage:</dt><dd><p>node 1 (ancestor) -&gt; node 2 -&gt; node 3 -&gt; … -&gt; node n (grand
children)</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.create_random_nodes">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_random_nodes</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">type_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'cmd'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">depth</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a></span></span><a class="reference internal" href="_modules/pynodes.html#Node.create_random_nodes"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.create_random_nodes" title="Link to this definition"></a></dt>
<dd><p>Creates random tree of nodes for testing purpose</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.get_child">
<span class="sig-name descname"><span class="pre">get_child</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.get_child"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.get_child" title="Link to this definition"></a></dt>
<dd><p>find and returns a child with specified name. None if nothing found</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.get_sibling">
<span class="sig-name descname"><span class="pre">get_sibling</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.get_sibling"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.get_sibling" title="Link to this definition"></a></dt>
<dd><p>find and returns a sibling with specified name. None if nothing
found</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.has_children">
<span class="sig-name descname"><span class="pre">has_children</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.has_children"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.has_children" title="Link to this definition"></a></dt>
<dd><p>check if Node object has one child at least</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.has_parent">
<span class="sig-name descname"><span class="pre">has_parent</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.has_parent"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.has_parent" title="Link to this definition"></a></dt>
<dd><p>check if Node object has a parent or not</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.has_siblings">
<span class="sig-name descname"><span class="pre">has_siblings</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.has_siblings"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.has_siblings" title="Link to this definition"></a></dt>
<dd><p>check if Node object has one sibling at least</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.is_child">
<span class="sig-name descname"><span class="pre">is_child</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.is_child"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.is_child" title="Link to this definition"></a></dt>
<dd><p>check if Node object is a child of the other Node object</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.is_sibling">
<span class="sig-name descname"><span class="pre">is_sibling</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.is_sibling"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.is_sibling" title="Link to this definition"></a></dt>
<dd><p>Check if Node object is a sibling of the other Node object</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>other</strong> Other Node object to be compared with</p>
</dd>
</dl>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.level">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">level</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="headerlink" href="#pynodes.Node.level" title="Link to this definition"></a></dt>
<dd><p>returns the level of the Node object</p>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.parents">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">parents</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pynodes.Node.parents" title="Link to this definition"></a></dt>
<dd><p>returns all the ancestors of the Node object</p>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.path">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">path</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#pynodes.Node.path" title="Link to this definition"></a></dt>
<dd><p>returns a representation of the ancestor lineage of self</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.pretty_print">
<span class="sig-name descname"><span class="pre">pretty_print</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">option</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.pretty_print"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.pretty_print" title="Link to this definition"></a></dt>
<dd><p>print children tree from current instance</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.reset_stats">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">reset_stats</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.reset_stats"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.reset_stats" title="Link to this definition"></a></dt>
<dd><p>reset all the ClassVar members</p>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.siblings">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">siblings</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pynodes.Node.siblings" title="Link to this definition"></a></dt>
<dd><p>returns all the siblings of the Node object</p>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="index.html" class="btn btn-neutral float-left" title="Welcome to pynodess documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, fabthegreat.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@ -1,26 +1,25 @@
<!DOCTYPE html>
<html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>pynodes &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=12dfc556" />
<script src="../_static/documentation_options.js?v=2709fde1"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="prev" title="Welcome to pynodess documentation!" href="../index.html" />
<link rel="prev" title="API" href="../api.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
@ -33,15 +32,11 @@
<div class="body" role="main">
<section id="module-pynodes">
<span id="pynodes"></span><h1>pynodes<a class="headerlink" href="#module-pynodes" title="Permalink to this headline"></a></h1>
<span id="pynodes"></span><h1>pynodes<a class="headerlink" href="#module-pynodes" title="Link to this heading"></a></h1>
<p class="rubric">Classes</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="../index.html#pynodes.Node" title="pynodes.Node"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Node</span></code></a>(name[, parent])</p></td>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Node</span></code>(name[, parent])</p></td>
<td><p>Should be subclassed only</p></td>
</tr>
</tbody>
@ -66,14 +61,19 @@
<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">pynodes</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">API</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">pynodes</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li>Previous: <a href="../index.html" title="previous chapter">Welcome to pynodess documentation!</a></li>
<li><a href="../api.html">API</a><ul>
<li>Previous: <a href="../api.html" title="previous chapter">API</a></li>
</ul></li>
</ul></li>
</ul>
</div>
@ -86,7 +86,7 @@
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
<script>document.getElementById('searchbox').style.display = "block"</script>
@ -100,11 +100,11 @@
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2024, fabthegreat.
&#169;2024, fabthegreat.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../_sources/generated/pynodes.rst.txt"

View File

@ -1,34 +1,71 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &mdash; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=12dfc556" />
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="#" />
<link rel="search" title="Search" href="search.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<a href="index.html" class="icon icon-home">
pynodes
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="api.html">API</a></li>
</ul>
<div class="body" role="main">
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">pynodes</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Index</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1 id="index">Index</h1>
@ -39,6 +76,7 @@
| <a href="#H"><strong>H</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
@ -48,7 +86,7 @@
<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.add_child">add_child() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.add_child">add_child() (pynodes.Node method)</a>
</li>
</ul></td>
</tr></table>
@ -56,11 +94,11 @@
<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.check_lineage">check_lineage() (pynodes.Node static method)</a>
<li><a href="api.html#pynodes.Node.check_lineage">check_lineage() (pynodes.Node static method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.create_random_nodes">create_random_nodes() (pynodes.Node class method)</a>
<li><a href="api.html#pynodes.Node.create_random_nodes">create_random_nodes() (pynodes.Node class method)</a>
</li>
</ul></td>
</tr></table>
@ -68,11 +106,11 @@
<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.get_child">get_child() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.get_child">get_child() (pynodes.Node method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.get_sibling">get_sibling() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.get_sibling">get_sibling() (pynodes.Node method)</a>
</li>
</ul></td>
</tr></table>
@ -80,13 +118,13 @@
<h2 id="H">H</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.has_children">has_children() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.has_children">has_children() (pynodes.Node method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.has_parent">has_parent() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.has_parent">has_parent() (pynodes.Node method)</a>
</li>
<li><a href="index.html#pynodes.Node.has_siblings">has_siblings() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.has_siblings">has_siblings() (pynodes.Node method)</a>
</li>
</ul></td>
</tr></table>
@ -94,11 +132,11 @@
<h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.is_child">is_child() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.is_child">is_child() (pynodes.Node method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.is_sibling">is_sibling() (pynodes.Node method)</a>
<li><a href="api.html#pynodes.Node.is_sibling">is_sibling() (pynodes.Node method)</a>
</li>
</ul></td>
</tr></table>
@ -106,15 +144,28 @@
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.level">level (pynodes.Node property)</a>
<li><a href="api.html#pynodes.Node.level">level (pynodes.Node property)</a>
</li>
</ul></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
module
<ul>
<li><a href="api.html#module-pynodes">pynodes</a>
</li>
</ul></li>
</ul></td>
</tr></table>
<h2 id="N">N</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node">Node (class in pynodes)</a>
<li><a href="api.html#pynodes.Node">Node (class in pynodes)</a>
</li>
</ul></td>
</tr></table>
@ -122,21 +173,28 @@
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.parents">parents (pynodes.Node property)</a>
<li><a href="api.html#pynodes.Node.parents">parents (pynodes.Node property)</a>
</li>
<li><a href="api.html#pynodes.Node.path">path (pynodes.Node property)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.path">path (pynodes.Node property)</a>
<li><a href="api.html#pynodes.Node.pretty_print">pretty_print() (pynodes.Node method)</a>
</li>
<li><a href="index.html#pynodes.Node.pretty_print">pretty_print() (pynodes.Node method)</a>
<li>
pynodes
<ul>
<li><a href="api.html#module-pynodes">module</a>
</li>
</ul></li>
</ul></td>
</tr></table>
<h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.reset_stats">reset_stats() (pynodes.Node class method)</a>
<li><a href="api.html#pynodes.Node.reset_stats">reset_stats() (pynodes.Node class method)</a>
</li>
</ul></td>
</tr></table>
@ -144,70 +202,38 @@
<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pynodes.Node.siblings">siblings (pynodes.Node property)</a>
<li><a href="api.html#pynodes.Node.siblings">siblings (pynodes.Node property)</a>
</li>
</ul></td>
</tr></table>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, fabthegreat.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">pynodes</a></h1>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, fabthegreat.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
</div>
</body>
</body>
</html>

View File

@ -1,230 +1,157 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to pynodess documentation! &mdash; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<title>Welcome to pynodess documentation! &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=12dfc556" />
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<link rel="next" title="API" href="api.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<a href="#" class="icon icon-home">
pynodes
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="api.html">API</a></li>
</ul>
<div class="body" role="main">
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="#">pynodes</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="#" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Welcome to pynodess documentation!</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="welcome-to-pynodes-s-documentation">
<h1>Welcome to pynodess documentation!<a class="headerlink" href="#welcome-to-pynodes-s-documentation" title="Link to this heading"></a></h1>
<p><strong>pynodes</strong> is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(venv)</span> <span class="gp">$ </span>pip<span class="w"> </span>install<span class="w"> </span>pynodes
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This project is under active development.</p>
</div>
<section id="content">
<h2>Content:<a class="headerlink" href="#content" title="Link to this heading"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="api.html">API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api.html#pynodes.Node"><code class="docutils literal notranslate"><span class="pre">Node</span></code></a></li>
</ul>
</li>
</ul>
</div>
</section>
<section id="installation">
<h2>Installation:<a class="headerlink" href="#installation" title="Link to this heading"></a></h2>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(venv)</span> <span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://gitea.lutix.org/ftg/nodes.git
</pre></div>
</div>
<p>Source code is hosted on my own instance of <a class="reference external" href="https://gitea.lutix.org/nodes">gitea</a>.</p>
<div class="toctree-wrapper compound">
</div>
<p>Source code is hosted on my own instance of <a class="reference external" href="https://gitea.lutix.org/ftg/nodes">gitea</a>.</p>
</section>
<section id="basic-usage">
<h1>Basic Usage<a class="headerlink" href="#basic-usage" title="Link to this heading"></a></h1>
<h2>Basic Usage:<a class="headerlink" href="#basic-usage" title="Link to this heading"></a></h2>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pynodes</span>
<span class="n">node</span> <span class="o">=</span> <span class="n">pynodes</span><span class="o">.</span><span class="n">Node</span><span class="p">()</span>
<span class="k">class</span> <span class="nc">Person</span><span class="p">(</span><span class="n">pynodes</span><span class="o">.</span><span class="n">Node</span><span class="p">):</span>
<span class="k">pass</span>
<span class="n">bob</span> <span class="o">=</span> <span class="n">Person</span><span class="p">(</span><span class="s1">&#39;Bob&#39;</span><span class="p">)</span>
<span class="n">eve</span> <span class="o">=</span> <span class="n">Person</span><span class="p">(</span><span class="s1">&#39;Eve&#39;</span><span class="p">)</span>
<span class="n">alice</span> <span class="o">=</span> <span class="n">Person</span><span class="p">(</span><span class="s1">&#39;Alice&#39;</span><span class="p">)</span>
<span class="n">alice_again</span> <span class="o">=</span> <span class="n">Person</span><span class="p">(</span><span class="s1">&#39;Alice&#39;</span><span class="p">)</span> <span class="c1"># will raise an error</span>
<span class="c1"># Alice is parent of bob and eve</span>
<span class="n">alice</span><span class="o">.</span><span class="n">add_child</span><span class="p">(</span><span class="n">bob</span><span class="p">)</span>
<span class="n">alice</span><span class="o">.</span><span class="n">add_child</span><span class="p">(</span><span class="n">eve</span><span class="p">)</span>
<span class="n">alice</span><span class="o">.</span><span class="n">pretty_print</span><span class="p">()</span>
</pre></div>
</div>
<dl class="py class">
<dt class="sig sig-object py" id="pynodes.Node">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pynodes.</span></span><span class="sig-name descname"><span class="pre">Node</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">parent</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pynodes.html#Node"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node" title="Link to this definition"></a></dt>
<dd><p>Should be subclassed only</p>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.add_child">
<span class="sig-name descname"><span class="pre">add_child</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">child</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.add_child"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.add_child" title="Link to this definition"></a></dt>
<dd><p>add new child node to current instance</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.check_lineage">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">check_lineage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nodes</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.check_lineage"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.check_lineage" title="Link to this definition"></a></dt>
<dd><dl class="simple">
<dt>check if the list of nodes is a straight lineage:</dt><dd><p>node 1 (ancestor) -&gt; node 2 -&gt; node 3 -&gt; … -&gt; node n (grand
children)</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.create_random_nodes">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_random_nodes</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">type_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'cmd'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">depth</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a></span></span><a class="reference internal" href="_modules/pynodes.html#Node.create_random_nodes"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.create_random_nodes" title="Link to this definition"></a></dt>
<dd><p>Creates random tree of nodes for testing purpose</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.get_child">
<span class="sig-name descname"><span class="pre">get_child</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.get_child"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.get_child" title="Link to this definition"></a></dt>
<dd><p>find and returns a child with specified name. None if nothing found</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.get_sibling">
<span class="sig-name descname"><span class="pre">get_sibling</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.get_sibling"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.get_sibling" title="Link to this definition"></a></dt>
<dd><p>find and returns a sibling with specified name. None if nothing
found</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.has_children">
<span class="sig-name descname"><span class="pre">has_children</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.has_children"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.has_children" title="Link to this definition"></a></dt>
<dd><p>check if Node object has one child at least</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.has_parent">
<span class="sig-name descname"><span class="pre">has_parent</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.has_parent"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.has_parent" title="Link to this definition"></a></dt>
<dd><p>check if Node object has a parent or not</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.has_siblings">
<span class="sig-name descname"><span class="pre">has_siblings</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.has_siblings"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.has_siblings" title="Link to this definition"></a></dt>
<dd><p>check if Node object has one sibling at least</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.is_child">
<span class="sig-name descname"><span class="pre">is_child</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.is_child"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.is_child" title="Link to this definition"></a></dt>
<dd><p>check if Node object is a child of the other Node object</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.is_sibling">
<span class="sig-name descname"><span class="pre">is_sibling</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.is_sibling"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.is_sibling" title="Link to this definition"></a></dt>
<dd><p>check if Node object is a sibling of the other Node object</p>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.level">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">level</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="headerlink" href="#pynodes.Node.level" title="Link to this definition"></a></dt>
<dd><p>returns the level of the Node object</p>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.parents">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">parents</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pynodes.Node.parents" title="Link to this definition"></a></dt>
<dd><p>returns all the ancestors of the Node object</p>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.path">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">path</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#pynodes.Node.path" title="Link to this definition"></a></dt>
<dd><p>returns a representation of the ancestor lineage of self</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.pretty_print">
<span class="sig-name descname"><span class="pre">pretty_print</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.pretty_print"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.pretty_print" title="Link to this definition"></a></dt>
<dd><p>print children tree from current instance</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="pynodes.Node.reset_stats">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">reset_stats</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="_modules/pynodes.html#Node.reset_stats"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynodes.Node.reset_stats" title="Link to this definition"></a></dt>
<dd><p>reset all the ClassVar members</p>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="pynodes.Node.siblings">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">siblings</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pynodes.Node" title="pynodes.Node"><span class="pre">Node</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pynodes.Node.siblings" title="Link to this definition"></a></dt>
<dd><p>returns all the siblings of the Node object</p>
</dd></dl>
</dd></dl>
<div class="literal-block-wrapper docutils container" id="id1">
<div class="code-block-caption"><span class="caption-text">Pretty print of the tree</span><a class="headerlink" href="#id1" title="Link to this code"></a></div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">Alice</span>
<span class="o">--</span> <span class="n">Bob</span>
<span class="o">--</span> <span class="n">Eve</span>
</pre></div>
</div>
</div>
</section>
<section id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Link to this heading"></a></h1>
<ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
</ul>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="api.html" class="btn btn-neutral float-right" title="API" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, fabthegreat.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="#">pynodes</a></h1>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="#">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, fabthegreat.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="_sources/index.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</body>
</html>

Binary file not shown.

View File

@ -1,42 +1,78 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Module Index &mdash; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Module Index &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
<script>
DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true;
</script>
</head><body>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<a href="index.html" class="icon icon-home">
pynodes
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="api.html">API</a></li>
</ul>
<div class="body" role="main">
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">pynodes</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Python Module Index</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Python Module Index</h1>
@ -51,68 +87,36 @@
<tr>
<td></td>
<td>
<a href="index.html#module-pynodes"><code class="xref">pynodes</code></a></td><td>
<a href="api.html#module-pynodes"><code class="xref">pynodes</code></a></td><td>
<em></em></td></tr>
</table>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, fabthegreat.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">pynodes</a></h1>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2024, fabthegreat.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>
</body>
</body>
</html>

View File

@ -1,118 +1,119 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &mdash; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=12dfc556" />
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<script src="_static/searchtools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="#" />
<script src="searchindex.js" defer></script>
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<link rel="search" title="Search" href="#" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<a href="index.html" class="icon icon-home">
pynodes
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="#" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="api.html">API</a></li>
</ul>
<div class="body" role="main">
<h1 id="search-documentation">Search</h1>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">pynodes</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Search</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<noscript>
<div class="admonition warning">
<p>
Please activate JavaScript to enable the search
functionality.
</p>
<div id="fallback" class="admonition warning">
<p class="last">
Please activate JavaScript to enable the search functionality.
</p>
</div>
</noscript>
<p>
Searching for multiple words only shows matches that contain
all words.
</p>
<form action="" method="get">
<input type="text" name="q" aria-labelledby="search-documentation" value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="search" />
<span id="search-progress" style="padding-left: 10px"></span>
</form>
<div id="search-results">
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, fabthegreat.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">pynodes</a></h1>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<script>
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
<script id="searchindexloader"></script>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, fabthegreat.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
</div>
</body>
</body>
</html>

View File

@ -1 +1 @@
Search.setIndex({"docnames": ["index"], "filenames": ["index.rst"], "titles": ["Welcome to pynodes\u2019s documentation!"], "terms": {"i": 0, "python": 0, "librari": 0, "manag": 0, "node": 0, "class": 0, "A": 0, "an": 0, "object": 0, "which": 0, "relat": 0, "other": 0, "given": 0, "tree": 0, "chart": 0, "venv": 0, "pip": 0, "instal": 0, "import": 0, "name": 0, "str": 0, "parent": 0, "none": 0, "sourc": 0, "should": 0, "subclass": 0, "onli": 0, "add_child": 0, "child": 0, "add": 0, "new": 0, "current": 0, "instanc": 0, "static": 0, "check_lineag": 0, "list": 0, "bool": 0, "check": 0, "straight": 0, "lineag": 0, "1": 0, "ancestor": 0, "2": 0, "3": 0, "n": 0, "grand": 0, "children": 0, "classmethod": 0, "create_random_nod": 0, "type_": 0, "cmd": 0, "depth": 0, "int": 0, "0": 0, "creat": 0, "random": 0, "test": 0, "purpos": 0, "properti": 0, "path": 0, "return": 0, "represent": 0, "self": 0, "pretty_print": 0, "print": 0, "from": 0, "reset_stat": 0, "reset": 0, "all": 0, "classvar": 0, "member": 0, "index": 0, "modul": 0, "search": 0, "page": 0, "level": 0, "sibl": 0, "get_child": 0, "find": 0, "specifi": 0, "noth": 0, "found": 0, "get_sibl": 0, "has_children": 0, "ha": 0, "one": 0, "least": 0, "has_par": 0, "has_sibl": 0, "is_child": 0, "is_sibl": 0, "code": 0, "host": 0, "my": 0, "own": 0, "gitea": 0, "link": [], "text": []}, "objects": {"pynodes": [[0, 0, 1, "", "Node"]], "pynodes.Node": [[0, 1, 1, "", "add_child"], [0, 1, 1, "", "check_lineage"], [0, 1, 1, "", "create_random_nodes"], [0, 1, 1, "", "get_child"], [0, 1, 1, "", "get_sibling"], [0, 1, 1, "", "has_children"], [0, 1, 1, "", "has_parent"], [0, 1, 1, "", "has_siblings"], [0, 1, 1, "", "is_child"], [0, 1, 1, "", "is_sibling"], [0, 2, 1, "", "level"], [0, 2, 1, "", "parents"], [0, 2, 1, "", "path"], [0, 1, 1, "", "pretty_print"], [0, 1, 1, "", "reset_stats"], [0, 2, 1, "", "siblings"]]}, "objtypes": {"0": "py:class", "1": "py:method", "2": "py:property"}, "objnames": {"0": ["py", "class", "Python class"], "1": ["py", "method", "Python method"], "2": ["py", "property", "Python property"]}, "titleterms": {"welcom": 0, "pynod": 0, "": 0, "document": 0, "basic": 0, "usag": 0, "indic": 0, "tabl": 0}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1, "sphinx": 60}, "alltitles": {"Welcome to pynodes\u2019s documentation!": [[0, "welcome-to-pynodes-s-documentation"]], "Basic Usage": [[0, "basic-usage"]], "Indices and tables": [[0, "indices-and-tables"]]}, "indexentries": {"node (class in pynodes)": [[0, "pynodes.Node"]], "add_child() (pynodes.node method)": [[0, "pynodes.Node.add_child"]], "check_lineage() (pynodes.node static method)": [[0, "pynodes.Node.check_lineage"]], "create_random_nodes() (pynodes.node class method)": [[0, "pynodes.Node.create_random_nodes"]], "get_child() (pynodes.node method)": [[0, "pynodes.Node.get_child"]], "get_sibling() (pynodes.node method)": [[0, "pynodes.Node.get_sibling"]], "has_children() (pynodes.node method)": [[0, "pynodes.Node.has_children"]], "has_parent() (pynodes.node method)": [[0, "pynodes.Node.has_parent"]], "has_siblings() (pynodes.node method)": [[0, "pynodes.Node.has_siblings"]], "is_child() (pynodes.node method)": [[0, "pynodes.Node.is_child"]], "is_sibling() (pynodes.node method)": [[0, "pynodes.Node.is_sibling"]], "level (pynodes.node property)": [[0, "pynodes.Node.level"]], "parents (pynodes.node property)": [[0, "pynodes.Node.parents"]], "path (pynodes.node property)": [[0, "pynodes.Node.path"]], "pretty_print() (pynodes.node method)": [[0, "pynodes.Node.pretty_print"]], "reset_stats() (pynodes.node class method)": [[0, "pynodes.Node.reset_stats"]], "siblings (pynodes.node property)": [[0, "pynodes.Node.siblings"]]}})
Search.setIndex({"docnames": ["api", "index"], "filenames": ["api.rst", "index.rst"], "titles": ["API", "Welcome to pynodes\u2019s documentation!"], "terms": {"i": [0, 1], "python": 0, "librari": 0, "manag": 0, "node": [0, 1], "class": [0, 1], "A": 0, "an": [0, 1], "object": 0, "which": 0, "relat": 0, "other": 0, "given": 0, "tree": [0, 1], "chart": 0, "venv": 1, "pip": [], "instal": [], "import": 1, "name": 0, "str": 0, "parent": [0, 1], "none": 0, "sourc": [0, 1], "should": 0, "subclass": 0, "onli": 0, "add_child": [0, 1], "child": 0, "add": 0, "new": 0, "current": 0, "instanc": [0, 1], "static": 0, "check_lineag": 0, "list": 0, "bool": 0, "check": 0, "straight": 0, "lineag": 0, "1": 0, "ancestor": 0, "2": 0, "3": 0, "n": 0, "grand": 0, "children": 0, "classmethod": 0, "create_random_nod": 0, "type_": 0, "cmd": 0, "depth": 0, "int": 0, "0": 0, "creat": 0, "random": 0, "test": 0, "purpos": 0, "properti": 0, "path": 0, "return": 0, "represent": 0, "self": 0, "pretty_print": [0, 1], "print": [0, 1], "from": 0, "reset_stat": 0, "reset": 0, "all": 0, "classvar": 0, "member": 0, "index": [], "modul": [], "search": [], "page": [], "level": 0, "sibl": 0, "get_child": 0, "find": 0, "specifi": 0, "noth": 0, "found": 0, "get_sibl": 0, "has_children": 0, "ha": 0, "one": 0, "least": 0, "has_par": 0, "has_sibl": 0, "is_child": 0, "is_sibl": 0, "code": 1, "host": 1, "my": 1, "own": 1, "gitea": 1, "link": [], "text": [], "usag": [], "basic": [], "pynod": 0, "api": 1, "thi": 1, "project": 1, "under": 1, "activ": 1, "develop": 1, "person": 1, "pass": 1, "bob": 1, "ev": 1, "alic": 1, "pretti": 1, "alice_again": 1, "rais": 1, "error": 1, "cool": [], "bit": [], "some": [], "option": 0, "default": 0, "git": 1, "clone": 1, "http": 1, "lutix": 1, "org": 1, "ftg": 1, "paramet": 0, "param": [], "compar": 0}, "objects": {"": [[0, 0, 0, "-", "pynodes"]], "pynodes": [[0, 1, 1, "", "Node"]], "pynodes.Node": [[0, 2, 1, "", "add_child"], [0, 2, 1, "", "check_lineage"], [0, 2, 1, "", "create_random_nodes"], [0, 2, 1, "", "get_child"], [0, 2, 1, "", "get_sibling"], [0, 2, 1, "", "has_children"], [0, 2, 1, "", "has_parent"], [0, 2, 1, "", "has_siblings"], [0, 2, 1, "", "is_child"], [0, 2, 1, "", "is_sibling"], [0, 3, 1, "", "level"], [0, 3, 1, "", "parents"], [0, 3, 1, "", "path"], [0, 2, 1, "", "pretty_print"], [0, 2, 1, "", "reset_stats"], [0, 3, 1, "", "siblings"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:property"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "property", "Python property"]}, "titleterms": {"welcom": 1, "pynod": 1, "": 1, "document": 1, "basic": 1, "usag": 1, "indic": [], "tabl": [], "instal": 1, "api": 0, "content": 1}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1, "sphinx": 60}, "alltitles": {"Welcome to pynodes\u2019s documentation!": [[1, "welcome-to-pynodes-s-documentation"]], "Content:": [[1, "content"]], "Installation:": [[1, "installation"]], "Basic Usage:": [[1, "basic-usage"]], "API": [[0, "api"]]}, "indexentries": {"node (class in pynodes)": [[0, "pynodes.Node"]], "add_child() (pynodes.node method)": [[0, "pynodes.Node.add_child"]], "check_lineage() (pynodes.node static method)": [[0, "pynodes.Node.check_lineage"]], "create_random_nodes() (pynodes.node class method)": [[0, "pynodes.Node.create_random_nodes"]], "get_child() (pynodes.node method)": [[0, "pynodes.Node.get_child"]], "get_sibling() (pynodes.node method)": [[0, "pynodes.Node.get_sibling"]], "has_children() (pynodes.node method)": [[0, "pynodes.Node.has_children"]], "has_parent() (pynodes.node method)": [[0, "pynodes.Node.has_parent"]], "has_siblings() (pynodes.node method)": [[0, "pynodes.Node.has_siblings"]], "is_child() (pynodes.node method)": [[0, "pynodes.Node.is_child"]], "is_sibling() (pynodes.node method)": [[0, "pynodes.Node.is_sibling"]], "level (pynodes.node property)": [[0, "pynodes.Node.level"]], "module": [[0, "module-pynodes"]], "parents (pynodes.node property)": [[0, "pynodes.Node.parents"]], "path (pynodes.node property)": [[0, "pynodes.Node.path"]], "pretty_print() (pynodes.node method)": [[0, "pynodes.Node.pretty_print"]], "pynodes": [[0, "module-pynodes"]], "reset_stats() (pynodes.node class method)": [[0, "pynodes.Node.reset_stats"]], "siblings (pynodes.node property)": [[0, "pynodes.Node.siblings"]]}})

102
docs/build/html/usage.html vendored Normal file
View File

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>API &#8212; pynodes 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=12dfc556" />
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="api">
<h1>API<a class="headerlink" href="#api" title="Link to this heading"></a></h1>
<p><strong>pynodes</strong> is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.</p>
</section>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">pynodes</a></h1>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, fabthegreat.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="_sources/usage.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>

BIN
docs/source/.index.rst.swp Normal file

Binary file not shown.

8
docs/source/api.rst Normal file
View File

@ -0,0 +1,8 @@
API
=====
**pynodes** is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.
.. automodule:: pynodes
:members:

View File

@ -14,6 +14,7 @@ import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
import pynodes
import sphinx_rtd_theme
# -- Project information -----------------------------------------------------
@ -51,7 +52,9 @@ exclude_patterns = []
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
#html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,

View File

@ -6,34 +6,57 @@
Welcome to pynodes's documentation!
===================================
**pynodes** is a Python library to manage Nodes classes.
A node is an object which is related to other nodes given a tree chart.
.. note::
.. code-block:: console
This project is under active development.
(venv) $ pip install pynodes
Source code is hosted on my own instance of `gitea <https://gitea.lutix.org/nodes>`_.
Content:
--------
.. toctree::
:maxdepth: 2
:caption: Contents:
api
Installation:
-------------
.. code-block:: console
(venv) $ git clone https://gitea.lutix.org/ftg/nodes.git
Source code is hosted on my own instance of `gitea <https://gitea.lutix.org/ftg/nodes>`_.
Basic Usage:
------------
Basic Usage
===========
.. code-block:: python
import pynodes
node = pynodes.Node()
.. autoclass:: pynodes.Node
:members:
class Person(pynodes.Node):
pass
bob = Person('Bob')
eve = Person('Eve')
alice = Person('Alice')
alice_again = Person('Alice') # will raise an error
# Alice is parent of bob and eve
alice.add_child(bob)
alice.add_child(eve)
alice.pretty_print()
.. code-block::
:caption: Pretty print of the tree
Alice
-- Bob
-- Eve
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,9 +1,9 @@
from __future__ import annotations # for Class forward reference
import random
import uuid
from typing import ClassVar
class Node:
"""
Should be subclassed only
@ -23,6 +23,10 @@ class Node:
return cls
def __new__(cls, name: str, parent: Node | None = None) -> None:
"""
prevent the user to set the same name for 2 nodes
??? better to do it with uuid?
"""
for n in cls.all_nodes:
if name == n.name:
raise AttributeError('Node with this name already exists')
@ -33,10 +37,15 @@ class Node:
self.name = name
self.parent = parent # is set with add_child
self.children: list[Node] = []
self.id = uuid.uuid4()
type(self).all_nodes.append(self)
def add_child(self, child: Node) -> None:
""" add new child node to current instance """
"""
Add new child node to current instance
:param child: Node object
"""
child.parent = self
if child.name not in [c.name for c in self.children]:
self.children.append(child)
@ -47,16 +56,19 @@ class Node:
else:
raise Exception('Child with same name already exists')
@property
def siblings(self) -> list[Node]:
""" returns all the siblings of the Node object """
"""
Returns all the siblings of the Node object
"""
if self.has_siblings():
return self.parent.children
@property
def parents(self) -> list[Node]:
""" returns all the ancestors of the Node object """
"""
Returns all the ancestors of the Node object
"""
parents = []
p = self
while p.has_parent():
@ -66,7 +78,9 @@ class Node:
@property
def level(self) -> int:
""" returns the level of the Node object """
"""
Returns the level of the Node object
"""
level = 0
p = self
while p.has_parent():
@ -77,7 +91,7 @@ class Node:
@property
def path(self) -> str:
"""
returns a representation of the ancestor lineage of self
Returns a representation of the ancestor lineage of self
"""
path = ''
for p in reversed(self.parents):
@ -86,25 +100,35 @@ class Node:
return path
def is_sibling(self, other: str) -> bool:
""" check if Node object is a sibling of the other Node object """
"""
Check if Node object is a sibling of the other Node object
:param other: Other Node object to be compared with
"""
if other in [s.name for s in self.siblings]:
return True
else:
return False
def is_child(self, other: str) -> bool:
""" check if Node object is a child of the other Node object """
"""
Check if Node object is a child of the other Node object
"""
if other in [s.name for s in self.children]:
return True
else:
return False
def pretty_print(self) -> None:
""" print children tree from current instance """
def pretty_print(self, option: str = 'default') -> None:
"""
Print children tree from current instance
"""
dashes = ' '*self.level+'|'+'--'*self.level+' '
if option == 'id':
dashes += f'[{self.id}] '
print(f'{dashes}{self.name}')
for c in self.children:
c.pretty_print()
c.pretty_print(option)
def has_parent(self) -> bool:
""" check if Node object has a parent or not """
@ -180,20 +204,16 @@ class Node:
def create_node(level, i):
id_ = len(cls.all_nodes) + 1
return cls(f'{type_}_'+str(id_))
def create_node_list(level: int, width: int = 5):
return [create_node(level, i)
for i in range(random.randint(1, width))]
def create_arg_tree(arg: cls):
if arg.level < depth:
for a in create_node_list(arg.level):
arg.add_child(a)
create_arg_tree(a)
return arg
arg = cls('parser')
return create_arg_tree(arg)
def __lt__(self, other):
@ -211,7 +231,6 @@ class Node:
def __str__(self) -> str:
return self.name
if __name__ == "__main__":
# while True:
@ -222,5 +241,17 @@ if __name__ == "__main__":
# print([n.name for n in node_list])
# print(Node.check_lineage(node_list))
# input('pause')
n0 = Node('name0')
n1 = Node('name0')
class Person(Node):
pass
bob = Person('Bob')
eve = Person('Eve')
alice = Person('Alice')
# Alice is parent of bob and eve
alice.add_child(bob)
alice.add_child(eve)
alice.pretty_print(option = 'id')
print(alice.id)