Your IP : 3.146.178.220


Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/tabnanny.cpython-311.opt-1.pyc

�

c��f0,���dZdZddlZddlZddlZgd�Zdadad�Zd�Z	Gd�de
��Zd	�ZGd
�d��Z
d�Zd
�Zedkre	��dSdS)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)�check�NannyNag�process_tokensc��d}|D]3}tj�|t|��z��d}�4tj�d��dS)N�� �
)�sys�stderr�write�str)�args�sep�args   �//opt/alt/python311/lib64/python3.11/tabnanny.py�errprintr sY��
�C������
����s�3�x�x��(�(�(�����J���T������c�x�ddl}	|�tjdd�d��\}}n'#|j$r}t	|��Yd}~dSd}~wwxYw|D]%\}}|dkr
t
dza|dkr
tdza�&|s#t	dtjdd��dS|D]}t|���dS)Nr��qvz-qz-vzUsage:z[-v] file_or_directory ...)�getoptr�argv�errorr�
filename_only�verboser)r�optsr�msg�o�ars       r�mainr!'s����M�M�M���]�]�3�8�A�B�B�<��6�6�
��d�d���<������
�
�
����������������"�"���1���9�9�)�A�-�M���9�9���k�G������3�8�A�;�(D�E�E�E�������
�c�
�
�
�
��s�+2�
A�A�Ac�*�eZdZdZd�Zd�Zd�Zd�ZdS)rzk
    Raised by process_tokens() if detecting an ambiguous indent.
    Captured and handled in check().
    c�2�|||c|_|_|_dS�N)�linenor�line)�selfr%rr&s    r�__init__zNannyNag.__init__@s��+1�3��(���T�X�t�y�y�yrc��|jSr$)r%�r's r�
