Method: difflib.Differ.__init__
Calls: 26, Exceptions: 0, Paths: 1Back
Path 1: 26 calls (1.0)
None (26)
IS_CHARACTER_JUNK def (20) None (6)
1def __init__(self, linejunk=None, charjunk=None):
2 """
3 Construct a text differencer, with optional filters.
4
5 The two optional keyword parameters are for filter functions:
6
7 - `linejunk`: A function that should accept a single string argument,
8 and return true iff the string is junk. The module-level function
9 `IS_LINE_JUNK` may be used to filter out lines without visible
10 characters, except for at most one splat ('#'). It is recommended
11 to leave linejunk None; the underlying SequenceMatcher class has
12 an adaptive notion of "noise" lines that's better than any static
13 definition the author has ever been able to craft.
14
15 - `charjunk`: A function that should accept a string of length 1. The
16 module-level function `IS_CHARACTER_JUNK` may be used to filter out
17 whitespace characters (a blank or tab; **note**: bad idea to include
18 newline in this!). Use of IS_CHARACTER_JUNK is recommended.
19 """
20
21 self.linejunk = linejunk
22 self.charjunk = charjunk