grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î ¤ f’,ã@sôdZdZddlZddlZddlZddlZeedƒsZedƒ‚ndddgZda da d d „Z d d „Z Gd d„de ƒZdd„ZGdd„dƒZdd„Zdd„Zedkrðe ƒndS)a–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. Ú6éNÚNLz4tokenize.NL doesn't exist -- tokenize module too oldÚcheckÚNannyNagÚprocess_tokenscGsKd}x.|D]&}tjj|t|ƒƒd}q WtjjdƒdS)NÚú Ú )ÚsysÚstderrÚwriteÚstr)ÚargsÚsepÚarg©rú-/opt/alt/python34/lib64/python3.4/tabnanny.pyÚerrprint#s   rcCsëy)tjtjdd…dƒ\}}Wn6tjk ra}zt|ƒdSWYdd}~XnXxF|D]>\}}|dkrŽtdan|dkritdaqiqiW|sÌtdtjddƒdSx|D]}t|ƒqÓWdS)NéZqvz-qz-vzUsage:rz[-v] file_or_directory ...)Úgetoptr ÚargvÚerrorrÚ filename_onlyÚverboser)ZoptsrÚmsgÚoÚarrrrÚmain*s)     rc@sFeZdZdZdd„Zdd„Zdd„Zdd „Zd S) rzg Raised by tokeneater() if detecting an ambiguous indent. Captured and handled in check(). cCs!||||_|_|_dS)N)ÚlinenorÚline)ÚselfrrrrrrÚ__init__AszNannyNag.__init__cCs|jS)N)r)r rrrÚ get_linenoCszNannyNag.get_linenocCs|jS)N)r)r rrrÚget_msgEszNannyNag.get_msgcCs|jS)N)r)r rrrÚget_lineGszNannyNag.get_lineN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r!r"r#r$rrrrr<s    c %CsÉtjj|ƒrÌtjj|ƒ rÌtr?td|fƒntj|ƒ}xw|D]o}tjj||ƒ}tjj|ƒr•tjj|ƒ s·tjj|dd…ƒdkrUt |ƒqUqUWdSyt j |ƒ}Wn=t k r}zt d||fƒdSWYdd}~XnXtdkr<td|ƒnzaytt j|jƒƒWn@t jk r›}zt d||fƒdSWYdd}~Xntk r×}zt d ||fƒdSWYdd}~XnÅtk r›}z¥|jƒ}|jƒ}tr?td ||fƒtd |fƒt|jƒƒnFd |kr\d |d }ntrot|ƒnt||t|ƒƒdSWYdd}~XnXWd|jƒXtrÅtd|fƒndS)a~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. z%r: listing directoryéNz.pyz%r: I/O Error: %srzchecking %r ...z%r: Token Error: %sz%r: Indentation Error: %sz)%r: *** Line %d: trouble in tab city! ***zoffending line: %rrú"z%r: Clean bill of health.éýÿÿÿ)ÚosÚpathÚisdirÚislinkrÚprintÚlistdirÚjoinÚnormcaserÚtokenizeÚopenÚOSErrorrrÚgenerate_tokensÚreadlineÚ TokenErrorÚIndentationErrorrr"r$r#rÚreprÚclose) ÚfileÚnamesÚnameÚfullnameÚfrZnagÚbadlinerrrrrJsT % "      c@speZdZd\ZZdd„Zdd„Zdd„Zdd „Zd d „Z d d „Z dd„Z dS)Ú Whitespacez c Cs||_tjtj}}g}d}}}x¤|jD]™}||krc|d}|d}q:||krÒ|d}|d}|t|ƒkr·|dg|t|ƒd}n||d||sz#format_witnesses..z at tab sizerÚsrz, )rGr2)ÚwZfirstsÚprefixrrrÚformat_witnesses s  rdcCsŠtj}tj}tj}tjtjf}tdƒg}d}xA|D]9\}}} } } ||krsd}qI||krðd}t|ƒ} |dj| ƒsà|dj| ƒ} dt | ƒ}t | d|| ƒ‚n|j | ƒqI||kr d}|d=qI|rI||krId}t| ƒ} |d j | ƒs‚|d j | ƒ} dt | ƒ}t | d|| ƒ‚q‚qIqIWdS) Nrrrzindent not greater e.g. zindent not equal e.g. éÿÿÿÿrererere)r4ÚINDENTÚDEDENTÚNEWLINEÚCOMMENTrrCr\r]rdrrXrWrZ)ÚtokensrfrgrhZJUNKÚindentsZ check_equalÚtypeÚtokenÚstartÚendrZthisguyZwitnessrrrrrs6          Ú__main__)r(Ú __version__r,r rr4ÚhasattrÚ ValueErrorÚ__all__rrrrÚ ExceptionrrrCrdrr%rrrrÚ s&       =†  7