Skip to main content

Module difflib

Module difflib 

Source
Expand description

The part of Python’s difflib (CPython 3.13) that fontTools.diff uses: SequenceMatcher without a junk function, with its “popular elements” heuristic (autojunk), and unified_diff.

Structs§

Match
A matching block: a[a..a + size] == b[b..b + size] (Match).
SequenceMatcher
SequenceMatcher(None, a, b, autojunk): finds the longest matching blocks of two sequences, recursively.

Enums§

Tag
An operation turning a range of a into a range of b (get_opcodes).

Functions§

unified_diff
unified_diff(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm): the lines of the unified diff of two sequences of lines, with n lines of context.

Type Aliases§

Opcode
An opcode: the tag and the ranges (i1, i2, j1, j2). The ranges are signed: with a negative number of context lines, get_grouped_opcodes makes ranges that Python slices as it does negative indices.