get_linenozNannyNag.get_linenoBs
���{�rc��|jSr$)rr*s r�get_msgzNannyNag.get_msgDs	���x�rc��|jSr$)r&r*s r�get_linezNannyNag.get_lineFs
���y�rN)�__name__�
__module__�__qualname__�__doc__r(r+r-r/�rrrr;sZ��������=�=�=�����������rrc�|�tj�|��r�tj�|��s�trt|�d���tj|��}|D]�}tj�||��}tj�|��rtj�|��r+tj�|dd���dkrt|����dS	tj|��}n,#t$r}t|�d|����Yd}~dSd}~wwxYwtdkrtd|z��	ttj|j�����n_#tj$r3}t|�d|����Yd}~|���dSd}~wt&$r3}t|�d	|����Yd}~|���dSd}~wt($r�}|���}|���}trHtd
||fz��td|����t|�����nAd|vrd
|zd
z}t0rt|��nt||t3|����Yd}~|���dSd}~wwxYw	|���n#|���wxYwtrt|�d���dSdS)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: listing directory���Nz.pyz
: I/O Error: rzchecking %r ...z: Token Error: z: Indentation Error: z)%r: *** Line %d: trouble in tab city! ***zoffending line: r	�"z: Clean bill of health.)�os�path�isdir�islinkr�print�listdir�join�normcaser�tokenize�open�OSErrorrr�generate_tokens�readline�
TokenError�close�IndentationErrorrr+r/r-r�repr)	�file�names�name�fullname�fr�nag�badliner&s	         rrrIsU��
�w�}�}�T���
�2�7�>�>�$�#7�#7�
��	5��T�T�T�3�4�4�4��
�4� � ���	 �	 �D��w�|�|�D�$�/�/�H���
�
�h�'�'�
 ��G�N�N�8�,�,�
 ��� � ��b�c�c��+�+�u�4�4��h���������M�$��������������c�c�2�3�3�3�����������������{�{�
��$�&�'�'�'���x�/��
�;�;�<�<�<�<��������$�$�$���4�5�5�5�����(	
���	�	�	�	�	�����%��������c�c�:�;�;�;����� 	
���	�	�	�	�	����������.�.�"�"���|�|�~�~���	3��=��w��O�P�P�P��E�$�$�0�1�1�1��#�+�+�-�-� � � � ��d�{�{�3��:��#3�D��
3�e�D�k�k�k�k���g�t�D�z�z�2�2�2�����	
���	�	�	�	�	���������	=�0	
���	�	�	�	�����	�	�	�	�����5�
�T�T�T�3�4�4�4�4�4�5�5sm�D!�!
E
�+E�E
�+&F�L�K/�"G�6L�
K/�H�1L�
K/�B8K*�L�*K/�/L�Lc�B�eZdZd\ZZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	S)
�
Whitespacez 	c��||_tjtj}}g}dx}x}}|jD]c}||kr|dz}|dz}�||krJ|dz}|dz}|t	|��kr|dg|t	|��z
dzzz}||dz||<d}�c||_||_t|��|f|_t	|��dk|_	dS)Nrr)
�rawrQ�S�T�len�n�nt�tuple�norm�	is_simple)	r'�wsrTrU�count�brWrX�chs	         rr(zWhitespace.__init__�s�������|�Z�\�1��������A���(�	�	�B��Q�w�w���E����E����q�����E���!�V����E�
�
�?�?�!�Q�C�1�s�5�z�z�>�A�+=�$>�>�E� ��8�a�<��a�������������%�L�L�!�O��	��U���q�����rc�V�|j\}}tt|��dz
|��S�Nr)rZ�maxrV)r'r]�trailings   r�longest_run_of_spacesz Whitespace.longest_run_of_spaces�s'���)���x��3�u�:�:�a�<��*�*�*rc��|j\}}d}t|t|����D]}|||z||zz}�||||jzzzS)Nr)rZ�rangerVrX)r'�tabsizer]rc�il�is      r�indent_levelzWhitespace.indent_level�sb���)���x�
���w��E�
�
�+�+�	,�	,�A��a��j�5��8�+�+�B�B��'�R�$�'�\�2�2�2rc�"�|j|jkSr$)rZ)r'�others  r�equalzWhitespace.equal�s���y�E�J�&�&rc�x�t|���|�����dz}g}td|dz��D]l}|�|��|�|��kr>|�||�|��|�|��f���m|Sra�rbrdrfrj�append�r'rlrWr �tss     r�not_equal_witnesszWhitespace.not_equal_witness�������*�*�,�,��+�+�-�-�
/�
/�12�
3������1�Q�3�-�-�	5�	5�B�� � ��$�$��(:�(:�2�(>�(>�>�>����2��,�,�R�0�0� �-�-�b�1�1�3�5�5�5���rc�^�|j|jkrdS|jr|jr|j|jkSt|���|�����dz}td|dz��D]1}|�|��|�|��krdS�2dS)NFr�T)rWr[rXrbrdrfrj)r'rlrWrrs    r�lesszWhitespace.less�s����6�U�W����5��>�	'�e�o�	'��7�e�h�&�&���*�*�,�,��+�+�-�-�
/�
/�12�
3����1�Q�3�-�-�	�	�B�� � ��$�$��(:�(:�2�(>�(>�>�>��u�u�?��trc�x�t|���|�����dz}g}td|dz��D]l}|�|��|�|��kr>|�||�|��|�|��f���m|Srarorqs     r�not_less_witnesszWhitespace.not_less_witnessrtrN)r0r1r2rTrUr(rdrjrmrsrwryr4rrrQrQ�s��������D�A�q�*)�)�)�2+�+�+�3�3�3�.'�'�'�	�	�	�0���"	�	�	�	�	rrQc��d�|D��}d}t|��dkr|dz}|dzd�|��zS)Nc3�@K�|]}t|d��V��dS)rN)r)�.0�tups  r�	<genexpr>z#format_witnesses.<locals>.<genexpr>
s,����
'�
'�c�c�#�a�&�k�k�
'�
'�
'�
'�
'�
'rzat tab sizer�sr	z, )rVr>)�w�firsts�prefixs   r�format_witnessesr�sM��
'�
'�Q�
'�
'�
'�F�
�F�
�1�v�v��z�z��#����C�<�$�)�)�F�+�+�+�+rc���tj}tj}tj}tjtjf}t
d��g}d}|D�] \}}}	}
}||krd}�||kr�d}t
|��}|d�|��sD|d�|��}
dt|
��z}t|	d||���|�|����||krd}|d=��|rt||vrpd}t
|��}|d�|��sD|d�
|��}
dt|
��z}t|	d||�����"dS)Nrrr���zindent not greater e.g. zindent not equal e.g. )r@�INDENT�DEDENT�NEWLINE�COMMENT�NLrQrwryr�rrprmrs)�tokensr�r�r��JUNK�indents�check_equal�type�token�start�endr&�thisguy�witnessrs               rrrs���
�_�F�
�_�F���G���X�[�(�D��"�~�~��G��K�+1�,4�,4�'��u�e�S�$��7�?�?��K�K�
�V�^�^��K� ��'�'�G��2�;�#�#�G�,�,�
4�!�"�+�6�6�w�?�?��0�3C�G�3L�3L�L���u�Q�x��d�3�3�3��N�N�7�#�#�#�#�
�V�^�^��K�����
�	4�T��-�-��K� ��&�&�G��2�;�$�$�W�-�-�
4�!�"�+�7�7��@�@��.�1A�'�1J�1J�J���u�Q�x��d�3�3�3��Y,4�,4r�__main__)r3�__version__r8rr@�__all__rrrr!�	ExceptionrrrQr�rr0r4rr�<module>r�s��
�
�$��	�	�	�	�
�
�
�
�����
1�
1�
1��
���
�������(�����y����;5�;5�;5�zD�D�D�D�D�D�D�D�L,�,�,�44�44�44�n�z����D�F�F�F�F�F��r

?>