Files
pylib/docs/build/html/pylib.helper.html
Daniel Weschke 033cb92dc4 add tui module and example, add contex manager cd and the method run_file in helper
import vendor modules only once during import

change text color for the method cad_wireframe in geometry_plot_pylab and add hide key
2020-01-13 10:25:33 +01:00

187 lines
7.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>pylib.helper module &#8212; pylib 2019.12.21 documentation</title>
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="pylib.mathematics module" href="pylib.mathematics.html" />
<link rel="prev" title="pylib.geometry_plot_pylab module" href="pylib.geometry_plot_pylab.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>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-pylib.helper">
<span id="pylib-helper-module"></span><h1>pylib.helper module<a class="headerlink" href="#module-pylib.helper" title="Permalink to this headline"></a></h1>
<p>Helper objects.</p>
<dl class="field-list simple">
<dt class="field-odd">Date</dt>
<dd class="field-odd"><p>2020-01-01</p>
</dd>
</dl>
<span class="target" id="module-helper"></span><dl class="class">
<dt id="pylib.helper.cd">
<em class="property">class </em><code class="sig-name descname">cd</code><span class="sig-paren">(</span><em class="sig-param">new_path</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/helper.html#cd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.helper.cd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Context manager for changing the current working directory</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>new_path</strong> (<em>string</em>) the directory to change into</p>
</dd>
<dt class="field-even">Example</dt>
<dd class="field-even"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># enter the directory and run some code:</span>
<span class="k">with</span> <span class="n">cd</span><span class="p">(</span><span class="s2">&quot;~/tmp&quot;</span><span class="p">):</span>
<span class="c1"># we are now in ~/tmp</span>
<span class="c1"># code</span>
<span class="c1"># outside the context manager we are back where we started.</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="pylib.helper.run_file">
<code class="sig-name descname">run_file</code><span class="sig-paren">(</span><em class="sig-param">file_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/helper.html#run_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.helper.run_file" title="Permalink to this definition"></a></dt>
<dd><p>Run a file.</p>
<p>Inside a pythin interpreter it changes to the directory of the
file and after excuting the file it changes back to the working
directory before.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>file_name</strong> (<em>string</em>) the file to execute</p>
</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="pylib.helper.timeit">
<em class="property">class </em><code class="sig-name descname">timeit</code><span class="sig-paren">(</span><em class="sig-param">description=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylib/helper.html#timeit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.helper.timeit" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">contextlib.ContextDecorator</span></code></p>
<p>Meassure time for a function or code block.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>description</strong> (<em>str</em>) description for the function or code block
used for the print-out</p>
</dd>
<dt class="field-even">Example</dt>
<dd class="field-even"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="n">timeit</span><span class="p">(</span><span class="s1">&#39;section_test&#39;</span><span class="p">):</span>
<span class="gp">... </span> <span class="c1"># code</span>
<span class="go">section_test took 0.006 ms</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nd">@timeit</span><span class="p">(</span><span class="s1">&#39;func&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">func</span><span class="p">():</span>
<span class="c1"># code</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">func</span><span class="p">()</span>
<span class="go">func took 0.006 ms</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">pylib</a></h1>
<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">pylib</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="pylib.html">pylib package</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li><a href="modules.html">pylib</a><ul>
<li><a href="pylib.html">pylib package</a><ul>
<li>Previous: <a href="pylib.geometry_plot_pylab.html" title="previous chapter">pylib.geometry_plot_pylab module</a></li>
<li>Next: <a href="pylib.mathematics.html" title="next chapter">pylib.mathematics module</a></li>
</ul></li>
</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" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2019, Daniel Weschke.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.1</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/pylib.helper.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>