<!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>util module — Whoosh 2.5.1 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: '2.5.1', 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="Whoosh 2.5.1 documentation" href="../index.html" /> <link rel="up" title="Whoosh API" href="api.html" /> <link rel="next" title="writing module" href="writing.html" /> <link rel="prev" title="support.levenshtein module" href="support/levenshtein.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="writing.html" title="writing module" accesskey="N">next</a> |</li> <li class="right" > <a href="support/levenshtein.html" title="support.levenshtein module" accesskey="P">previous</a> |</li> <li><a href="../index.html">Whoosh 2.5.1 documentation</a> »</li> <li><a href="api.html" accesskey="U">Whoosh API</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-whoosh.util"> <span id="util-module"></span><h1><tt class="docutils literal"><span class="pre">util</span></tt> module<a class="headerlink" href="#module-whoosh.util" title="Permalink to this headline">¶</a></h1> <dl class="function"> <dt id="whoosh.util.fib"> <tt class="descclassname">whoosh.util.</tt><tt class="descname">fib</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#whoosh.util.fib" title="Permalink to this definition">¶</a></dt> <dd><p>Returns the nth value in the Fibonacci sequence.</p> </dd></dl> <dl class="function"> <dt id="whoosh.util.make_binary_tree"> <tt class="descclassname">whoosh.util.</tt><tt class="descname">make_binary_tree</tt><big>(</big><em>fn</em>, <em>args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#whoosh.util.make_binary_tree" title="Permalink to this definition">¶</a></dt> <dd><p>Takes a function/class that takes two positional arguments and a list of arguments and returns a binary tree of results/instances.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">make_binary_tree</span><span class="p">(</span><span class="n">UnionMatcher</span><span class="p">,</span> <span class="p">[</span><span class="n">matcher1</span><span class="p">,</span> <span class="n">matcher2</span><span class="p">,</span> <span class="n">matcher3</span><span class="p">])</span> <span class="go">UnionMatcher(matcher1, UnionMatcher(matcher2, matcher3))</span> </pre></div> </div> <p>Any keyword arguments given to this function are passed to the class initializer.</p> </dd></dl> <dl class="function"> <dt id="whoosh.util.make_weighted_tree"> <tt class="descclassname">whoosh.util.</tt><tt class="descname">make_weighted_tree</tt><big>(</big><em>fn</em>, <em>ls</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#whoosh.util.make_weighted_tree" title="Permalink to this definition">¶</a></dt> <dd><p>Takes a function/class that takes two positional arguments and a list of (weight, argument) tuples and returns a huffman-like weighted tree of results/instances.</p> </dd></dl> <dl class="function"> <dt id="whoosh.util.synchronized"> <tt class="descclassname">whoosh.util.</tt><tt class="descname">synchronized</tt><big>(</big><em>func</em><big>)</big><a class="headerlink" href="#whoosh.util.synchronized" title="Permalink to this definition">¶</a></dt> <dd><p>Decorator for storage-access methods, which synchronizes on a threading lock. The parent object must have ‘is_closed’ and ‘_sync_lock’ attributes.</p> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="support/levenshtein.html" title="previous chapter"><tt class="docutils literal docutils literal docutils literal"><span class="pre">support.levenshtein</span></tt> module</a></p> <h4>Next topic</h4> <p class="topless"><a href="writing.html" title="next chapter"><tt class="docutils literal"><span class="pre">writing</span></tt> module</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/api/util.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="writing.html" title="writing module" >next</a> |</li> <li class="right" > <a href="support/levenshtein.html" title="support.levenshtein module" >previous</a> |</li> <li><a href="../index.html">Whoosh 2.5.1 documentation</a> »</li> <li><a href="api.html" >Whoosh API</a> »</li> </ul> </div> <div class="footer"> © Copyright 2007-2012 Matt Chaput. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>