Lines Matching +full:supports +full:- +full:hyperlinks
1 :mod:`difflib` --- Helpers for computing deltas
34 **Timing:** The basic Ratcliff-Obershelp algorithm is cubic time in the worst
36 quadratic time for the worst case and has expected-case behavior dependent in a
40 **Automatic junk heuristic:** :class:`SequenceMatcher` supports a heuristic that
54 human-readable differences or deltas. Differ uses :class:`SequenceMatcher`
56 within similar (near-matching) lines.
58 Each line of a :class:`Differ` delta begins with a two-letter code:
60 +----------+-------------------------------------------+
63 | ``'- '`` | line unique to sequence 1 |
64 +----------+-------------------------------------------+
66 +----------+-------------------------------------------+
68 +----------+-------------------------------------------+
70 +----------+-------------------------------------------+
81 with inter-line and intra-line change highlights. The table can be generated in
108 inter-line and intra-line changes highlighted.
119 "next" hyperlinks (setting to zero would cause the "next" hyperlinks to place
127 is a complete HTML table showing line by line differences with inter-line and
128 intra-line changes highlighted.
133 :file:`Tools/scripts/diff.py` is a command-line front-end to this class and
148 By default, the diff control lines (those with ``***`` or ``---``) are created
168 --- after.py
175 --- 1,4 ----
181 See :ref:`difflib-interface` for a more detailed example.
214 Compare *a* and *b* (lists of strings); return a :class:`Differ`\ -style
222 Python 2.3. Before then, the default was the module-level function
226 frequent as to constitute noise, and this usually works better than the pre-2.3
230 returns if the character is junk, or false if not. The default is module-level
234 :file:`Tools/scripts/ndiff.py` is a command-line front-end to this function.
239 - one
243 - two
244 - three
245 ? -
283 By default, the diff control lines (those with ``---``, ``+++``, or ``@@``) are
302 --- before.py
304 @@ -1,4 +1,4 @@
305 -bacon
306 -eggs
307 -ham
313 See :ref:`difflib-interface` for a more detailed example.
334 …ng: The Gestalt Approach <http://www.drdobbs.com/database/pattern-matching-the-gestalt-approach/18…
339 .. _sequence-matcher:
342 -----------------------
349 Optional argument *isjunk* must be ``None`` (the default) or a one-argument
442 triples always describe non-adjacent equal blocks.
447 The guarantee that adjacent triples always describe non-adjacent blocks
459 Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is
466 +---------------+---------------------------------------------+
471 +---------------+---------------------------------------------+
474 +---------------+---------------------------------------------+
478 +---------------+---------------------------------------------+
479 | ``'equal'`` | ``a[i1:i2] == b[j1:j2]`` (the sub-sequences |
481 +---------------+---------------------------------------------+
550 .. _sequencematcher-examples:
553 ------------------------
601 .. _differ-objects:
604 --------------
606 Note that :class:`Differ`\ -generated deltas make no claim to be **minimal**
607 diffs. To the contrary, minimal diffs are often counter-intuitive, because they
635 Each sequence must contain individual single-line strings ending with
637 :meth:`~file.readlines` method of file-like objects. The delta
638 generated also consists of newline-terminated strings, ready to be
639 printed as-is via the :meth:`~file.writelines` method of a
640 file-like object.
643 .. _differ-examples:
646 --------------
649 individual single-line strings ending with newlines (such sequences can also be
650 obtained from the :meth:`~file.readlines` method of file-like objects):
659 >>> text1[0][-1]
679 ``result`` is a list of strings, so let's pretty-print it:
684 '- 2. Explicit is better than implicit.\n',
685 '- 3. Simple is better than complex.\n',
688 '- 4. Complex is better than complicated.\n',
689 '? ^ ---- ^\n',
694 As a single multi-line string it looks like this:
699 - 2. Explicit is better than implicit.
700 - 3. Simple is better than complex.
703 - 4. Complex is better than complicated.
704 ? ^ ---- ^
710 .. _difflib-interface:
712 A command-line interface to difflib
713 -----------------------------------
715 This example shows how to use difflib to create a ``diff``-like utility.
736 parser.add_option("-c", action="store_true", default=False,
738 parser.add_option("-u", action="store_true", default=False,
740 hlp = 'Produce HTML side by side diff (can use -c and -l in conjunction)'
741 parser.add_option("-m", action="store_true", default=False, help=hlp)
742 parser.add_option("-n", action="store_true", default=False,
744 parser.add_option("-l", "--lines", type="int", default=3,