mò %U²Ic@sÝdZdZdkZdkZdkZdkZeedƒpedƒ‚ndddgZda da d „Z d „Z de fd „ƒYZd „Zd fd„ƒYZd„Zd„Zedjo e ƒndS(s–The Tab Nanny despises ambiguous indentation. She knows no mercy. tabnanny -- Detection of ambiguous indentation For the time being this module is intended to be called as a script. However it is possible to import it into an IDE and use the function check() described below. Warning: The API provided by this module is likely to change in future releases; such changes may not be backward compatible. t6NtNLs4tokenize.NL doesn't exist -- tokenize module too oldtchecktNannyNagtprocess_tokensicGsKd}x.|D]&}tii|t|ƒƒd}q WtiidƒdS(Ntt s (tseptargstargtsyststderrtwritetstr(RR R((t%/data/zmath/lib/python2.4/tabnanny.pyterrprint#s  cCsÞy#titiddƒ\}}Wn&tij o}t|ƒdSnXxJ|D]B\}}|djot da n|djot da qSqSW|ptdtiddƒdSnx|D]}t |ƒqÆWdS(Nitqvs-qs-vsUsage:is[-v] file_or_directory ...(tgetoptR targvtoptsRterrortmsgRtotat filename_onlytverboseR R(RRRR RR((Rtmain*s$#     cBs2tZdZd„Zd„Zd„Zd„ZRS(sg Raised by tokeneater() if detecting an ambiguous indent. Captured and handled in check(). cCs!||||_|_|_dS(N(tlinenoRtlinetself(RRRR((Rt__init__AscCs|iS(N(RR(R((Rt get_linenoCscCs|iS(N(RR(R((Rtget_msgEscCs|iS(N(RR(R((Rtget_lineGs(t__name__t __module__t__doc__RRR R!(((RR<s    c Cs2tii|ƒoºtii|ƒ o¦tod|fGHnti|ƒ}xu|D]m}tii ||ƒ}tii|ƒotii|ƒ ptii |dƒdjot |ƒqTqTWdSnyt |ƒ}Wn-tj o!}td||fƒdSnXtdjo d|GHnytti|iƒƒWnÓtij o!}td||fƒdSn¥tj o˜}|iƒ}|iƒ}to*d ||fGHd |fGH|iƒGHnCd |jod |d }nto |GHn|G|Gt|ƒGHdSnXtod |fGHndS(s~check(file_or_dir) If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is checked for whitespace related problems. The diagnostic messages are written to standard output using the print statement. s%r: listing directoryiýÿÿÿs.pyNs%r: I/O Error: %sischecking %r ...s%r: Token Error: %ss)%r: *** Line %d: trouble in tab city! ***soffending line: %rRt"s%r: Clean bill of health.( tostpathtisdirtfiletislinkRtlistdirtnamestnametjointfullnametnormcaseRtopentftIOErrorRRRttokenizetgenerate_tokenstreadlinet TokenErrorRtnagRtbadlineR!RR Rtrepr( R)R-R2RR8R9R,RR/((RRJsL'D         t WhitespacecBsStZd\ZZd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( Ns c Cs||_titi}}g}d}}}xª|iD]Ÿ}||jo|d}|d}q:||jof|d}|d}|t |ƒjo#|dg|t |ƒd}n||d||RDR?RC((RR—s*       #   cCs&|i\}}tt|ƒd|ƒS(Ni(RRGR@ttrailingtmaxRE(RR@RI((Rtlongest_run_of_spaces°scCs^|i\}}d}x3t|t|ƒƒD]}|||||}q+W||||i S(Ni( RRGR@RItiltrangettabsizeREtiRC(RRNR@RORIRL((Rt indent_level´s cCs|i|ijS(N(RRGtother(RRQ((RtequalËscCs’t|iƒ|iƒƒd}g}xftd|dƒD]Q}|i|ƒ|i|ƒjo,|i ||i|ƒ|i|ƒfƒq9q9W|S(Ni( RJRRKRQRBRRMttsRPtappend(RRQRRSRB((Rtnot_equal_witnessÒs 0cCs«|i|ijotSn|io|io|i|ijSnt|iƒ|iƒƒd}xBtd|dƒD]-}|i |ƒ|i |ƒjotSqvqvWt S(Nii( RRBRQtFalseRHRCRJRKRMRSRPtTrue(RRQRSRB((Rtlessês  cCs’t|iƒ|iƒƒd}g}xftd|dƒD]Q}|i|ƒ|i|ƒjo,|i ||i|ƒ|i|ƒfƒq9q9W|S(Ni( RJRRKRQRBRRMRSRPRT(RRQRRSRB((Rtnot_less_witnessûs 0( R"R#R>R?RRKRPRRRURXRY(((RR;€s       cCsNtd„|ƒ}d}t|ƒdjo|d}n|ddi|ƒS(NcCst|dƒS(Ni(R ttup(RZ((Rtss at tab sizeitsRs, (tmaptwtfirststprefixRER.(R^R`R_((Rtformat_witnessess cCs—ti}ti}ti}titif}tdƒg}d}xN|D]F\} }}} } | |jo d}qI| |jotd}t|ƒ}|di|ƒp=|di|ƒ} dt| ƒ} t|d| | ƒ‚n|i|ƒqI| |jod}|d=qI|ot| |jogd}t| ƒ}|di|ƒp=|di|ƒ} dt| ƒ} t|d| | ƒ‚qqIqIWdS(NRiiiÿÿÿÿsindent not greater e.g. sindent not equal e.g. (R4tINDENTtDEDENTtNEWLINEtCOMMENTRtJUNKR;tindentst check_equalttokensttypettokentstarttendRtthisguyRXRYtwitnessRaRRRTRRRU(RiRcRfRbRnRdRkRlRgRoRRmRRjRh((RR s8          t__main__(R$t __version__R&R RR4thasattrt ValueErrort__all__RRRRt ExceptionRRR;RaRR"( RR;RtRRaRR RR4RRRqR&((Rt? s&       6†  7