[frames] | no frames]

# Class InsensitiveSequenceMatcher

source code

difflib.SequenceMatcher --+
|
InsensitiveSequenceMatcher

Acts like SequenceMatcher, but tries not to find very small equal blocks amidst large spans of changes
 Instance Methods

 get_matching_blocks(self) Return list of triples describing matching subsequences. source code

Inherited from difflib.SequenceMatcher: __init__, find_longest_match, get_grouped_opcodes, get_opcodes, quick_ratio, ratio, real_quick_ratio, set_seq1, set_seq2, set_seqs

 Class Variables
threshold = 2
 Method Details

### get_matching_blocks(self)

source code

Return list of triples describing matching subsequences.

Each triple is of the form (i, j, n), and means that a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in i and in j. New in Python 2.5, it's also guaranteed that if (i, j, n) and (i', j', n') are adjacent triples in the list, and the second is not the last triple in the list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe adjacent equal blocks.

The last triple is a dummy, (len(a), len(b), 0), and is the only triple with n==0.

>>> s = SequenceMatcher(None, "abxcd", "abcd")
>>> s.get_matching_blocks()
[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]
Overrides: difflib.SequenceMatcher.get_matching_blocks
(inherited documentation)

 Generated by Epydoc 3.0.1 on Sun Oct 14 18:04:13 2012 http://epydoc.sourceforge.net