;
Êâ"Ic               @   sã   d  Z  d Z d d l Z d d l Z d d l Z d d l Z e e d ƒ p e d ƒ ‚ n d d d g Z d a	 d a
 d	 „  Z d
 „  Z Gd „  d e ƒ Z d „  Z Gd „  d ƒ Z d „  Z d „  Z e d k o e ƒ  n d S(   u–  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.
u   6i    Nu   NLu4   tokenize.NL doesn't exist -- tokenize module too oldu   checku   NannyNagu   process_tokensc              G   sK   d } x. |  D]& } t  j j | t | ƒ ƒ d } q Wt  j j d ƒ d  S(   Nu    u    u   
(   u   sysu   stderru   writeu   str(   u   argsu   sepu   arg(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   errprint#   s     
c              C   só   y) t  j  t j d d  … d ƒ \ }  } Wn8 t  j k
 o) } z t | ƒ d  SWYd  d  } ~ Xn XxJ |  D]B \ } } | d k o t d a n | d k o t d a qk qk W| p t d t j d d ƒ d  Sx | D] } t | ƒ qÛ Wd  S(   Ni   u   qvu   -qu   -vu   Usage:i    u   [-v] file_or_directory ...(   u   getoptu   sysu   argvu   erroru   errprintu   filename_onlyu   verboseu   check(   u   optsu   argsu   msgu   ou   au   arg(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   main*   s"    )
  c             B   s8   |  Ee  Z d  Z d „  Z d „  Z d „  Z d „  Z d S(   ug   
    Raised by tokeneater() if detecting an ambiguous indent.
    Captured and handled in check().
    c             C   s!   | | | |  _  |  _ |  _ d  S(   N(   u   linenou   msgu   line(   u   selfu   linenou   msgu   line(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   __init__A   s    c             C   s   |  j  S(   N(   u   lineno(   u   self(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu
   get_linenoC   s    c             C   s   |  j  S(   N(   u   msg(   u   self(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   get_msgE   s    c             C   s   |  j  S(   N(   u   line(   u   self(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   get_lineG   s    N(   u   __name__u
   __module__u   __doc__u   __init__u
   get_linenou   get_msgu   get_line(   u
   __locals__(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   NannyNag<   s
   
			c       	      C   sÏ  t  j j |  ƒ oÂ t  j j |  ƒ o® t o t d |  f ƒ n t  j |  ƒ } x{ | D]s } t  j j |  | ƒ } t  j j | ƒ o t  j j | ƒ p# t  j j | d d … ƒ d k o t	 | ƒ qY qY Wd Sy t
 |  ƒ } Wn? t k
 o3 } z t d |  | f ƒ d SWYd d } ~ Xn Xt d k o t d |  ƒ n y t t j | j ƒ ƒ WnLt j k
 o3 } z t d |  | f ƒ d SWYd d } ~ Xnt k
 o3 } z t d	 |  | f ƒ d SWYd d } ~ XnÎ t k
 oÁ } z« | j ƒ  } | j ƒ  } t o9 t d
 |  | f ƒ t d | f ƒ t | j ƒ  ƒ nK d |  k o d |  d }  n t o t |  ƒ n t |  | t | ƒ ƒ d SWYd d } ~ Xn Xt o t d |  f ƒ n d S(   u~  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.
    u   %r: listing directoryiýÿÿÿNu   .pyu   %r: I/O Error: %si   u   checking %r ...u   %r: Token Error: %su   %r: Indentation Error: %su)   %r: *** Line %d: trouble in tab city! ***u   offending line: %ru    u   "u   %r: Clean bill of health.(   u   osu   pathu   isdiru   islinku   verboseu   printu   listdiru   joinu   normcaseu   checku   openu   IOErroru   errprintu   process_tokensu   tokenizeu   generate_tokensu   readlineu
   TokenErroru   IndentationErroru   NannyNagu
   get_linenou   get_lineu   get_msgu   filename_onlyu   repr(	   u   fileu   namesu   nameu   fullnameu   fu   msgu   nagu   badlineu   line(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   checkJ   sT    
' #  c             B   sY   |  Ee  Z d  \ Z Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d S(	   u    	c       	      C   s  | |  _  t j t j } } g  } d } } } xª |  j  D]Ÿ } | | k o | d } | d } q: | | k of | d } | d } | t | ƒ k o# | d g | t | ƒ d } n | | d | | <d } q: Pq: W| |  _ | |  _ t | ƒ | f |  _ t | ƒ d k |  _	 d  S(   Ni    i   (
   u   rawu
   Whitespaceu   Su   Tu   lenu   nu   ntu   tupleu   normu	   is_simple(	   u   selfu   wsu   Su   Tu   countu   bu   nu   ntu   ch(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   __init__›   s*    	
 


#
		c             C   s&   |  j  \ } } t t | ƒ d | ƒ S(   Ni   (   u   normu   maxu   len(   u   selfu   countu   trailing(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   longest_run_of_spaces´   s    c             C   s^   |  j  \ } } d } x3 t | t | ƒ ƒ D] } | | | | | } q+ W| | | |  j S(   Ni    (   u   normu   rangeu   lenu   nt(   u   selfu   tabsizeu   countu   trailingu   ilu   i(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   indent_level¸   s     c             C   s   |  j  | j  k S(   N(   u   norm(   u   selfu   other(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   equalÏ   s    c             C   s’   t  |  j ƒ  | j ƒ  ƒ d } g  } xf t d | d ƒ D]Q } |  j | ƒ | j | ƒ k o, | j | |  j | ƒ | j | ƒ f ƒ q9 q9 W| S(   Ni   (   u   maxu   longest_run_of_spacesu   rangeu   indent_levelu   append(   u   selfu   otheru   nu   au   ts(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   not_equal_witnessÖ   s     	c             C   s¢   |  j  | j  k o d S|  j o | j o |  j | j k St |  j ƒ  | j ƒ  ƒ d } x? t d | d ƒ D]* } |  j | ƒ | j | ƒ k o d Sqp Wd S(   Ni   i   FT(	   u   nu   Falseu	   is_simpleu   ntu   maxu   longest_run_of_spacesu   rangeu   indent_levelu   True(   u   selfu   otheru   nu   ts(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   lessî   s     	c             C   s’   t  |  j ƒ  | j ƒ  ƒ d } g  } xf t d | d ƒ D]Q } |  j | ƒ | j | ƒ k o, | j | |  j | ƒ | j | ƒ f ƒ q9 q9 W| S(   Ni   (   u   maxu   longest_run_of_spacesu   rangeu   indent_levelu   append(   u   selfu   otheru   nu   au   ts(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   not_less_witnessÿ   s     	N(   u   __name__u
   __module__u   Su   Tu   __init__u   longest_run_of_spacesu   indent_levelu   equalu   not_equal_witnessu   lessu   not_less_witness(   u
   __locals__(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu
   Whitespace„   s   
						u
   Whitespacec             C   sN   t  d „  |  ƒ } d } t |  ƒ d k o | d } n | d d j | ƒ S(   Nc             S   s   t  |  d  ƒ S(   i    (   u   str(   u   tup(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   <lambda>  s    u   at tab sizei   u   su    u   , (   u   mapu   lenu   join(   u   wu   firstsu   prefix(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   format_witnesses
  s
    c             C   s—  t  j } t  j } t  j } t  j t  j f } t d ƒ g } d } xN|  D]F\ } } }	 }
 } | | k o
 d } qI | | k ot d } t | ƒ } | d j | ƒ p= | d j | ƒ } d t	 | ƒ } t
 |	 d | | ƒ ‚ n | j | ƒ qI | | k o d } | d =qI | ot | | k og d } t | ƒ } | d j | ƒ p= | d j | ƒ } d t	 | ƒ } t
 |	 d | | ƒ ‚ qqI qI Wd  S(   Nu    i    i   iÿÿÿÿu   indent not greater e.g. u   indent not equal e.g. (   u   tokenizeu   INDENTu   DEDENTu   NEWLINEu   COMMENTu   NLu
   Whitespaceu   lessu   not_less_witnessu   format_witnessesu   NannyNagu   appendu   equalu   not_equal_witness(   u   tokensu   INDENTu   DEDENTu   NEWLINEu   JUNKu   indentsu   check_equalu   typeu   tokenu   startu   endu   lineu   thisguyu   witnessu   msg(    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   process_tokens  s8    			 

u   __main__(   u   __doc__u   __version__u   osu   sysu   getoptu   tokenizeu   hasattru
   ValueErroru   __all__u   verboseu   filename_onlyu   errprintu   mainu	   Exceptionu   NannyNagu   checku
   Whitespaceu   format_witnessesu   process_tokensu   __name__(    (    (    u%   /mit/python/lib/python3.0/tabnanny.pyu   <module>   s&   			:†		7