284 lines
19 KiB
HTML
284 lines
19 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
|
||
|
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
|
||
|
<title>accounting.storage package — Accounting API 0.1-beta documentation</title>
|
||
|
|
||
|
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
var DOCUMENTATION_OPTIONS = {
|
||
|
URL_ROOT: '../',
|
||
|
VERSION: '0.1-beta',
|
||
|
COLLAPSE_INDEX: false,
|
||
|
FILE_SUFFIX: '.html',
|
||
|
HAS_SOURCE: true
|
||
|
};
|
||
|
</script>
|
||
|
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||
|
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||
|
<link rel="top" title="Accounting API 0.1-beta documentation" href="../index.html" />
|
||
|
<link rel="up" title="accounting package" href="accounting.html" />
|
||
|
<link rel="next" title="accounting.storage.sql package" href="accounting.storage.sql.html" />
|
||
|
<link rel="prev" title="accounting package" href="accounting.html" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="related">
|
||
|
<h3>Navigation</h3>
|
||
|
<ul>
|
||
|
<li class="right" style="margin-right: 10px">
|
||
|
<a href="../genindex.html" title="General Index"
|
||
|
accesskey="I">index</a></li>
|
||
|
<li class="right" >
|
||
|
<a href="../py-modindex.html" title="Python Module Index"
|
||
|
>modules</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="accounting.storage.sql.html" title="accounting.storage.sql package"
|
||
|
accesskey="N">next</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="accounting.html" title="accounting package"
|
||
|
accesskey="P">previous</a> |</li>
|
||
|
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> »</li>
|
||
|
<li><a href="accounting.html" accesskey="U">accounting package</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<div class="document">
|
||
|
<div class="documentwrapper">
|
||
|
<div class="bodywrapper">
|
||
|
<div class="body">
|
||
|
|
||
|
<div class="section" id="accounting-storage-package">
|
||
|
<h1>accounting.storage package<a class="headerlink" href="#accounting-storage-package" title="Permalink to this headline">¶</a></h1>
|
||
|
<div class="section" id="subpackages">
|
||
|
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
|
||
|
<div class="toctree-wrapper compound">
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="accounting.storage.sql.html">accounting.storage.sql package</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="accounting.storage.sql.html#submodules">Submodules</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="accounting.storage.sql.html#module-accounting.storage.sql.models">accounting.storage.sql.models module</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="accounting.storage.sql.html#module-accounting.storage.sql">Module contents</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section" id="submodules">
|
||
|
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
|
||
|
</div>
|
||
|
<div class="section" id="module-accounting.storage.ledgercli">
|
||
|
<span id="accounting-storage-ledgercli-module"></span><h2>accounting.storage.ledgercli module<a class="headerlink" href="#module-accounting.storage.ledgercli" title="Permalink to this headline">¶</a></h2>
|
||
|
<dl class="class">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger">
|
||
|
<em class="property">class </em><tt class="descclassname">accounting.storage.ledgercli.</tt><tt class="descname">Ledger</tt><big>(</big><em>app=None</em>, <em>ledger_file=None</em>, <em>ledger_bin=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Bases: <a class="reference internal" href="#accounting.storage.Storage" title="accounting.storage.Storage"><tt class="xref py py-class docutils literal"><span class="pre">accounting.storage.Storage</span></tt></a></p>
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.add_transaction">
|
||
|
<tt class="descname">add_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.add_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.add_transaction" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Writes a transaction to the ledger file by opening it in ‘ab’ mode and
|
||
|
writing a ledger transaction based on the
|
||
|
<a class="reference internal" href="accounting.html#accounting.models.Transaction" title="accounting.models.Transaction"><tt class="xref py py-class docutils literal"><span class="pre">Transaction</span></tt></a> instance in
|
||
|
<tt class="xref py py-data docutils literal"><span class="pre">transaction</span></tt>.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.assemble_arguments">
|
||
|
<tt class="descname">assemble_arguments</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.assemble_arguments"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.assemble_arguments" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Returns a list of arguments suitable for <a class="reference external" href="http://docs.python.org/3.3/library/subprocess.html#subprocess.Popen" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">subprocess.Popen</span></tt></a>
|
||
|
based on <tt class="xref py py-attr docutils literal"><span class="pre">self.ledger_bin</span></tt> and <tt class="xref py py-attr docutils literal"><span class="pre">self.ledger_file</span></tt>.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.bal">
|
||
|
<tt class="descname">bal</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.bal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.bal" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.get_process">
|
||
|
<tt class="descname">get_process</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.get_process"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.get_process" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Returns <tt class="xref py py-attr docutils literal"><span class="pre">self.ledger_process</span></tt> if it evaluates to <tt class="docutils literal"><span class="pre">True</span></tt>. If
|
||
|
<tt class="xref py py-attr docutils literal"><span class="pre">self.ledger_process</span></tt> is not set the result of
|
||
|
<a class="reference internal" href="#accounting.storage.ledgercli.Ledger.init_process" title="accounting.storage.ledgercli.Ledger.init_process"><tt class="xref py py-meth docutils literal"><span class="pre">self.init_process()</span></tt></a> is returned.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.get_transactions">
|
||
|
<tt class="descname">get_transactions</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.get_transactions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.get_transactions" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.init_process">
|
||
|
<tt class="descname">init_process</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.init_process"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.init_process" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Creates a new (presumably) ledger subprocess based on the args from
|
||
|
<a class="reference internal" href="#accounting.storage.ledgercli.Ledger.assemble_arguments" title="accounting.storage.ledgercli.Ledger.assemble_arguments"><tt class="xref py py-meth docutils literal"><span class="pre">Ledger.assemble_arguments()</span></tt></a> and then runs
|
||
|
<a class="reference internal" href="#accounting.storage.ledgercli.Ledger.read_until_prompt" title="accounting.storage.ledgercli.Ledger.read_until_prompt"><tt class="xref py py-meth docutils literal"><span class="pre">Ledger.read_until_prompt()</span></tt></a> once (which should return the banner
|
||
|
text) and discards the output.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.locked_process">
|
||
|
<tt class="descname">locked_process</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.locked_process"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.locked_process" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Context manager that checks that the ledger process is not already
|
||
|
locked, then “locks” the process and yields the process handle and
|
||
|
unlocks the process when execution is returned.</p>
|
||
|
<p>Since this decorated as a <a class="reference external" href="http://docs.python.org/3.3/library/contextlib.html#contextlib.contextmanager" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">contextlib.contextmanager()</span></tt></a> the
|
||
|
recommended use is with the <tt class="docutils literal"><span class="pre">with</span></tt>-statement.</p>
|
||
|
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">locked_process</span><span class="p">()</span> <span class="k">as</span> <span class="n">p</span><span class="p">:</span>
|
||
|
<span class="n">p</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">b</span><span class="s">'bal</span><span class="se">\n</span><span class="s">'</span><span class="p">)</span>
|
||
|
|
||
|
<span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">read_until_prompt</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.read_until_prompt">
|
||
|
<tt class="descname">read_until_prompt</tt><big>(</big><em>process</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.read_until_prompt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.read_until_prompt" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Reads from the subprocess instance <tt class="xref py py-data docutils literal"><span class="pre">process</span></tt> until it finds a
|
||
|
combination of <tt class="docutils literal"><span class="pre">\n]\x20</span></tt> (the prompt), then returns the output
|
||
|
without the prompt.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.reg">
|
||
|
<tt class="descname">reg</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.reg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.reg" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.send_command">
|
||
|
<tt class="descname">send_command</tt><big>(</big><em>command</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.send_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.send_command" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.ledgercli.Ledger.update_transaction">
|
||
|
<tt class="descname">update_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#Ledger.update_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.Ledger.update_transaction" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="accounting.storage.ledgercli.main">
|
||
|
<tt class="descclassname">accounting.storage.ledgercli.</tt><tt class="descname">main</tt><big>(</big><em>argv=None</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage/ledgercli.html#main"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.ledgercli.main" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
</div>
|
||
|
<div class="section" id="module-accounting.storage">
|
||
|
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-accounting.storage" title="Permalink to this headline">¶</a></h2>
|
||
|
<dl class="class">
|
||
|
<dt id="accounting.storage.Storage">
|
||
|
<em class="property">class </em><tt class="descclassname">accounting.storage.</tt><tt class="descname">Storage</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">builtins.object</span></tt></p>
|
||
|
<p>ABC for accounting storage</p>
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.Storage.get_account">
|
||
|
<tt class="descname">get_account</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_account"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_account" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.Storage.get_accounts">
|
||
|
<tt class="descname">get_accounts</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_accounts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_accounts" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.Storage.get_transaction">
|
||
|
<tt class="descname">get_transaction</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_transaction" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.Storage.get_transactions">
|
||
|
<tt class="descname">get_transactions</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="reference internal" href="../_modules/accounting/storage.html#Storage.get_transactions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#accounting.storage.Storage.get_transactions" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.Storage.reverse_transaction">
|
||
|
<tt class="descname">reverse_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><a class="headerlink" href="#accounting.storage.Storage.reverse_transaction" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="accounting.storage.Storage.update_transaction">
|
||
|
<tt class="descname">update_transaction</tt><big>(</big><em>transaction</em><big>)</big><a class="headerlink" href="#accounting.storage.Storage.update_transaction" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd></dd></dl>
|
||
|
|
||
|
</dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="sphinxsidebar">
|
||
|
<div class="sphinxsidebarwrapper">
|
||
|
<h3><a href="../index.html">Table Of Contents</a></h3>
|
||
|
<ul>
|
||
|
<li><a class="reference internal" href="#">accounting.storage package</a><ul>
|
||
|
<li><a class="reference internal" href="#subpackages">Subpackages</a><ul>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li><a class="reference internal" href="#submodules">Submodules</a></li>
|
||
|
<li><a class="reference internal" href="#module-accounting.storage.ledgercli">accounting.storage.ledgercli module</a></li>
|
||
|
<li><a class="reference internal" href="#module-accounting.storage">Module contents</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<h4>Previous topic</h4>
|
||
|
<p class="topless"><a href="accounting.html"
|
||
|
title="previous chapter">accounting package</a></p>
|
||
|
<h4>Next topic</h4>
|
||
|
<p class="topless"><a href="accounting.storage.sql.html"
|
||
|
title="next chapter">accounting.storage.sql package</a></p>
|
||
|
<h3>This Page</h3>
|
||
|
<ul class="this-page-menu">
|
||
|
<li><a href="../_sources/api/accounting.storage.txt"
|
||
|
rel="nofollow">Show Source</a></li>
|
||
|
</ul>
|
||
|
<div id="searchbox" style="display: none">
|
||
|
<h3>Quick search</h3>
|
||
|
<form class="search" action="../search.html" method="get">
|
||
|
<input type="text" name="q" />
|
||
|
<input type="submit" value="Go" />
|
||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||
|
<input type="hidden" name="area" value="default" />
|
||
|
</form>
|
||
|
<p class="searchtip" style="font-size: 90%">
|
||
|
Enter search terms or a module, class or function name.
|
||
|
</p>
|
||
|
</div>
|
||
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="clearer"></div>
|
||
|
</div>
|
||
|
<div class="related">
|
||
|
<h3>Navigation</h3>
|
||
|
<ul>
|
||
|
<li class="right" style="margin-right: 10px">
|
||
|
<a href="../genindex.html" title="General Index"
|
||
|
>index</a></li>
|
||
|
<li class="right" >
|
||
|
<a href="../py-modindex.html" title="Python Module Index"
|
||
|
>modules</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="accounting.storage.sql.html" title="accounting.storage.sql package"
|
||
|
>next</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="accounting.html" title="accounting package"
|
||
|
>previous</a> |</li>
|
||
|
<li><a href="../index.html">Accounting API 0.1-beta documentation</a> »</li>
|
||
|
<li><a href="accounting.html" >accounting package</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="footer">
|
||
|
© Copyright 2013, Joar Wandborg.
|
||
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|