MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __init__

Method __init__

tools/python-3.11.9-amd64/Lib/difflib.py:120–182  ·  view source on GitHub ↗

Construct a SequenceMatcher. Optional arg isjunk is None (the default), or a one-argument function that takes a sequence element and returns true iff the element is junk. None is equivalent to passing "lambda x: 0", i.e. no elements are considered to be junk.

(self, isjunk=None, a='', b='', autojunk=True)

Source from the content-addressed store, hash-verified

118 """
119
120 def __init__(self, isjunk=None, a='', b='', autojunk=True):
121 """Construct a SequenceMatcher.
122
123 Optional arg isjunk is None (the default), or a one-argument
124 function that takes a sequence element and returns true iff the
125 element is junk. None is equivalent to passing "lambda x: 0", i.e.
126 no elements are considered to be junk. For example, pass
127 lambda x: x in " \\t"
128 if you're comparing lines as sequences of characters, and don't
129 want to synch up on blanks or hard tabs.
130
131 Optional arg a is the first of two sequences to be compared. By
132 default, an empty string. The elements of a must be hashable. See
133 also .set_seqs() and .set_seq1().
134
135 Optional arg b is the second of two sequences to be compared. By
136 default, an empty string. The elements of b must be hashable. See
137 also .set_seqs() and .set_seq2().
138
139 Optional arg autojunk should be set to False to disable the
140 "automatic junk heuristic" that treats popular elements as junk
141 (see module documentation for more information).
142 """
143
144 # Members:
145 # a
146 # first sequence
147 # b
148 # second sequence; differences are computed as "what do
149 # we need to do to 'a' to change it into 'b'?"
150 # b2j
151 # for x in b, b2j[x] is a list of the indices (into b)
152 # at which x appears; junk and popular elements do not appear
153 # fullbcount
154 # for x in b, fullbcount[x] == the number of times x
155 # appears in b; only materialized if really needed (used
156 # only for computing quick_ratio())
157 # matching_blocks
158 # a list of (i, j, k) triples, where a[i:i+k] == b[j:j+k];
159 # ascending & non-overlapping in i and in j; terminated by
160 # a dummy (len(a), len(b), 0) sentinel
161 # opcodes
162 # a list of (tag, i1, i2, j1, j2) tuples, where tag is
163 # one of
164 # 'replace' a[i1:i2] should be replaced by b[j1:j2]
165 # 'delete' a[i1:i2] should be deleted
166 # 'insert' b[j1:j2] should be inserted
167 # 'equal' a[i1:i2] == b[j1:j2]
168 # isjunk
169 # a user-supplied function taking a sequence element and
170 # returning true iff the element is "junk" -- this has
171 # subtle but helpful effects on the algorithm, which I'll
172 # get around to writing up someday <0.9 wink>.
173 # DON'T USE! Only __chain_b uses this. Use "in self.bjunk".
174 # bjunk
175 # the items in b for which isjunk is True.
176 # bpopular
177 # nonjunk items in b treated as junk by the heuristic (if used).

Callers

nothing calls this directly

Calls 1

set_seqsMethod · 0.95

Tested by

no test coverage detected