This file is indexed.

/usr/share/doc/python-pebl/html/util.html is in python-pebl-doc 1.0.2-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!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>&lt;no title&gt; &#8212; Pebl 1.0.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:     '1.0.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="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Pebl 1.0.1 documentation" href="index.html" />
    <link rel="up" title="API Reference" href="apiref.html" />
    <link rel="prev" title="taskcontroller.ec2 – Amazon EC2 task controller" href="taskcontroller/ec2.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 role="document">
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <span class="target" id="module-pebl.util"></span><p>Miscellaneous utility functions.</p>
<dl class="function">
<dt id="pebl.util.as_list">
<code class="descclassname">pebl.util.</code><code class="descname">as_list</code><span class="sig-paren">(</span><em>c</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.as_list" title="Permalink to this definition"></a></dt>
<dd><p>Ensures that the result is a list.</p>
<p>If input is a list/tuple/set, return it.
If it&#8217;s None, return empty list.
Else, return a list with input as the only element.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.autoassign">
<code class="descclassname">pebl.util.</code><code class="descname">autoassign</code><span class="sig-paren">(</span><em>self</em>, <em>locals</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.autoassign" title="Permalink to this definition"></a></dt>
<dd><p>Automatically assigns local variables to <cite>self</cite>.
Generally used in <cite>__init__</cite> methods, as in:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">foo</span><span class="p">,</span> <span class="n">bar</span><span class="p">,</span> <span class="n">baz</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span> 
    <span class="n">autoassign</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">locals</span><span class="p">())</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="pebl.util.cartesian_product">
<code class="descclassname">pebl.util.</code><code class="descname">cartesian_product</code><span class="sig-paren">(</span><em>list_of_lists</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.cartesian_product" title="Permalink to this definition"></a></dt>
<dd><p>Given n lists (or sets), generate all n-tuple combinations.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">cartesian_product</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="s2">&quot;foo&quot;</span><span class="p">]]))</span>
<span class="go">[(0, 0), (0, 1), (0, &#39;foo&#39;), (1, 0), (1, 1), (1, &#39;foo&#39;)]</span>
</pre></div>
</div>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">cartesian_product</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]]))</span>
<span class="go">[(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)]</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="pebl.util.cond">
<code class="descclassname">pebl.util.</code><code class="descname">cond</code><span class="sig-paren">(</span><em>condition</em>, <em>expr1</em>, <em>expr2</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.cond" title="Permalink to this definition"></a></dt>
<dd><p>Marked for deletion.. Python2.5 provides this.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.edit_distance">
<code class="descclassname">pebl.util.</code><code class="descname">edit_distance</code><span class="sig-paren">(</span><em>network1</em>, <em>network2</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.edit_distance" title="Permalink to this definition"></a></dt>
<dd><p>Returns the edit distance between two networks.</p>
<p>This is a good (but not the only one) metric for determining similarity
between two networks.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.entropy_of_list">
<code class="descclassname">pebl.util.</code><code class="descname">entropy_of_list</code><span class="sig-paren">(</span><em>lst</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.entropy_of_list" title="Permalink to this definition"></a></dt>
<dd><p>Given a list of values, generate histogram and calculate the entropy.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.extended_property">
<code class="descclassname">pebl.util.</code><code class="descname">extended_property</code><span class="sig-paren">(</span><em>func</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.extended_property" title="Permalink to this definition"></a></dt>
<dd><p>Function decorator for defining property attributes</p>
<p>The decorated function is expected to return a dictionary
containing one or more of the following pairs:</p>
<blockquote>
<div><ul class="simple">
<li>fget - function for getting attribute value</li>
<li>fset - function for setting attribute value</li>
<li>fdel - function for deleting attribute</li>
</ul>
</div></blockquote>
</dd></dl>

<dl class="function">
<dt id="pebl.util.flatten">
<code class="descclassname">pebl.util.</code><code class="descname">flatten</code><span class="sig-paren">(</span><em>seq</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.flatten" title="Permalink to this definition"></a></dt>
<dd><p>Given a nested datastructure, flatten it.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.levenshtein">
<code class="descclassname">pebl.util.</code><code class="descname">levenshtein</code><span class="sig-paren">(</span><em>a</em>, <em>b</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.levenshtein" title="Permalink to this definition"></a></dt>
<dd><p>Calculates the Levenshtein distance between <em>strings</em> a and b.</p>
<p>from <a class="reference external" href="http://hetland.org/coding/python/levenshtein.py">http://hetland.org/coding/python/levenshtein.py</a></p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.logadd">
<code class="descclassname">pebl.util.</code><code class="descname">logadd</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.logadd" title="Permalink to this definition"></a></dt>
<dd><p>Adds two log values.</p>
<p>Ensures accuracy even when the difference between values is large.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.logscale_probwheel">
<code class="descclassname">pebl.util.</code><code class="descname">logscale_probwheel</code><span class="sig-paren">(</span><em>items</em>, <em>logweights</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.logscale_probwheel" title="Permalink to this definition"></a></dt>
<dd><p>Randomly select an item from a [log] weighted list of items.</p>
<p>Fucntion just rescale logweights and exponentiates before calling
probwheel.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.logsum">
<code class="descclassname">pebl.util.</code><code class="descname">logsum</code><span class="sig-paren">(</span><em>lst</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.logsum" title="Permalink to this definition"></a></dt>
<dd><p>Sums a list of log values, ensuring accuracy.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.lru_cache">
<code class="descclassname">pebl.util.</code><code class="descname">lru_cache</code><span class="sig-paren">(</span><em>maxsize</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.lru_cache" title="Permalink to this definition"></a></dt>
<dd><p>Decorator applying a least-recently-used cache with the given maximum size.</p>
<p>Arguments to the cached function must be hashable.
Cache performance statistics stored in f.hits and f.misses.</p>
<p>from <a class="reference external" href="http://code.activestate.com/recipes/498245/">http://code.activestate.com/recipes/498245/</a></p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.nestediter">
<code class="descclassname">pebl.util.</code><code class="descname">nestediter</code><span class="sig-paren">(</span><em>lst1</em>, <em>lst2</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.nestediter" title="Permalink to this definition"></a></dt>
<dd><p>A syntactic shortform for doing nested loops.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.normalize">
<code class="descclassname">pebl.util.</code><code class="descname">normalize</code><span class="sig-paren">(</span><em>lst</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.normalize" title="Permalink to this definition"></a></dt>
<dd><p>Normalizes a list of numbers (sets sum to 1.0).</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.probwheel">
<code class="descclassname">pebl.util.</code><code class="descname">probwheel</code><span class="sig-paren">(</span><em>items</em>, <em>weights</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.probwheel" title="Permalink to this definition"></a></dt>
<dd><p>Randomly select an item from a weighted list of items.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.rescale_logvalues">
<code class="descclassname">pebl.util.</code><code class="descname">rescale_logvalues</code><span class="sig-paren">(</span><em>lst</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.rescale_logvalues" title="Permalink to this definition"></a></dt>
<dd><p>Rescales a list of log values by setting max value to 0.0</p>
<p>This function is necessary when working with list of log values. Without
it, we could have overflows. This is a lot faster than using arbitrary
precision math libraries.</p>
</dd></dl>

<dl class="function">
<dt id="pebl.util.unzip">
<code class="descclassname">pebl.util.</code><code class="descname">unzip</code><span class="sig-paren">(</span><em>l</em>, <em>*jj</em><span class="sig-paren">)</span><a class="headerlink" href="#pebl.util.unzip" title="Permalink to this definition"></a></dt>
<dd><p>Opposite of zip().</p>
<p>jj is a tuple of list indexes (or keys) to extract or unzip. If not
specified, all items are unzipped.</p>
</dd></dl>



          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper"><div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
  <li><a href="apiref.html">API Reference</a><ul>
      <li>Previous: <a href="taskcontroller/ec2.html" title="previous chapter"><code class="docutils literal"><span class="pre">taskcontroller.ec2</span></code> &#8211; Amazon EC2 task controller</a></li>
  </ul></li>
  </ul></li>
</ul>
</div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/util.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2016, Abhik Shah.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.8</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
      
      |
      <a href="_sources/util.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>