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 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
|
<?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>lxml.tests.common_imports</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> <a
href="lxml-module.html">Home</a> </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"
><a class="navbar" target="_top" href="http://codespeak.net/lxml/">lxml API</a></th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="lxml-module.html">Package lxml</a> ::
<a href="lxml.tests-module.html">Package tests</a> ::
Module common_imports
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="lxml.tests.common_imports-pysrc.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<h1 class="epydoc">Source Code for <a href="lxml.tests.common_imports-module.html">Module lxml.tests.common_imports</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">unittest</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Variable lxml.etree.XPath.path=lxml.etree.XPath-class.html#path"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-0', 'path', 'link-0');">path</a></tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">re</tt><tt class="py-op">,</tt> <tt class="py-name">gc</tt><tt class="py-op">,</tt> <tt class="py-name">sys</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Package lxml=lxml-module.html"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-1', 'lxml', 'link-1');">lxml</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module lxml.etree=lxml.etree-module.html,Variable lxml.sax.ElementTreeContentHandler.etree=lxml.sax.ElementTreeContentHandler-class.html#etree,Variable lxml.tests.test_elementtree.CElementTreeTestCase.etree=lxml.tests.test_elementtree.CElementTreeTestCase-class.html#etree,Variable lxml.tests.test_elementtree.ETreeTestCaseBase.etree=lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#etree,Variable lxml.tests.test_elementtree.ElementTreeTestCase.etree=lxml.tests.test_elementtree.ElementTreeTestCase-class.html#etree,Variable lxml.tests.test_io.ElementTreeIOTestCase.etree=lxml.tests.test_io.ElementTreeIOTestCase-class.html#etree,Variable lxml.tests.test_io.IOTestCaseBase.etree=lxml.tests.test_io.IOTestCaseBase-class.html#etree"><a title="lxml.etree
lxml.sax.ElementTreeContentHandler.etree
lxml.tests.test_elementtree.CElementTreeTestCase.etree
lxml.tests.test_elementtree.ETreeTestCaseBase.etree
lxml.tests.test_elementtree.ElementTreeTestCase.etree
lxml.tests.test_io.ElementTreeIOTestCase.etree
lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-2', 'etree', 'link-2');">etree</a></tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"> </tt>
<a name="make_version_tuple"></a><div id="make_version_tuple-def"><a name="L7"></a><tt class="py-lineno"> 7</tt> <a class="py-toggle" href="#" id="make_version_tuple-toggle" onclick="return toggle('make_version_tuple');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#make_version_tuple">make_version_tuple</a><tt class="py-op">(</tt><tt class="py-param">version_string</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="make_version_tuple-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="make_version_tuple-expanded"><a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"> <tt class="py-name">l</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">part</tt> <tt class="py-keyword">in</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Method lxml.etree._Element.findall()=lxml.etree._Element-class.html#findall,Method lxml.etree._ElementTree.findall()=lxml.etree._ElementTree-class.html#findall,Method lxml.objectify.ObjectifiedElement.findall()=lxml.objectify.ObjectifiedElement-class.html#findall"><a title="lxml.etree._Element.findall
lxml.etree._ElementTree.findall
lxml.objectify.ObjectifiedElement.findall" class="py-name" href="#" onclick="return doclink('link-3', 'findall', 'link-3');">findall</a></tt><tt class="py-op">(</tt><tt class="py-string">'([0-9]+|[^0-9.]+)'</tt><tt class="py-op">,</tt> <tt class="py-name">version_string</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"> <tt class="py-name">l</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Method lxml.etree._AppendOnlyElementProxy.append()=lxml.etree._AppendOnlyElementProxy-class.html#append,Method lxml.etree._Element.append()=lxml.etree._Element-class.html#append,Method lxml.etree.__ContentOnlyElement.append()=lxml.etree.__ContentOnlyElement-class.html#append"><a title="lxml.etree._AppendOnlyElementProxy.append
lxml.etree._Element.append
lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-4', 'append', 'link-4');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">part</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">ValueError</tt><tt class="py-op">:</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"> <tt class="py-name">l</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
lxml.etree._Element.append
lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-5', 'append', 'link-4');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">part</tt><tt class="py-op">)</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">tuple</tt><tt class="py-op">(</tt><tt class="py-name">l</tt><tt class="py-op">)</tt> </tt>
</div><a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt class="py-name">elementtree</tt> <tt class="py-keyword">import</tt> <tt id="link-6" class="py-name" targets="Function lxml.etree.ElementTree()=lxml.etree-module.html#ElementTree,Variable lxml.tests.common_imports.ElementTree=lxml.tests.common_imports-module.html#ElementTree"><a title="lxml.etree.ElementTree
lxml.tests.common_imports.ElementTree" class="py-name" href="#" onclick="return doclink('link-6', 'ElementTree', 'link-6');">ElementTree</a></tt> <tt class="py-comment"># standard ET</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt id="link-7" class="py-name" targets="Variable lxml.tests.test_threading.ThreadPipelineTestCase.xml=lxml.tests.test_threading.ThreadPipelineTestCase-class.html#xml"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-7', 'xml', 'link-7');">xml</a></tt><tt class="py-op">.</tt><tt id="link-8" class="py-name"><a title="lxml.etree
lxml.sax.ElementTreeContentHandler.etree
lxml.tests.test_elementtree.CElementTreeTestCase.etree
lxml.tests.test_elementtree.ETreeTestCaseBase.etree
lxml.tests.test_elementtree.ElementTreeTestCase.etree
lxml.tests.test_io.ElementTreeIOTestCase.etree
lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-8', 'etree', 'link-2');">etree</a></tt> <tt class="py-keyword">import</tt> <tt id="link-9" class="py-name"><a title="lxml.etree.ElementTree
lxml.tests.common_imports.ElementTree" class="py-name" href="#" onclick="return doclink('link-9', 'ElementTree', 'link-6');">ElementTree</a></tt> <tt class="py-comment"># Python 2.5+</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"> <tt id="link-10" class="py-name"><a title="lxml.etree.ElementTree
lxml.tests.common_imports.ElementTree" class="py-name" href="#" onclick="return doclink('link-10', 'ElementTree', 'link-6');">ElementTree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt id="link-11" class="py-name" targets="Method lxml.objectify.ObjectPath.hasattr()=lxml.objectify.ObjectPath-class.html#hasattr"><a title="lxml.objectify.ObjectPath.hasattr" class="py-name" href="#" onclick="return doclink('link-11', 'hasattr', 'link-11');">hasattr</a></tt><tt class="py-op">(</tt><tt id="link-12" class="py-name"><a title="lxml.etree.ElementTree
lxml.tests.common_imports.ElementTree" class="py-name" href="#" onclick="return doclink('link-12', 'ElementTree', 'link-6');">ElementTree</a></tt><tt class="py-op">,</tt> <tt class="py-string">'VERSION'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-13" class="py-name" targets="Function lxml.tests.common_imports.make_version_tuple()=lxml.tests.common_imports-module.html#make_version_tuple"><a title="lxml.tests.common_imports.make_version_tuple" class="py-name" href="#" onclick="return doclink('link-13', 'make_version_tuple', 'link-13');">make_version_tuple</a></tt><tt class="py-op">(</tt><tt id="link-14" class="py-name"><a title="lxml.etree.ElementTree
lxml.tests.common_imports.ElementTree" class="py-name" href="#" onclick="return doclink('link-14', 'ElementTree', 'link-6');">ElementTree</a></tt><tt class="py-op">.</tt><tt class="py-name">VERSION</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op"><</tt> <tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-number">3</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"> <tt class="py-comment"># compatibility tests require ET 1.3+</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"> <tt id="link-15" class="py-name"><a title="lxml.etree.ElementTree
lxml.tests.common_imports.ElementTree" class="py-name" href="#" onclick="return doclink('link-15', 'ElementTree', 'link-6');">ElementTree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</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">try</tt><tt class="py-op">:</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt id="link-16" class="py-name" targets="Variable lxml.tests.common_imports.cElementTree=lxml.tests.common_imports-module.html#cElementTree,Variable lxml.tests.test_elementtree.cElementTree=lxml.tests.test_elementtree-module.html#cElementTree"><a title="lxml.tests.common_imports.cElementTree
lxml.tests.test_elementtree.cElementTree" class="py-name" href="#" onclick="return doclink('link-16', 'cElementTree', 'link-16');">cElementTree</a></tt> <tt class="py-comment"># standard ET</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt> <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt id="link-17" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-17', 'xml', 'link-7');">xml</a></tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="lxml.etree
lxml.sax.ElementTreeContentHandler.etree
lxml.tests.test_elementtree.CElementTreeTestCase.etree
lxml.tests.test_elementtree.ETreeTestCaseBase.etree
lxml.tests.test_elementtree.ElementTreeTestCase.etree
lxml.tests.test_io.ElementTreeIOTestCase.etree
lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-18', 'etree', 'link-2');">etree</a></tt> <tt class="py-keyword">import</tt> <tt id="link-19" class="py-name"><a title="lxml.tests.common_imports.cElementTree
lxml.tests.test_elementtree.cElementTree" class="py-name" href="#" onclick="return doclink('link-19', 'cElementTree', 'link-16');">cElementTree</a></tt> <tt class="py-comment"># Python 2.5+</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"> <tt id="link-20" class="py-name"><a title="lxml.tests.common_imports.cElementTree
lxml.tests.test_elementtree.cElementTree" class="py-name" href="#" onclick="return doclink('link-20', 'cElementTree', 'link-16');">cElementTree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt id="link-21" class="py-name"><a title="lxml.objectify.ObjectPath.hasattr" class="py-name" href="#" onclick="return doclink('link-21', 'hasattr', 'link-11');">hasattr</a></tt><tt class="py-op">(</tt><tt id="link-22" class="py-name"><a title="lxml.tests.common_imports.cElementTree
lxml.tests.test_elementtree.cElementTree" class="py-name" href="#" onclick="return doclink('link-22', 'cElementTree', 'link-16');">cElementTree</a></tt><tt class="py-op">,</tt> <tt class="py-string">'VERSION'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-23" class="py-name"><a title="lxml.tests.common_imports.make_version_tuple" class="py-name" href="#" onclick="return doclink('link-23', 'make_version_tuple', 'link-13');">make_version_tuple</a></tt><tt class="py-op">(</tt><tt id="link-24" class="py-name"><a title="lxml.tests.common_imports.cElementTree
lxml.tests.test_elementtree.cElementTree" class="py-name" href="#" onclick="return doclink('link-24', 'cElementTree', 'link-16');">cElementTree</a></tt><tt class="py-op">.</tt><tt class="py-name">VERSION</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op"><=</tt> <tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"> <tt class="py-comment"># compatibility tests do not run with cET 1.0.7</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"> <tt id="link-25" class="py-name"><a title="lxml.tests.common_imports.cElementTree
lxml.tests.test_elementtree.cElementTree" class="py-name" href="#" onclick="return doclink('link-25', 'cElementTree', 'link-16');">cElementTree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt class="py-name">doctest</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"> <tt class="py-comment"># check if the system version has everything we need</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocFileSuite</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocTestParser</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt> <tt class="py-line"> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">NORMALIZE_WHITESPACE</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">ELLIPSIS</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-op">(</tt><tt class="py-name">ImportError</tt><tt class="py-op">,</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"> <tt class="py-comment"># we need our own version to make it work (Python 2.3?)</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt class="py-name">local_doctest</tt> <tt class="py-keyword">as</tt> <tt class="py-name">doctest</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"> </tt>
<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-name">sorted</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">NameError</tt><tt class="py-op">:</tt> </tt>
<a name="sorted"></a><div id="sorted-def"><a name="L56"></a><tt class="py-lineno"> 56</tt> <a class="py-toggle" href="#" id="sorted-toggle" onclick="return toggle('sorted');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#sorted">sorted</a><tt class="py-op">(</tt><tt class="py-param">seq</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="sorted-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="sorted-expanded"><a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"> <tt class="py-name">seq</tt> <tt class="py-op">=</tt> <tt class="py-name">list</tt><tt class="py-op">(</tt><tt class="py-name">seq</tt><tt class="py-op">)</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt> <tt class="py-line"> <tt class="py-name">seq</tt><tt class="py-op">.</tt><tt class="py-name">sort</tt><tt class="py-op">(</tt><tt class="py-op">**</tt><tt class="py-name">kwargs</tt><tt class="py-op">)</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">seq</tt> </tt>
</div><a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"><tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-string">'sorted'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">sorted</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"> </tt>
<a name="_get_caller_relative_path"></a><div id="_get_caller_relative_path-def"><a name="L63"></a><tt class="py-lineno"> 63</tt> <a class="py-toggle" href="#" id="_get_caller_relative_path-toggle" onclick="return toggle('_get_caller_relative_path');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#_get_caller_relative_path">_get_caller_relative_path</a><tt class="py-op">(</tt><tt class="py-param">filename</tt><tt class="py-op">,</tt> <tt class="py-param">frame_depth</tt><tt class="py-op">=</tt><tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_get_caller_relative_path-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_get_caller_relative_path-expanded"><a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"> <tt class="py-name">module</tt> <tt class="py-op">=</tt> <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-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">_getframe</tt><tt class="py-op">(</tt><tt class="py-name">frame_depth</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">f_globals</tt><tt class="py-op">[</tt><tt class="py-string">'__name__'</tt><tt class="py-op">]</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">return</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-26', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">normpath</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-27', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-28" class="py-name" targets="Method lxml.cssselect.XPathExpr.join()=lxml.cssselect.XPathExpr-class.html#join"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-28', 'join', 'link-28');">join</a></tt><tt class="py-op">(</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-29', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">dirname</tt><tt class="py-op">(</tt><tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">module</tt><tt class="py-op">,</tt> <tt class="py-string">'__file__'</tt><tt class="py-op">,</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-30" class="py-name" targets="Variable lxml.etree._LogEntry.filename=lxml.etree._LogEntry-class.html#filename"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-30', 'filename', 'link-30');">filename</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L67"></a><tt class="py-lineno"> 67</tt> <tt class="py-line"> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">version_info</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-number">3</tt><tt class="py-op">:</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"> <tt class="py-comment"># Python 3</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"> <tt class="py-name">unicode</tt> <tt class="py-op">=</tt> <tt id="link-31" class="py-name" targets="Class str=str-class.html"><a title="str" class="py-name" href="#" onclick="return doclink('link-31', 'str', 'link-31');">str</a></tt> </tt>
<a name="_str"></a><div id="_str-def"><a name="L71"></a><tt class="py-lineno"> 71</tt> <a class="py-toggle" href="#" id="_str-toggle" onclick="return toggle('_str');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#_str">_str</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">encoding</tt><tt class="py-op">=</tt><tt class="py-string">"UTF-8"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_str-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_str-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">s</tt> </tt>
</div><a name="_bytes"></a><div id="_bytes-def"><a name="L73"></a><tt class="py-lineno"> 73</tt> <a class="py-toggle" href="#" id="_bytes-toggle" onclick="return toggle('_bytes');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#_bytes">_bytes</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">encoding</tt><tt class="py-op">=</tt><tt class="py-string">"UTF-8"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_bytes-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_bytes-expanded"><a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt id="link-32" class="py-name" targets="Variable lxml.etree.DocInfo.encoding=lxml.etree.DocInfo-class.html#encoding"><a title="lxml.etree.DocInfo.encoding" class="py-name" href="#" onclick="return doclink('link-32', 'encoding', 'link-32');">encoding</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L75"></a><tt class="py-lineno"> 75</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt class="py-name">io</tt> <tt class="py-keyword">import</tt> <tt class="py-name">StringIO</tt><tt class="py-op">,</tt> <tt class="py-name">BytesIO</tt> <tt class="py-keyword">as</tt> <tt class="py-name">_BytesIO</tt> </tt>
<a name="BytesIO"></a><div id="BytesIO-def"><a name="L76"></a><tt class="py-lineno"> 76</tt> <a class="py-toggle" href="#" id="BytesIO-toggle" onclick="return toggle('BytesIO');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#BytesIO">BytesIO</a><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-param">args</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BytesIO-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BytesIO-expanded"><a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">args</tt> <tt class="py-keyword">and</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">args</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt id="link-33" class="py-name"><a title="str" class="py-name" href="#" onclick="return doclink('link-33', 'str', 'link-31');">str</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"> <tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">args</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-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">"UTF-8"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">_BytesIO</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-name">args</tt><tt class="py-op">)</tt> </tt>
</div><a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"> <tt id="link-34" class="py-name" targets="Variable lxml.tests.common_imports.doctest_parser=lxml.tests.common_imports-module.html#doctest_parser"><a title="lxml.tests.common_imports.doctest_parser" class="py-name" href="#" onclick="return doclink('link-34', 'doctest_parser', 'link-34');">doctest_parser</a></tt> <tt class="py-op">=</tt> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocTestParser</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"> <tt id="link-35" class="py-name" targets="Variable lxml.tests.common_imports._fix_unicode=lxml.tests.common_imports-module.html#_fix_unicode"><a title="lxml.tests.common_imports._fix_unicode" class="py-name" href="#" onclick="return doclink('link-35', '_fix_unicode', 'link-35');">_fix_unicode</a></tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-string">r'(\s+)u(["\'])'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"> <tt id="link-36" class="py-name" targets="Function lxml.tests.common_imports._fix_exceptions()=lxml.tests.common_imports-module.html#_fix_exceptions"><a title="lxml.tests.common_imports._fix_exceptions" class="py-name" href="#" onclick="return doclink('link-36', '_fix_exceptions', 'link-36');">_fix_exceptions</a></tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-string">r'(.*except [^(]*),\s*(.*:)'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
<a name="make_doctest"></a><div id="make_doctest-def"><a name="L84"></a><tt class="py-lineno"> 84</tt> <a class="py-toggle" href="#" id="make_doctest-toggle" onclick="return toggle('make_doctest');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#make_doctest">make_doctest</a><tt class="py-op">(</tt><tt class="py-param">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="make_doctest-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="make_doctest-expanded"><a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"> <tt id="link-37" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-37', 'filename', 'link-30');">filename</a></tt> <tt class="py-op">=</tt> <tt id="link-38" class="py-name" targets="Function lxml.tests.common_imports._get_caller_relative_path()=lxml.tests.common_imports-module.html#_get_caller_relative_path"><a title="lxml.tests.common_imports._get_caller_relative_path" class="py-name" href="#" onclick="return doclink('link-38', '_get_caller_relative_path', 'link-38');">_get_caller_relative_path</a></tt><tt class="py-op">(</tt><tt id="link-39" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-39', 'filename', 'link-30');">filename</a></tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt> <tt class="py-line"> <tt class="py-name">doctests</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt id="link-40" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-40', 'filename', 'link-30');">filename</a></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name" targets="Method lxml.tests.common_imports.LargeFileLike.read()=lxml.tests.common_imports.LargeFileLike-class.html#read,Method lxml.tests.common_imports.SillyFileLike.read()=lxml.tests.common_imports.SillyFileLike-class.html#read"><a title="lxml.tests.common_imports.LargeFileLike.read
lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-41', 'read', 'link-41');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt> <tt class="py-line"> <tt class="py-name">doctests</tt> <tt class="py-op">=</tt> <tt id="link-42" class="py-name"><a title="lxml.tests.common_imports._fix_unicode" class="py-name" href="#" onclick="return doclink('link-42', '_fix_unicode', 'link-35');">_fix_unicode</a></tt><tt class="py-op">(</tt><tt class="py-string">r'\1\2'</tt><tt class="py-op">,</tt> <tt class="py-name">doctests</tt><tt class="py-op">)</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"> <tt class="py-name">doctests</tt> <tt class="py-op">=</tt> <tt id="link-43" class="py-name"><a title="lxml.tests.common_imports._fix_exceptions" class="py-name" href="#" onclick="return doclink('link-43', '_fix_exceptions', 'link-36');">_fix_exceptions</a></tt><tt class="py-op">(</tt><tt class="py-string">r'\1 as \2'</tt><tt class="py-op">,</tt> <tt class="py-name">doctests</tt><tt class="py-op">)</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocTestCase</tt><tt class="py-op">(</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> <tt id="link-44" class="py-name"><a title="lxml.tests.common_imports.doctest_parser" class="py-name" href="#" onclick="return doclink('link-44', 'doctest_parser', 'link-34');">doctest_parser</a></tt><tt class="py-op">.</tt><tt class="py-name">get_doctest</tt><tt class="py-op">(</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"> <tt class="py-name">doctests</tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-45', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">basename</tt><tt class="py-op">(</tt><tt id="link-46" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-46', 'filename', 'link-30');">filename</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-47" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-47', 'filename', 'link-30');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"><tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"> <tt class="py-comment"># Python 2</tt> </tt>
<a name="_str"></a><div id="_str-def"><a name="L94"></a><tt class="py-lineno"> 94</tt> <a class="py-toggle" href="#" id="_str-toggle" onclick="return toggle('_str');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#_str">_str</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">encoding</tt><tt class="py-op">=</tt><tt class="py-string">"UTF-8"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_str-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_str-expanded"><a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">unicode</tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">,</tt> <tt id="link-48" class="py-name"><a title="lxml.etree.DocInfo.encoding" class="py-name" href="#" onclick="return doclink('link-48', 'encoding', 'link-32');">encoding</a></tt><tt class="py-op">=</tt><tt id="link-49" class="py-name"><a title="lxml.etree.DocInfo.encoding" class="py-name" href="#" onclick="return doclink('link-49', 'encoding', 'link-32');">encoding</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="_bytes"></a><div id="_bytes-def"><a name="L96"></a><tt class="py-lineno"> 96</tt> <a class="py-toggle" href="#" id="_bytes-toggle" onclick="return toggle('_bytes');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#_bytes">_bytes</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">,</tt> <tt class="py-param">encoding</tt><tt class="py-op">=</tt><tt class="py-string">"UTF-8"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_bytes-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_bytes-expanded"><a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">s</tt> </tt>
</div><a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"> <tt class="py-keyword">from</tt> <tt class="py-name">StringIO</tt> <tt class="py-keyword">import</tt> <tt class="py-name">StringIO</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"> <tt class="py-name">BytesIO</tt> <tt class="py-op">=</tt> <tt class="py-name">StringIO</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"> <tt id="link-50" class="py-name"><a title="lxml.tests.common_imports.doctest_parser" class="py-name" href="#" onclick="return doclink('link-50', 'doctest_parser', 'link-34');">doctest_parser</a></tt> <tt class="py-op">=</tt> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocTestParser</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"> <tt id="link-51" class="py-name" targets="Function lxml.tests.common_imports._fix_traceback()=lxml.tests.common_imports-module.html#_fix_traceback"><a title="lxml.tests.common_imports._fix_traceback" class="py-name" href="#" onclick="return doclink('link-51', '_fix_traceback', 'link-51');">_fix_traceback</a></tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-string">r'^(\s*)(?:\w+\.)+(\w*(?:Error|Exception|Invalid):)'</tt><tt class="py-op">,</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">M</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"> <tt id="link-52" class="py-name"><a title="lxml.tests.common_imports._fix_exceptions" class="py-name" href="#" onclick="return doclink('link-52', '_fix_exceptions', 'link-36');">_fix_exceptions</a></tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-string">r'(.*except [^(]*)\s+as\s+(.*:)'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"> <tt id="link-53" class="py-name" targets="Function lxml.tests.common_imports._fix_bytes()=lxml.tests.common_imports-module.html#_fix_bytes"><a title="lxml.tests.common_imports._fix_bytes" class="py-name" href="#" onclick="return doclink('link-53', '_fix_bytes', 'link-53');">_fix_bytes</a></tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-string">r'(\s+)b(["\'])'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
<a name="make_doctest"></a><div id="make_doctest-def"><a name="L105"></a><tt class="py-lineno">105</tt> <a class="py-toggle" href="#" id="make_doctest-toggle" onclick="return toggle('make_doctest');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#make_doctest">make_doctest</a><tt class="py-op">(</tt><tt class="py-param">filename</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="make_doctest-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="make_doctest-expanded"><a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt id="link-54" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-54', 'filename', 'link-30');">filename</a></tt> <tt class="py-op">=</tt> <tt id="link-55" class="py-name"><a title="lxml.tests.common_imports._get_caller_relative_path" class="py-name" href="#" onclick="return doclink('link-55', '_get_caller_relative_path', 'link-38');">_get_caller_relative_path</a></tt><tt class="py-op">(</tt><tt id="link-56" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-56', 'filename', 'link-30');">filename</a></tt><tt class="py-op">)</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"> <tt class="py-name">doctests</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt id="link-57" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-57', 'filename', 'link-30');">filename</a></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.read
lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-58', 'read', 'link-41');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> <tt class="py-name">doctests</tt> <tt class="py-op">=</tt> <tt id="link-59" class="py-name"><a title="lxml.tests.common_imports._fix_traceback" class="py-name" href="#" onclick="return doclink('link-59', '_fix_traceback', 'link-51');">_fix_traceback</a></tt><tt class="py-op">(</tt><tt class="py-string">r'\1\2'</tt><tt class="py-op">,</tt> <tt class="py-name">doctests</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-name">doctests</tt> <tt class="py-op">=</tt> <tt id="link-60" class="py-name"><a title="lxml.tests.common_imports._fix_exceptions" class="py-name" href="#" onclick="return doclink('link-60', '_fix_exceptions', 'link-36');">_fix_exceptions</a></tt><tt class="py-op">(</tt><tt class="py-string">r'\1, \2'</tt><tt class="py-op">,</tt> <tt class="py-name">doctests</tt><tt class="py-op">)</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> <tt class="py-name">doctests</tt> <tt class="py-op">=</tt> <tt id="link-61" class="py-name"><a title="lxml.tests.common_imports._fix_bytes" class="py-name" href="#" onclick="return doclink('link-61', '_fix_bytes', 'link-53');">_fix_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">r'\1\2'</tt><tt class="py-op">,</tt> <tt class="py-name">doctests</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocTestCase</tt><tt class="py-op">(</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"> <tt id="link-62" class="py-name"><a title="lxml.tests.common_imports.doctest_parser" class="py-name" href="#" onclick="return doclink('link-62', 'doctest_parser', 'link-34');">doctest_parser</a></tt><tt class="py-op">.</tt><tt class="py-name">get_doctest</tt><tt class="py-op">(</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"> <tt class="py-name">doctests</tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-63" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-63', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">basename</tt><tt class="py-op">(</tt><tt id="link-64" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-64', 'filename', 'link-30');">filename</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-65" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-65', 'filename', 'link-30');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"> </tt>
<a name="HelperTestCase"></a><div id="HelperTestCase-def"><a name="L115"></a><tt class="py-lineno">115</tt> <a class="py-toggle" href="#" id="HelperTestCase-toggle" onclick="return toggle('HelperTestCase');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.common_imports.HelperTestCase-class.html">HelperTestCase</a><tt class="py-op">(</tt><tt class="py-base-class">unittest</tt><tt class="py-op">.</tt><tt class="py-base-class">TestCase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="HelperTestCase-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="HelperTestCase-expanded"><a name="HelperTestCase.tearDown"></a><div id="HelperTestCase.tearDown-def"><a name="L116"></a><tt class="py-lineno">116</tt> <a class="py-toggle" href="#" id="HelperTestCase.tearDown-toggle" onclick="return toggle('HelperTestCase.tearDown');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.HelperTestCase-class.html#tearDown">tearDown</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="HelperTestCase.tearDown-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="HelperTestCase.tearDown-expanded"><a name="L117"></a><tt class="py-lineno">117</tt> <tt class="py-line"> <tt class="py-name">gc</tt><tt class="py-op">.</tt><tt class="py-name">collect</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"> </tt>
<a name="HelperTestCase.parse"></a><div id="HelperTestCase.parse-def"><a name="L119"></a><tt class="py-lineno">119</tt> <a class="py-toggle" href="#" id="HelperTestCase.parse-toggle" onclick="return toggle('HelperTestCase.parse');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.HelperTestCase-class.html#parse">parse</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">text</tt><tt class="py-op">,</tt> <tt class="py-param">parser</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="HelperTestCase.parse-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="HelperTestCase.parse-expanded"><a name="L120"></a><tt class="py-lineno">120</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">BytesIO</tt><tt class="py-op">(</tt><tt id="link-66" class="py-name" targets="Variable lxml.etree.QName.text=lxml.etree.QName-class.html#text,Variable lxml.etree._AppendOnlyElementProxy.text=lxml.etree._AppendOnlyElementProxy-class.html#text,Variable lxml.etree._Element.text=lxml.etree._Element-class.html#text,Variable lxml.etree._Entity.text=lxml.etree._Entity-class.html#text,Variable lxml.etree._ReadOnlyElementProxy.text=lxml.etree._ReadOnlyElementProxy-class.html#text,Variable lxml.etree.__ContentOnlyElement.text=lxml.etree.__ContentOnlyElement-class.html#text,Variable lxml.objectify.ObjectifiedElement.text=lxml.objectify.ObjectifiedElement-class.html#text"><a title="lxml.etree.QName.text
lxml.etree._AppendOnlyElementProxy.text
lxml.etree._Element.text
lxml.etree._Entity.text
lxml.etree._ReadOnlyElementProxy.text
lxml.etree.__ContentOnlyElement.text
lxml.objectify.ObjectifiedElement.text" class="py-name" href="#" onclick="return doclink('link-66', 'text', 'link-66');">text</a></tt><tt class="py-op">)</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-67" class="py-name"><a title="lxml.etree
lxml.sax.ElementTreeContentHandler.etree
lxml.tests.test_elementtree.CElementTreeTestCase.etree
lxml.tests.test_elementtree.ETreeTestCaseBase.etree
lxml.tests.test_elementtree.ElementTreeTestCase.etree
lxml.tests.test_io.ElementTreeIOTestCase.etree
lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-67', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-68" class="py-name" targets="Function lxml.cssselect.parse()=lxml.cssselect-module.html#parse,Method lxml.etree._ElementTree.parse()=lxml.etree._ElementTree-class.html#parse,Function lxml.etree.parse()=lxml.etree-module.html#parse,Function lxml.html.ElementSoup.parse()=lxml.html.ElementSoup-module.html#parse,Function lxml.html.html5parser.parse()=lxml.html.html5parser-module.html#parse,Function lxml.html.parse()=lxml.html-module.html#parse,Function lxml.html.soupparser.parse()=lxml.html.soupparser-module.html#parse,Function lxml.objectify.parse()=lxml.objectify-module.html#parse,Method lxml.tests.common_imports.HelperTestCase.parse()=lxml.tests.common_imports.HelperTestCase-class.html#parse"><a title="lxml.cssselect.parse
lxml.etree._ElementTree.parse
lxml.etree.parse
lxml.html.ElementSoup.parse
lxml.html.html5parser.parse
lxml.html.parse
lxml.html.soupparser.parse
lxml.objectify.parse
lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-68', 'parse', 'link-68');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt id="link-69" class="py-name" targets="Variable lxml.etree._ElementTree.parser=lxml.etree._ElementTree-class.html#parser,Variable lxml.tests.test_pyclasslookup.PyClassLookupTestCase.parser=lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#parser"><a title="lxml.etree._ElementTree.parser
lxml.tests.test_pyclasslookup.PyClassLookupTestCase.parser" class="py-name" href="#" onclick="return doclink('link-69', 'parser', 'link-69');">parser</a></tt><tt class="py-op">=</tt><tt id="link-70" class="py-name"><a title="lxml.etree._ElementTree.parser
lxml.tests.test_pyclasslookup.PyClassLookupTestCase.parser" class="py-name" href="#" onclick="return doclink('link-70', 'parser', 'link-69');">parser</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"> </tt>
<a name="HelperTestCase._rootstring"></a><div id="HelperTestCase._rootstring-def"><a name="L123"></a><tt class="py-lineno">123</tt> <a class="py-toggle" href="#" id="HelperTestCase._rootstring-toggle" onclick="return toggle('HelperTestCase._rootstring');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.HelperTestCase-class.html#_rootstring">_rootstring</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">tree</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="HelperTestCase._rootstring-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="HelperTestCase._rootstring-expanded"><a name="L124"></a><tt class="py-lineno">124</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-71" class="py-name"><a title="lxml.etree
lxml.sax.ElementTreeContentHandler.etree
lxml.tests.test_elementtree.CElementTreeTestCase.etree
lxml.tests.test_elementtree.ETreeTestCaseBase.etree
lxml.tests.test_elementtree.ElementTreeTestCase.etree
lxml.tests.test_io.ElementTreeIOTestCase.etree
lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-71', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-72" class="py-name" targets="Method lxml.etree.XSLT.tostring()=lxml.etree.XSLT-class.html#tostring,Function lxml.etree.tostring()=lxml.etree-module.html#tostring,Function lxml.html.tostring()=lxml.html-module.html#tostring"><a title="lxml.etree.XSLT.tostring
lxml.etree.tostring
lxml.html.tostring" class="py-name" href="#" onclick="return doclink('link-72', 'tostring', 'link-72');">tostring</a></tt><tt class="py-op">(</tt><tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name" targets="Method lxml.etree._ElementTree.getroot()=lxml.etree._ElementTree-class.html#getroot"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-73', 'getroot', 'link-73');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-74" class="py-name" targets="Method lxml.etree._Element.replace()=lxml.etree._Element-class.html#replace,Method lxml.etree._ExsltRegExp.replace()=lxml.etree._ExsltRegExp-class.html#replace"><a title="lxml.etree._Element.replace
lxml.etree._ExsltRegExp.replace" class="py-name" href="#" onclick="return doclink('link-74', 'replace', 'link-74');">replace</a></tt><tt class="py-op">(</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"> <tt id="link-75" class="py-name" targets="Function lxml.tests.common_imports._bytes()=lxml.tests.common_imports-module.html#_bytes"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-75', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">' '</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-76" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-76', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name"><a title="lxml.etree._Element.replace
lxml.etree._ExsltRegExp.replace" class="py-name" href="#" onclick="return doclink('link-77', 'replace', 'link-74');">replace</a></tt><tt class="py-op">(</tt><tt id="link-78" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-78', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'\n'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-79" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-79', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"> <tt class="py-comment"># assertFalse doesn't exist in Python 2.3</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"> <tt class="py-name">unittest</tt><tt class="py-op">.</tt><tt class="py-name">TestCase</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name" targets="Variable lxml.tests.common_imports.HelperTestCase.assertFalse=lxml.tests.common_imports.HelperTestCase-class.html#assertFalse"><a title="lxml.tests.common_imports.HelperTestCase.assertFalse" class="py-name" href="#" onclick="return doclink('link-80', 'assertFalse', 'link-80');">assertFalse</a></tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</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="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"> <tt id="link-81" class="py-name"><a title="lxml.tests.common_imports.HelperTestCase.assertFalse" class="py-name" href="#" onclick="return doclink('link-81', 'assertFalse', 'link-80');">assertFalse</a></tt> <tt class="py-op">=</tt> <tt class="py-name">unittest</tt><tt class="py-op">.</tt><tt class="py-name">TestCase</tt><tt class="py-op">.</tt><tt class="py-name">failIf</tt> </tt>
</div><a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"> </tt>
<a name="SillyFileLike"></a><div id="SillyFileLike-def"><a name="L133"></a><tt class="py-lineno">133</tt> <a class="py-toggle" href="#" id="SillyFileLike-toggle" onclick="return toggle('SillyFileLike');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.common_imports.SillyFileLike-class.html">SillyFileLike</a><tt class="py-op">:</tt> </tt>
</div><div id="SillyFileLike-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="SillyFileLike-expanded"><a name="SillyFileLike.__init__"></a><div id="SillyFileLike.__init__-def"><a name="L134"></a><tt class="py-lineno">134</tt> <a class="py-toggle" href="#" id="SillyFileLike.__init__-toggle" onclick="return toggle('SillyFileLike.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.SillyFileLike-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">xml_data</tt><tt class="py-op">=</tt><tt id="link-82" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-82', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'<foo><bar/></foo>'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SillyFileLike.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SillyFileLike.__init__-expanded"><a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xml_data</tt> <tt class="py-op">=</tt> <tt class="py-name">xml_data</tt> </tt>
</div><a name="L136"></a><tt class="py-lineno">136</tt> <tt class="py-line"> </tt>
<a name="SillyFileLike.read"></a><div id="SillyFileLike.read-def"><a name="L137"></a><tt class="py-lineno">137</tt> <a class="py-toggle" href="#" id="SillyFileLike.read-toggle" onclick="return toggle('SillyFileLike.read');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.SillyFileLike-class.html#read">read</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">amount</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="SillyFileLike.read-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SillyFileLike.read-expanded"><a name="L138"></a><tt class="py-lineno">138</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xml_data</tt><tt class="py-op">:</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">amount</tt><tt class="py-op">:</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"> <tt id="link-83" class="py-name" targets="Method lxml.etree.TreeBuilder.data()=lxml.etree.TreeBuilder-class.html#data"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-83', 'data', 'link-83');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xml_data</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">amount</tt><tt class="py-op">]</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xml_data</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xml_data</tt><tt class="py-op">[</tt><tt class="py-name">amount</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"> <tt id="link-84" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-84', 'data', 'link-83');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xml_data</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xml_data</tt> <tt class="py-op">=</tt> <tt id="link-85" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-85', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-86" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-86', 'data', 'link-83');">data</a></tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-87" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-87', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"> </tt>
<a name="LargeFileLike"></a><div id="LargeFileLike-def"><a name="L148"></a><tt class="py-lineno">148</tt> <a class="py-toggle" href="#" id="LargeFileLike-toggle" onclick="return toggle('LargeFileLike');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.common_imports.LargeFileLike-class.html">LargeFileLike</a><tt class="py-op">:</tt> </tt>
</div><div id="LargeFileLike-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="LargeFileLike-expanded"><a name="LargeFileLike.__init__"></a><div id="LargeFileLike.__init__-def"><a name="L149"></a><tt class="py-lineno">149</tt> <a class="py-toggle" href="#" id="LargeFileLike.__init__-toggle" onclick="return toggle('LargeFileLike.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.LargeFileLike-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">charlen</tt><tt class="py-op">=</tt><tt class="py-number">100</tt><tt class="py-op">,</tt> <tt class="py-param">depth</tt><tt class="py-op">=</tt><tt class="py-number">4</tt><tt class="py-op">,</tt> <tt class="py-param">children</tt><tt class="py-op">=</tt><tt class="py-number">5</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LargeFileLike.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="LargeFileLike.__init__-expanded"><a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-88" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-88', 'data', 'link-83');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">BytesIO</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chars</tt> <tt class="py-op">=</tt> <tt id="link-89" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-89', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'a'</tt><tt class="py-op">)</tt> <tt class="py-op">*</tt> <tt class="py-name">charlen</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">children</tt> <tt class="py-op">=</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">children</tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">more</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-90" class="py-name" targets="Method lxml.tests.common_imports.LargeFileLike.iterelements()=lxml.tests.common_imports.LargeFileLike-class.html#iterelements,Method lxml.tests.common_imports.LargeFileLikeUnicode.iterelements()=lxml.tests.common_imports.LargeFileLikeUnicode-class.html#iterelements"><a title="lxml.tests.common_imports.LargeFileLike.iterelements
lxml.tests.common_imports.LargeFileLikeUnicode.iterelements" class="py-name" href="#" onclick="return doclink('link-90', 'iterelements', 'link-90');">iterelements</a></tt><tt class="py-op">(</tt><tt class="py-name">depth</tt><tt class="py-op">)</tt> </tt>
</div><a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"> </tt>
<a name="LargeFileLike.iterelements"></a><div id="LargeFileLike.iterelements-def"><a name="L155"></a><tt class="py-lineno">155</tt> <a class="py-toggle" href="#" id="LargeFileLike.iterelements-toggle" onclick="return toggle('LargeFileLike.iterelements');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.LargeFileLike-class.html#iterelements">iterelements</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">depth</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LargeFileLike.iterelements-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="LargeFileLike.iterelements-expanded"><a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt id="link-91" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-91', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'<root>'</tt><tt class="py-op">)</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"> <tt class="py-name">depth</tt> <tt class="py-op">-=</tt> <tt class="py-number">1</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">depth</tt> <tt class="py-op">></tt> <tt class="py-number">0</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">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">children</tt><tt class="py-op">:</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">element</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-92" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.iterelements
lxml.tests.common_imports.LargeFileLikeUnicode.iterelements" class="py-name" href="#" onclick="return doclink('link-92', 'iterelements', 'link-90');">iterelements</a></tt><tt class="py-op">(</tt><tt class="py-name">depth</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">element</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chars</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"> <tt class="py-keyword">else</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">yield</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chars</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt id="link-93" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-93', '_bytes', 'link-75');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'</root>'</tt><tt class="py-op">)</tt> </tt>
</div><a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"> </tt>
<a name="LargeFileLike.read"></a><div id="LargeFileLike.read-def"><a name="L167"></a><tt class="py-lineno">167</tt> <a class="py-toggle" href="#" id="LargeFileLike.read-toggle" onclick="return toggle('LargeFileLike.read');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.LargeFileLike-class.html#read">read</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">amount</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="LargeFileLike.read-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="LargeFileLike.read-expanded"><a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"> <tt id="link-94" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-94', 'data', 'link-83');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-95" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-95', 'data', 'link-83');">data</a></tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"> <tt id="link-96" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
lxml.etree._Element.append
lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-96', 'append', 'link-4');">append</a></tt> <tt class="py-op">=</tt> <tt id="link-97" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-97', 'data', 'link-83');">data</a></tt><tt class="py-op">.</tt><tt id="link-98" class="py-name" targets="Method lxml.etree._ElementTree.write()=lxml.etree._ElementTree-class.html#write"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-98', 'write', 'link-98');">write</a></tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">amount</tt><tt class="py-op">:</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">element</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">more</tt><tt class="py-op">:</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"> <tt id="link-99" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
lxml.etree._Element.append
lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-99', 'append', 'link-4');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">)</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-100" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-100', 'data', 'link-83');">data</a></tt><tt class="py-op">.</tt><tt class="py-name">tell</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">>=</tt> <tt class="py-name">amount</tt><tt class="py-op">:</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt> <tt class="py-line"> <tt class="py-keyword">break</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">element</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">more</tt><tt class="py-op">:</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt> <tt class="py-line"> <tt id="link-101" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
lxml.etree._Element.append
lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-101', 'append', 'link-4');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">)</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-102" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-102', 'data', 'link-83');">data</a></tt><tt class="py-op">.</tt><tt class="py-name">getvalue</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt> <tt class="py-line"> <tt id="link-103" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-103', 'data', 'link-83');">data</a></tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt> <tt class="py-line"> <tt id="link-104" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-104', 'data', 'link-83');">data</a></tt><tt class="py-op">.</tt><tt class="py-name">truncate</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">amount</tt><tt class="py-op">:</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt> <tt class="py-line"> <tt id="link-105" class="py-name"><a title="lxml.etree._AppendOnlyElementProxy.append
lxml.etree._Element.append
lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-105', 'append', 'link-4');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-name">amount</tt><tt class="py-op">:</tt><tt class="py-op">]</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">result</tt> <tt class="py-op">=</tt> <tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">amount</tt><tt class="py-op">]</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div></div><a name="L185"></a><tt class="py-lineno">185</tt> <tt class="py-line"> </tt>
<a name="LargeFileLikeUnicode"></a><div id="LargeFileLikeUnicode-def"><a name="L186"></a><tt class="py-lineno">186</tt> <a class="py-toggle" href="#" id="LargeFileLikeUnicode-toggle" onclick="return toggle('LargeFileLikeUnicode');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.common_imports.LargeFileLikeUnicode-class.html">LargeFileLikeUnicode</a><tt class="py-op">(</tt><tt class="py-base-class">LargeFileLike</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LargeFileLikeUnicode-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="LargeFileLikeUnicode-expanded"><a name="LargeFileLikeUnicode.__init__"></a><div id="LargeFileLikeUnicode.__init__-def"><a name="L187"></a><tt class="py-lineno">187</tt> <a class="py-toggle" href="#" id="LargeFileLikeUnicode.__init__-toggle" onclick="return toggle('LargeFileLikeUnicode.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.LargeFileLikeUnicode-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">charlen</tt><tt class="py-op">=</tt><tt class="py-number">100</tt><tt class="py-op">,</tt> <tt class="py-param">depth</tt><tt class="py-op">=</tt><tt class="py-number">4</tt><tt class="py-op">,</tt> <tt class="py-param">children</tt><tt class="py-op">=</tt><tt class="py-number">5</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LargeFileLikeUnicode.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="LargeFileLikeUnicode.__init__-expanded"><a name="L188"></a><tt class="py-lineno">188</tt> <tt class="py-line"> <tt id="link-106" class="py-name" targets="Class lxml.tests.common_imports.LargeFileLike=lxml.tests.common_imports.LargeFileLike-class.html"><a title="lxml.tests.common_imports.LargeFileLike" class="py-name" href="#" onclick="return doclink('link-106', 'LargeFileLike', 'link-106');">LargeFileLike</a></tt><tt class="py-op">.</tt><tt id="link-107" class="py-name" targets="Method lxml.builder.ElementMaker.__init__()=lxml.builder.ElementMaker-class.html#__init__,Method lxml.cssselect.Attrib.__init__()=lxml.cssselect.Attrib-class.html#__init__,Method lxml.cssselect.CSSSelector.__init__()=lxml.cssselect.CSSSelector-class.html#__init__,Method lxml.cssselect.Class.__init__()=lxml.cssselect.Class-class.html#__init__,Method lxml.cssselect.CombinedSelector.__init__()=lxml.cssselect.CombinedSelector-class.html#__init__,Method lxml.cssselect.Element.__init__()=lxml.cssselect.Element-class.html#__init__,Method lxml.cssselect.Function.__init__()=lxml.cssselect.Function-class.html#__init__,Method lxml.cssselect.Hash.__init__()=lxml.cssselect.Hash-class.html#__init__,Method lxml.cssselect.Or.__init__()=lxml.cssselect.Or-class.html#__init__,Method lxml.cssselect.Pseudo.__init__()=lxml.cssselect.Pseudo-class.html#__init__,Method lxml.cssselect.TokenStream.__init__()=lxml.cssselect.TokenStream-class.html#__init__,Method lxml.cssselect.XPathExpr.__init__()=lxml.cssselect.XPathExpr-class.html#__init__,Method lxml.cssselect.XPathExprOr.__init__()=lxml.cssselect.XPathExprOr-class.html#__init__,Method lxml.doctestcompare._RestoreChecker.__init__()=lxml.doctestcompare._RestoreChecker-class.html#__init__,Method lxml.etree.AncestorsIterator.__init__()=lxml.etree.AncestorsIterator-class.html#__init__,Method lxml.etree.AttributeBasedElementClassLookup.__init__()=lxml.etree.AttributeBasedElementClassLookup-class.html#__init__,Method lxml.etree.CDATA.__init__()=lxml.etree.CDATA-class.html#__init__,Method lxml.etree.DTD.__init__()=lxml.etree.DTD-class.html#__init__,Method lxml.etree.DocInfo.__init__()=lxml.etree.DocInfo-class.html#__init__,Method lxml.etree.ETCompatXMLParser.__init__()=lxml.etree.ETCompatXMLParser-class.html#__init__,Method lxml.etree.ETXPath.__init__()=lxml.etree.ETXPath-class.html#__init__,Method lxml.etree.ElementBase.__init__()=lxml.etree.ElementBase-class.html#__init__,Method lxml.etree.ElementChildIterator.__init__()=lxml.etree.ElementChildIterator-class.html#__init__,Method lxml.etree.ElementDefaultClassLookup.__init__()=lxml.etree.ElementDefaultClassLookup-class.html#__init__,Method lxml.etree.ElementDepthFirstIterator.__init__()=lxml.etree.ElementDepthFirstIterator-class.html#__init__,Method lxml.etree.ElementNamespaceClassLookup.__init__()=lxml.etree.ElementNamespaceClassLookup-class.html#__init__,Method lxml.etree.ElementTextIterator.__init__()=lxml.etree.ElementTextIterator-class.html#__init__,Method lxml.etree.FallbackElementClassLookup.__init__()=lxml.etree.FallbackElementClassLookup-class.html#__init__,Method lxml.etree.HTMLParser.__init__()=lxml.etree.HTMLParser-class.html#__init__,Method lxml.etree.LxmlError.__init__()=lxml.etree.LxmlError-class.html#__init__,Method lxml.etree.PyErrorLog.__init__()=lxml.etree.PyErrorLog-class.html#__init__,Method lxml.etree.QName.__init__()=lxml.etree.QName-class.html#__init__,Method lxml.etree.RelaxNG.__init__()=lxml.etree.RelaxNG-class.html#__init__,Method lxml.etree.Schematron.__init__()=lxml.etree.Schematron-class.html#__init__,Method lxml.etree.SiblingsIterator.__init__()=lxml.etree.SiblingsIterator-class.html#__init__,Method lxml.etree.TreeBuilder.__init__()=lxml.etree.TreeBuilder-class.html#__init__,Method lxml.etree.XInclude.__init__()=lxml.etree.XInclude-class.html#__init__,Method lxml.etree.XMLParser.__init__()=lxml.etree.XMLParser-class.html#__init__,Method lxml.etree.XMLSchema.__init__()=lxml.etree.XMLSchema-class.html#__init__,Method lxml.etree.XMLSyntaxError.__init__()=lxml.etree.XMLSyntaxError-class.html#__init__,Method lxml.etree.XPath.__init__()=lxml.etree.XPath-class.html#__init__,Method lxml.etree.XPathDocumentEvaluator.__init__()=lxml.etree.XPathDocumentEvaluator-class.html#__init__,Method lxml.etree.XPathElementEvaluator.__init__()=lxml.etree.XPathElementEvaluator-class.html#__init__,Method lxml.etree.XSLT.__init__()=lxml.etree.XSLT-class.html#__init__,Method lxml.etree.XSLTAccessControl.__init__()=lxml.etree.XSLTAccessControl-class.html#__init__,Method lxml.etree._Attrib.__init__()=lxml.etree._Attrib-class.html#__init__,Method lxml.etree._BaseContext.__init__()=lxml.etree._BaseContext-class.html#__init__,Method lxml.etree._BaseErrorLog.__init__()=lxml.etree._BaseErrorLog-class.html#__init__,Method lxml.etree._BaseParser.__init__()=lxml.etree._BaseParser-class.html#__init__,Method lxml.etree._DomainErrorLog.__init__()=lxml.etree._DomainErrorLog-class.html#__init__,Method lxml.etree._ErrorLog.__init__()=lxml.etree._ErrorLog-class.html#__init__,Method lxml.etree._ExsltRegExp.__init__()=lxml.etree._ExsltRegExp-class.html#__init__,Method lxml.etree._FileReaderContext.__init__()=lxml.etree._FileReaderContext-class.html#__init__,Method lxml.etree._FilelikeWriter.__init__()=lxml.etree._FilelikeWriter-class.html#__init__,Method lxml.etree._IDDict.__init__()=lxml.etree._IDDict-class.html#__init__,Method lxml.etree._IterparseContext.__init__()=lxml.etree._IterparseContext-class.html#__init__,Method lxml.etree._ListErrorLog.__init__()=lxml.etree._ListErrorLog-class.html#__init__,Method lxml.etree._NamespaceRegistry.__init__()=lxml.etree._NamespaceRegistry-class.html#__init__,Method lxml.etree._ParserDictionaryContext.__init__()=lxml.etree._ParserDictionaryContext-class.html#__init__,Method lxml.etree._PythonSaxParserTarget.__init__()=lxml.etree._PythonSaxParserTarget-class.html#__init__,Method lxml.etree._ResolverRegistry.__init__()=lxml.etree._ResolverRegistry-class.html#__init__,Method lxml.etree._RotatingErrorLog.__init__()=lxml.etree._RotatingErrorLog-class.html#__init__,Method lxml.etree._TargetParserResult.__init__()=lxml.etree._TargetParserResult-class.html#__init__,Method lxml.etree._TempStore.__init__()=lxml.etree._TempStore-class.html#__init__,Method lxml.etree._Validator.__init__()=lxml.etree._Validator-class.html#__init__,Method lxml.etree._XPathContext.__init__()=lxml.etree._XPathContext-class.html#__init__,Method lxml.etree._XPathEvaluatorBase.__init__()=lxml.etree._XPathEvaluatorBase-class.html#__init__,Method lxml.etree._XSLTContext.__init__()=lxml.etree._XSLTContext-class.html#__init__,Method lxml.etree._XSLTQuotedStringParam.__init__()=lxml.etree._XSLTQuotedStringParam-class.html#__init__,Method lxml.etree.iterparse.__init__()=lxml.etree.iterparse-class.html#__init__,Method lxml.etree.iterwalk.__init__()=lxml.etree.iterwalk-class.html#__init__,Method lxml.html.CheckboxValues.__init__()=lxml.html.CheckboxValues-class.html#__init__,Method lxml.html.FieldsDict.__init__()=lxml.html.FieldsDict-class.html#__init__,Method lxml.html.HTMLParser.__init__()=lxml.html.HTMLParser-class.html#__init__,Method lxml.html.HtmlElementClassLookup.__init__()=lxml.html.HtmlElementClassLookup-class.html#__init__,Method lxml.html.InputGetter.__init__()=lxml.html.InputGetter-class.html#__init__,Method lxml.html.MultipleSelectOptions.__init__()=lxml.html.MultipleSelectOptions-class.html#__init__,Method lxml.html.XHTMLParser.__init__()=lxml.html.XHTMLParser-class.html#__init__,Method lxml.html._MethodFunc.__init__()=lxml.html._MethodFunc-class.html#__init__,Method lxml.html.clean.Cleaner.__init__()=lxml.html.clean.Cleaner-class.html#__init__,Method lxml.html.formfill.DefaultErrorCreator.__init__()=lxml.html.formfill.DefaultErrorCreator-class.html#__init__,Method lxml.html.html5parser.HTMLParser.__init__()=lxml.html.html5parser.HTMLParser-class.html#__init__,Method lxml.html.html5parser.XHTMLParser.__init__()=lxml.html.html5parser.XHTMLParser-class.html#__init__,Method lxml.objectify.ElementMaker.__init__()=lxml.objectify.ElementMaker-class.html#__init__,Method lxml.objectify.ObjectPath.__init__()=lxml.objectify.ObjectPath-class.html#__init__,Method lxml.objectify.ObjectifyElementClassLookup.__init__()=lxml.objectify.ObjectifyElementClassLookup-class.html#__init__,Method lxml.objectify.PyType.__init__()=lxml.objectify.PyType-class.html#__init__,Method lxml.sax.ElementTreeContentHandler.__init__()=lxml.sax.ElementTreeContentHandler-class.html#__init__,Method lxml.sax.ElementTreeProducer.__init__()=lxml.sax.ElementTreeProducer-class.html#__init__,Method lxml.tests.common_imports.LargeFileLike.__init__()=lxml.tests.common_imports.LargeFileLike-class.html#__init__,Method lxml.tests.common_imports.LargeFileLikeUnicode.__init__()=lxml.tests.common_imports.LargeFileLikeUnicode-class.html#__init__,Method lxml.tests.common_imports.SillyFileLike.__init__()=lxml.tests.common_imports.SillyFileLike-class.html#__init__,Method lxml.tests.test_css.CSSTestCase.__init__()=lxml.tests.test_css.CSSTestCase-class.html#__init__,Method lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__()=lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__,Method lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver.__init__()=lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html#__init__"><a title="lxml.builder.ElementMaker.__init__
lxml.cssselect.Attrib.__init__
lxml.cssselect.CSSSelector.__init__
lxml.cssselect.Class.__init__
lxml.cssselect.CombinedSelector.__init__
lxml.cssselect.Element.__init__
lxml.cssselect.Function.__init__
lxml.cssselect.Hash.__init__
lxml.cssselect.Or.__init__
lxml.cssselect.Pseudo.__init__
lxml.cssselect.TokenStream.__init__
lxml.cssselect.XPathExpr.__init__
lxml.cssselect.XPathExprOr.__init__
lxml.doctestcompare._RestoreChecker.__init__
lxml.etree.AncestorsIterator.__init__
lxml.etree.AttributeBasedElementClassLookup.__init__
lxml.etree.CDATA.__init__
lxml.etree.DTD.__init__
lxml.etree.DocInfo.__init__
lxml.etree.ETCompatXMLParser.__init__
lxml.etree.ETXPath.__init__
lxml.etree.ElementBase.__init__
lxml.etree.ElementChildIterator.__init__
lxml.etree.ElementDefaultClassLookup.__init__
lxml.etree.ElementDepthFirstIterator.__init__
lxml.etree.ElementNamespaceClassLookup.__init__
lxml.etree.ElementTextIterator.__init__
lxml.etree.FallbackElementClassLookup.__init__
lxml.etree.HTMLParser.__init__
lxml.etree.LxmlError.__init__
lxml.etree.PyErrorLog.__init__
lxml.etree.QName.__init__
lxml.etree.RelaxNG.__init__
lxml.etree.Schematron.__init__
lxml.etree.SiblingsIterator.__init__
lxml.etree.TreeBuilder.__init__
lxml.etree.XInclude.__init__
lxml.etree.XMLParser.__init__
lxml.etree.XMLSchema.__init__
lxml.etree.XMLSyntaxError.__init__
lxml.etree.XPath.__init__
lxml.etree.XPathDocumentEvaluator.__init__
lxml.etree.XPathElementEvaluator.__init__
lxml.etree.XSLT.__init__
lxml.etree.XSLTAccessControl.__init__
lxml.etree._Attrib.__init__
lxml.etree._BaseContext.__init__
lxml.etree._BaseErrorLog.__init__
lxml.etree._BaseParser.__init__
lxml.etree._DomainErrorLog.__init__
lxml.etree._ErrorLog.__init__
lxml.etree._ExsltRegExp.__init__
lxml.etree._FileReaderContext.__init__
lxml.etree._FilelikeWriter.__init__
lxml.etree._IDDict.__init__
lxml.etree._IterparseContext.__init__
lxml.etree._ListErrorLog.__init__
lxml.etree._NamespaceRegistry.__init__
lxml.etree._ParserDictionaryContext.__init__
lxml.etree._PythonSaxParserTarget.__init__
lxml.etree._ResolverRegistry.__init__
lxml.etree._RotatingErrorLog.__init__
lxml.etree._TargetParserResult.__init__
lxml.etree._TempStore.__init__
lxml.etree._Validator.__init__
lxml.etree._XPathContext.__init__
lxml.etree._XPathEvaluatorBase.__init__
lxml.etree._XSLTContext.__init__
lxml.etree._XSLTQuotedStringParam.__init__
lxml.etree.iterparse.__init__
lxml.etree.iterwalk.__init__
lxml.html.CheckboxValues.__init__
lxml.html.FieldsDict.__init__
lxml.html.HTMLParser.__init__
lxml.html.HtmlElementClassLookup.__init__
lxml.html.InputGetter.__init__
lxml.html.MultipleSelectOptions.__init__
lxml.html.XHTMLParser.__init__
lxml.html._MethodFunc.__init__
lxml.html.clean.Cleaner.__init__
lxml.html.formfill.DefaultErrorCreator.__init__
lxml.html.html5parser.HTMLParser.__init__
lxml.html.html5parser.XHTMLParser.__init__
lxml.objectify.ElementMaker.__init__
lxml.objectify.ObjectPath.__init__
lxml.objectify.ObjectifyElementClassLookup.__init__
lxml.objectify.PyType.__init__
lxml.sax.ElementTreeContentHandler.__init__
lxml.sax.ElementTreeProducer.__init__
lxml.tests.common_imports.LargeFileLike.__init__
lxml.tests.common_imports.LargeFileLikeUnicode.__init__
lxml.tests.common_imports.SillyFileLike.__init__
lxml.tests.test_css.CSSTestCase.__init__
lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__
lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver.__init__" class="py-name" href="#" onclick="return doclink('link-107', '__init__', 'link-107');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">charlen</tt><tt class="py-op">,</tt> <tt class="py-name">depth</tt><tt class="py-op">,</tt> <tt class="py-name">children</tt><tt class="py-op">)</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-108" class="py-name"><a title="lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-108', 'data', 'link-83');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">StringIO</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chars</tt> <tt class="py-op">=</tt> <tt id="link-109" class="py-name" targets="Function lxml.tests.common_imports._str()=lxml.tests.common_imports-module.html#_str"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-109', '_str', 'link-109');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'a'</tt><tt class="py-op">)</tt> <tt class="py-op">*</tt> <tt class="py-name">charlen</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">more</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-110" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.iterelements
lxml.tests.common_imports.LargeFileLikeUnicode.iterelements" class="py-name" href="#" onclick="return doclink('link-110', 'iterelements', 'link-90');">iterelements</a></tt><tt class="py-op">(</tt><tt class="py-name">depth</tt><tt class="py-op">)</tt> </tt>
</div><a name="L192"></a><tt class="py-lineno">192</tt> <tt class="py-line"> </tt>
<a name="LargeFileLikeUnicode.iterelements"></a><div id="LargeFileLikeUnicode.iterelements-def"><a name="L193"></a><tt class="py-lineno">193</tt> <a class="py-toggle" href="#" id="LargeFileLikeUnicode.iterelements-toggle" onclick="return toggle('LargeFileLikeUnicode.iterelements');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports.LargeFileLikeUnicode-class.html#iterelements">iterelements</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">depth</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LargeFileLikeUnicode.iterelements-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="LargeFileLikeUnicode.iterelements-expanded"><a name="L194"></a><tt class="py-lineno">194</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt id="link-111" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-111', '_str', 'link-109');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'<root>'</tt><tt class="py-op">)</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt> <tt class="py-line"> <tt class="py-name">depth</tt> <tt class="py-op">-=</tt> <tt class="py-number">1</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">depth</tt> <tt class="py-op">></tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">children</tt><tt class="py-op">:</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">element</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-112" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.iterelements
lxml.tests.common_imports.LargeFileLikeUnicode.iterelements" class="py-name" href="#" onclick="return doclink('link-112', 'iterelements', 'link-90');">iterelements</a></tt><tt class="py-op">(</tt><tt class="py-name">depth</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">element</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chars</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chars</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt id="link-113" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-113', '_str', 'link-109');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'</root>'</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L204"></a><tt class="py-lineno">204</tt> <tt class="py-line"> </tt>
<a name="fileInTestDir"></a><div id="fileInTestDir-def"><a name="L205"></a><tt class="py-lineno">205</tt> <a class="py-toggle" href="#" id="fileInTestDir-toggle" onclick="return toggle('fileInTestDir');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#fileInTestDir">fileInTestDir</a><tt class="py-op">(</tt><tt class="py-param">name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="fileInTestDir-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="fileInTestDir-expanded"><a name="L206"></a><tt class="py-lineno">206</tt> <tt class="py-line"> <tt class="py-name">_testdir</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-114" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-114', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">dirname</tt><tt class="py-op">(</tt><tt class="py-name">__file__</tt><tt class="py-op">)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-115" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-115', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-116" class="py-name"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-116', 'join', 'link-28');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">_testdir</tt><tt class="py-op">,</tt> <tt id="link-117" class="py-name" targets="Variable lxml.etree._Entity.name=lxml.etree._Entity-class.html#name,Variable lxml.html.InputMixin.name=lxml.html.InputMixin-class.html#name,Variable lxml.objectify.PyType.name=lxml.objectify.PyType-class.html#name"><a title="lxml.etree._Entity.name
lxml.html.InputMixin.name
lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-117', 'name', 'link-117');">name</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L208"></a><tt class="py-lineno">208</tt> <tt class="py-line"> </tt>
<a name="canonicalize"></a><div id="canonicalize-def"><a name="L209"></a><tt class="py-lineno">209</tt> <a class="py-toggle" href="#" id="canonicalize-toggle" onclick="return toggle('canonicalize');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#canonicalize">canonicalize</a><tt class="py-op">(</tt><tt class="py-param">xml</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="canonicalize-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="canonicalize-expanded"><a name="L210"></a><tt class="py-lineno">210</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">BytesIO</tt><tt class="py-op">(</tt><tt id="link-118" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-118', 'xml', 'link-7');">xml</a></tt><tt class="py-op">)</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt id="link-119" class="py-name"><a title="lxml.etree
lxml.sax.ElementTreeContentHandler.etree
lxml.tests.test_elementtree.CElementTreeTestCase.etree
lxml.tests.test_elementtree.ETreeTestCaseBase.etree
lxml.tests.test_elementtree.ElementTreeTestCase.etree
lxml.tests.test_io.ElementTreeIOTestCase.etree
lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-119', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-120" class="py-name"><a title="lxml.cssselect.parse
lxml.etree._ElementTree.parse
lxml.etree.parse
lxml.html.ElementSoup.parse
lxml.html.html5parser.parse
lxml.html.parse
lxml.html.soupparser.parse
lxml.objectify.parse
lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-120', 'parse', 'link-68');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">BytesIO</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L213"></a><tt class="py-lineno">213</tt> <tt class="py-line"> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-121" class="py-name" targets="Method lxml.etree._ElementTree.write_c14n()=lxml.etree._ElementTree-class.html#write_c14n"><a title="lxml.etree._ElementTree.write_c14n" class="py-name" href="#" onclick="return doclink('link-121', 'write_c14n', 'link-121');">write_c14n</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">getvalue</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L215"></a><tt class="py-lineno">215</tt> <tt class="py-line"> </tt>
<a name="unentitify"></a><div id="unentitify-def"><a name="L216"></a><tt class="py-lineno">216</tt> <a class="py-toggle" href="#" id="unentitify-toggle" onclick="return toggle('unentitify');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.common_imports-module.html#unentitify">unentitify</a><tt class="py-op">(</tt><tt class="py-param">xml</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="unentitify-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="unentitify-expanded"><a name="L217"></a><tt class="py-lineno">217</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">entity_name</tt><tt class="py-op">,</tt> <tt id="link-122" class="py-name" targets="Variable lxml.html.CheckboxGroup.value=lxml.html.CheckboxGroup-class.html#value,Variable lxml.html.InputElement.value=lxml.html.InputElement-class.html#value,Variable lxml.html.RadioGroup.value=lxml.html.RadioGroup-class.html#value,Variable lxml.html.SelectElement.value=lxml.html.SelectElement-class.html#value,Variable lxml.html.TextareaElement.value=lxml.html.TextareaElement-class.html#value"><a title="lxml.html.CheckboxGroup.value
lxml.html.InputElement.value
lxml.html.RadioGroup.value
lxml.html.SelectElement.value
lxml.html.TextareaElement.value" class="py-name" href="#" onclick="return doclink('link-122', 'value', 'link-122');">value</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt id="link-123" class="py-name"><a title="lxml.etree._Element.findall
lxml.etree._ElementTree.findall
lxml.objectify.ObjectifiedElement.findall" class="py-name" href="#" onclick="return doclink('link-123', 'findall', 'link-3');">findall</a></tt><tt class="py-op">(</tt><tt class="py-string">"(&#([0-9]+);)"</tt><tt class="py-op">,</tt> <tt id="link-124" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-124', 'xml', 'link-7');">xml</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt> <tt class="py-line"> <tt id="link-125" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-125', 'xml', 'link-7');">xml</a></tt> <tt class="py-op">=</tt> <tt id="link-126" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-126', 'xml', 'link-7');">xml</a></tt><tt class="py-op">.</tt><tt id="link-127" class="py-name"><a title="lxml.etree._Element.replace
lxml.etree._ExsltRegExp.replace" class="py-name" href="#" onclick="return doclink('link-127', 'replace', 'link-74');">replace</a></tt><tt class="py-op">(</tt><tt class="py-name">entity_name</tt><tt class="py-op">,</tt> <tt class="py-name">unichr</tt><tt class="py-op">(</tt><tt class="py-name">int</tt><tt class="py-op">(</tt><tt id="link-128" class="py-name"><a title="lxml.html.CheckboxGroup.value
lxml.html.InputElement.value
lxml.html.RadioGroup.value
lxml.html.SelectElement.value
lxml.html.TextareaElement.value" class="py-name" href="#" onclick="return doclink('link-128', 'value', 'link-122');">value</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-129" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-129', 'xml', 'link-7');">xml</a></tt> </tt>
</div><a name="L220"></a><tt class="py-lineno">220</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> <a
href="lxml-module.html">Home</a> </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"
><a class="navbar" target="_top" href="http://codespeak.net/lxml/">lxml API</a></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 Thu Sep 2 09:04:37 2010
</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>
|