File: lxml.html.diff.html

package info (click to toggle)
lxml 6.0.2-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 32,588 kB
  • sloc: python: 30,649; javascript: 1,640; ansic: 311; xml: 267; makefile: 243; sh: 68
file content (1894 lines) | stat: -rw-r--r-- 160,449 bytes parent folder | download
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
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894


<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>lxml.html.diff module &mdash; lxml  documentation</title>
      <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
      <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />

  
      <script src="_static/jquery.js?v=5d32c60e"></script>
      <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
      <script src="_static/documentation_options.js?v=5929fcd5"></script>
      <script src="_static/doctools.js?v=9bcbadda"></script>
      <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="lxml.html.formfill module" href="lxml.html.formfill.html" />
    <link rel="prev" title="lxml.html.defs module" href="lxml.html.defs.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="index.html" class="icon icon-home">
            lxml
              <img src="_static/python-xml.png" class="logo" alt="Logo"/>
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="lxml.html">lxml package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="lxml.html.html">lxml.html package</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="lxml.html.ElementSoup.html">lxml.html.ElementSoup module</a></li>
<li class="toctree-l3"><a class="reference internal" href="lxml.html.builder.html">lxml.html.builder module</a></li>
<li class="toctree-l3"><a class="reference internal" href="lxml.html.clean.html">lxml.html.clean module</a></li>
<li class="toctree-l3"><a class="reference internal" href="lxml.html.defs.html">lxml.html.defs module</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">lxml.html.diff module</a></li>
<li class="toctree-l3"><a class="reference internal" href="lxml.html.formfill.html">lxml.html.formfill module</a></li>
<li class="toctree-l3"><a class="reference internal" href="lxml.html.html5parser.html">lxml.html.html5parser module</a></li>
<li class="toctree-l3"><a class="reference internal" href="lxml.html.soupparser.html">lxml.html.soupparser module</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="lxml.isoschematron.html">lxml.isoschematron package</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml.ElementInclude.html">lxml.ElementInclude module</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml._elementpath.html">lxml._elementpath module</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml.builder.html">lxml.builder module</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml.cssselect.html">lxml.cssselect module</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml.doctestcompare.html">lxml.doctestcompare module</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml.etree.html">lxml.etree module</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml.objectify.html">lxml.objectify module</a></li>
<li class="toctree-l2"><a class="reference internal" href="lxml.sax.html">lxml.sax module</a></li>
</ul>
</li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">lxml</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="lxml.html">lxml package</a></li>
          <li class="breadcrumb-item"><a href="lxml.html.html">lxml.html package</a></li>
      <li class="breadcrumb-item active">lxml.html.diff module</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/lxml.html.diff.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="module-lxml.html.diff">
