/usr/share/doc/python-logilab-common/apidoc/logilab.common-pysrc.html is in python-logilab-common 1.1.0-1.
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 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | <?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>logilab.common</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th bgcolor="#70b0f0" class="navbar-select"
> Home </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Logilab's common library</th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
Package logilab ::
Package common
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="logilab.common-pysrc.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<h1 class="epydoc">Source Code for <a href="logilab.common-module.html">Package logilab.common</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment"># copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment"># contact http://www.logilab.fr/ -- mailto:contact@logilab.fr</tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-comment"># This file is part of logilab-common.</tt> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment"># logilab-common is free software: you can redistribute it and/or modify it under</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"># the terms of the GNU Lesser General Public License as published by the Free</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment"># Software Foundation, either version 2.1 of the License, or (at your option) any</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"># later version.</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-comment"># logilab-common is distributed in the hope that it will be useful, but WITHOUT</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-comment"># ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-comment"># FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-comment"># details.</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-comment"># You should have received a copy of the GNU Lesser General Public License along</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-comment"># with logilab-common. If not, see <http://www.gnu.org/licenses/>.</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-docstring">"""Logilab common library (aka Logilab's extension to the standard library).</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"><tt class="py-docstring">:type STD_BLACKLIST: tuple</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"><tt class="py-docstring">:var STD_BLACKLIST: directories ignored by default by the functions in</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"><tt class="py-docstring"> this package which have to recurse into directories</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-docstring">:type IGNORED_EXTENSIONS: tuple</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-docstring">:var IGNORED_EXTENSIONS: file extensions that may usually be ignored</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">"restructuredtext en"</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">types</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Variable logilab.common.modutils.pkg_resources=logilab.common.modutils-module.html#pkg_resources"><a title="logilab.common.modutils.pkg_resources" class="py-name" href="#" onclick="return doclink('link-0', 'pkg_resources', 'link-0');">pkg_resources</a></tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"><tt class="py-name">__version__</tt> <tt class="py-op">=</tt> <tt id="link-1" class="py-name"><a title="logilab.common.modutils.pkg_resources" class="py-name" href="#" onclick="return doclink('link-1', 'pkg_resources', 'link-0');">pkg_resources</a></tt><tt class="py-op">.</tt><tt class="py-name">get_distribution</tt><tt class="py-op">(</tt><tt class="py-string">'logilab-common'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">version</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt> <tt class="py-line"> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"><tt class="py-comment"># deprecated, but keep compatibility with pylint < 1.4.4</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"><tt id="link-2" class="py-name" targets="Variable logilab.common.__pkginfo__=logilab.common-module.html#__pkginfo__"><a title="logilab.common.__pkginfo__" class="py-name" href="#" onclick="return doclink('link-2', '__pkginfo__', 'link-2');">__pkginfo__</a></tt> <tt class="py-op">=</tt> <tt class="py-name">types</tt><tt class="py-op">.</tt><tt class="py-name">ModuleType</tt><tt class="py-op">(</tt><tt class="py-string">'__pkginfo__'</tt><tt class="py-op">)</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"><tt id="link-3" class="py-name"><a title="logilab.common.__pkginfo__" class="py-name" href="#" onclick="return doclink('link-3', '__pkginfo__', 'link-2');">__pkginfo__</a></tt><tt class="py-op">.</tt><tt class="py-name">__package__</tt> <tt class="py-op">=</tt> <tt class="py-name">__name__</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"><tt id="link-4" class="py-name"><a title="logilab.common.__pkginfo__" class="py-name" href="#" onclick="return doclink('link-4', '__pkginfo__', 'link-2');">__pkginfo__</a></tt><tt class="py-op">.</tt><tt class="py-name">version</tt> <tt class="py-op">=</tt> <tt class="py-name">__version__</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">modules</tt><tt class="py-op">[</tt><tt class="py-string">'logilab.common.__pkginfo__'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-5" class="py-name"><a title="logilab.common.__pkginfo__" class="py-name" href="#" onclick="return doclink('link-5', '__pkginfo__', 'link-2');">__pkginfo__</a></tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"><tt id="link-6" class="py-name" targets="Variable logilab.common.STD_BLACKLIST=logilab.common-module.html#STD_BLACKLIST"><a title="logilab.common.STD_BLACKLIST" class="py-name" href="#" onclick="return doclink('link-6', 'STD_BLACKLIST', 'link-6');">STD_BLACKLIST</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">'CVS'</tt><tt class="py-op">,</tt> <tt class="py-string">'.svn'</tt><tt class="py-op">,</tt> <tt class="py-string">'.hg'</tt><tt class="py-op">,</tt> <tt class="py-string">'debian'</tt><tt class="py-op">,</tt> <tt class="py-string">'dist'</tt><tt class="py-op">,</tt> <tt class="py-string">'build'</tt><tt class="py-op">)</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"><tt id="link-7" class="py-name" targets="Variable logilab.common.IGNORED_EXTENSIONS=logilab.common-module.html#IGNORED_EXTENSIONS"><a title="logilab.common.IGNORED_EXTENSIONS" class="py-name" href="#" onclick="return doclink('link-7', 'IGNORED_EXTENSIONS', 'link-7');">IGNORED_EXTENSIONS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">'.pyc'</tt><tt class="py-op">,</tt> <tt class="py-string">'.pyo'</tt><tt class="py-op">,</tt> <tt class="py-string">'.elc'</tt><tt class="py-op">,</tt> <tt class="py-string">'~'</tt><tt class="py-op">,</tt> <tt class="py-string">'.swp'</tt><tt class="py-op">,</tt> <tt class="py-string">'.orig'</tt><tt class="py-op">)</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"><tt class="py-comment"># set this to False if you've mx DateTime installed but you don't want your db</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"><tt class="py-comment"># adapter to use it (should be set before you got a connection)</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt> <tt class="py-line"><tt id="link-8" class="py-name" targets="Variable logilab.common.USE_MX_DATETIME=logilab.common-module.html#USE_MX_DATETIME"><a title="logilab.common.USE_MX_DATETIME" class="py-name" href="#" onclick="return doclink('link-8', 'USE_MX_DATETIME', 'link-8');">USE_MX_DATETIME</a></tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"> </tt>
<a name="attrdict"></a><div id="attrdict-def"><a name="L50"></a><tt class="py-lineno"> 50</tt> <a class="py-toggle" href="#" id="attrdict-toggle" onclick="return toggle('attrdict');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="logilab.common.attrdict-class.html">attrdict</a><tt class="py-op">(</tt><tt class="py-base-class">dict</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="attrdict-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="attrdict-expanded"><a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"> <tt class="py-docstring">"""A dictionary for which keys are also accessible as attributes."""</tt> </tt>
<a name="attrdict.__getattr__"></a><div id="attrdict.__getattr__-def"><a name="L52"></a><tt class="py-lineno"> 52</tt> <a class="py-toggle" href="#" id="attrdict.__getattr__-toggle" onclick="return toggle('attrdict.__getattr__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.attrdict-class.html#__getattr__">__getattr__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">attr</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="attrdict.__getattr__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="attrdict.__getattr__-expanded"><a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">[</tt><tt class="py-name">attr</tt><tt class="py-op">]</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">KeyError</tt><tt class="py-op">:</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">(</tt><tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"> </tt>
<a name="dictattr"></a><div id="dictattr-def"><a name="L58"></a><tt class="py-lineno"> 58</tt> <a class="py-toggle" href="#" id="dictattr-toggle" onclick="return toggle('dictattr');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="logilab.common.dictattr-class.html">dictattr</a><tt class="py-op">(</tt><tt class="py-base-class">dict</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="dictattr-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="dictattr-expanded"><a name="dictattr.__init__"></a><div id="dictattr.__init__-def"><a name="L59"></a><tt class="py-lineno"> 59</tt> <a class="py-toggle" href="#" id="dictattr.__init__-toggle" onclick="return toggle('dictattr.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.dictattr-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">proxy</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="dictattr.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="dictattr.__init__-expanded"><a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__proxy</tt> <tt class="py-op">=</tt> <tt class="py-name">proxy</tt> </tt>
</div><a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"> </tt>
<a name="dictattr.__getitem__"></a><div id="dictattr.__getitem__-def"><a name="L62"></a><tt class="py-lineno"> 62</tt> <a class="py-toggle" href="#" id="dictattr.__getitem__-toggle" onclick="return toggle('dictattr.__getitem__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.dictattr-class.html#__getitem__">__getitem__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">attr</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="dictattr.__getitem__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="dictattr.__getitem__-expanded"><a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__proxy</tt><tt class="py-op">,</tt> <tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">KeyError</tt><tt class="py-op">(</tt><tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L67"></a><tt class="py-lineno"> 67</tt> <tt class="py-line"> </tt>
<a name="nullobject"></a><div id="nullobject-def"><a name="L68"></a><tt class="py-lineno"> 68</tt> <a class="py-toggle" href="#" id="nullobject-toggle" onclick="return toggle('nullobject');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="logilab.common.nullobject-class.html">nullobject</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="nullobject-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="nullobject-expanded"><a name="nullobject.__repr__"></a><div id="nullobject.__repr__-def"><a name="L69"></a><tt class="py-lineno"> 69</tt> <a class="py-toggle" href="#" id="nullobject.__repr__-toggle" onclick="return toggle('nullobject.__repr__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.nullobject-class.html#__repr__">__repr__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="nullobject.__repr__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="nullobject.__repr__-expanded"><a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'<nullobject>'</tt> </tt>
</div><a name="nullobject.__bool__"></a><div id="nullobject.__bool__-def"><a name="L71"></a><tt class="py-lineno"> 71</tt> <a class="py-toggle" href="#" id="nullobject.__bool__-toggle" onclick="return toggle('nullobject.__bool__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.nullobject-class.html#__bool__">__bool__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="nullobject.__bool__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="nullobject.__bool__-expanded"><a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
</div><a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"> <tt class="py-name">__nonzero__</tt> <tt class="py-op">=</tt> <tt id="link-9" class="py-name" targets="Method logilab.common.nullobject.__bool__()=logilab.common.nullobject-class.html#__bool__"><a title="logilab.common.nullobject.__bool__" class="py-name" href="#" onclick="return doclink('link-9', '__bool__', 'link-9');">__bool__</a></tt> </tt>
</div><a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"> </tt>
<a name="tempattr"></a><div id="tempattr-def"><a name="L75"></a><tt class="py-lineno"> 75</tt> <a class="py-toggle" href="#" id="tempattr-toggle" onclick="return toggle('tempattr');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="logilab.common.tempattr-class.html">tempattr</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="tempattr-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="tempattr-expanded"><a name="tempattr.__init__"></a><div id="tempattr.__init__-def"><a name="L76"></a><tt class="py-lineno"> 76</tt> <a class="py-toggle" href="#" id="tempattr.__init__-toggle" onclick="return toggle('tempattr.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.tempattr-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">obj</tt><tt class="py-op">,</tt> <tt class="py-param">attr</tt><tt class="py-op">,</tt> <tt class="py-param">value</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="tempattr.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="tempattr.__init__-expanded"><a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">obj</tt> <tt class="py-op">=</tt> <tt class="py-name">obj</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">attr</tt> <tt class="py-op">=</tt> <tt class="py-name">attr</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> <tt class="py-op">=</tt> <tt class="py-name">value</tt> </tt>
</div><a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"> </tt>
<a name="tempattr.__enter__"></a><div id="tempattr.__enter__-def"><a name="L81"></a><tt class="py-lineno"> 81</tt> <a class="py-toggle" href="#" id="tempattr.__enter__-toggle" onclick="return toggle('tempattr.__enter__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.tempattr-class.html#__enter__">__enter__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="tempattr.__enter__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="tempattr.__enter__-expanded"><a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">oldvalue</tt> <tt class="py-op">=</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">obj</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">attr</tt><tt class="py-op">)</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"> <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">obj</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">attr</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">obj</tt> </tt>
</div><a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"> </tt>
<a name="tempattr.__exit__"></a><div id="tempattr.__exit__-def"><a name="L86"></a><tt class="py-lineno"> 86</tt> <a class="py-toggle" href="#" id="tempattr.__exit__-toggle" onclick="return toggle('tempattr.__exit__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.tempattr-class.html#__exit__">__exit__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">exctype</tt><tt class="py-op">,</tt> <tt class="py-param">value</tt><tt class="py-op">,</tt> <tt class="py-param">traceback</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="tempattr.__exit__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="tempattr.__exit__-expanded"><a name="L87"></a><tt class="py-lineno"> 87</tt> <tt class="py-line"> <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">obj</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">attr</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">oldvalue</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"><tt class="py-comment"># flatten -----</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"><tt class="py-comment"># XXX move in a specific module and use yield instead</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"><tt class="py-comment"># do not mix flatten and translate</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"><tt class="py-comment"># def iterable(obj):</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"><tt class="py-comment"># try: iter(obj)</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"><tt class="py-comment"># except: return False</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"><tt class="py-comment"># return True</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"><tt class="py-comment"># def is_string_like(obj):</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"><tt class="py-comment"># try: obj +''</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"><tt class="py-comment"># except (TypeError, ValueError): return False</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"><tt class="py-comment"># return True</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"><tt class="py-comment">#def is_scalar(obj):</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"><tt class="py-comment"># return is_string_like(obj) or not iterable(obj)</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"><tt class="py-comment">#def flatten(seq):</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"><tt class="py-comment"># for item in seq:</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"><tt class="py-comment"># if is_scalar(item):</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"><tt class="py-comment"># yield item</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"><tt class="py-comment"># else:</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"><tt class="py-comment"># for subitem in flatten(item):</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"><tt class="py-comment"># yield subitem</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt> <tt class="py-line"> </tt>
<a name="flatten"></a><div id="flatten-def"><a name="L116"></a><tt class="py-lineno">116</tt> <a class="py-toggle" href="#" id="flatten-toggle" onclick="return toggle('flatten');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common-module.html#flatten">flatten</a><tt class="py-op">(</tt><tt class="py-param">iterable</tt><tt class="py-op">,</tt> <tt class="py-param">tr_func</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">results</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="flatten-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="flatten-expanded"><a name="L117"></a><tt class="py-lineno">117</tt> <tt class="py-line"> <tt class="py-docstring">"""Flatten a list of list with any level.</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt> <tt class="py-line"><tt class="py-docstring"> If tr_func is not None, it should be a one argument function that'll be called</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt> <tt class="py-line"><tt class="py-docstring"> on each final element.</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"><tt class="py-docstring"> :rtype: list</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt> <tt class="py-line"><tt class="py-docstring"> >>> flatten([1, [2, 3]])</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"><tt class="py-docstring"> [1, 2, 3]</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">results</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"> <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">val</tt> <tt class="py-keyword">in</tt> <tt class="py-name">iterable</tt><tt class="py-op">:</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">list</tt><tt class="py-op">,</tt> <tt class="py-name">tuple</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"> <tt id="link-10" class="py-name" targets="Function logilab.common.flatten()=logilab.common-module.html#flatten,Method logilab.common.tree.Node.flatten()=logilab.common.tree.Node-class.html#flatten"><a title="logilab.common.flatten
logilab.common.tree.Node.flatten" class="py-name" href="#" onclick="return doclink('link-10', 'flatten', 'link-10');">flatten</a></tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">,</tt> <tt class="py-name">tr_func</tt><tt class="py-op">,</tt> <tt class="py-name">results</tt><tt class="py-op">)</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">tr_func</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt> <tt class="py-line"> <tt class="py-name">results</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Method logilab.common.tree.ListNode.append()=logilab.common.tree.ListNode-class.html#append,Method logilab.common.tree.Node.append()=logilab.common.tree.Node-class.html#append,Method logilab.common.ureports.nodes.BaseLayout.append()=logilab.common.ureports.nodes.BaseLayout-class.html#append"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-11', 'append', 'link-11');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">)</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"> <tt class="py-name">results</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-12', 'append', 'link-11');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">tr_func</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">results</tt> </tt>
</div><a name="L137"></a><tt class="py-lineno">137</tt> <tt class="py-line"> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt> <tt class="py-line"> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"><tt class="py-comment"># XXX is function below still used ?</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"> </tt>
<a name="make_domains"></a><div id="make_domains-def"><a name="L141"></a><tt class="py-lineno">141</tt> <a class="py-toggle" href="#" id="make_domains-toggle" onclick="return toggle('make_domains');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common-module.html#make_domains">make_domains</a><tt class="py-op">(</tt><tt class="py-param">lists</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="make_domains-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="make_domains-expanded"><a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"><tt class="py-docstring"> Given a list of lists, return a list of domain for each list to produce all</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"><tt class="py-docstring"> combinations of possibles values.</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"><tt class="py-docstring"> :rtype: list</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt> <tt class="py-line"><tt class="py-docstring"> Example:</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"><tt class="py-docstring"> >>> make_domains(['a', 'b'], ['c','d', 'e'])</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"><tt class="py-docstring"> [['a', 'b', 'a', 'b', 'a', 'b'], ['c', 'c', 'd', 'd', 'e', 'e']]</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt class="py-name">six</tt><tt class="py-op">.</tt><tt class="py-name">moves</tt> <tt class="py-keyword">import</tt> <tt class="py-name">range</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"> <tt class="py-name">domains</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">iterable</tt> <tt class="py-keyword">in</tt> <tt class="py-name">lists</tt><tt class="py-op">:</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"> <tt class="py-name">new_domain</tt> <tt class="py-op">=</tt> <tt class="py-name">iterable</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">domains</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"> <tt class="py-name">domains</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">domains</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">*</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">iterable</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">domains</tt><tt class="py-op">:</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt> <tt class="py-line"> <tt class="py-name">missing</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">domains</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> <tt class="py-op">-</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">iterable</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">/</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">iterable</tt><tt class="py-op">)</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"> <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">j</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">iterable</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"> <tt class="py-name">value</tt> <tt class="py-op">=</tt> <tt class="py-name">iterable</tt><tt class="py-op">[</tt><tt class="py-name">j</tt><tt class="py-op">]</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">dummy</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">missing</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"> <tt class="py-name">new_domain</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Method logilab.common.tree.ListNode.insert()=logilab.common.tree.ListNode-class.html#insert,Method logilab.common.tree.Node.insert()=logilab.common.tree.Node-class.html#insert"><a title="logilab.common.tree.ListNode.insert
logilab.common.tree.Node.insert" class="py-name" href="#" onclick="return doclink('link-13', 'insert', 'link-13');">insert</a></tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt><tt class="py-op">)</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"> <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt> <tt class="py-line"> <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"> <tt class="py-name">domains</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-14', 'append', 'link-11');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">new_domain</tt><tt class="py-op">)</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">domains</tt> </tt>
</div><a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt> <tt class="py-line"> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"><tt class="py-comment"># private stuff ################################################################</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt> <tt class="py-line"> </tt>
<a name="_handle_blacklist"></a><div id="_handle_blacklist-def"><a name="L174"></a><tt class="py-lineno">174</tt> <a class="py-toggle" href="#" id="_handle_blacklist-toggle" onclick="return toggle('_handle_blacklist');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common-module.html#_handle_blacklist">_handle_blacklist</a><tt class="py-op">(</tt><tt class="py-param">blacklist</tt><tt class="py-op">,</tt> <tt class="py-param">dirnames</tt><tt class="py-op">,</tt> <tt class="py-param">filenames</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_handle_blacklist-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_handle_blacklist-expanded"><a name="L175"></a><tt class="py-lineno">175</tt> <tt class="py-line"> <tt class="py-docstring">"""remove files/directories in the black list</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt> <tt class="py-line"><tt class="py-docstring"> dirnames/filenames are usually from os.walk</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">norecurs</tt> <tt class="py-keyword">in</tt> <tt class="py-name">blacklist</tt><tt class="py-op">:</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">norecurs</tt> <tt class="py-keyword">in</tt> <tt class="py-name">dirnames</tt><tt class="py-op">:</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt> <tt class="py-line"> <tt class="py-name">dirnames</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Method logilab.common.table.Table.remove()=logilab.common.table.Table-class.html#remove,Method logilab.common.tasksqueue.PrioritizedTasksQueue.remove()=logilab.common.tasksqueue.PrioritizedTasksQueue-class.html#remove,Method logilab.common.tree.BinaryNode.remove()=logilab.common.tree.BinaryNode-class.html#remove,Method logilab.common.tree.ListNode.remove()=logilab.common.tree.ListNode-class.html#remove,Method logilab.common.tree.Node.remove()=logilab.common.tree.Node-class.html#remove"><a title="logilab.common.table.Table.remove
logilab.common.tasksqueue.PrioritizedTasksQueue.remove
logilab.common.tree.BinaryNode.remove
logilab.common.tree.ListNode.remove
logilab.common.tree.Node.remove" class="py-name" href="#" onclick="return doclink('link-15', 'remove', 'link-15');">remove</a></tt><tt class="py-op">(</tt><tt class="py-name">norecurs</tt><tt class="py-op">)</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">norecurs</tt> <tt class="py-keyword">in</tt> <tt class="py-name">filenames</tt><tt class="py-op">:</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt> <tt class="py-line"> <tt class="py-name">filenames</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="logilab.common.table.Table.remove
logilab.common.tasksqueue.PrioritizedTasksQueue.remove
logilab.common.tree.BinaryNode.remove
logilab.common.tree.ListNode.remove
logilab.common.tree.Node.remove" class="py-name" href="#" onclick="return doclink('link-16', 'remove', 'link-15');">remove</a></tt><tt class="py-op">(</tt><tt class="py-name">norecurs</tt><tt class="py-op">)</tt> </tt>
</div><a name="L184"></a><tt class="py-lineno">184</tt> <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th bgcolor="#70b0f0" class="navbar-select"
> Home </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Logilab's common library</th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1
on Sun Jan 17 22:12:20 2016
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>
|