Files
pylib/docs/build/html/pylib.helper.html
2026-01-22 18:50:07 +01:00

206 lines
9.6 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="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="c1"># code</span>
<span class="n">section_test</span> <span class="n">took</span> <span class="mf">0.006</span> <span class="n">ms</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>
<span class="n">func</span><span class="p">()</span>
<span class="n">func</span> <span class="n">took</span> <span class="mf">0.006</span> <span class="n">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><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="pylib.html#subpackages">Subpackages</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="pylib.html#submodules">Submodules</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="pylib.data.html">pylib.data module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.data_step.html">pylib.data_step module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.data_step_std.html">pylib.data_step_std module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.date.html">pylib.date module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.drawblock.html">pylib.drawblock module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.function.html">pylib.function module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.geometry.html">pylib.geometry module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.geometry2d.html">pylib.geometry2d module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.geometry2d_plot.html">pylib.geometry2d_plot module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.geometry_plot.html">pylib.geometry_plot module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.geometry_plot_pylab.html">pylib.geometry_plot_pylab module</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">pylib.helper module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.mathematics.html">pylib.mathematics module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.time_of_day.html">pylib.time_of_day module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylib.tui.html">pylib.tui module</a></li>
</ul>
</li>
</ul>
</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>