<span id="lxml-html-diff-module"></span><h1>lxml.html.diff module<a class="headerlink" href="#module-lxml.html.diff" title="Link to this heading"></a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="lxml.html.diff.DEL_END">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">DEL_END</span></span><a class="headerlink" href="#lxml.html.diff.DEL_END" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="lxml.html.diff.DEL_START">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">DEL_START</span></span><a class="headerlink" href="#lxml.html.diff.DEL_START" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">InsensitiveSequenceMatcher</span></span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">SequenceMatcher</span></code></p>
<p>Acts like SequenceMatcher, but tries not to find very small equal
blocks amidst large spans of changes</p>
<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.get_grouped_opcodes">
<span class="sig-name descname"><span class="pre">get_grouped_opcodes</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.get_grouped_opcodes" title="Link to this definition"></a></dt>
<dd><p>Isolate change clusters by eliminating ranges with no changes.</p>
<p>Return a generator of groups with up to n lines of context.
Each group is in the same format as returned by get_opcodes().</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span><span class="w"> </span><span class="nn">pprint</span><span class="w"> </span><span class="kn">import</span> <span class="n">pprint</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">40</span><span class="p">)))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">a</span><span class="p">[:]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="p">[</span><span class="mi">8</span><span class="p">:</span><span class="mi">8</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;i&#39;</span><span class="p">]</span>     <span class="c1"># Make an insertion</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="p">[</span><span class="mi">20</span><span class="p">]</span> <span class="o">+=</span> <span class="s1">&#39;x&#39;</span>       <span class="c1"># Make a replacement</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="p">[</span><span class="mi">23</span><span class="p">:</span><span class="mi">28</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>      <span class="c1"># Make a deletion</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="p">[</span><span class="mi">30</span><span class="p">]</span> <span class="o">+=</span> <span class="s1">&#39;y&#39;</span>       <span class="c1"># Make another replacement</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pprint</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">SequenceMatcher</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span><span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">)</span><span class="o">.</span><span class="n">get_grouped_opcodes</span><span class="p">()))</span>
<span class="go">[[(&#39;equal&#39;, 5, 8, 5, 8), (&#39;insert&#39;, 8, 8, 8, 9), (&#39;equal&#39;, 8, 11, 9, 12)],</span>
<span class="go"> [(&#39;equal&#39;, 16, 19, 17, 20),</span>
<span class="go">  (&#39;replace&#39;, 19, 20, 20, 21),</span>
<span class="go">  (&#39;equal&#39;, 20, 22, 21, 23),</span>
<span class="go">  (&#39;delete&#39;, 22, 27, 23, 23),</span>
<span class="go">  (&#39;equal&#39;, 27, 30, 23, 26)],</span>
<span class="go"> [(&#39;equal&#39;, 31, 34, 27, 30),</span>
<span class="go">  (&#39;replace&#39;, 34, 35, 30, 31),</span>
<span class="go">  (&#39;equal&#39;, 35, 38, 31, 34)]]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.ratio">
<span class="sig-name descname"><span class="pre">ratio</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.ratio" title="Link to this definition"></a></dt>
<dd><p>Return a measure of the sequences’ similarity (float in [0,1]).</p>
<p>Where T is the total number of elements in both sequences, and
M is the number of matches, this is 2.0*M / T.
Note that this is 1 if the sequences are identical, and 0 if
they have nothing in common.</p>
<p>.ratio() is expensive to compute if you haven’t already computed
.get_matching_blocks() or .get_opcodes(), in which case you may
want to try .quick_ratio() or .real_quick_ratio() first to get an
upper bound.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">SequenceMatcher</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="s2">&quot;abcd&quot;</span><span class="p">,</span> <span class="s2">&quot;bcde&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">ratio</span><span class="p">()</span>
<span class="go">0.75</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">quick_ratio</span><span class="p">()</span>
<span class="go">0.75</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">real_quick_ratio</span><span class="p">()</span>
<span class="go">1.0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.set_seq1">
<span class="sig-name descname"><span class="pre">set_seq1</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">a</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.set_seq1" title="Link to this definition"></a></dt>
<dd><p>Set the first sequence to be compared.</p>
<p>The second sequence to be compared is not changed.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">SequenceMatcher</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="s2">&quot;abcd&quot;</span><span class="p">,</span> <span class="s2">&quot;bcde&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">ratio</span><span class="p">()</span>
<span class="go">0.75</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">set_seq1</span><span class="p">(</span><span class="s2">&quot;bcde&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">ratio</span><span class="p">()</span>
<span class="go">1.0</span>
<span class="gp">&gt;&gt;&gt;</span>
</pre></div>
</div>
<p>SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against
many sequences, use .set_seq2(S) once and call .set_seq1(x)
repeatedly for each of the other sequences.</p>
<p>See also set_seqs() and set_seq2().</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.set_seq2">
<span class="sig-name descname"><span class="pre">set_seq2</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">b</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.set_seq2" title="Link to this definition"></a></dt>
<dd><p>Set the second sequence to be compared.</p>
<p>The first sequence to be compared is not changed.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">SequenceMatcher</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="s2">&quot;abcd&quot;</span><span class="p">,</span> <span class="s2">&quot;bcde&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">ratio</span><span class="p">()</span>
<span class="go">0.75</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">set_seq2</span><span class="p">(</span><span class="s2">&quot;abcd&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">ratio</span><span class="p">()</span>
<span class="go">1.0</span>
<span class="gp">&gt;&gt;&gt;</span>
</pre></div>
</div>
<p>SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against
many sequences, use .set_seq2(S) once and call .set_seq1(x)
repeatedly for each of the other sequences.</p>
<p>See also set_seqs() and set_seq1().</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.set_seqs">
<span class="sig-name descname"><span class="pre">set_seqs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">a</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.set_seqs" title="Link to this definition"></a></dt>
<dd><p>Set the two sequences to be compared.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">SequenceMatcher</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">set_seqs</span><span class="p">(</span><span class="s2">&quot;abcd&quot;</span><span class="p">,</span> <span class="s2">&quot;bcde&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">ratio</span><span class="p">()</span>
<span class="go">0.75</span>
</pre></div>
</div>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.a">
<span class="sig-name descname"><span class="pre">a</span></span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.a" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.b">
<span class="sig-name descname"><span class="pre">b</span></span><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.b" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="lxml.html.diff.InsensitiveSequenceMatcher.threshold">
<span class="sig-name descname"><span class="pre">threshold</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">2</span></em><a class="headerlink" href="#lxml.html.diff.InsensitiveSequenceMatcher.threshold" title="Link to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="lxml.html.diff.href_token">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">href_token</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pre_tags</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">post_tags</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trailing_whitespace</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#lxml.html.diff.token" title="lxml.html.diff.token"><code class="xref py py-class docutils literal notranslate"><span class="pre">token</span></code></a></p>
<p>Represents the href in an anchor tag.  Unlike other words, we only
show the href when it changes.</p>
<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.maketrans">
<em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">maketrans</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.maketrans" title="Link to this definition"></a></dt>
<dd><p>Return a translation table usable for str.translate().</p>
<p>If there is only one argument, it must be a dictionary mapping Unicode
ordinals (integers) or characters to Unicode ordinals, strings or None.
Character keys will be then converted to ordinals.
If there are two arguments, they must be strings of equal length, and
in the resulting dictionary, each character in x will be mapped to the
character at the same position in y. If there is a third argument, it
must be a string, whose characters will be mapped to None in the result.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.capitalize">
<span class="sig-name descname"><span class="pre">capitalize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.capitalize" title="Link to this definition"></a></dt>
<dd><p>Return a capitalized version of the string.</p>
<p>More specifically, make the first character have upper case and the rest lower
case.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.casefold">
<span class="sig-name descname"><span class="pre">casefold</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.casefold" title="Link to this definition"></a></dt>
<dd><p>Return a version of the string suitable for caseless comparisons.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.center">
<span class="sig-name descname"><span class="pre">center</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.center" title="Link to this definition"></a></dt>
<dd><p>Return a centered string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.count">
<span class="sig-name descname"><span class="pre">count</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.count" title="Link to this definition"></a></dt>
<dd><p>Return the number of non-overlapping occurrences of substring sub in string S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.encode">
<span class="sig-name descname"><span class="pre">encode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">encoding</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'utf-8'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'strict'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.encode" title="Link to this definition"></a></dt>
<dd><p>Encode the string using the codec registered for encoding.</p>
<dl class="simple">
<dt>encoding</dt><dd><p>The encoding in which to encode the string.</p>
</dd>
<dt>errors</dt><dd><p>The error handling scheme to use for encoding errors.
The default is ‘strict’ meaning that encoding errors raise a
UnicodeEncodeError.  Other possible values are ‘ignore’, ‘replace’ and
‘xmlcharrefreplace’ as well as any other name registered with
codecs.register_error that can handle UnicodeEncodeErrors.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.endswith">
<span class="sig-name descname"><span class="pre">endswith</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.endswith" title="Link to this definition"></a></dt>
<dd><p>Return True if the string ends with the specified suffix, False otherwise.</p>
<dl class="simple">
<dt>suffix</dt><dd><p>A string or a tuple of strings to try.</p>
</dd>
<dt>start</dt><dd><p>Optional start position. Default: start of the string.</p>
</dd>
<dt>end</dt><dd><p>Optional stop position. Default: end of the string.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.expandtabs">
<span class="sig-name descname"><span class="pre">expandtabs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tabsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">8</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.expandtabs" title="Link to this definition"></a></dt>
<dd><p>Return a copy where all tab characters are expanded using spaces.</p>
<p>If tabsize is not given, a tab size of 8 characters is assumed.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.find">
<span class="sig-name descname"><span class="pre">find</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.find" title="Link to this definition"></a></dt>
<dd><p>Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.format">
<span class="sig-name descname"><span class="pre">format</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.format" title="Link to this definition"></a></dt>
<dd><p>Return a formatted version of the string, using substitutions from args and kwargs.
The substitutions are identified by braces (‘{’ and ‘}’).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.format_map">
<span class="sig-name descname"><span class="pre">format_map</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mapping</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.format_map" title="Link to this definition"></a></dt>
<dd><p>Return a formatted version of the string, using substitutions from mapping.
The substitutions are identified by braces (‘{’ and ‘}’).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.html">
<span class="sig-name descname"><span class="pre">html</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.html" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.index">
<span class="sig-name descname"><span class="pre">index</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.index" title="Link to this definition"></a></dt>
<dd><p>Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isalnum">
<span class="sig-name descname"><span class="pre">isalnum</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isalnum" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an alpha-numeric string, False otherwise.</p>
<p>A string is alpha-numeric if all characters in the string are alpha-numeric and
there is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isalpha">
<span class="sig-name descname"><span class="pre">isalpha</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isalpha" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an alphabetic string, False otherwise.</p>
<p>A string is alphabetic if all characters in the string are alphabetic and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isascii">
<span class="sig-name descname"><span class="pre">isascii</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isascii" title="Link to this definition"></a></dt>
<dd><p>Return True if all characters in the string are ASCII, False otherwise.</p>
<p>ASCII characters have code points in the range U+0000-U+007F.
Empty string is ASCII too.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isdecimal">
<span class="sig-name descname"><span class="pre">isdecimal</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isdecimal" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a decimal string, False otherwise.</p>
<p>A string is a decimal string if all characters in the string are decimal and
there is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isdigit">
<span class="sig-name descname"><span class="pre">isdigit</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isdigit" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a digit string, False otherwise.</p>
<p>A string is a digit string if all characters in the string are digits and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isidentifier">
<span class="sig-name descname"><span class="pre">isidentifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isidentifier" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a valid Python identifier, False otherwise.</p>
<p>Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
such as “def” or “class”.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.islower">
<span class="sig-name descname"><span class="pre">islower</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.islower" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a lowercase string, False otherwise.</p>
<p>A string is lowercase if all cased characters in the string are lowercase and
there is at least one cased character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isnumeric">
<span class="sig-name descname"><span class="pre">isnumeric</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isnumeric" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a numeric string, False otherwise.</p>
<p>A string is numeric if all characters in the string are numeric and there is at
least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isprintable">
<span class="sig-name descname"><span class="pre">isprintable</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isprintable" title="Link to this definition"></a></dt>
<dd><p>Return True if all characters in the string are printable, False otherwise.</p>
<p>A character is printable if repr() may use it in its output.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isspace">
<span class="sig-name descname"><span class="pre">isspace</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isspace" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a whitespace string, False otherwise.</p>
<p>A string is whitespace if all characters in the string are whitespace and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.istitle">
<span class="sig-name descname"><span class="pre">istitle</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.istitle" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a title-cased string, False otherwise.</p>
<p>In a title-cased string, upper- and title-case characters may only
follow uncased characters and lowercase characters only cased ones.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.isupper">
<span class="sig-name descname"><span class="pre">isupper</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.isupper" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an uppercase string, False otherwise.</p>
<p>A string is uppercase if all cased characters in the string are uppercase and
there is at least one cased character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.join">
<span class="sig-name descname"><span class="pre">join</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">iterable</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.join" title="Link to this definition"></a></dt>
<dd><p>Concatenate any number of strings.</p>
<p>The string whose method is called is inserted in between each given string.
The result is returned as a new string.</p>
<p>Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -&gt; ‘ab.pq.rs’</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.ljust">
<span class="sig-name descname"><span class="pre">ljust</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.ljust" title="Link to this definition"></a></dt>
<dd><p>Return a left-justified string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.lower">
<span class="sig-name descname"><span class="pre">lower</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.lower" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string converted to lowercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.lstrip">
<span class="sig-name descname"><span class="pre">lstrip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.lstrip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with leading whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.partition">
<span class="sig-name descname"><span class="pre">partition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.partition" title="Link to this definition"></a></dt>
<dd><p>Partition the string into three parts using the given separator.</p>
<p>This will search for the separator in the string.  If the separator is found,
returns a 3-tuple containing the part before the separator, the separator
itself, and the part after it.</p>
<p>If the separator is not found, returns a 3-tuple containing the original string
and two empty strings.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.removeprefix">
<span class="sig-name descname"><span class="pre">removeprefix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prefix</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.removeprefix" title="Link to this definition"></a></dt>
<dd><p>Return a str with the given prefix string removed if present.</p>
<p>If the string starts with the prefix string, return string[len(prefix):].
Otherwise, return a copy of the original string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.removesuffix">
<span class="sig-name descname"><span class="pre">removesuffix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">suffix</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.removesuffix" title="Link to this definition"></a></dt>
<dd><p>Return a str with the given suffix string removed if present.</p>
<p>If the string ends with the suffix string and that suffix is not empty,
return string[:-len(suffix)]. Otherwise, return a copy of the original
string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.replace">
<span class="sig-name descname"><span class="pre">replace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">old</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">new</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.replace" title="Link to this definition"></a></dt>
<dd><p>Return a copy with all occurrences of substring old replaced by new.</p>
<blockquote>
<div><dl class="simple">
<dt>count</dt><dd><p>Maximum number of occurrences to replace.
-1 (the default value) means replace all occurrences.</p>
</dd>
</dl>
</div></blockquote>
<p>If the optional argument count is given, only the first count occurrences are
replaced.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.rfind">
<span class="sig-name descname"><span class="pre">rfind</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.rfind" title="Link to this definition"></a></dt>
<dd><p>Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.rindex">
<span class="sig-name descname"><span class="pre">rindex</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.rindex" title="Link to this definition"></a></dt>
<dd><p>Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.rjust">
<span class="sig-name descname"><span class="pre">rjust</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.rjust" title="Link to this definition"></a></dt>
<dd><p>Return a right-justified string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.rpartition">
<span class="sig-name descname"><span class="pre">rpartition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.rpartition" title="Link to this definition"></a></dt>
<dd><p>Partition the string into three parts using the given separator.</p>
<p>This will search for the separator in the string, starting at the end. If
the separator is found, returns a 3-tuple containing the part before the
separator, the separator itself, and the part after it.</p>
<p>If the separator is not found, returns a 3-tuple containing two empty strings
and the original string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.rsplit">
<span class="sig-name descname"><span class="pre">rsplit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxsplit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.rsplit" title="Link to this definition"></a></dt>
<dd><p>Return a list of the substrings in the string, using sep as the separator string.</p>
<blockquote>
<div><dl>
<dt>sep</dt><dd><p>The separator used to split the string.</p>
<p>When set to None (the default value), will split on any whitespace
character (including n r t f and spaces) and will discard
empty strings from the result.</p>
</dd>
<dt>maxsplit</dt><dd><p>Maximum number of splits.
-1 (the default value) means no limit.</p>
</dd>
</dl>
</div></blockquote>
<p>Splitting starts at the end of the string and works to the front.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.rstrip">
<span class="sig-name descname"><span class="pre">rstrip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.rstrip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with trailing whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.split">
<span class="sig-name descname"><span class="pre">split</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxsplit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.split" title="Link to this definition"></a></dt>
<dd><p>Return a list of the substrings in the string, using sep as the separator string.</p>
<blockquote>
<div><dl>
<dt>sep</dt><dd><p>The separator used to split the string.</p>
<p>When set to None (the default value), will split on any whitespace
character (including n r t f and spaces) and will discard
empty strings from the result.</p>
</dd>
<dt>maxsplit</dt><dd><p>Maximum number of splits.
-1 (the default value) means no limit.</p>
</dd>
</dl>
</div></blockquote>
<p>Splitting starts at the front of the string and works to the end.</p>
<p>Note, str.split() is mainly useful for data that has been intentionally
delimited.  With natural text that includes punctuation, consider using
the regular expression module.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.splitlines">
<span class="sig-name descname"><span class="pre">splitlines</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">keepends</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.splitlines" title="Link to this definition"></a></dt>
<dd><p>Return a list of the lines in the string, breaking at line boundaries.</p>
<p>Line breaks are not included in the resulting list unless keepends is given and
true.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.startswith">
<span class="sig-name descname"><span class="pre">startswith</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.startswith" title="Link to this definition"></a></dt>
<dd><p>Return True if the string starts with the specified prefix, False otherwise.</p>
<dl class="simple">
<dt>prefix</dt><dd><p>A string or a tuple of strings to try.</p>
</dd>
<dt>start</dt><dd><p>Optional start position. Default: start of the string.</p>
</dd>
<dt>end</dt><dd><p>Optional stop position. Default: end of the string.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.strip">
<span class="sig-name descname"><span class="pre">strip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.strip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with leading and trailing whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.swapcase">
<span class="sig-name descname"><span class="pre">swapcase</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.swapcase" title="Link to this definition"></a></dt>
<dd><p>Convert uppercase characters to lowercase and lowercase characters to uppercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.title">
<span class="sig-name descname"><span class="pre">title</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.title" title="Link to this definition"></a></dt>
<dd><p>Return a version of the string where each word is titlecased.</p>
<p>More specifically, words start with uppercased characters and all remaining
cased characters have lower case.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.translate">
<span class="sig-name descname"><span class="pre">translate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">table</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.translate" title="Link to this definition"></a></dt>
<dd><p>Replace each character in the string using the given translation table.</p>
<blockquote>
<div><dl class="simple">
<dt>table</dt><dd><p>Translation table, which must be a mapping of Unicode ordinals to
Unicode ordinals, strings, or None.</p>
</dd>
</dl>
</div></blockquote>
<p>The table must implement lookup/indexing via __getitem__, for instance a
dictionary or list.  If this operation raises LookupError, the character is
left untouched.  Characters mapped to None are deleted.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.upper">
<span class="sig-name descname"><span class="pre">upper</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.upper" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string converted to uppercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.zfill">
<span class="sig-name descname"><span class="pre">zfill</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.href_token.zfill" title="Link to this definition"></a></dt>
<dd><p>Pad a numeric string with zeros on the left, to fill a field of the given width.</p>
<p>The string is never truncated.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="lxml.html.diff.href_token.hide_when_equal">
<span class="sig-name descname"><span class="pre">hide_when_equal</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">True</span></em><a class="headerlink" href="#lxml.html.diff.href_token.hide_when_equal" title="Link to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">tag_token</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">html_repr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pre_tags</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">post_tags</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trailing_whitespace</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#lxml.html.diff.token" title="lxml.html.diff.token"><code class="xref py py-class docutils literal notranslate"><span class="pre">token</span></code></a></p>
<p>Represents a token that is actually a tag.  Currently this is just
the &lt;img&gt; tag, which takes up visible space just like a word but
is only represented in a document by a tag.</p>
<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.maketrans">
<em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">maketrans</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.maketrans" title="Link to this definition"></a></dt>
<dd><p>Return a translation table usable for str.translate().</p>
<p>If there is only one argument, it must be a dictionary mapping Unicode
ordinals (integers) or characters to Unicode ordinals, strings or None.
Character keys will be then converted to ordinals.
If there are two arguments, they must be strings of equal length, and
in the resulting dictionary, each character in x will be mapped to the
character at the same position in y. If there is a third argument, it
must be a string, whose characters will be mapped to None in the result.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.capitalize">
<span class="sig-name descname"><span class="pre">capitalize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.capitalize" title="Link to this definition"></a></dt>
<dd><p>Return a capitalized version of the string.</p>
<p>More specifically, make the first character have upper case and the rest lower
case.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.casefold">
<span class="sig-name descname"><span class="pre">casefold</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.casefold" title="Link to this definition"></a></dt>
<dd><p>Return a version of the string suitable for caseless comparisons.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.center">
<span class="sig-name descname"><span class="pre">center</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.center" title="Link to this definition"></a></dt>
<dd><p>Return a centered string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.count">
<span class="sig-name descname"><span class="pre">count</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.count" title="Link to this definition"></a></dt>
<dd><p>Return the number of non-overlapping occurrences of substring sub in string S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.encode">
<span class="sig-name descname"><span class="pre">encode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">encoding</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'utf-8'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'strict'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.encode" title="Link to this definition"></a></dt>
<dd><p>Encode the string using the codec registered for encoding.</p>
<dl class="simple">
<dt>encoding</dt><dd><p>The encoding in which to encode the string.</p>
</dd>
<dt>errors</dt><dd><p>The error handling scheme to use for encoding errors.
The default is ‘strict’ meaning that encoding errors raise a
UnicodeEncodeError.  Other possible values are ‘ignore’, ‘replace’ and
‘xmlcharrefreplace’ as well as any other name registered with
codecs.register_error that can handle UnicodeEncodeErrors.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.endswith">
<span class="sig-name descname"><span class="pre">endswith</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.endswith" title="Link to this definition"></a></dt>
<dd><p>Return True if the string ends with the specified suffix, False otherwise.</p>
<dl class="simple">
<dt>suffix</dt><dd><p>A string or a tuple of strings to try.</p>
</dd>
<dt>start</dt><dd><p>Optional start position. Default: start of the string.</p>
</dd>
<dt>end</dt><dd><p>Optional stop position. Default: end of the string.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.expandtabs">
<span class="sig-name descname"><span class="pre">expandtabs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tabsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">8</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.expandtabs" title="Link to this definition"></a></dt>
<dd><p>Return a copy where all tab characters are expanded using spaces.</p>
<p>If tabsize is not given, a tab size of 8 characters is assumed.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.find">
<span class="sig-name descname"><span class="pre">find</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.find" title="Link to this definition"></a></dt>
<dd><p>Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.format">
<span class="sig-name descname"><span class="pre">format</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.format" title="Link to this definition"></a></dt>
<dd><p>Return a formatted version of the string, using substitutions from args and kwargs.
The substitutions are identified by braces (‘{’ and ‘}’).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.format_map">
<span class="sig-name descname"><span class="pre">format_map</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mapping</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.format_map" title="Link to this definition"></a></dt>
<dd><p>Return a formatted version of the string, using substitutions from mapping.
The substitutions are identified by braces (‘{’ and ‘}’).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.html">
<span class="sig-name descname"><span class="pre">html</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.html" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.index">
<span class="sig-name descname"><span class="pre">index</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.index" title="Link to this definition"></a></dt>
<dd><p>Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isalnum">
<span class="sig-name descname"><span class="pre">isalnum</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isalnum" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an alpha-numeric string, False otherwise.</p>
<p>A string is alpha-numeric if all characters in the string are alpha-numeric and
there is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isalpha">
<span class="sig-name descname"><span class="pre">isalpha</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isalpha" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an alphabetic string, False otherwise.</p>
<p>A string is alphabetic if all characters in the string are alphabetic and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isascii">
<span class="sig-name descname"><span class="pre">isascii</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isascii" title="Link to this definition"></a></dt>
<dd><p>Return True if all characters in the string are ASCII, False otherwise.</p>
<p>ASCII characters have code points in the range U+0000-U+007F.
Empty string is ASCII too.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isdecimal">
<span class="sig-name descname"><span class="pre">isdecimal</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isdecimal" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a decimal string, False otherwise.</p>
<p>A string is a decimal string if all characters in the string are decimal and
there is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isdigit">
<span class="sig-name descname"><span class="pre">isdigit</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isdigit" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a digit string, False otherwise.</p>
<p>A string is a digit string if all characters in the string are digits and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isidentifier">
<span class="sig-name descname"><span class="pre">isidentifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isidentifier" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a valid Python identifier, False otherwise.</p>
<p>Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
such as “def” or “class”.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.islower">
<span class="sig-name descname"><span class="pre">islower</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.islower" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a lowercase string, False otherwise.</p>
<p>A string is lowercase if all cased characters in the string are lowercase and
there is at least one cased character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isnumeric">
<span class="sig-name descname"><span class="pre">isnumeric</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isnumeric" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a numeric string, False otherwise.</p>
<p>A string is numeric if all characters in the string are numeric and there is at
least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isprintable">
<span class="sig-name descname"><span class="pre">isprintable</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isprintable" title="Link to this definition"></a></dt>
<dd><p>Return True if all characters in the string are printable, False otherwise.</p>
<p>A character is printable if repr() may use it in its output.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isspace">
<span class="sig-name descname"><span class="pre">isspace</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isspace" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a whitespace string, False otherwise.</p>
<p>A string is whitespace if all characters in the string are whitespace and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.istitle">
<span class="sig-name descname"><span class="pre">istitle</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.istitle" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a title-cased string, False otherwise.</p>
<p>In a title-cased string, upper- and title-case characters may only
follow uncased characters and lowercase characters only cased ones.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.isupper">
<span class="sig-name descname"><span class="pre">isupper</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.isupper" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an uppercase string, False otherwise.</p>
<p>A string is uppercase if all cased characters in the string are uppercase and
there is at least one cased character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.join">
<span class="sig-name descname"><span class="pre">join</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">iterable</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.join" title="Link to this definition"></a></dt>
<dd><p>Concatenate any number of strings.</p>
<p>The string whose method is called is inserted in between each given string.
The result is returned as a new string.</p>
<p>Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -&gt; ‘ab.pq.rs’</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.ljust">
<span class="sig-name descname"><span class="pre">ljust</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.ljust" title="Link to this definition"></a></dt>
<dd><p>Return a left-justified string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.lower">
<span class="sig-name descname"><span class="pre">lower</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.lower" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string converted to lowercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.lstrip">
<span class="sig-name descname"><span class="pre">lstrip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.lstrip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with leading whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.partition">
<span class="sig-name descname"><span class="pre">partition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.partition" title="Link to this definition"></a></dt>
<dd><p>Partition the string into three parts using the given separator.</p>
<p>This will search for the separator in the string.  If the separator is found,
returns a 3-tuple containing the part before the separator, the separator
itself, and the part after it.</p>
<p>If the separator is not found, returns a 3-tuple containing the original string
and two empty strings.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.removeprefix">
<span class="sig-name descname"><span class="pre">removeprefix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prefix</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.removeprefix" title="Link to this definition"></a></dt>
<dd><p>Return a str with the given prefix string removed if present.</p>
<p>If the string starts with the prefix string, return string[len(prefix):].
Otherwise, return a copy of the original string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.removesuffix">
<span class="sig-name descname"><span class="pre">removesuffix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">suffix</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.removesuffix" title="Link to this definition"></a></dt>
<dd><p>Return a str with the given suffix string removed if present.</p>
<p>If the string ends with the suffix string and that suffix is not empty,
return string[:-len(suffix)]. Otherwise, return a copy of the original
string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.replace">
<span class="sig-name descname"><span class="pre">replace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">old</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">new</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.replace" title="Link to this definition"></a></dt>
<dd><p>Return a copy with all occurrences of substring old replaced by new.</p>
<blockquote>
<div><dl class="simple">
<dt>count</dt><dd><p>Maximum number of occurrences to replace.
-1 (the default value) means replace all occurrences.</p>
</dd>
</dl>
</div></blockquote>
<p>If the optional argument count is given, only the first count occurrences are
replaced.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.rfind">
<span class="sig-name descname"><span class="pre">rfind</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.rfind" title="Link to this definition"></a></dt>
<dd><p>Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.rindex">
<span class="sig-name descname"><span class="pre">rindex</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.rindex" title="Link to this definition"></a></dt>
<dd><p>Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.rjust">
<span class="sig-name descname"><span class="pre">rjust</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.rjust" title="Link to this definition"></a></dt>
<dd><p>Return a right-justified string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.rpartition">
<span class="sig-name descname"><span class="pre">rpartition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.rpartition" title="Link to this definition"></a></dt>
<dd><p>Partition the string into three parts using the given separator.</p>
<p>This will search for the separator in the string, starting at the end. If
the separator is found, returns a 3-tuple containing the part before the
separator, the separator itself, and the part after it.</p>
<p>If the separator is not found, returns a 3-tuple containing two empty strings
and the original string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.rsplit">
<span class="sig-name descname"><span class="pre">rsplit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxsplit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.rsplit" title="Link to this definition"></a></dt>
<dd><p>Return a list of the substrings in the string, using sep as the separator string.</p>
<blockquote>
<div><dl>
<dt>sep</dt><dd><p>The separator used to split the string.</p>
<p>When set to None (the default value), will split on any whitespace
character (including n r t f and spaces) and will discard
empty strings from the result.</p>
</dd>
<dt>maxsplit</dt><dd><p>Maximum number of splits.
-1 (the default value) means no limit.</p>
</dd>
</dl>
</div></blockquote>
<p>Splitting starts at the end of the string and works to the front.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.rstrip">
<span class="sig-name descname"><span class="pre">rstrip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.rstrip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with trailing whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.split">
<span class="sig-name descname"><span class="pre">split</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxsplit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.split" title="Link to this definition"></a></dt>
<dd><p>Return a list of the substrings in the string, using sep as the separator string.</p>
<blockquote>
<div><dl>
<dt>sep</dt><dd><p>The separator used to split the string.</p>
<p>When set to None (the default value), will split on any whitespace
character (including n r t f and spaces) and will discard
empty strings from the result.</p>
</dd>
<dt>maxsplit</dt><dd><p>Maximum number of splits.
-1 (the default value) means no limit.</p>
</dd>
</dl>
</div></blockquote>
<p>Splitting starts at the front of the string and works to the end.</p>
<p>Note, str.split() is mainly useful for data that has been intentionally
delimited.  With natural text that includes punctuation, consider using
the regular expression module.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.splitlines">
<span class="sig-name descname"><span class="pre">splitlines</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">keepends</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.splitlines" title="Link to this definition"></a></dt>
<dd><p>Return a list of the lines in the string, breaking at line boundaries.</p>
<p>Line breaks are not included in the resulting list unless keepends is given and
true.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.startswith">
<span class="sig-name descname"><span class="pre">startswith</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.startswith" title="Link to this definition"></a></dt>
<dd><p>Return True if the string starts with the specified prefix, False otherwise.</p>
<dl class="simple">
<dt>prefix</dt><dd><p>A string or a tuple of strings to try.</p>
</dd>
<dt>start</dt><dd><p>Optional start position. Default: start of the string.</p>
</dd>
<dt>end</dt><dd><p>Optional stop position. Default: end of the string.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.strip">
<span class="sig-name descname"><span class="pre">strip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.strip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with leading and trailing whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.swapcase">
<span class="sig-name descname"><span class="pre">swapcase</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.swapcase" title="Link to this definition"></a></dt>
<dd><p>Convert uppercase characters to lowercase and lowercase characters to uppercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.title">
<span class="sig-name descname"><span class="pre">title</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.title" title="Link to this definition"></a></dt>
<dd><p>Return a version of the string where each word is titlecased.</p>
<p>More specifically, words start with uppercased characters and all remaining
cased characters have lower case.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.translate">
<span class="sig-name descname"><span class="pre">translate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">table</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.translate" title="Link to this definition"></a></dt>
<dd><p>Replace each character in the string using the given translation table.</p>
<blockquote>
<div><dl class="simple">
<dt>table</dt><dd><p>Translation table, which must be a mapping of Unicode ordinals to
Unicode ordinals, strings, or None.</p>
</dd>
</dl>
</div></blockquote>
<p>The table must implement lookup/indexing via __getitem__, for instance a
dictionary or list.  If this operation raises LookupError, the character is
left untouched.  Characters mapped to None are deleted.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.upper">
<span class="sig-name descname"><span class="pre">upper</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.upper" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string converted to uppercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.zfill">
<span class="sig-name descname"><span class="pre">zfill</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tag_token.zfill" title="Link to this definition"></a></dt>
<dd><p>Pad a numeric string with zeros on the left, to fill a field of the given width.</p>
<p>The string is never truncated.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="lxml.html.diff.tag_token.hide_when_equal">
<span class="sig-name descname"><span class="pre">hide_when_equal</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">False</span></em><a class="headerlink" href="#lxml.html.diff.tag_token.hide_when_equal" title="Link to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="lxml.html.diff.token">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">token</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pre_tags</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">post_tags</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trailing_whitespace</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
<p>Represents a diffable token, generally a word that is displayed to
the user.  Opening tags are attached to this token when they are
adjacent (pre_tags) and closing tags that follow the word
(post_tags).  Some exceptions occur when there are empty tags
adjacent to a word, so there may be close tags in pre_tags, or
open tags in post_tags.</p>
<p>We also keep track of whether the word was originally followed by
whitespace, even though we do not want to treat the word as
equivalent to a similar word that does not have a trailing
space.</p>
<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.maketrans">
<em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">maketrans</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.maketrans" title="Link to this definition"></a></dt>
<dd><p>Return a translation table usable for str.translate().</p>
<p>If there is only one argument, it must be a dictionary mapping Unicode
ordinals (integers) or characters to Unicode ordinals, strings or None.
Character keys will be then converted to ordinals.
If there are two arguments, they must be strings of equal length, and
in the resulting dictionary, each character in x will be mapped to the
character at the same position in y. If there is a third argument, it
must be a string, whose characters will be mapped to None in the result.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.capitalize">
<span class="sig-name descname"><span class="pre">capitalize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.capitalize" title="Link to this definition"></a></dt>
<dd><p>Return a capitalized version of the string.</p>
<p>More specifically, make the first character have upper case and the rest lower
case.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.casefold">
<span class="sig-name descname"><span class="pre">casefold</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.casefold" title="Link to this definition"></a></dt>
<dd><p>Return a version of the string suitable for caseless comparisons.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.center">
<span class="sig-name descname"><span class="pre">center</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.center" title="Link to this definition"></a></dt>
<dd><p>Return a centered string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.count">
<span class="sig-name descname"><span class="pre">count</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.count" title="Link to this definition"></a></dt>
<dd><p>Return the number of non-overlapping occurrences of substring sub in string S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.encode">
<span class="sig-name descname"><span class="pre">encode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">encoding</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'utf-8'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">errors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'strict'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.encode" title="Link to this definition"></a></dt>
<dd><p>Encode the string using the codec registered for encoding.</p>
<dl class="simple">
<dt>encoding</dt><dd><p>The encoding in which to encode the string.</p>
</dd>
<dt>errors</dt><dd><p>The error handling scheme to use for encoding errors.
The default is ‘strict’ meaning that encoding errors raise a
UnicodeEncodeError.  Other possible values are ‘ignore’, ‘replace’ and
‘xmlcharrefreplace’ as well as any other name registered with
codecs.register_error that can handle UnicodeEncodeErrors.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.endswith">
<span class="sig-name descname"><span class="pre">endswith</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.endswith" title="Link to this definition"></a></dt>
<dd><p>Return True if the string ends with the specified suffix, False otherwise.</p>
<dl class="simple">
<dt>suffix</dt><dd><p>A string or a tuple of strings to try.</p>
</dd>
<dt>start</dt><dd><p>Optional start position. Default: start of the string.</p>
</dd>
<dt>end</dt><dd><p>Optional stop position. Default: end of the string.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.expandtabs">
<span class="sig-name descname"><span class="pre">expandtabs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tabsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">8</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.expandtabs" title="Link to this definition"></a></dt>
<dd><p>Return a copy where all tab characters are expanded using spaces.</p>
<p>If tabsize is not given, a tab size of 8 characters is assumed.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.find">
<span class="sig-name descname"><span class="pre">find</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.find" title="Link to this definition"></a></dt>
<dd><p>Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.format">
<span class="sig-name descname"><span class="pre">format</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.format" title="Link to this definition"></a></dt>
<dd><p>Return a formatted version of the string, using substitutions from args and kwargs.
The substitutions are identified by braces (‘{’ and ‘}’).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.format_map">
<span class="sig-name descname"><span class="pre">format_map</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mapping</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.format_map" title="Link to this definition"></a></dt>
<dd><p>Return a formatted version of the string, using substitutions from mapping.
The substitutions are identified by braces (‘{’ and ‘}’).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.html">
<span class="sig-name descname"><span class="pre">html</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.html" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.index">
<span class="sig-name descname"><span class="pre">index</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.index" title="Link to this definition"></a></dt>
<dd><p>Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isalnum">
<span class="sig-name descname"><span class="pre">isalnum</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isalnum" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an alpha-numeric string, False otherwise.</p>
<p>A string is alpha-numeric if all characters in the string are alpha-numeric and
there is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isalpha">
<span class="sig-name descname"><span class="pre">isalpha</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isalpha" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an alphabetic string, False otherwise.</p>
<p>A string is alphabetic if all characters in the string are alphabetic and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isascii">
<span class="sig-name descname"><span class="pre">isascii</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isascii" title="Link to this definition"></a></dt>
<dd><p>Return True if all characters in the string are ASCII, False otherwise.</p>
<p>ASCII characters have code points in the range U+0000-U+007F.
Empty string is ASCII too.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isdecimal">
<span class="sig-name descname"><span class="pre">isdecimal</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isdecimal" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a decimal string, False otherwise.</p>
<p>A string is a decimal string if all characters in the string are decimal and
there is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isdigit">
<span class="sig-name descname"><span class="pre">isdigit</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isdigit" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a digit string, False otherwise.</p>
<p>A string is a digit string if all characters in the string are digits and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isidentifier">
<span class="sig-name descname"><span class="pre">isidentifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isidentifier" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a valid Python identifier, False otherwise.</p>
<p>Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
such as “def” or “class”.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.islower">
<span class="sig-name descname"><span class="pre">islower</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.islower" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a lowercase string, False otherwise.</p>
<p>A string is lowercase if all cased characters in the string are lowercase and
there is at least one cased character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isnumeric">
<span class="sig-name descname"><span class="pre">isnumeric</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isnumeric" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a numeric string, False otherwise.</p>
<p>A string is numeric if all characters in the string are numeric and there is at
least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isprintable">
<span class="sig-name descname"><span class="pre">isprintable</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isprintable" title="Link to this definition"></a></dt>
<dd><p>Return True if all characters in the string are printable, False otherwise.</p>
<p>A character is printable if repr() may use it in its output.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isspace">
<span class="sig-name descname"><span class="pre">isspace</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isspace" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a whitespace string, False otherwise.</p>
<p>A string is whitespace if all characters in the string are whitespace and there
is at least one character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.istitle">
<span class="sig-name descname"><span class="pre">istitle</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.istitle" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is a title-cased string, False otherwise.</p>
<p>In a title-cased string, upper- and title-case characters may only
follow uncased characters and lowercase characters only cased ones.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.isupper">
<span class="sig-name descname"><span class="pre">isupper</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.isupper" title="Link to this definition"></a></dt>
<dd><p>Return True if the string is an uppercase string, False otherwise.</p>
<p>A string is uppercase if all cased characters in the string are uppercase and
there is at least one cased character in the string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.join">
<span class="sig-name descname"><span class="pre">join</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">iterable</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.join" title="Link to this definition"></a></dt>
<dd><p>Concatenate any number of strings.</p>
<p>The string whose method is called is inserted in between each given string.
The result is returned as a new string.</p>
<p>Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -&gt; ‘ab.pq.rs’</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.ljust">
<span class="sig-name descname"><span class="pre">ljust</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.ljust" title="Link to this definition"></a></dt>
<dd><p>Return a left-justified string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.lower">
<span class="sig-name descname"><span class="pre">lower</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.lower" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string converted to lowercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.lstrip">
<span class="sig-name descname"><span class="pre">lstrip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.lstrip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with leading whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.partition">
<span class="sig-name descname"><span class="pre">partition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.partition" title="Link to this definition"></a></dt>
<dd><p>Partition the string into three parts using the given separator.</p>
<p>This will search for the separator in the string.  If the separator is found,
returns a 3-tuple containing the part before the separator, the separator
itself, and the part after it.</p>
<p>If the separator is not found, returns a 3-tuple containing the original string
and two empty strings.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.removeprefix">
<span class="sig-name descname"><span class="pre">removeprefix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prefix</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.removeprefix" title="Link to this definition"></a></dt>
<dd><p>Return a str with the given prefix string removed if present.</p>
<p>If the string starts with the prefix string, return string[len(prefix):].
Otherwise, return a copy of the original string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.removesuffix">
<span class="sig-name descname"><span class="pre">removesuffix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">suffix</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.removesuffix" title="Link to this definition"></a></dt>
<dd><p>Return a str with the given suffix string removed if present.</p>
<p>If the string ends with the suffix string and that suffix is not empty,
return string[:-len(suffix)]. Otherwise, return a copy of the original
string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.replace">
<span class="sig-name descname"><span class="pre">replace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">old</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">new</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.replace" title="Link to this definition"></a></dt>
<dd><p>Return a copy with all occurrences of substring old replaced by new.</p>
<blockquote>
<div><dl class="simple">
<dt>count</dt><dd><p>Maximum number of occurrences to replace.
-1 (the default value) means replace all occurrences.</p>
</dd>
</dl>
</div></blockquote>
<p>If the optional argument count is given, only the first count occurrences are
replaced.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.rfind">
<span class="sig-name descname"><span class="pre">rfind</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.rfind" title="Link to this definition"></a></dt>
<dd><p>Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.rindex">
<span class="sig-name descname"><span class="pre">rindex</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.rindex" title="Link to this definition"></a></dt>
<dd><p>Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].</p>
<p>Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.rjust">
<span class="sig-name descname"><span class="pre">rjust</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fillchar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'</span> <span class="pre">'</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.rjust" title="Link to this definition"></a></dt>
<dd><p>Return a right-justified string of length width.</p>
<p>Padding is done using the specified fill character (default is a space).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.rpartition">
<span class="sig-name descname"><span class="pre">rpartition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.rpartition" title="Link to this definition"></a></dt>
<dd><p>Partition the string into three parts using the given separator.</p>
<p>This will search for the separator in the string, starting at the end. If
the separator is found, returns a 3-tuple containing the part before the
separator, the separator itself, and the part after it.</p>
<p>If the separator is not found, returns a 3-tuple containing two empty strings
and the original string.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.rsplit">
<span class="sig-name descname"><span class="pre">rsplit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxsplit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.rsplit" title="Link to this definition"></a></dt>
<dd><p>Return a list of the substrings in the string, using sep as the separator string.</p>
<blockquote>
<div><dl>
<dt>sep</dt><dd><p>The separator used to split the string.</p>
<p>When set to None (the default value), will split on any whitespace
character (including n r t f and spaces) and will discard
empty strings from the result.</p>
</dd>
<dt>maxsplit</dt><dd><p>Maximum number of splits.
-1 (the default value) means no limit.</p>
</dd>
</dl>
</div></blockquote>
<p>Splitting starts at the end of the string and works to the front.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.rstrip">
<span class="sig-name descname"><span class="pre">rstrip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.rstrip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with trailing whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.split">
<span class="sig-name descname"><span class="pre">split</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxsplit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.split" title="Link to this definition"></a></dt>
<dd><p>Return a list of the substrings in the string, using sep as the separator string.</p>
<blockquote>
<div><dl>
<dt>sep</dt><dd><p>The separator used to split the string.</p>
<p>When set to None (the default value), will split on any whitespace
character (including n r t f and spaces) and will discard
empty strings from the result.</p>
</dd>
<dt>maxsplit</dt><dd><p>Maximum number of splits.
-1 (the default value) means no limit.</p>
</dd>
</dl>
</div></blockquote>
<p>Splitting starts at the front of the string and works to the end.</p>
<p>Note, str.split() is mainly useful for data that has been intentionally
delimited.  With natural text that includes punctuation, consider using
the regular expression module.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.splitlines">
<span class="sig-name descname"><span class="pre">splitlines</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">keepends</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.splitlines" title="Link to this definition"></a></dt>
<dd><p>Return a list of the lines in the string, breaking at line boundaries.</p>
<p>Line breaks are not included in the resulting list unless keepends is given and
true.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.startswith">
<span class="sig-name descname"><span class="pre">startswith</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.startswith" title="Link to this definition"></a></dt>
<dd><p>Return True if the string starts with the specified prefix, False otherwise.</p>
<dl class="simple">
<dt>prefix</dt><dd><p>A string or a tuple of strings to try.</p>
</dd>
<dt>start</dt><dd><p>Optional start position. Default: start of the string.</p>
</dd>
<dt>end</dt><dd><p>Optional stop position. Default: end of the string.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.strip">
<span class="sig-name descname"><span class="pre">strip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chars</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.strip" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string with leading and trailing whitespace removed.</p>
<p>If chars is given and not None, remove characters in chars instead.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.swapcase">
<span class="sig-name descname"><span class="pre">swapcase</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.swapcase" title="Link to this definition"></a></dt>
<dd><p>Convert uppercase characters to lowercase and lowercase characters to uppercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.title">
<span class="sig-name descname"><span class="pre">title</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.title" title="Link to this definition"></a></dt>
<dd><p>Return a version of the string where each word is titlecased.</p>
<p>More specifically, words start with uppercased characters and all remaining
cased characters have lower case.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.translate">
<span class="sig-name descname"><span class="pre">translate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">table</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.translate" title="Link to this definition"></a></dt>
<dd><p>Replace each character in the string using the given translation table.</p>
<blockquote>
<div><dl class="simple">
<dt>table</dt><dd><p>Translation table, which must be a mapping of Unicode ordinals to
Unicode ordinals, strings, or None.</p>
</dd>
</dl>
</div></blockquote>
<p>The table must implement lookup/indexing via __getitem__, for instance a
dictionary or list.  If this operation raises LookupError, the character is
left untouched.  Characters mapped to None are deleted.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.upper">
<span class="sig-name descname"><span class="pre">upper</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.upper" title="Link to this definition"></a></dt>
<dd><p>Return a copy of the string converted to uppercase.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="lxml.html.diff.token.zfill">
<span class="sig-name descname"><span class="pre">zfill</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">width</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.token.zfill" title="Link to this definition"></a></dt>
<dd><p>Pad a numeric string with zeros on the left, to fill a field of the given width.</p>
<p>The string is never truncated.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="lxml.html.diff.token.hide_when_equal">
<span class="sig-name descname"><span class="pre">hide_when_equal</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">False</span></em><a class="headerlink" href="#lxml.html.diff.token.hide_when_equal" title="Link to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.__pyx_unpickle_InsensitiveSequenceMatcher">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">__pyx_unpickle_InsensitiveSequenceMatcher</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">__pyx_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">__pyx_checksum</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">__pyx_state</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.__pyx_unpickle_InsensitiveSequenceMatcher" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff._find_words">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">_find_words</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">endpos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">9223372036854775807</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff._find_words" title="Link to this definition"></a></dt>
<dd><p>Return a list of all non-overlapping matches of pattern in string.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff._has_start_whitespace">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">_has_start_whitespace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">endpos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">9223372036854775807</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff._has_start_whitespace" title="Link to this definition"></a></dt>
<dd><p>Matches zero or more characters at the beginning of the string.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff._merge_element_contents">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">_merge_element_contents</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">el</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff._merge_element_contents" title="Link to this definition"></a></dt>
<dd><p>Removes an element, but merges its contents into its place, e.g.,
given &lt;p&gt;Hi &lt;i&gt;there!&lt;/i&gt;&lt;/p&gt;, if you remove the &lt;i&gt; element you get
&lt;p&gt;Hi there!&lt;/p&gt;</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff._replace_ins_del">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">_replace_ins_del</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">repl</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">string</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff._replace_ins_del" title="Link to this definition"></a></dt>
<dd><p>Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff._search_body">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">_search_body</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">endpos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">9223372036854775807</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff._search_body" title="Link to this definition"></a></dt>
<dd><p>Scan through string looking for a match, and return a corresponding match object instance.</p>
<p>Return None if no position in the string matches.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff._search_end_body">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">_search_end_body</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">endpos</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">9223372036854775807</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff._search_end_body" title="Link to this definition"></a></dt>
<dd><p>Scan through string looking for a match, and return a corresponding match object instance.</p>
<p>Return None if no position in the string matches.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.cleanup_delete">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">cleanup_delete</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chunks</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.cleanup_delete" title="Link to this definition"></a></dt>
<dd><p>Cleans up any DEL_START/DEL_END markers in the document, replacing
them with &lt;del&gt;&lt;/del&gt;.  To do this while keeping the document
valid, it may need to drop some tags (either start or end tags).</p>
<p>It may also move the del into adjacent tags to try to move it to a
similar location where it was originally located (e.g., moving a
delete into preceding &lt;div&gt; tag, if the del looks like (DEL_START,
‘Text&lt;/div&gt;’, DEL_END)</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.cleanup_html">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">cleanup_html</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">html</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.cleanup_html" title="Link to this definition"></a></dt>
<dd><p>This ‘cleans’ the HTML, meaning that any page structure is removed
(only the contents of &lt;body&gt; are used, if there is any &lt;body).
Also &lt;ins&gt; and &lt;del&gt; tags are removed.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.compress_tokens">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">compress_tokens</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.compress_tokens" title="Link to this definition"></a></dt>
<dd><p>Combine adjacent tokens when there is no HTML between the tokens,
and they share an annotation</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.copy_annotations">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">copy_annotations</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.copy_annotations" title="Link to this definition"></a></dt>
<dd><p>Copy annotations from the tokens listed in src to the tokens in dest</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.default_markup">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">default_markup</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">version</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.default_markup" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.end_tag">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">end_tag</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">el</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.end_tag" title="Link to this definition"></a></dt>
<dd><p>The text representation of an end tag for a tag.  Includes
trailing whitespace when appropriate.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.expand_tokens">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">expand_tokens</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">equal</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.expand_tokens" title="Link to this definition"></a></dt>
<dd><p>Given a list of tokens, return a generator of the chunks of
text for the data in the tokens.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.fixup_chunks">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">fixup_chunks</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chunks</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.fixup_chunks" title="Link to this definition"></a></dt>
<dd><p>This function takes a list of chunks and produces a list of tokens.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.fixup_ins_del_tags">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">fixup_ins_del_tags</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">html</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.fixup_ins_del_tags" title="Link to this definition"></a></dt>
<dd><p>Given an html string, move any &lt;ins&gt; or &lt;del&gt; tags inside of any
block-level elements, e.g. transform &lt;ins&gt;&lt;p&gt;word&lt;/p&gt;&lt;/ins&gt; to
&lt;p&gt;&lt;ins&gt;word&lt;/ins&gt;&lt;/p&gt;</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.flatten_el">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">flatten_el</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">el</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_hrefs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skip_tag</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.flatten_el" title="Link to this definition"></a></dt>
<dd><p>Takes an lxml element el, and generates all the text chunks for
that tag.  Each start tag is a chunk, each word is a chunk, and each
end tag is a chunk.</p>
<p>If skip_tag is true, then the outermost container tag is
not returned (just its contents).</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.html_annotate">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">html_annotate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">doclist</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">markup=&lt;cyfunction</span> <span class="pre">default_markup&gt;</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.html_annotate" title="Link to this definition"></a></dt>
<dd><p>doclist should be ordered from oldest to newest, like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">version1</span> <span class="o">=</span> <span class="s1">&#39;Hello World&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">version2</span> <span class="o">=</span> <span class="s1">&#39;Goodbye World&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">html_annotate</span><span class="p">([(</span><span class="n">version1</span><span class="p">,</span> <span class="s1">&#39;version 1&#39;</span><span class="p">),</span>
<span class="gp">... </span>                     <span class="p">(</span><span class="n">version2</span><span class="p">,</span> <span class="s1">&#39;version 2&#39;</span><span class="p">)]))</span>
<span class="go">&lt;span title=&quot;version 2&quot;&gt;Goodbye&lt;/span&gt; &lt;span title=&quot;version 1&quot;&gt;World&lt;/span&gt;</span>
</pre></div>
</div>
<p>The documents must be <em>fragments</em> (str/UTF8 or unicode), not
complete documents</p>
<p>The markup argument is a function to markup the spans of words.
This function is called like markup(‘Hello’, ‘version 2’), and
returns HTML.  The first argument is text and never includes any
markup.  The default uses a span with a title:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">default_markup</span><span class="p">(</span><span class="s1">&#39;Some Text&#39;</span><span class="p">,</span> <span class="s1">&#39;by Joe&#39;</span><span class="p">))</span>
<span class="go">&lt;span title=&quot;by Joe&quot;&gt;Some Text&lt;/span&gt;</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.html_annotate_merge_annotations">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">html_annotate_merge_annotations</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens_old</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tokens_new</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.html_annotate_merge_annotations" title="Link to this definition"></a></dt>
<dd><p>Merge the annotations from tokens_old into tokens_new, when the
tokens in the new document already existed in the old document.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.htmldiff">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">htmldiff</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">old_html</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">new_html</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.htmldiff" title="Link to this definition"></a></dt>
<dd><p>Do a diff of the old and new document.  The documents are HTML
<em>fragments</em> (str/UTF8 or unicode), they are not complete documents
(i.e., no &lt;html&gt; tag).</p>
<p>Returns HTML with &lt;ins&gt; and &lt;del&gt; tags added around the
appropriate text.</p>
<p>Markup is generally ignored, with the markup from new_html
preserved, and possibly some markup from old_html (though it is
considered acceptable to lose some of the old markup).  Only the
words in the HTML are diffed.  The exception is &lt;img&gt; tags, which
are treated like words, and the href attribute of &lt;a&gt; tags, which
are noted inside the tag itself when there are changes.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.htmldiff_tokens">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">htmldiff_tokens</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">html1_tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">html2_tokens</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.htmldiff_tokens" title="Link to this definition"></a></dt>
<dd><p>Does a diff on the tokens themselves, returning a list of text
chunks (not tokens).</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.is_end_tag">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">is_end_tag</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tok</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.is_end_tag" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.is_start_tag">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">is_start_tag</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tok</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.is_start_tag" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.is_word">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">is_word</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tok</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.is_word" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.markup_serialize_tokens">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">markup_serialize_tokens</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">markup_func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.markup_serialize_tokens" title="Link to this definition"></a></dt>
<dd><p>Serialize the list of tokens into a list of text chunks, calling
markup_func around text to add annotations.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.merge_delete">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">merge_delete</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">del_chunks</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.merge_delete" title="Link to this definition"></a></dt>
<dd><p>Adds the text chunks in del_chunks to the document doc (another
list of text chunks) with marker to show it is a delete.
cleanup_delete later resolves these markers into &lt;del&gt; tags.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.merge_insert">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">merge_insert</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ins_chunks</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.merge_insert" title="Link to this definition"></a></dt>
<dd><p>doc is the already-handled document (as a list of text chunks);
here we add &lt;ins&gt;ins_chunks&lt;/ins&gt; to the end of that.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.parse_html">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">parse_html</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">html</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cleanup</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.parse_html" title="Link to this definition"></a></dt>
<dd><p>Parses an HTML fragment, returning an lxml element.  Note that the HTML will be
wrapped in a &lt;div&gt; tag that was not in the original document.</p>
<p>If cleanup is true, make sure there’s no &lt;head&gt; or &lt;body&gt;, and get
rid of any &lt;ins&gt; and &lt;del&gt; tags.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.serialize_html_fragment">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">serialize_html_fragment</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">el</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skip_outer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.serialize_html_fragment" title="Link to this definition"></a></dt>
<dd><p>Serialize a single lxml element as HTML.  The serialized form
includes the elements tail.</p>
<p>If skip_outer is true, then don’t serialize the outermost tag</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.split_trailing_whitespace">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">split_trailing_whitespace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">word</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.split_trailing_whitespace" title="Link to this definition"></a></dt>
<dd><blockquote>
<div><p>This function takes a word, such as ‘test</p>
</div></blockquote>
<p>‘ and returns (‘test’,’</p>
<p>‘)</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.split_words">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">split_words</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.split_words" title="Link to this definition"></a></dt>
<dd><p>Splits some text into words. Includes trailing whitespace
on each word when appropriate.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.start_tag">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">start_tag</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">el</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.start_tag" title="Link to this definition"></a></dt>
<dd><p>The text representation of the start tag for a tag.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.tokenize">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">tokenize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">html</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_hrefs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tokenize" title="Link to this definition"></a></dt>
<dd><p>Parse the given HTML and returns token objects (words with attached tags).</p>
<p>This parses only the content of a page; anything in the head is
ignored, and the &lt;head&gt; and &lt;body&gt; elements are themselves
optional.  The content is then parsed by lxml, which ensures the
validity of the resulting parsed document (though lxml may make
incorrect guesses when the markup is particular bad).</p>
<p>&lt;ins&gt; and &lt;del&gt; tags are also eliminated from the document, as
that gets confusing.</p>
<p>If include_hrefs is true, then the href attribute of &lt;a&gt; tags is
included as a special kind of diffable token.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="lxml.html.diff.tokenize_annotated">
<span class="sig-prename descclassname"><span class="pre">lxml.html.diff.</span></span><span class="sig-name descname"><span class="pre">tokenize_annotated</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">doc</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">annotation</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#lxml.html.diff.tokenize_annotated" title="Link to this definition"></a></dt>
<dd><p>Tokenize a document and add an annotation attribute to each token</p>
</dd></dl>

</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="lxml.html.defs.html" class="btn btn-neutral float-left" title="lxml.html.defs module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="lxml.html.formfill.html" class="btn btn-neutral float-right" title="lxml.html.formfill module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2020, lxml dev team.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>