280 lines
12 KiB
HTML
280 lines
12 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>materials module — material 2019.5.18 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>
|
||
<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" />
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<div class="section" id="module-materials">
|
||
<span id="materials-module"></span><h1>materials module<a class="headerlink" href="#module-materials" title="Permalink to this headline">¶</a></h1>
|
||
<p>Material database.</p>
|
||
<dl class="function">
|
||
<dt id="materials.absolute_path">
|
||
<code class="descclassname">materials.</code><code class="descname">absolute_path</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.absolute_path" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get full path.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>filename</strong> (<em>str</em>) – the file name to use</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>str – the absolute path</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.get_value">
|
||
<code class="descclassname">materials.</code><code class="descname">get_value</code><span class="sig-paren">(</span><em>data</em>, <em>element</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.get_value" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get value of nested dictionary.
|
||
If data element is itself a list of length one, the element of the list is
|
||
returned.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>data</strong> (<em>dict</em>) – the data</p></li>
|
||
<li><p><strong>key</strong> (<em>str</em>) – the key to get</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>int or float or list or dict – element value of the dict</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.load_material">
|
||
<code class="descclassname">materials.</code><code class="descname">load_material</code><span class="sig-paren">(</span><em>materialname</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.load_material" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Read material file and convert it to a Python object.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>materialname</strong> (<em>str</em>) – the material name to load</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>list or dict – the content of the material</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.main">
|
||
<code class="descclassname">materials.</code><code class="descname">main</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#materials.main" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Main function.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.print_dict">
|
||
<code class="descclassname">materials.</code><code class="descname">print_dict</code><span class="sig-paren">(</span><em>data_dict</em>, <em>print_keys=True</em>, <em>prespaces=0</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.print_dict" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Print one dimensional dict data.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>data_dict</strong> (<em>dict</em>) – the dict data to print</p></li>
|
||
<li><p><strong>print_keys</strong> (<em>bool</em>) – print the keys (default value = True)</p></li>
|
||
<li><p><strong>prespaces</strong> (<em>int</em>) – number of spaces as prefix (default value = 0)</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.print_list">
|
||
<code class="descclassname">materials.</code><code class="descname">print_list</code><span class="sig-paren">(</span><em>data_list</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.print_list" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Print list.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>data_list</strong> (<em>list</em>) – the list to print</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.print_material">
|
||
<code class="descclassname">materials.</code><code class="descname">print_material</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.print_material" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Print material data (Python object).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>data</strong> (<em>str</em><em> or </em><em>list</em><em> or </em><em>dict</em>) – the material data</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.print_quantity">
|
||
<code class="descclassname">materials.</code><code class="descname">print_quantity</code><span class="sig-paren">(</span><em>quantity</em>, <em>prespaces=0</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.print_quantity" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Print quantity.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>quantity</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em>) – the quantity to print. Either a number or a list of two
|
||
elements, the first the magnitude and the second the unit.</p></li>
|
||
<li><p><strong>prespaces</strong> (<em>int</em>) – number of spaces as prefix (default value = 0)</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.read_dir">
|
||
<code class="descclassname">materials.</code><code class="descname">read_dir</code><span class="sig-paren">(</span><em>directory</em>, <em>exclude=None</em>, <em>fullpath=False</em>, <em>extension=True</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.read_dir" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Read all files in directory as list.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>directory</strong> (<em>str</em>) – the directory to read</p></li>
|
||
<li><p><strong>exclude</strong> (<em>list</em><em> or </em><em>None</em>) – file names that should be excluded from the list (default value = None)</p></li>
|
||
<li><p><strong>fullpath</strong> (<em>bool</em>) – get full path (default value = False)</p></li>
|
||
<li><p><strong>extension</strong> (<em>bool</em>) – include file extension (default value = True)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>list – the list of files in the directory</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.read_file">
|
||
<code class="descclassname">materials.</code><code class="descname">read_file</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.read_file" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Read file as string.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>filename</strong> (<em>str</em>) – the name of the file to read</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>str – the content of the file</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.read_material">
|
||
<code class="descclassname">materials.</code><code class="descname">read_material</code><span class="sig-paren">(</span><em>materialname</em>, <em>fullpath=True</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.read_material" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Read material file as string.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>materialname</strong> (<em>str</em>) – the name of the material to read</p></li>
|
||
<li><p><strong>fullpath</strong> (<em>bool</em>) – use full path (default value = True)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>str – the content of the material</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>OSError</strong> – raises os exception</p></li>
|
||
<li><p><strong>IOError</strong> – raises io exception</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="function">
|
||
<dt id="materials.search_keys">
|
||
<code class="descclassname">materials.</code><code class="descname">search_keys</code><span class="sig-paren">(</span><em>data</em>, <em>keys</em><span class="sig-paren">)</span><a class="headerlink" href="#materials.search_keys" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Search for json keys in string data.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>data</strong> (<em>str</em>) – the data to search in</p></li>
|
||
<li><p><strong>keys</strong> (<em>str</em><em> or </em><em>list</em><em> or </em><em>None</em>) – the key to search for</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Results</dt>
|
||
<dd class="field-even"><p>dict – the key value pair matching the given keys in the data</p>
|
||
</dd>
|
||
</dl>
|
||
</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">material</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>Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" />
|
||
<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">
|
||
©2019, Daniel Weschke.
|
||
|
||
|
|
||
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.0.1</a>
|
||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||
|
||
|
|
||
<a href="_sources/materials.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |