<spanid="accounting-storage-ledgercli-module"></span><h2>accounting.storage.ledgercli module<aclass="headerlink"href="#module-accounting.storage.ledgercli"title="Permalink to this headline">¶</a></h2>
<dlclass="class">
<dtid="accounting.storage.ledgercli.Ledger">
<emclass="property">class </em><ttclass="descclassname">accounting.storage.ledgercli.</tt><ttclass="descname">Ledger</tt><big>(</big><em>app=None</em>, <em>ledger_file=None</em>, <em>ledger_bin=None</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">add_transaction</tt><big>(</big><em>transaction</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.add_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="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
<aclass="reference internal"href="accounting.html#accounting.models.Transaction"title="accounting.models.Transaction"><ttclass="xref py py-class docutils literal"><spanclass="pre">Transaction</span></tt></a> instance in
<ttclass="descname">assemble_arguments</tt><big>(</big><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.assemble_arguments"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.assemble_arguments"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of arguments suitable for <aclass="reference external"href="http://docs.python.org/3.3/library/subprocess.html#subprocess.Popen"title="(in Python v3.3)"><ttclass="xref py py-class docutils literal"><spanclass="pre">subprocess.Popen</span></tt></a>
based on <ttclass="xref py py-attr docutils literal"><spanclass="pre">self.ledger_bin</span></tt> and <ttclass="xref py py-attr docutils literal"><spanclass="pre">self.ledger_file</span></tt>.</p>
</dd></dl>
<dlclass="method">
<dtid="accounting.storage.ledgercli.Ledger.bal">
<ttclass="descname">bal</tt><big>(</big><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.bal"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.bal"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">delete_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.delete_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.delete_transaction"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">get_process</tt><big>(</big><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.get_process"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.get_process"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns <ttclass="xref py py-attr docutils literal"><spanclass="pre">self.ledger_process</span></tt> if it evaluates to <ttclass="docutils literal"><spanclass="pre">True</span></tt>. If
<ttclass="xref py py-attr docutils literal"><spanclass="pre">self.ledger_process</span></tt> is not set the result of
<aclass="reference internal"href="#accounting.storage.ledgercli.Ledger.init_process"title="accounting.storage.ledgercli.Ledger.init_process"><ttclass="xref py py-meth docutils literal"><spanclass="pre">self.init_process()</span></tt></a> is returned.</p>
<ttclass="descname">get_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.get_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.get_transaction"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">get_transactions</tt><big>(</big><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.get_transactions"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.get_transactions"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">init_process</tt><big>(</big><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.init_process"><spanclass="viewcode-link">[source]</span></a><aclass="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
<aclass="reference internal"href="#accounting.storage.ledgercli.Ledger.assemble_arguments"title="accounting.storage.ledgercli.Ledger.assemble_arguments"><ttclass="xref py py-meth docutils literal"><spanclass="pre">Ledger.assemble_arguments()</span></tt></a> and then runs
<aclass="reference internal"href="#accounting.storage.ledgercli.Ledger.read_until_prompt"title="accounting.storage.ledgercli.Ledger.read_until_prompt"><ttclass="xref py py-meth docutils literal"><spanclass="pre">Ledger.read_until_prompt()</span></tt></a> once (which should return the banner
<ttclass="descname">locked_process</tt><big>(</big><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.locked_process"><spanclass="viewcode-link">[source]</span></a><aclass="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 <aclass="reference external"href="http://docs.python.org/3.3/library/contextlib.html#contextlib.contextmanager"title="(in Python v3.3)"><ttclass="xref py py-func docutils literal"><spanclass="pre">contextlib.contextmanager()</span></tt></a> the
recommended use is with the <ttclass="docutils literal"><spanclass="pre">with</span></tt>-statement.</p>
<ttclass="descname">read_until_prompt</tt><big>(</big><em>process</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.read_until_prompt"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.read_until_prompt"title="Permalink to this definition">¶</a></dt>
<dd><p>Reads from the subprocess instance <ttclass="xref py py-data docutils literal"><spanclass="pre">process</span></tt> until it finds a
combination of <ttclass="docutils literal"><spanclass="pre">\n]\x20</span></tt> (the prompt), then returns the output
without the prompt.</p>
</dd></dl>
<dlclass="method">
<dtid="accounting.storage.ledgercli.Ledger.reg">
<ttclass="descname">reg</tt><big>(</big><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.reg"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.reg"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">send_command</tt><big>(</big><em>command</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.send_command"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.send_command"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">update_transaction</tt><big>(</big><em>transaction</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#Ledger.update_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.Ledger.update_transaction"title="Permalink to this definition">¶</a></dt>
<ttclass="descclassname">accounting.storage.ledgercli.</tt><ttclass="descname">main</tt><big>(</big><em>argv=None</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage/ledgercli.html#main"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.ledgercli.main"title="Permalink to this definition">¶</a></dt>
<spanid="module-contents"></span><h2>Module contents<aclass="headerlink"href="#module-accounting.storage"title="Permalink to this headline">¶</a></h2>
<dlclass="class">
<dtid="accounting.storage.Storage">
<emclass="property">class </em><ttclass="descclassname">accounting.storage.</tt><ttclass="descname">Storage</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">add_transaction</tt><big>(</big><em>transaction</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.add_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.add_transaction"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">delete_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.delete_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.delete_transaction"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">get_account</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.get_account"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.get_account"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="accounting.storage.Storage.get_accounts">
<ttclass="descname">get_accounts</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.get_accounts"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.get_accounts"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">get_transaction</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.get_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.get_transaction"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">get_transactions</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.get_transactions"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.get_transactions"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">reverse_transaction</tt><big>(</big><em>transaction_id</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.reverse_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.reverse_transaction"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">update_transaction</tt><big>(</big><em>transaction</em><big>)</big><aclass="reference internal"href="../_modules/accounting/storage.html#Storage.update_transaction"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.Storage.update_transaction"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><ttclass="descclassname">accounting.storage.</tt><ttclass="descname">TransactionNotFound</tt><aclass="reference internal"href="../_modules/accounting/storage.html#TransactionNotFound"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#accounting.storage.TransactionNotFound"title="Permalink to this definition">¶</a></dt>