/opt/alt/python33/lib64/python3.3/__pycache__
NameSizeModeActions
abc.cpython-33.pyc96150644editdlrm
abc.cpython-33.pyo95490644editdlrm
aifc.cpython-33.pyc361160644editdlrm
aifc.cpython-33.pyo361160644editdlrm
antigravity.cpython-33.pyc10690644editdlrm
antigravity.cpython-33.pyo10690644editdlrm
argparse.cpython-33.pyc940130644editdlrm
argparse.cpython-33.pyo938200644editdlrm
ast.cpython-33.pyc153870644editdlrm
ast.cpython-33.pyo153870644editdlrm
asynchat.cpython-33.pyc113410644editdlrm
asynchat.cpython-33.pyo113410644editdlrm
asyncore.cpython-33.pyc254730644editdlrm
asyncore.cpython-33.pyo254730644editdlrm
base64.cpython-33.pyc154590644editdlrm
base64.cpython-33.pyo151980644editdlrm
bdb.cpython-33.pyc260120644editdlrm
bdb.cpython-33.pyo260120644editdlrm
binhex.cpython-33.pyc191020644editdlrm
binhex.cpython-33.pyo191020644editdlrm
bisect.cpython-33.pyc33680644editdlrm
bisect.cpython-33.pyo33680644editdlrm
bz2.cpython-33.pyc192120644editdlrm
bz2.cpython-33.pyo192120644editdlrm
calendar.cpython-33.pyc387950644editdlrm
calendar.cpython-33.pyo387950644editdlrm
cgi.cpython-33.pyc369260644editdlrm
cgi.cpython-33.pyo369260644editdlrm
cgitb.cpython-33.pyc137890644editdlrm
cgitb.cpython-33.pyo137890644editdlrm
chunk.cpython-33.pyc64220644editdlrm
chunk.cpython-33.pyo64220644editdlrm
cmd.cpython-33.pyc160740644editdlrm
cmd.cpython-33.pyo160740644editdlrm
code.cpython-33.pyc117330644editdlrm
code.cpython-33.pyo117330644editdlrm
codecs.cpython-33.pyc464380644editdlrm
codecs.cpython-33.pyo464380644editdlrm
codeop.cpython-33.pyc76810644editdlrm
codeop.cpython-33.pyo76810644editdlrm
colorsys.cpython-33.pyc43710644editdlrm
colorsys.cpython-33.pyo43710644editdlrm
compileall.cpython-33.pyc87870644editdlrm
compileall.cpython-33.pyo87870644editdlrm
configparser.cpython-33.pyc608840644editdlrm
configparser.cpython-33.pyo608840644editdlrm
contextlib.cpython-33.pyc115140644editdlrm
contextlib.cpython-33.pyo115140644editdlrm
copy.cpython-33.pyc100400644editdlrm
copy.cpython-33.pyo99480644editdlrm
copyreg.cpython-33.pyc57480644editdlrm
copyreg.cpython-33.pyo57040644editdlrm
cProfile.cpython-33.pyc70830644editdlrm
cProfile.cpython-33.pyo70830644editdlrm
crypt.cpython-33.pyc30780644editdlrm
crypt.cpython-33.pyo30780644editdlrm
csv.cpython-33.pyc178400644editdlrm
csv.cpython-33.pyo178400644editdlrm
datetime.cpython-33.pyc780030644editdlrm
datetime.cpython-33.pyo756790644editdlrm
decimal.cpython-33.pyc2127810644editdlrm
decimal.cpython-33.pyo2127810644editdlrm
difflib.cpython-33.pyc698400644editdlrm
difflib.cpython-33.pyo697890644editdlrm
dis.cpython-33.pyc112330644editdlrm
dis.cpython-33.pyo112330644editdlrm
doctest.cpython-33.pyc985250644editdlrm
doctest.cpython-33.pyo981630644editdlrm
dummy_threading.cpython-33.pyc13630644editdlrm
dummy_threading.cpython-33.pyo13630644editdlrm
filecmp.cpython-33.pyc113310644editdlrm
filecmp.cpython-33.pyo113310644editdlrm
fileinput.cpython-33.pyc177440644editdlrm
fileinput.cpython-33.pyo177440644editdlrm
fnmatch.cpython-33.pyc38210644editdlrm
fnmatch.cpython-33.pyo38210644editdlrm
formatter.cpython-33.pyc274240644editdlrm
formatter.cpython-33.pyo274240644editdlrm
fractions.cpython-33.pyc242130644editdlrm
fractions.cpython-33.pyo242130644editdlrm
ftplib.cpython-33.pyc450290644editdlrm
ftplib.cpython-33.pyo450290644editdlrm
functools.cpython-33.pyc158210644editdlrm
functools.cpython-33.pyo158210644editdlrm
genericpath.cpython-33.pyc37650644editdlrm
genericpath.cpython-33.pyo37650644editdlrm
getopt.cpython-33.pyc81130644editdlrm
getopt.cpython-33.pyo80680644editdlrm
getpass.cpython-33.pyc55560644editdlrm
getpass.cpython-33.pyo55560644editdlrm
gettext.cpython-33.pyc209130644editdlrm
gettext.cpython-33.pyo209130644editdlrm
glob.cpython-33.pyc32930644editdlrm
glob.cpython-33.pyo32930644editdlrm
gzip.cpython-33.pyc248760644editdlrm
gzip.cpython-33.pyo248160644editdlrm
hashlib.cpython-33.pyc62060644editdlrm
hashlib.cpython-33.pyo62060644editdlrm
heapq.cpython-33.pyc162350644editdlrm
heapq.cpython-33.pyo162350644editdlrm
hmac.cpython-33.pyc58170644editdlrm
hmac.cpython-33.pyo58170644editdlrm
imaplib.cpython-33.pyc569950644editdlrm
imaplib.cpython-33.pyo537260644editdlrm
imghdr.cpython-33.pyc55300644editdlrm
imghdr.cpython-33.pyo55300644editdlrm
imp.cpython-33.pyc125770644editdlrm
imp.cpython-33.pyo125770644editdlrm
inspect.cpython-33.pyc817110644editdlrm
inspect.cpython-33.pyo817110644editdlrm
io.cpython-33.pyc42830644editdlrm
io.cpython-33.pyo42830644editdlrm
ipaddress.cpython-33.pyc817980644editdlrm
ipaddress.cpython-33.pyo817980644editdlrm
keyword.cpython-33.pyc22100644editdlrm
keyword.cpython-33.pyo22100644editdlrm
linecache.cpython-33.pyc38700644editdlrm
linecache.cpython-33.pyo38700644editdlrm
locale.cpython-33.pyc538620644editdlrm
locale.cpython-33.pyo538620644editdlrm
lzma.cpython-33.pyc186630644editdlrm
lzma.cpython-33.pyo186630644editdlrm
macpath.cpython-33.pyc80210644editdlrm
macpath.cpython-33.pyo80210644editdlrm
macurl2path.cpython-33.pyc25610644editdlrm
macurl2path.cpython-33.pyo25610644editdlrm
mailbox.cpython-33.pyc992890644editdlrm
mailbox.cpython-33.pyo991500644editdlrm
mailcap.cpython-33.pyc81150644editdlrm
mailcap.cpython-33.pyo81150644editdlrm
mimetypes.cpython-33.pyc202480644editdlrm
mimetypes.cpython-33.pyo202480644editdlrm
modulefinder.cpython-33.pyc228520644editdlrm
modulefinder.cpython-33.pyo227700644editdlrm
netrc.cpython-33.pyc55220644editdlrm
netrc.cpython-33.pyo55220644editdlrm
nntplib.cpython-33.pyc469840644editdlrm
nntplib.cpython-33.pyo469840644editdlrm
ntpath.cpython-33.pyc176360644editdlrm
ntpath.cpython-33.pyo176360644editdlrm
nturl2path.cpython-33.pyc20830644editdlrm
nturl2path.cpython-33.pyo20830644editdlrm
numbers.cpython-33.pyc188590644editdlrm
numbers.cpython-33.pyo188590644editdlrm
opcode.cpython-33.pyc59710644editdlrm
opcode.cpython-33.pyo59710644editdlrm
optparse.cpython-33.pyc707610644editdlrm
optparse.cpython-33.pyo706780644editdlrm
os.cpython-33.pyc384310644editdlrm
os.cpython-33.pyo384310644editdlrm
os2emxpath.cpython-33.pyc52380644editdlrm
os2emxpath.cpython-33.pyo52380644editdlrm
pdb.cpython-33.pyc629640644editdlrm
pdb.cpython-33.pyo628920644editdlrm
pickle.cpython-33.pyc531300644editdlrm
pickle.cpython-33.pyo528970644editdlrm
pickletools.cpython-33.pyc675040644editdlrm
pickletools.cpython-33.pyo663350644editdlrm
pipes.cpython-33.pyc101470644editdlrm
pipes.cpython-33.pyo101470644editdlrm
pkgutil.cpython-33.pyc233760644editdlrm
pkgutil.cpython-33.pyo233760644editdlrm
platform.cpython-33.pyc404530644editdlrm
platform.cpython-33.pyo404530644editdlrm
plistlib.cpython-33.pyc235430644editdlrm
plistlib.cpython-33.pyo234490644editdlrm
poplib.cpython-33.pyc146030644editdlrm
poplib.cpython-33.pyo146030644editdlrm
posixpath.cpython-33.pyc136890644editdlrm
posixpath.cpython-33.pyo136890644editdlrm
pprint.cpython-33.pyc133000644editdlrm
pprint.cpython-33.pyo131230644editdlrm
profile.cpython-33.pyc187800644editdlrm
profile.cpython-33.pyo184890644editdlrm
pstats.cpython-33.pyc323010644editdlrm
pstats.cpython-33.pyo323010644editdlrm
pty.cpython-33.pyc57950644editdlrm
pty.cpython-33.pyo57950644editdlrm
pyclbr.cpython-33.pyc110450644editdlrm
pyclbr.cpython-33.pyo110450644editdlrm
pydoc.cpython-33.pyc1225580644editdlrm
pydoc.cpython-33.pyo1224800644editdlrm
py_compile.cpython-33.pyc76990644editdlrm
py_compile.cpython-33.pyo76990644editdlrm
queue.cpython-33.pyc120380644editdlrm
queue.cpython-33.pyo120380644editdlrm
quopri.cpython-33.pyc79970644editdlrm
quopri.cpython-33.pyo76870644editdlrm
random.cpython-33.pyc237740644editdlrm
random.cpython-33.pyo237740644editdlrm
re.cpython-33.pyc164520644editdlrm
re.cpython-33.pyo164520644editdlrm
reprlib.cpython-33.pyc83140644editdlrm
reprlib.cpython-33.pyo83140644editdlrm
rlcompleter.cpython-33.pyc64760644editdlrm
rlcompleter.cpython-33.pyo64760644editdlrm
runpy.cpython-33.pyc104850644editdlrm
runpy.cpython-33.pyo104850644editdlrm
sched.cpython-33.pyc82470644editdlrm
sched.cpython-33.pyo82470644editdlrm
shelve.cpython-33.pyc127620644editdlrm
shelve.cpython-33.pyo127620644editdlrm
shlex.cpython-33.pyc93940644editdlrm
shlex.cpython-33.pyo93940644editdlrm
shutil.cpython-33.pyc413740644editdlrm
shutil.cpython-33.pyo413740644editdlrm
site.cpython-33.pyc255970644editdlrm
site.cpython-33.pyo255970644editdlrm
smtpd.cpython-33.pyc343270644editdlrm
smtpd.cpython-33.pyo343270644editdlrm
smtplib.cpython-33.pyc411750644editdlrm
smtplib.cpython-33.pyo410810644editdlrm
sndhdr.cpython-33.pyc85480644editdlrm
sndhdr.cpython-33.pyo85480644editdlrm
socket.cpython-33.pyc184350644editdlrm
socket.cpython-33.pyo183820644editdlrm
socketserver.cpython-33.pyc313750644editdlrm
socketserver.cpython-33.pyo313750644editdlrm
sre_compile.cpython-33.pyc123190644editdlrm
sre_compile.cpython-33.pyo121380644editdlrm
sre_constants.cpython-33.pyc64920644editdlrm
sre_constants.cpython-33.pyo64920644editdlrm
sre_parse.cpython-33.pyc255610644editdlrm
sre_parse.cpython-33.pyo255610644editdlrm
ssl.cpython-33.pyc282640644editdlrm
ssl.cpython-33.pyo282640644editdlrm
stat.cpython-33.pyc45830644editdlrm
stat.cpython-33.pyo45830644editdlrm
string.cpython-33.pyc103350644editdlrm
string.cpython-33.pyo103350644editdlrm
stringprep.cpython-33.pyc161030644editdlrm
stringprep.cpython-33.pyo160310644editdlrm
struct.cpython-33.pyc4070644editdlrm
struct.cpython-33.pyo4070644editdlrm
subprocess.cpython-33.pyc559780644editdlrm
subprocess.cpython-33.pyo558450644editdlrm
sunau.cpython-33.pyc236770644editdlrm
sunau.cpython-33.pyo236770644editdlrm
symbol.cpython-33.pyc30490644editdlrm
symbol.cpython-33.pyo30490644editdlrm
symtable.cpython-33.pyc173490644editdlrm
symtable.cpython-33.pyo172120644editdlrm
sysconfig.cpython-33.pyc223060644editdlrm
sysconfig.cpython-33.pyo223060644editdlrm
tabnanny.cpython-33.pyc101820644editdlrm
tabnanny.cpython-33.pyo101820644editdlrm
tarfile.cpython-33.pyc881300644editdlrm
tarfile.cpython-33.pyo881300644editdlrm
telnetlib.cpython-33.pyc271230644editdlrm
telnetlib.cpython-33.pyo271230644editdlrm
tempfile.cpython-33.pyc308500644editdlrm
tempfile.cpython-33.pyo308500644editdlrm
textwrap.cpython-33.pyc141750644editdlrm
textwrap.cpython-33.pyo140830644editdlrm
this.cpython-33.pyc14290644editdlrm
this.cpython-33.pyo14290644editdlrm
threading.cpython-33.pyc496310644editdlrm
threading.cpython-33.pyo487700644editdlrm
timeit.cpython-33.pyc136170644editdlrm
timeit.cpython-33.pyo136170644editdlrm
token.cpython-33.pyc43970644editdlrm
token.cpython-33.pyo43970644editdlrm
tokenize.cpython-33.pyc246200644editdlrm
tokenize.cpython-33.pyo245640644editdlrm
trace.cpython-33.pyc316190644editdlrm
trace.cpython-33.pyo315560644editdlrm
traceback.cpython-33.pyc145130644editdlrm
traceback.cpython-33.pyo145130644editdlrm
tty.cpython-33.pyc14790644editdlrm
tty.cpython-33.pyo14790644editdlrm
types.cpython-33.pyc37690644editdlrm
types.cpython-33.pyo37690644editdlrm
uu.cpython-33.pyc48760644editdlrm
uu.cpython-33.pyo48760644editdlrm
uuid.cpython-33.pyc259170644editdlrm
uuid.cpython-33.pyo258390644editdlrm
warnings.cpython-33.pyc158380644editdlrm
warnings.cpython-33.pyo148810644editdlrm
wave.cpython-33.pyc250250644editdlrm
wave.cpython-33.pyo248170644editdlrm
weakref.cpython-33.pyc184420644editdlrm
weakref.cpython-33.pyo184420644editdlrm
webbrowser.cpython-33.pyc261110644editdlrm
webbrowser.cpython-33.pyo260660644editdlrm
xdrlib.cpython-33.pyc125230644editdlrm
xdrlib.cpython-33.pyo125230644editdlrm
zipfile.cpython-33.pyc590100644editdlrm
zipfile.cpython-33.pyo589450644editdlrm
_compat_pickle.cpython-33.pyc55060644editdlrm
_compat_pickle.cpython-33.pyo55060644editdlrm
_dummy_thread.cpython-33.pyc60490644editdlrm
_dummy_thread.cpython-33.pyo60490644editdlrm
_markupbase.cpython-33.pyc114560644editdlrm
_markupbase.cpython-33.pyo112400644editdlrm
_osx_support.cpython-33.pyc138340644editdlrm
_osx_support.cpython-33.pyo138340644editdlrm
_pyio.cpython-33.pyc853190644editdlrm
_pyio.cpython-33.pyo852930644editdlrm
_strptime.cpython-33.pyc196490644editdlrm
_strptime.cpython-33.pyo196490644editdlrm
_sysconfigdata.cpython-33.pyc236720644editdlrm
_sysconfigdata.cpython-33.pyo236720644editdlrm
_threading_local.cpython-33.pyc87250644editdlrm
_threading_local.cpython-33.pyo87250644editdlrm
_weakrefset.cpython-33.pyc133080644editdlrm
_weakrefset.cpython-33.pyo133080644editdlrm
__future__.cpython-33.pyc50110644editdlrm
__future__.cpython-33.pyo50110644editdlrm
__phello__.cpython-33.pyc1460644editdlrm
__phello__.cpython-33.pyo1460644editdlrm
Edit: /opt/alt/python33/lib64/python3.3/__pycache__/difflib.cpython-33.pyc (69840B)
fWBc @sdZddddddddd d d g Zd d lZd d lZd dlmZed dZddZGdddZ ddddZ ddZ GdddZ d d l Z e jdjddZdddZddZdddddd d!d Zd"d#Zdddddd d$dZeed%dZeeed&d'Zd(Zd)Zd*Zd+ZGd,d d eZ[ d-dZd.d/Z e!d0kre nd S(1ue Module difflib -- helpers for computing deltas between objects. Function get_close_matches(word, possibilities, n=3, cutoff=0.6): Use SequenceMatcher to return list of the best "good enough" matches. Function context_diff(a, b): For two lists of strings, return a delta in context diff format. Function ndiff(a, b): Return a delta: the difference between `a` and `b` (lists of strings). Function restore(delta, which): Return one of the two sequences that generated an ndiff delta. Function unified_diff(a, b): For two lists of strings, return a delta in unified diff format. Class SequenceMatcher: A flexible class for comparing pairs of sequences of any type. Class Differ: For producing human-readable deltas from sequences of lines of text. Class HtmlDiff: For producing HTML side by side comparison with change highlights. uget_close_matchesundiffurestoreuSequenceMatcheruDifferuIS_CHARACTER_JUNKu IS_LINE_JUNKu context_diffu unified_diffuHtmlDiffuMatchiN(u namedtupleua b sizecCs|rd||SdS(Ng@g?((umatchesulength((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_calculate_ratio's u_calculate_ratiocBs|EeZdZdZd ddd!ddZddZddZd d Z d d Z d dZ ddZ ddZ ddZddZdddZddZddZddZd S("uSequenceMatcheru SequenceMatcher is a flexible class for comparing pairs of sequences of any type, so long as the sequence elements are hashable. The basic algorithm predates, and is a little fancier than, an algorithm published in the late 1980's by Ratcliff and Obershelp under the hyperbolic name "gestalt pattern matching". The basic idea is to find the longest contiguous matching subsequence that contains no "junk" elements (R-O doesn't address junk). The same idea is then applied recursively to the pieces of the sequences to the left and to the right of the matching subsequence. This does not yield minimal edit sequences, but does tend to yield matches that "look right" to people. SequenceMatcher tries to compute a "human-friendly diff" between two sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the longest *contiguous* & junk-free matching subsequence. That's what catches peoples' eyes. The Windows(tm) windiff has another interesting notion, pairing up elements that appear uniquely in each sequence. That, and the method here, appear to yield more intuitive difference reports than does diff. This method appears to be the least vulnerable to synching up on blocks of "junk lines", though (like blank lines in ordinary text files, or maybe "

" lines in HTML files). That may be because this is the only method of the 3 that has a *concept* of "junk" . Example, comparing two strings, and considering blanks to be "junk": >>> s = SequenceMatcher(lambda x: x == " ", ... "private Thread currentThread;", ... "private volatile Thread currentThread;") >>> .ratio() returns a float in [0, 1], measuring the "similarity" of the sequences. As a rule of thumb, a .ratio() value over 0.6 means the sequences are close matches: >>> print(round(s.ratio(), 3)) 0.866 >>> If you're only interested in where the sequences match, .get_matching_blocks() is handy: >>> for block in s.get_matching_blocks(): ... print("a[%d] and b[%d] match for %d elements" % block) a[0] and b[0] match for 8 elements a[8] and b[17] match for 21 elements a[29] and b[38] match for 0 elements Note that the last tuple returned by .get_matching_blocks() is always a dummy, (len(a), len(b), 0), and this is the only case in which the last tuple element (number of elements matched) is 0. If you want to know how to change the first sequence into the second, use .get_opcodes(): >>> for opcode in s.get_opcodes(): ... print("%6s a[%d:%d] b[%d:%d]" % opcode) equal a[0:8] b[0:8] insert a[8:8] b[8:17] equal a[8:29] b[17:38] See the Differ class for a fancy human-friendly file differencer, which uses SequenceMatcher both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines. See also function get_close_matches() in this module, which shows how simple code building on SequenceMatcher can be used to do useful work. Timing: Basic R-O is cubic time worst case and quadratic time expected case. SequenceMatcher is quadratic time for the worst case and has expected-case behavior dependent in a complicated way on how many elements the sequences have in common; best case time is linear. Methods: __init__(isjunk=None, a='', b='') Construct a SequenceMatcher. set_seqs(a, b) Set the two sequences to be compared. set_seq1(a) Set the first sequence to be compared. set_seq2(b) Set the second sequence to be compared. find_longest_match(alo, ahi, blo, bhi) Find longest matching block in a[alo:ahi] and b[blo:bhi]. get_matching_blocks() Return list of triples describing matching subsequences. get_opcodes() Return list of 5-tuples describing how to turn a into b. ratio() Return a measure of the sequences' similarity (float in [0,1]). quick_ratio() Return an upper bound on .ratio() relatively quickly. real_quick_ratio() Return an upper bound on ratio() very quickly. ucCs6||_d|_|_||_|j||dS(u!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. For example, pass lambda x: x in " \t" if you're comparing lines as sequences of characters, and don't want to synch up on blanks or hard tabs. Optional arg a is the first of two sequences to be compared. By default, an empty string. The elements of a must be hashable. See also .set_seqs() and .set_seq1(). Optional arg b is the second of two sequences to be compared. By default, an empty string. The elements of b must be hashable. See also .set_seqs() and .set_seq2(). Optional arg autojunk should be set to False to disable the "automatic junk heuristic" that treats popular elements as junk (see module documentation for more information). N(uisjunkuNoneuaubuautojunkuset_seqs(uselfuisjunkuaubuautojunk((u,/opt/alt/python33/lib64/python3.3/difflib.pyu__init__s;  uSequenceMatcher.__init__cCs|j||j|dS(uSet the two sequences to be compared. >>> s = SequenceMatcher() >>> s.set_seqs("abcd", "bcde") >>> s.ratio() 0.75 N(uset_seq1uset_seq2(uselfuaub((u,/opt/alt/python33/lib64/python3.3/difflib.pyuset_seqss uSequenceMatcher.set_seqscCs0||jkrdS||_d|_|_dS(uMSet the first sequence to be compared. The second sequence to be compared is not changed. >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s.ratio() 0.75 >>> s.set_seq1("bcde") >>> s.ratio() 1.0 >>> SequenceMatcher computes and caches detailed information about the second sequence, so if you want to compare one sequence S against many sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for each of the other sequences. See also set_seqs() and set_seq2(). N(uauNoneumatching_blocksuopcodes(uselfua((u,/opt/alt/python33/lib64/python3.3/difflib.pyuset_seq1s uSequenceMatcher.set_seq1cCsC||jkrdS||_d|_|_d|_|jdS(uMSet 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 and caches detailed information about the second sequence, so if you want to compare one sequence S against many sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for each of the other sequences. See also set_seqs() and set_seq1(). N(ubuNoneumatching_blocksuopcodesu fullbcountu_SequenceMatcher__chain_b(uselfub((u,/opt/alt/python33/lib64/python3.3/difflib.pyuset_seq2s   uSequenceMatcher.set_seq2c Cs\|j}i|_}x9t|D]+\}}|j|g}|j|q#Wt|_}|j}|rx0|jD]"}||r~|j |q~q~Wx|D] }||=qWnt|_ }t |} |j rX| dkrX| dd} x<|j D].\}} t | | kr |j |q q Wx|D] }||=qDWndS(Niidi(ubub2ju enumerateu setdefaultuappendusetubjunkuisjunkukeysuaddubpopularulenuautojunkuitems( uselfubub2juiueltuindicesujunkuisjunkupopularununtestuidxs((u,/opt/alt/python33/lib64/python3.3/difflib.pyu __chain_b*s,       uSequenceMatcher.__chain_bcCs tjdtd||jkS(u2Deprecated; use 'item in SequenceMatcher().bjunk'.uX'SequenceMatcher().isbjunk(item)' is deprecated; use 'item in SMinstance.bjunk' instead.i(uwarningsuwarnuDeprecationWarningubjunk(uselfuitem((u,/opt/alt/python33/lib64/python3.3/difflib.pyuisbjunkQs  uSequenceMatcher.isbjunkcCs tjdtd||jkS(u5Deprecated; use 'item in SequenceMatcher().bpopular'.u^'SequenceMatcher().isbpopular(item)' is deprecated; use 'item in SMinstance.bpopular' instead.i(uwarningsuwarnuDeprecationWarningubpopular(uselfuitem((u,/opt/alt/python33/lib64/python3.3/difflib.pyu isbpopularXs  uSequenceMatcher.isbpopularcCs|j|j|j|jjf\}}}}||d} } } i} g} xt||D]}| j}i}x|j||| D]z}||krqn||krPn||ddd}||<|| kr||d||d|} } } qqW|} q]Wxm| |kr| |kr||| d r|| d|| dkr| d| d| d} } } qWx_| | |kr| | |kr||| |  r|| | || | kr| d7} qWxl| |krQ| |krQ||| drQ|| d|| dkrQ| d| d| d} } } qWx^| | |kr| | |kr||| | r|| | || | kr| d} qUWt| | | S(uFind longest matching block in a[alo:ahi] and b[blo:bhi]. If isjunk is not defined: Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where alo <= i <= i+k <= ahi blo <= j <= j+k <= bhi and for all (i',j',k') meeting those conditions, k >= k' i <= i' and if i == i', j <= j' In other words, of all maximal matching blocks, return one that starts earliest in a, and of all those maximal matching blocks that start earliest in a, return the one that starts earliest in b. >>> s = SequenceMatcher(None, " abcd", "abcd abcd") >>> s.find_longest_match(0, 5, 0, 9) Match(a=0, b=4, size=5) If isjunk is defined, first the longest matching block is determined as above, but with the additional restriction that no junk element appears in the block. Then that block is extended as far as possible by matching (only) junk elements on both sides. So the resulting block never matches on junk except as identical junk happens to be adjacent to an "interesting" match. Here's the same example as before, but considering blanks to be junk. That prevents " abcd" from matching the " abcd" at the tail end of the second sequence directly. Instead only the "abcd" can match, and matches the leftmost "abcd" in the second sequence: >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd") >>> s.find_longest_match(0, 5, 0, 9) Match(a=1, b=0, size=4) If no blocks match, return (alo, blo, 0). >>> s = SequenceMatcher(None, "ab", "c") >>> s.find_longest_match(0, 2, 0, 1) Match(a=0, b=0, size=0) ii(uaubub2jubjunku __contains__urangeugetuMatch(uselfualouahiubloubhiuaubub2juisbjunkubestiubestjubestsizeuj2lenunothinguiuj2lengetunewj2lenujuk((u,/opt/alt/python33/lib64/python3.3/difflib.pyufind_longest_match_sB8-    + $# $#u"SequenceMatcher.find_longest_matchcCs|jdk r|jSt|jt|j}}d|d|fg}g}x|r'|j\}}}}|j||||\} } } } | rS|j| || kr|| kr|j|| || fn| | |kr$| | |kr$|j| | || | |fq$qSqSW|jd} }}g}xw|D]o\}}}| ||kr|||kr||7}qM|r|j| ||fn|||} }}qMW|r|j| ||fn|j||df||_t t j |jS(uReturn 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") >>> list(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)] iN( umatching_blocksuNoneulenuaubupopufind_longest_matchuappendusortumapuMatchu_make(uselfulaulbuqueueumatching_blocksualouahiubloubhiuiujukuxui1uj1uk1u non_adjacentui2uj2uk2((u,/opt/alt/python33/lib64/python3.3/difflib.pyuget_matching_blockss8 %  +    u#SequenceMatcher.get_matching_blockscCs|jdk r|jSd}}g|_}x|jD]\}}}d}||krp||krpd}n*||krd}n||krd}n|r|j|||||fn||||}}|r:|jd||||fq:q:W|S(u[Return list of 5-tuples describing how to turn a into b. Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the tuple preceding it, and likewise for j1 == the previous j2. The tags are strings, with these meanings: 'replace': a[i1:i2] should be replaced by b[j1:j2] 'delete': a[i1:i2] should be deleted. Note that j1==j2 in this case. 'insert': b[j1:j2] should be inserted at a[i1:i1]. Note that i1==i2 in this case. 'equal': a[i1:i2] == b[j1:j2] >>> a = "qabxcd" >>> b = "abycdf" >>> s = SequenceMatcher(None, a, b) >>> for tag, i1, i2, j1, j2 in s.get_opcodes(): ... print(("%7s a[%d:%d] (%s) b[%d:%d] (%s)" % ... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))) delete a[0:1] (q) b[0:0] () equal a[1:3] (ab) b[0:2] (ab) replace a[3:4] (x) b[2:3] (y) equal a[4:6] (cd) b[3:5] (cd) insert a[6:6] () b[5:6] (f) iuureplaceudeleteuinsertuequalN(uopcodesuNoneuget_matching_blocksuappend(uselfuiujuansweruaiubjusizeutag((u,/opt/alt/python33/lib64/python3.3/difflib.pyu get_opcodess$       #uSequenceMatcher.get_opcodesic cs|j}|sdg}n|dddkr|d\}}}}}|t||||t||||f|d>> from pprint import pprint >>> a = list(map(str, range(1,40))) >>> b = a[:] >>> b[8:8] = ['i'] # Make an insertion >>> b[20] += 'x' # Make a replacement >>> b[23:28] = [] # Make a deletion >>> b[30] += 'y' # Make another replacement >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes())) [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)], [('equal', 16, 19, 17, 20), ('replace', 19, 20, 20, 21), ('equal', 20, 22, 21, 23), ('delete', 22, 27, 23, 23), ('equal', 27, 30, 23, 26)], [('equal', 31, 34, 27, 30), ('replace', 34, 35, 30, 31), ('equal', 35, 38, 31, 34)]] uequaliiN(uequaliiiiiii(u get_opcodesumaxuminuappendulen( uselfunucodesutagui1ui2uj1uj2unnugroup((u,/opt/alt/python33/lib64/python3.3/difflib.pyuget_grouped_opcodesKs(  66 6* -u#SequenceMatcher.get_grouped_opcodescCsBtdd|jD}t|t|jt|jS(uReturn a measure of the sequences' similarity (float in [0,1]). Where T is the total number of elements in both sequences, and M is the number of matches, this is 2.0*M / T. Note that this is 1 if the sequences are identical, and 0 if they have nothing in common. .ratio() is expensive to compute if you haven't already computed .get_matching_blocks() or .get_opcodes(), in which case you may want to try .quick_ratio() or .real_quick_ratio() first to get an upper bound. >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s.ratio() 0.75 >>> s.quick_ratio() 0.75 >>> s.real_quick_ratio() 1.0 css|]}|dVqdS(iNi((u.0utriple((u,/opt/alt/python33/lib64/python3.3/difflib.pyu su(SequenceMatcher.ratio..(usumuget_matching_blocksu_calculate_ratioulenuaub(uselfumatches((u,/opt/alt/python33/lib64/python3.3/difflib.pyuratio}suSequenceMatcher.ratiocCs|jdkrMi|_}x.|jD] }|j|dd|| 0. Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities that don't score at least that similar to word are ignored. The best (no more than n) matches among the possibilities are returned in a list, sorted by similarity score, most similar first. >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) ['apple', 'ape'] >>> import keyword as _keyword >>> get_close_matches("wheel", _keyword.kwlist) ['while'] >>> get_close_matches("Apple", _keyword.kwlist) [] >>> get_close_matches("accept", _keyword.kwlist) ['except'] iun must be > 0: %rgg?u cutoff must be in [0.0, 1.0]: %rcSsg|]\}}|qS(((u.0uscoreux((u,/opt/alt/python33/lib64/python3.3/difflib.pyu s u%get_close_matches..( u ValueErroruSequenceMatcheruset_seq2uset_seq1ureal_quick_ratiou quick_ratiouratiouappenduheapqunlargest(uwordu possibilitiesunucutoffuresultusux((u,/opt/alt/python33/lib64/python3.3/difflib.pyuget_close_matchess      cCsDdt|}}x*||kr?|||kr?|d7}qW|S(u} Return number of `ch` characters at the start of `line`. Example: >>> _count_leading(' abc', ' ') 3 ii(ulen(ulineuchuiun((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_count_leadings u_count_leadingcBst|EeZdZdZddddZddZddZdd Zd d Z d d Z ddZ dS(uDifferu Differ is a class for comparing sequences of lines of text, and producing human-readable differences or deltas. Differ uses SequenceMatcher both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines. Each line of a Differ delta begins with a two-letter code: '- ' line unique to sequence 1 '+ ' line unique to sequence 2 ' ' line common to both sequences '? ' line not present in either input sequence Lines beginning with '? ' attempt to guide the eye to intraline differences, and were not present in either input sequence. These lines can be confusing if the sequences contain tab characters. Note that Differ makes no claim to produce a *minimal* diff. To the contrary, minimal diffs are often counter-intuitive, because they synch up anywhere possible, sometimes accidental matches 100 pages apart. Restricting synch points to contiguous matches preserves some notion of locality, at the occasional cost of producing a longer diff. Example: Comparing two texts. First we set up the texts, sequences of individual single-line strings ending with newlines (such sequences can also be obtained from the `readlines()` method of file-like objects): >>> text1 = ''' 1. Beautiful is better than ugly. ... 2. Explicit is better than implicit. ... 3. Simple is better than complex. ... 4. Complex is better than complicated. ... '''.splitlines(keepends=True) >>> len(text1) 4 >>> text1[0][-1] '\n' >>> text2 = ''' 1. Beautiful is better than ugly. ... 3. Simple is better than complex. ... 4. Complicated is better than complex. ... 5. Flat is better than nested. ... '''.splitlines(keepends=True) Next we instantiate a Differ object: >>> d = Differ() Note that when instantiating a Differ object we may pass functions to filter out line and character 'junk'. See Differ.__init__ for details. Finally, we compare the two: >>> result = list(d.compare(text1, text2)) 'result' is a list of strings, so let's pretty-print it: >>> from pprint import pprint as _pprint >>> _pprint(result) [' 1. Beautiful is better than ugly.\n', '- 2. Explicit is better than implicit.\n', '- 3. Simple is better than complex.\n', '+ 3. Simple is better than complex.\n', '? ++\n', '- 4. Complex is better than complicated.\n', '? ^ ---- ^\n', '+ 4. Complicated is better than complex.\n', '? ++++ ^ ^\n', '+ 5. Flat is better than nested.\n'] As a single multi-line string it looks like this: >>> print(''.join(result), end="") 1. Beautiful is better than ugly. - 2. Explicit is better than implicit. - 3. Simple is better than complex. + 3. Simple is better than complex. ? ++ - 4. Complex is better than complicated. ? ^ ---- ^ + 4. Complicated is better than complex. ? ++++ ^ ^ + 5. Flat is better than nested. Methods: __init__(linejunk=None, charjunk=None) Construct a text differencer, with optional filters. compare(a, b) Compare two sequences of lines; generate the resulting delta. cCs||_||_dS(u Construct a text differencer, with optional filters. The two optional keyword parameters are for filter functions: - `linejunk`: A function that should accept a single string argument, and return true iff the string is junk. The module-level function `IS_LINE_JUNK` may be used to filter out lines without visible characters, except for at most one splat ('#'). It is recommended to leave linejunk None; as of Python 2.3, the underlying SequenceMatcher class has grown an adaptive notion of "noise" lines that's better than any static definition the author has ever been able to craft. - `charjunk`: A function that should accept a string of length 1. The module-level function `IS_CHARACTER_JUNK` may be used to filter out whitespace characters (a blank or tab; **note**: bad idea to include newline in this!). Use of IS_CHARACTER_JUNK is recommended. N(ulinejunkucharjunk(uselfulinejunkucharjunk((u,/opt/alt/python33/lib64/python3.3/difflib.pyu__init__\s uDiffer.__init__c cs t|j||}x|jD]\}}}}}|dkrd|j||||||} n|dkr|jd|||} na|dkr|jd|||} n:|dkr|jd|||} ntd|fx| D] } | VqWq"Wd S( u Compare two sequences of lines; generate the resulting delta. Each sequence must contain individual single-line strings ending with newlines. Such sequences can be obtained from the `readlines()` method of file-like objects. The delta generated also consists of newline- terminated strings, ready to be printed as-is via the writeline() method of a file-like object. Example: >>> print(''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(True), ... 'ore\ntree\nemu\n'.splitlines(True))), ... end="") - one ? ^ + ore ? ^ - two - three ? - + tree + emu ureplaceudeleteu-uinsertu+uequalu uunknown tag %rN(uSequenceMatcherulinejunku get_opcodesu_fancy_replaceu_dumpu ValueError( uselfuaubucruncherutagualouahiubloubhiuguline((u,/opt/alt/python33/lib64/python3.3/difflib.pyucomparets" !    uDiffer.compareccs1x*t||D]}d|||fVqWdS(u4Generate comparison results for a same-tagged range.u%s %sN(urange(uselfutaguxulouhiui((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_dumpsu Differ._dumpc cs||kr||kst||||kre|jd|||}|jd|||}n0|jd|||}|jd|||}x*||fD]} x| D] } | VqWqWdS(Nu+u-(uAssertionErroru_dump( uselfuaualouahiububloubhiufirstuseconduguline((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_plain_replaces uDiffer._plain_replaceccs&d\}}t|j} d\} } xt||D]} || } | j| xt||D]}||}|| kr| dkrd|| } } qdqdn| j|| j|krd| j|krd| j|krd| j|| }}}qdqdWq7W||krk| dkrTx+|j ||||||D] }|VqAWdS| | d}}}nd} x+|j ||||||D] }|VqW||||}}| dkrd}}| j ||x| j D]\}}}}}||||}}|dkr<|d|7}|d|7}q|dkrY|d |7}q|d krv|d |7}q|d kr|d |7}|d |7}qt d|fqWx1|j||||D] }|VqWn d|Vx3|j ||d|||d|D] }|VqWdS(uL When replacing one block of lines with another, search the blocks for *similar* lines; the best-matching pair (if any) is used as a synch point, and intraline difference marking is done on the similar pair. Lots of work, but often worth it. Example: >>> d = Differ() >>> results = d._fancy_replace(['abcDefghiJkl\n'], 0, 1, ... ['abcdefGhijkl\n'], 0, 1) >>> print(''.join(results), end="") - abcDefghiJkl ? ^ ^ ^ + abcdefGhijkl ? ^ ^ ^ gGz?g?Ng?uureplaceu^udeleteu-uinsertu+uequalu uunknown tag %ru i(gGz?g?(NN(uSequenceMatcherucharjunkuNoneurangeuset_seq2uset_seq1ureal_quick_ratiou quick_ratiouratiou_plain_replaceu _fancy_helperuset_seqsu get_opcodesu ValueErroru_qformat(uselfuaualouahiububloubhiu best_ratioucutoffucruncherueqiueqjujubjuiuaiubest_iubest_julineuaeltubeltuatagsubtagsutaguai1uai2ubj1ubj2ulaulb((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_fancy_replaces`        %  % %   "      -uDiffer._fancy_replacec csg}||krZ||kr?|j||||||}q|jd|||}n'||kr|jd|||}nx|D] }|VqWdS(Nu-u+(u_fancy_replaceu_dump( uselfuaualouahiububloubhiuguline((u,/opt/alt/python33/lib64/python3.3/difflib.pyu _fancy_helpers  !  uDiffer._fancy_helperccstt|dt|d}t|t|d|d}t|t|d|d}||dj}||dj}d|V|rdd||fVnd|V|rdd||fVndS(u Format "?" output and deal with leading tabs. Example: >>> d = Differ() >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', ... ' ^ ^ ^ ', ' ^ ^ ^ ') >>> for line in results: print(repr(line)) ... '- \tabcDefghiJkl\n' '? \t ^ ^ ^\n' '+ \tabcdefGhijkl\n' '? \t ^ ^ ^\n' u Nu u- u? %s%s u+ (uminu_count_leadingurstrip(uselfualineublineuatagsubtagsucommon((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_qformat!s""  uDiffer._qformatN( u__name__u __module__u __qualname__u__doc__uNoneu__init__ucompareu_dumpu_plain_replaceu_fancy_replaceu _fancy_helperu_qformat(u __locals__((u,/opt/alt/python33/lib64/python3.3/difflib.pyuDiffers\ *   b u \s*#?\s*$cCs||dk S(u Return 1 for ignorable line: iff `line` is blank or contains a single '#'. Examples: >>> IS_LINE_JUNK('\n') True >>> IS_LINE_JUNK(' # \n') True >>> IS_LINE_JUNK('hello\n') False N(uNone(ulineupat((u,/opt/alt/python33/lib64/python3.3/difflib.pyu IS_LINE_JUNKUsu cCs ||kS(u Return 1 for ignorable character: iff `ch` is a space or tab. Examples: >>> IS_CHARACTER_JUNK(' ') True >>> IS_CHARACTER_JUNK('\t') True >>> IS_CHARACTER_JUNK('\n') False >>> IS_CHARACTER_JUNK('x') False ((uchuws((u,/opt/alt/python33/lib64/python3.3/difflib.pyuIS_CHARACTER_JUNKescCsP|d}||}|dkr-dj|S|s@|d8}ndj||S(u Convert range to the "ed" formatiu{}u{},{}(uformat(ustartustopu beginningulength((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_format_range_unified|s     u_format_range_unifieduu ccsd}xtd||j|D]} |sd}|rIdj|nd} |rddj|nd} dj|| |Vdj|| |Vn| d| d} } t| d| d}t| d| d }d j|||Vx| D]\}}}}}|d kr>x!|||D]}d |Vq%Wqn|dkrqx$|||D]}d|Vq[Wn|dkrx$|||D]}d|VqWqqWq"WdS(u Compare two sequences of lines; generate the delta as a unified diff. Unified diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which defaults to three. By default, the diff control lines (those with ---, +++, or @@) are created with a trailing newline. This is helpful so that inputs created from file.readlines() result in diffs that are suitable for file.writelines() since both the inputs and outputs have trailing newlines. For inputs that do not have trailing newlines, set the lineterm argument to "" so that the output will be uniformly newline free. The unidiff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. The modification times are normally expressed in the ISO 8601 format. Example: >>> for line in unified_diff('one two three four'.split(), ... 'zero one tree four'.split(), 'Original', 'Current', ... '2005-01-26 23:30:50', '2010-04-02 10:20:52', ... lineterm=''): ... print(line) # doctest: +NORMALIZE_WHITESPACE --- Original 2005-01-26 23:30:50 +++ Current 2010-04-02 10:20:52 @@ -1,4 +1,4 @@ +zero one -two -three +tree four u {}uu --- {}{}{}u +++ {}{}{}iiiiiu@@ -{} +{} @@{}uequalu ureplaceudeleteu-uinsertu+NFTi>ureplaceudelete>ureplaceuinsert(uFalseuSequenceMatcheruNoneuget_grouped_opcodesuTrueuformatu_format_range_unified(uaubufromfileutofileu fromfiledateu tofiledateunulinetermustartedugroupufromdateutodateufirstulastu file1_rangeu file2_rangeutagui1ui2uj1uj2uline((u,/opt/alt/python33/lib64/python3.3/difflib.pyu unified_diffs.)"    cCsX|d}||}|s'|d8}n|dkr@dj|Sdj|||dS(u Convert range to the "ed" formatiu{}u{},{}(uformat(ustartustopu beginningulength((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_format_range_contexts     u_format_range_contextc cstdddddddd}d} xtd||j|D]} | sd} |rjd j|nd } |rd j|nd } d j|| |Vd j|| |Vn| d | d} }d|Vt| d|d}dj||Vtdd| DroxW| D]L\}}}}}|dkrx(|||D]}|||VqNWqqWnt| d|d}dj||Vtdd| DrCxW| D]L\}}}}}|dkrx(|||D]}|||VqWqqWqCqCWdS(uh Compare two sequences of lines; generate the delta as a context diff. Context diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which defaults to three. By default, the diff control lines (those with *** or ---) are created with a trailing newline. This is helpful so that inputs created from file.readlines() result in diffs that are suitable for file.writelines() since both the inputs and outputs have trailing newlines. For inputs that do not have trailing newlines, set the lineterm argument to "" so that the output will be uniformly newline free. The context diff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks. Example: >>> print(''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(True), ... 'zero\none\ntree\nfour\n'.splitlines(True), 'Original', 'Current')), ... end="") *** Original --- Current *************** *** 1,4 **** one ! two ! three four --- 1,4 ---- + zero one ! tree four uinsertu+ udeleteu- ureplaceu! uequalu u {}uu *** {}{}{}u --- {}{}{}iiu***************iu *** {} ****{}css*|] \}}}}}|dkVqdS(ureplaceudeleteN>ureplaceudelete((u.0utagu_((u,/opt/alt/python33/lib64/python3.3/difflib.pyu sucontext_diff..iiu --- {} ----{}css*|] \}}}}}|dkVqdS(ureplaceuinsertN>ureplaceuinsert((u.0utagu_((u,/opt/alt/python33/lib64/python3.3/difflib.pyu sNFTi( udictuFalseuSequenceMatcheruNoneuget_grouped_opcodesuTrueuformatu_format_range_contextuany(uaubufromfileutofileu fromfiledateu tofiledateunulinetermuprefixustartedugroupufromdateutodateufirstulastu file1_rangeutagui1ui2u_ulineu file2_rangeuj1uj2((u,/opt/alt/python33/lib64/python3.3/difflib.pyu context_diffs2,!"   cCst||j||S(u Compare `a` and `b` (lists of strings); return a `Differ`-style delta. Optional keyword parameters `linejunk` and `charjunk` are for filter functions (or None): - linejunk: A function that should accept a single string argument, and return true iff the string is junk. The default is None, and is recommended; as of Python 2.3, an adaptive notion of "noise" lines is used that does a good job on its own. - charjunk: A function that should accept a string of length 1. The default is module-level function IS_CHARACTER_JUNK, which filters out whitespace characters (a blank or tab; note: bad idea to include newline in this!). Tools/scripts/ndiff.py is a command-line front-end to this function. Example: >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True), ... 'ore\ntree\nemu\n'.splitlines(keepends=True)) >>> print(''.join(diff), end="") - one ? ^ + ore ? ^ - two - three ? - + tree + emu (uDifferucompare(uaubulinejunkucharjunk((u,/opt/alt/python33/lib64/python3.3/difflib.pyundiff&s"c#sddl}|jdt||||ddgfddfddfdd }|}|dkrxAt|Vqn0|d 7}d}xddg|} } d } xL| d krt|\} } } | |}| | | f| |<| d 7} qW| |kr1d V|}n | }d} x1|rp| |}| d 7} | |V|d 8}q@W|d }xJ|rt|\} } } | r|d }n |d 8}| | | fVq~WqdS( uReturns generator yielding marked up from/to side by side differences. Arguments: fromlines -- list of text lines to compared to tolines tolines -- list of text lines to be compared to fromlines context -- number of context lines to display on each side of difference, if None, all from/to text lines will be generated. linejunk -- passed on to ndiff (see ndiff documentation) charjunk -- passed on to ndiff (see ndiff documentation) This function returns an iterator which returns a tuple: (from line tuple, to line tuple, boolean flag) from/to line tuple -- (line num, line text) line num -- integer or None (to indicate a context separation) line text -- original line text with following markers inserted: '\0+' -- marks start of added text '\0-' -- marks start of deleted text '\0^' -- marks start of changed text '\1' -- marks end of added/deleted/changed text boolean flag -- None indicates context separation, True indicates either "from" or "to" line contains a change, otherwise False. This function/iterator was originally developed to generate side by side file difference for making HTML pages (see HtmlDiff class for example usage). Note, this function utilizes the ndiff function to generate the side by side difference markup. Optional ndiff arguments may be passed to this function and they in turn will be passed to ndiff. iNu (\++|\-+|\^+)c sH||d7<|dkr;|||jdddfS|dkr|jd|jd}}g}|dd}j||x_|ddd D]J\}\} } |d| d||| | d || d}qW|dd}n:|jddd}|s(d }nd||d }|||fS( uReturns line of text with user's change markup and line formatting. lines -- list of lines from the ndiff generator to produce a line of text from. When producing the line of text to return, the lines used are removed from this list. format_key -- '+' return first line in list with "add" markup around the entire line. '-' return first line in list with "delete" markup around the entire line. '?' return first line in list with add/delete/change intraline markup (indices obtained from second line) None return first line in list with no markup side -- indice into the num_lines list (0=from,1=to) num_lines -- from/to current line number. This is NOT intended to be a passed parameter. It is present as a keyword argument to maintain memory of the current line numbers between calls of this function. Note, this function is purposefully not defined at the module scope so that data it needs from its parent function (within whose context it is defined) does not need to be of module scope. iiiNu?cSs3|j|jdd|jg|jdS(Nii(uappendugroupuspan(u match_objectusub_info((u,/opt/alt/python33/lib64/python3.3/difflib.pyurecord_sub_infos&u3_mdiff.._make_line..record_sub_infouuu i(uNoneupopusub( ulinesu format_keyusideu num_linesutextumarkersusub_infourecord_sub_infoukeyubeginuend(u change_re(u,/opt/alt/python33/lib64/python3.3/difflib.pyu _make_linets  ! &< u_mdiff.._make_linec 3s^g}d\}}xExOt|dkrfy|jtWqtk rb|jdYqXqWdjdd|D}|jdr|}nR|jdr|dd|dd dfVqn|jd r|d 8}|d dddfVqn|jdrK|d dd}}|d d}}n|jdr|dd|dd dfVqng|jdr|dd|dd dfVqn,|jd r|d 8}|d dddfVqn|jdr3|d 7}d|dd dfVqn|jdrod|dd }}|d d}}n~|jdr|d 7}d|dd dfVqnE|jdr|dddd|dd dfVqnx|dkr|d 7}dVqWx|dkr0|d 8}d VqW|jdrItq||dfVqdS(!uYields from/to lines of text with a change indication. This function is an iterator. It itself pulls lines from a differencing iterator, processes them and yields them. When it can it yields both a "from" and a "to" line, otherwise it will yield one or the other. In addition to yielding the lines of from/to text, a boolean flag is yielded to indicate if the text line(s) have differences in them. Note, this function is purposefully not defined at the module scope so that data it needs from its parent function (within whose context it is defined) does not need to be of module scope. iiuXucSsg|]}|dqS(i((u.0uline((u,/opt/alt/python33/lib64/python3.3/difflib.pyu s u2_mdiff.._line_iterator..u-?+?u?iu--++u-u--?+u--+u- u-+?u-?+u+--u+u+ u+-u Nu (iiT(u--?+u--+u- (u+ u+-F(uu (N(uu T(uu ((uu NT( ulenuappendunextu StopIterationujoinu startswithuTrueuNoneuFalse(ulinesunum_blanks_pendingunum_blanks_to_yieldusu from_lineuto_line(u _make_lineudiff_lines_iterator(u,/opt/alt/python33/lib64/python3.3/difflib.pyu_line_iteratorsl   & &&   0     u_mdiff.._line_iteratorc3s}gg}}xxt|dks@t|dkrt|\}}}|dk rw|j||fn|dk r|j||fqqW|jd\}}|jd\}}|||p|fVqdS(utYields from/to lines of text with a change indication. This function is an iterator. It itself pulls lines from the line iterator. Its difference from that iterator is that this function always yields a pair of from/to text lines (with the change indication). If necessary it will collect single from/to lines until it has a matching pair from/to pair to yield. Note, this function is purposefully not defined at the module scope so that data it needs from its parent function (within whose context it is defined) does not need to be of module scope. iN(ulenunextuNoneuappendupop(u line_iteratoru fromlinesutolinesu from_lineuto_lineu found_diffufromDiffuto_diff(u_line_iterator(u,/opt/alt/python33/lib64/python3.3/difflib.pyu_line_pair_iterators  '  u#_mdiff.._line_pair_iteratoriF(NNN(ureucompileundiffuNoneunextuFalse(u fromlinesutolinesucontextulinejunkucharjunkureu_line_pair_iteratoruline_pair_iteratorulines_to_writeuindexu contextLinesu found_diffu from_lineuto_lineui((u_line_iteratoru _make_lineu change_reudiff_lines_iteratoru,/opt/alt/python33/lib64/python3.3/difflib.pyu_mdiffJsJ" 8[              u_mdiffum %(table)s%(legend)s uH table.diff {font-family:Courier; border:medium;} .diff_header {background-color:#e0e0e0} td.diff_header {text-align:right} .diff_next {background-color:#c0c0c0} .diff_add {background-color:#aaffaa} .diff_chg {background-color:#ffff77} .diff_sub {background-color:#ffaaaa}uZ

%(header_row)s %(data_rows)s
u
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op
cBs|EeZdZdZeZeZeZeZdZddde ddZ dddddd Z d d Zd d ZddZddZddZddZddZddddddZdS(uHtmlDiffu{For producing HTML side by side comparison with change highlights. This class can be used to create an HTML table (or a complete HTML file containing the table) showing a side by side, line by line comparison of text with inter-line and intra-line change highlights. The table can be generated in either full or contextual difference mode. The following methods are provided for HTML generation: make_table -- generates HTML for a single side by side table make_file -- generates complete HTML file with a single side by side table See tools/scripts/diff.py for an example usage of this class. iicCs(||_||_||_||_dS(uHtmlDiff instance initializer Arguments: tabsize -- tab stop spacing, defaults to 8. wrapcolumn -- column number where lines are broken and wrapped, defaults to None where lines are not wrapped. linejunk,charjunk -- keyword arguments passed into ndiff() (used to by HtmlDiff() to generate the side by side HTML differences). See ndiff() documentation for argument default values and descriptions. N(u_tabsizeu _wrapcolumnu _linejunku _charjunk(uselfutabsizeu wrapcolumnulinejunkucharjunk((u,/opt/alt/python33/lib64/python3.3/difflib.pyu__init__s   uHtmlDiff.__init__uicCsD|jtd|jd|jd|j||||d|d|S(uReturns HTML file of side by side comparison with change highlights Arguments: fromlines -- list of "from" lines tolines -- list of "to" lines fromdesc -- "from" file column header string todesc -- "to" file column header string context -- set to True for contextual differences (defaults to False which shows full differences). numlines -- number of context lines. When context is set True, controls number of lines displayed before and after the change. When context is False, controls the number of lines to place the "next" link anchors before the next change (so click of "next" link jumps to just before the change). ustylesulegendutableucontextunumlines(u_file_templateudictu_stylesu_legendu make_table(uselfu fromlinesutolinesufromdescutodescucontextunumlines((u,/opt/alt/python33/lib64/python3.3/difflib.pyu make_files    uHtmlDiff.make_filecsNfddfdd|D}fdd|D}||fS(uReturns from/to line lists with tabs expanded and newlines removed. Instead of tab characters being replaced by the number of spaces needed to fill in to the next tab stop, this function will fill the space with tab characters. This is done so that the difference algorithms can identify changes in a file when tabs are replaced by spaces and vice versa. At the end of the HTML generation, the tab characters will be replaced with a nonbreakable space. csO|jdd}|jj}|jdd}|jddjdS(Nu uu u (ureplaceu expandtabsu_tabsizeurstrip(uline(uself(u,/opt/alt/python33/lib64/python3.3/difflib.pyu expand_tabssu2HtmlDiff._tab_newline_replace..expand_tabscsg|]}|qS(((u.0uline(u expand_tabs(u,/opt/alt/python33/lib64/python3.3/difflib.pyu s u1HtmlDiff._tab_newline_replace..csg|]}|qS(((u.0uline(u expand_tabs(u,/opt/alt/python33/lib64/python3.3/difflib.pyu s ((uselfu fromlinesutolines((u expand_tabsuselfu,/opt/alt/python33/lib64/python3.3/difflib.pyu_tab_newline_replaces  uHtmlDiff._tab_newline_replacec Csv|s|j||fdSt|}|j}||ks[||jdd|krr|j||fdSd}d}d}x||kr ||kr ||dkr|d7}||}|d7}q||dkr|d7}d}q|d7}|d7}qW|d|} ||d} |rL| d} d|| } n|j|| f|j|d| dS( uBuilds list of text lines by splitting text lines at wrap point This function will determine if the input text line needs to be wrapped (split) into separate lines. If so, the first wrap point will be determined and the first line appended to the output text line list. This function is used recursively to handle the second part of the split line to further split it. Nuiiuiuu>(uappendulenu _wrapcolumnucountu _split_line( uselfu data_listuline_numutextusizeumaxuiunumarkuline1uline2((u,/opt/alt/python33/lib64/python3.3/difflib.pyu _split_lines8   )       uHtmlDiff._split_linec csx|D]\}}}|dkr6|||fVqn||\}}\}}gg} } |j| |||j| ||xZ| s| r| r| jd}nd}| r| jd}nd}|||fVqWqWdS(u5Returns iterator that splits (wraps) mdiff text linesiuu N(uu (uu (uNoneu _split_lineupop( uselfudiffsufromdatautodatauflagufromlineufromtextutolineutotextufromlistutolist((u,/opt/alt/python33/lib64/python3.3/difflib.pyu _line_wrappers   uHtmlDiff._line_wrapperc Csggg}}}x|D]\}}}y<|j|jd|||j|jd||Wn,tk r|jd|jdYnX|j|qW|||fS(uCollects mdiff output into separate lists Before storing the mdiff from/to data into a list, it is converted into a single line of text with HTML markup. iiN(uappendu _format_lineu TypeErroruNone(uselfudiffsufromlistutolistuflaglistufromdatautodatauflag((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_collect_lines3s   uHtmlDiff._collect_linesc Csy%d|}d|j||f}Wntk r?d}YnX|jddjddjdd }|jd d j}d |||fS( uReturns HTML markup of "from" / "to" text lines side -- 0 or 1 indicating "from" or "to" text flag -- indicates if difference on line linenum -- line number (used for line number column) text -- line text to be marked up u%du id="%s%s"uu&u&u>u>u%s%s(u_prefixu TypeErrorureplaceurstrip(uselfusideuflagulinenumutextuid((u,/opt/alt/python33/lib64/python3.3/difflib.pyu _format_lineHs   *uHtmlDiff._format_linecCs<dtj}dtj}tjd7_||g|_dS(uCreate unique anchor prefixesufrom%d_uto%d_iN(uHtmlDiffu_default_prefixu_prefix(uselfu fromprefixutoprefix((u,/opt/alt/python33/lib64/python3.3/difflib.pyu _make_prefix_s  uHtmlDiff._make_prefixcCsY|jd}dgt|}dgt|}d \} } d} xt|D]x\} } | r| sd } | } td| |g} d|| f|| <| d7} d|| f|| nu2 No Differences Found u( Empty File u!fu#tF(iFT(u_prefixulenuFalseu enumerateuTrueumax(uselfufromlistutolistuflaglistucontextunumlinesutoprefixunext_idu next_hrefunum_chgu in_changeulastuiuflag((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_convert_flagsjs:          uHtmlDiff._convert_flagsc Cs|j|j||\}}|r1|}nd}t|||d|jd|j}|jrv|j|}n|j|\} } } |j | | | ||\} } } } } g}dd}x}t t | D]i}| |dkr|dkrD|j dqDq|j || || || || || |fqW|sT|ruddd |dd |f}nd }|j td d j|d |d |jd}|jddjddjddjddjddS(uReturns HTML table of side by side comparison with change highlights Arguments: fromlines -- list of "from" lines tolines -- list of "to" lines fromdesc -- "from" file column header string todesc -- "to" file column header string context -- set to True for contextual differences (defaults to False which shows full differences). numlines -- number of context lines. When context is set True, controls number of lines displayed before and after the change. When context is False, controls the number of lines to place the "next" link anchors before the next change (so click of "next" link jumps to just before the change). ulinejunkucharjunku1 %s%su%%s%s iu) u %s%s%s%su!
u+%suu data_rowsu header_rowuprefixiu+uu-uu^uuuu u N(u _make_prefixu_tab_newline_replaceuNoneu_mdiffu _linejunku _charjunku _wrapcolumnu _line_wrapperu_collect_linesu_convert_flagsurangeulenuappendu_table_templateudictujoinu_prefixureplace(uselfu fromlinesutolinesufromdescutodescucontextunumlinesu context_linesudiffsufromlistutolistuflaglistu next_hrefunext_idusufmtuiu header_rowutable((u,/opt/alt/python33/lib64/python3.3/difflib.pyu make_tablesJ    $      uHtmlDiff.make_tableNF(u__name__u __module__u __qualname__u__doc__u_file_templateu_stylesu_table_templateu_legendu_default_prefixuNoneuIS_CHARACTER_JUNKu__init__uFalseu make_fileu_tab_newline_replaceu _split_lineu _line_wrapperu_collect_linesu _format_lineu _make_prefixu_convert_flagsu make_table(u __locals__((u,/opt/alt/python33/lib64/python3.3/difflib.pyuHtmlDiffs&    7    / c csy"idd6dd6t|}Wn"tk rFtd|YnXd|f}x6|D].}|dd|krZ|ddVqZqZWdS(u0 Generate one of the two sequences that generated a delta. Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract lines originating from file 1 or 2 (parameter `which`), stripping off line prefixes. Examples: >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True), ... 'ore\ntree\nemu\n'.splitlines(keepends=True)) >>> diff = list(diff) >>> print(''.join(restore(diff, 1)), end="") one two three >>> print(''.join(restore(diff, 2)), end="") ore tree emu u- iu+ iu)unknown delta choice (must be 1 or 2): %ru N(uintuKeyErroru ValueError(udeltauwhichutaguprefixesuline((u,/opt/alt/python33/lib64/python3.3/difflib.pyurestores"   cCs%ddl}ddl}|j|S(Ni(udoctestudifflibutestmod(udoctestudifflib((u,/opt/alt/python33/lib64/python3.3/difflib.pyu_testsu_testu__main__("u__doc__u__all__uwarningsuheapqu collectionsu namedtupleu _namedtupleuMatchu_calculate_ratiouSequenceMatcheruget_close_matchesu_count_leadinguDifferureucompileumatchu IS_LINE_JUNKuIS_CHARACTER_JUNKu_format_range_unifiedu unified_diffu_format_range_contextu context_diffuNoneundiffu_mdiffu_file_templateu_stylesu_table_templateu_legenduobjectuHtmlDiffurestoreu_testu__name__(((u,/opt/alt/python33/lib64/python3.3/difflib.pyusN     0 V  G J$  ]