MCPcopy Index your code
hub / github.com/python/cpython / set_seq2

Method set_seq2

Lib/difflib.py:223–249  ·  view source on GitHub ↗

Set the second sequence to be compared. The first sequence to be compared is not changed. >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s.ratio() 0.75 >>> s.set_seq2("abcd") >>> s.ratio() 1.0 >>> SequenceMatcher computes

(self, b)

Source from the content-addressed store, hash-verified

221 self.matching_blocks = self.opcodes = None
222
223 def set_seq2(self, b):
224 """Set the second sequence to be compared.
225
226 The first sequence to be compared is not changed.
227
228 >>> s = SequenceMatcher(None, "abcd", "bcde")
229 >>> s.ratio()
230 0.75
231 >>> s.set_seq2("abcd")
232 >>> s.ratio()
233 1.0
234 >>>
235
236 SequenceMatcher computes and caches detailed information about the
237 second sequence, so if you want to compare one sequence S against
238 many sequences, use .set_seq2(S) once and call .set_seq1(x)
239 repeatedly for each of the other sequences.
240
241 See also set_seqs() and set_seq1().
242 """
243
244 if b is self.b:
245 return
246 self.b = b
247 self.matching_blocks = self.opcodes = None
248 self.fullbcount = None
249 self.__chain_b()
250
251 # For each element x in b, set b2j[x] to a list of the indices in
252 # b where x appears; the indices are in increasing order; note that

Callers 3

set_seqsMethod · 0.95
get_close_matchesFunction · 0.95
_fancy_replaceMethod · 0.95

Calls 1

__chain_bMethod · 0.95

Tested by

no test coverage detected