Edit File: tabnanny.cpython-36.pyc
3 � \�,������������������@���s����d�Z�dZddlZddlZddlZddlZeed�s:ed��dddgZda da d d ��Zdd��ZG�d d��de �Zdd��ZG�dd��d�Zdd��Zdd��Zedkr�e���dS�)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_tokensc��������������G���s:���d}x$|�D�]}t�jj|t|����d}q W�t�jjd��d�S�)N��� � )�sys�stderr�write�str)�args�sep�arg��r���� /usr/lib64/python3.6/tabnanny.py�errprint#���s ���� r���c��������������C���s����yt�j�tjdd���d�\}�}W�n*�t�jk rH�}�zt|��d�S�d�}~X�nX�x0|�D�](\}}|dkrhtd�a|dkrPtd�aqPW�|s�tdtjd�d��d�S�x|D�]}t|��q�W�d�S�)N����Zqvz-qz-vzUsage:r���z[-v] file_or_directory ...)�getoptr ����argv�errorr���� filename_only�verboser���)Zoptsr����msg�o�ar���r���r���r����main*���s���� r���c���������������@���s0���e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd S�)r���zk Raised by process_tokens() if detecting an ambiguous indent. Captured and handled in check(). c�������������C���s���|||��|�_�|�_|�_d�S�)N)�linenor����line)�selfr���r���r���r���r���r����__init__A���s����zNannyNag.__init__c�������������C���s���|�j�S�)N)r���)r ���r���r���r���� get_linenoC���s����zNannyNag.get_linenoc�������������C���s���|�j�S�)N)r���)r ���r���r���r����get_msgE���s����zNannyNag.get_msgc�������������C���s���|�j�S�)N)r���)r ���r���r���r����get_lineG���s����zNannyNag.get_lineN)�__name__� __module__�__qualname__�__doc__r!���r"���r#���r$���r���r���r���r���r���<���s ���c������� ���%���C���s"��t�jj|��r�t�jj|���r�tr,td|�f���t�j|��}xT|D�]L}t�jj|�|�}t�jj|�rht�jj|��s�t�jj|dd���dkr<t |��q<W�dS�yt j|��}W�n0�tk r��}�zt d|�|f���dS�d}~X�nX�tdkr�td|�����zytt j|j���W���n��t jk �r2�}�zt d|�|f���dS�d}~X�n��tk �rb�}�zt d |�|f���dS�d}~X�n��tk �r��}�z||j��}|j��}t�r�td |�|f���td|f���t|j����n6d|�k�r�d |��d �}�t�r�t|���nt|�|t|���dS�d}~X�nX�W�d|j���X�t�rtd|�f���dS�)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: %sr���zchecking %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�OSErrorr���r����generate_tokens�readline� TokenError�IndentationErrorr���r"���r$���r#���r����repr�close) �file�names�name�fullname�fr���Znag�badliner���r���r���r���r���J���sT���� �� c���������������@���sL���e�Zd�Zd\ZZdd��Zdd��Zdd��Zdd ��Zd d��Z dd ��Z dd��ZdS�)� Whitespacez c������� ������C���s����||�_�tjtj�}}g�}d�}�}}x~|�j�D�]t}||krJ|d�}|d�}q,||kr�|d�}|d�}|t|�kr�|dg|t|��d���}||�d�||<�d}q,P�q,W�||�_||�_t|�|f|�_t|�dk|�_ d�S�)Nr���r���) �rawrC����S�T�len�n�nt�tuple�norm� is_simple) r ���ZwsrE���rF����count�brH���rI���Zchr���r���r���r!�������s(���� zWhitespace.__init__c�������������C���s���|�j�\}}tt|�d�|�S�)Nr���)rK����maxrG���)r ���rM����trailingr���r���r����longest_run_of_spaces����s���� z Whitespace.longest_run_of_spacesc�������������C���sL���|�j�\}}d}x*t|t|��D�]}|||�||���}qW�||||�j���S�)Nr���)rK����rangerG���rI���)r ����tabsizerM���rP���Zil�ir���r���r����indent_level����s ���� zWhitespace.indent_levelc�������������C���s���|�j�|j�kS�)N)rK���)r ����otherr���r���r����equal����s����zWhitespace.equalc�������������C���sf���t�|�j��|j���d�}g�}xFtd|d��D�]4}|�j|�|j|�kr*|j||�j|�|j|�f��q*W�|S�)Nr���)rO���rQ���rR���rU����append)r ���rV���rH���r����tsr���r���r����not_equal_witness����s����zWhitespace.not_equal_witnessc�������������C���sr���|�j�|j�krdS�|�jr(|jr(|�j|jkS�t|�j��|j���d�}x.td|d��D�]}|�j|�|j|�krNdS�qNW�dS�)NFr�������T)rH���rL���rI���rO���rQ���rR���rU���)r ���rV���rH���rY���r���r���r����less����s����zWhitespace.lessc�������������C���sf���t�|�j��|j���d�}g�}xFtd|d��D�]4}|�j|�|j|�kr*|j||�j|�|j|�f��q*W�|S�)Nr���)rO���rQ���rR���rU���rX���)r ���rV���rH���r���rY���r���r���r����not_less_witness��s����zWhitespace.not_less_witnessN)r%���r&���r'���rE���rF���r!���rQ���rU���rW���rZ���r\���r]���r���r���r���r���rC�������s���rC���c�������������C���s8���dd��|�D��}d}t�|��dkr&|d�}|d�dj|��S�)Nc�������������s���s���|�]}t�|d���V��qdS�)r���N)r ���)�.0�tupr���r���r���� <genexpr>��s����z#format_witnesses.<locals>.<genexpr>zat tab sizer����sr���z, )rG���r2���)�wZfirsts�prefixr���r���r����format_witnesses ��s ����rd���c�������������C���s��t�j}t�j}t�j}t�jt�jf}td�g}d}x�|�D�]�\}}} } }||krNd}q2||kr�d}t|�}|d�j|�s�|d�j|�} dt | ��}t | d�||��|j|��q2||kr�d}|d=�q2|o�||kr2d}t|�}|d �j|�s2|d �j |�} dt | ��}t | d�||��q2W�d�S�)Nr���r���r���zindent not greater e.g. zindent not equal e.g. ���re���re���re���re���)r4����INDENT�DEDENT�NEWLINE�COMMENTr���rC���r\���r]���rd���r���rX���rW���rZ���)�tokensrf���rg���rh���ZJUNK�indentsZcheck_equal�type�token�start�endr���ZthisguyZwitnessr���r���r���r���r�����s6���� �__main__)r(����__version__r,���r ���r���r4����hasattr� ValueError�__all__r���r���r���r���� Exceptionr���r���rC���rd���r���r%���r���r���r���r����<module> ���s(��� =�7