;ò L+(;c@s…dZdddfZdkZdZdkZeidƒid„Zdd„Z[d fd „ƒYZ d „Z hd d <dd<dd<dd file1_or_file2 Print a human-friendly file difference report to stdout. Both inter- and intra-line differences are noted. In the second form, recreate file1 (-r1) or file2 (-r2) on stdout, from an ndiff report on stdin. In the first form, if -q ("quiet") is not specified, the first two lines of output are -: file1 +: file2 Each remaining line begins with a two-letter code: "- " line unique to file1 "+ " line unique to file2 " " line common to both files "? " line not present in either input file Lines beginning with "? " attempt to guide the eye to intraline differences, and were not present in either input file. These lines can be confusing if the source files contain tab characters. The first file can be recovered by retaining only lines that begin with " " or "- ", and deleting those 2-character prefixes; use ndiff with -r1. The second file can be recovered similarly, but by retaining only " " and "+ " lines; use ndiff with -r2; or, on Unix, the second file can be recovered by piping the output through sed -n '/^[+ ] /s/^..//p' See module comments for details and programmatic interface. iiiNs \s*#?\s*$cCs||ƒtj SdS(N(spatslinesNone(slinespat((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pys IS_LINE_JUNKjss cCs||jSdS(N(schsws(schsws((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysIS_CHARACTER_JUNKmssSequenceMatchercBs}tZeddd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „ZRS(NscCs-||_t|_|_|i||ƒdS(N(sisjunksselfsNonesasbsset_seqs(sselfsisjunksasb((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pys__init__ss& cCs|i|ƒ|i|ƒdS(N(sselfsset_seq1sasset_seq2sb(sselfsasb((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysset_seqss cCs5||ijodSn||_t|_|_dS(N(sasselfsNonesmatching_blockssopcodes(sselfsa((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysset_seq1¡s cCsH||ijodSn||_t|_|_t|_|iƒdS(N(sbsselfsNonesmatching_blockssopcodess fullbcounts_SequenceMatcher__chain_b(sselfsb((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysset_seq2§s   cCså|i}h|_}|i|_}xStt|ƒƒD]?}||}||ƒo||i |ƒq9|g||= 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. 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. If no blocks match, return (alo, blo, 0). iisget_matching_blockss returnsN(sselfsasbsb2jsisbjunksalosblosbestisbestjsbestsizesj2lensnothingsxrangesahisisgetsj2lengetsnewj2lensjsbhisksTRACE(sselfsalosahisblosbhisbestisbsbestjsisnewj2lensbestsizesjsisbjunksasnothingsj2lengetsj2lensksb2j((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysfind_longest_matchás:*    0 L)TcCsŸ|itj o |iSng|_t|iƒt|iƒf\}}|id|d||iƒ|ii ||dfƒt odG|iGHn|iSdS(Nis*** matching blocks( sselfsmatching_blockssNoneslensasbslaslbs_SequenceMatcher__helpersappendsTRACE(sselfslbsla((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysget_matching_blocks5s  $c Cs¿|i||||ƒ\}}} }| o||jo ||jo|i |||||ƒn|i |ƒ|| |jo|| |jo%|i || ||| ||ƒq»ndS(N( sselfsfind_longest_matchsalosahisblosbhisisjsksxs_SequenceMatcher__helpersanswersappend( sselfsalosahisblosbhisanswersjsisxsk((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pys__helperCs% "cCsAtd„|iƒdƒ}d|t|iƒt|iƒSdS(s/Return 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*M / T. Note that this is 1 if the sequences are identical, and 0 if they have nothing in common. cCs ||dS(Niÿÿÿÿ(ssumstriple(ssumstriple((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysXsif2.0N(sreducesselfsget_matching_blockssmatchesslensasb(sselfsmatches((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysratioOs cCs|itjo?h|_}x/|iD] }|i|dƒd||sss-s+s?(2sTRACEsalosahisblosbhisdumpsasbs best_ratioscutoffsSequenceMatchersIS_CHARACTER_JUNKscrunchersNoneseqiseqjsxrangesjsbjsset_seq2sisaisset_seq1sreal_quick_ratios quick_ratiosratiosbest_isbest_js plain_replaces fancy_helpersaeltsbeltsatagssbtagssset_seqss get_opcodesstagsai1sai2sbj1sbj2slaslbs ValueErrorslensmapscombinedsstringsrstripsjoin(sasalosahisbsblosbhiscutoffsaisaeltstagsbest_isbest_jslbslascrunchersai1sai2seqiseqjscombineds best_ratiosbeltsbjsbtagssbj2sbj1satagssisj((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pys fancy_replace²sv       9*           2cCsv||joA||jot||||||ƒqrtd|||ƒn%||jotd|||ƒndS(Ns-s+(salosahisblosbhis fancy_replacesasbsdump(sasalosahisbsblosbhi((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pys fancy_helpers    cCs5dk}|ii}||dƒ|tƒdSdS(Ns i(ssyssstderrswritesoutsmsgs__doc__(smsgssyssout((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysfails    cCsIyt|dƒSWn1tj o%}td|dt|ƒƒSnXdS(Nsrscouldn't open s: (sopensfnamesIOErrorsdetailsfailsstr(sfnamesdetail((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysfopen sc Cs@t|ƒ}t|ƒ}| p| odSn|iƒ}|iƒ|iƒ}|iƒt t ||ƒ}xÇ|i ƒD]¹\} }}} } | djot||||| | ƒq{| djotd|||ƒq{| djotd|| | ƒq{| djotd|||ƒq{td | ‚q{Wd SdS( Nisreplacesdeletes-sinserts+sequals s unknown tag i(sfopensf1namesf1sf2namesf2s readlinessasclosesbsSequenceMatchers IS_LINE_JUNKscrunchers get_opcodesstagsalosahisblosbhis fancy_replacesdumps ValueError( sf1namesf2namesasf1sf2sbsaloscrunchersahisblosbhistag((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysfcompare's&       c Csqdk}y|i|dƒ\} }Wn(|ij o}tt|ƒƒSnXd} d}}xN| D]F\}}|djod}d} qg|djod}|} qgqgW|o|otdƒSn|oB|otdƒSn| djot | ƒdSntd ƒSnt|ƒd jotd ƒSn|\}}| od G|GHd G|GHnt||ƒSdS(Nsqr:iis-qs-rscan't specify both -q and -rsno args allowed with -r options12s-r value must be 1 or 2isneed 2 filename argss-:s+:(sgetoptsargssoptsserrorsdetailsfailsstrsnoisysqseensrseensoptsvals whichfilesrestoreslensf1namesf2namesfcompare( sargssoptsvalsf2namesdetailsf1namesqseensgetoptsrseens whichfilesoptssnoisy((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysmainBs>           cCsldk}hdd<dd<|}d|f}x4|iiƒD]#}|d |jo |dGqAqAWdS(Ns1s- s2s+ s i(ssysswhichstagsprefixessstdins readlinessline(swhichssyssprefixesslinestag((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pysrestorebs  s__main__s-profiles ndiff.pros main(args)stime("s__doc__s __version__sstringsTRACEsrescompilesmatchs IS_LINE_JUNKsIS_CHARACTER_JUNKsSequenceMatchersdumps_combines plain_replaces fancy_replaces fancy_helpersfailsfopensfcomparesmainsrestores__name__ssyssargvsargssprofilespstatssremovesstatfsrunsStatssstatss strip_dirss sort_statss print_stats(srestoresdumpsfails plain_replacesfopensstatssstatfsres IS_LINE_JUNKsmainsSequenceMatchersprofilesfcomparesstringsargsssyss_combines fancy_replacesIS_CHARACTER_JUNKs __version__s fancy_helpersTRACEspstats((sW/mnt/gmirror/ports/devel/boaconstructor/work/boa-constructor-0.4.4/ExternalLib/ndiff.pys?,s<6   ÿ& *  \