AlkantarClanX12

Your IP : 3.137.169.14


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/__pycache__/pycodestyle.cpython-311.pyc

�

�܋fM���h�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
m
Z
ddlmZddl
mZ	ddlmZddlmZn#e$r	ddlmZYnwxYwejdkr3eeed	d����re��ej��e_d
ZdZdZ	ejd
krej�d��ZnCej� ej!d��pej�d��d��Zn
#e$rdZYnwxYwdZ"ej� ej�#e$��d��Z%dZ&ddd�Z'dZ(dZ)ddd�Z*dZ+e,gd���Z-e,ej.dd gz��e-z
Z/e,gd!���Z0e,gd"���Z1e1�2gd#���Z3ejd$krd%gngZ4e,gd&�e4z��Z5e,d'��Z6e,ej7ej8g��Z8e8�2ej9ej:g��Z;e;�2ej<ej=g��Z>gd(�Z?ej@d)��ZAej@d*��ZBej@d+��ZCej@d,��ZDej@d-��ZEej@d.��ZFej@d/��ZGej@d0��ZHej@d1��ZIej@d2��ZJej@d3d4� e/��z��ZKej@d5��ZLej@d6��ZMej@d7��ZNej@d8��ZOej@d9��ZPej@d:�Qd4� d;�d<D��������ZRej@d=��ZSej@d>��ZTiiid?�ZUd@�ZVd�dA�ZWeWdB���ZXeWdC���ZYeWdD���ZZeWdE���Z[eWdF���Z\dG�Z]eWdH���Z^eWdI���Z_eWdJ���Z`eWdK���ZaeWdL���ZbeWdM���ZceWdN���ZdeWdO���ZeeWdP���ZfeWdQ���ZgeWdR���ZheWdS���ZieWdT���ZjeWdU���ZkeWdV���ZleWdW���ZmeWdX���Zne,dY��e,dZ��zZod[�Zpd\�ZqeWd]���ZreWd^���ZseWd_���ZteWd`���ZueWda���ZveWdb���ZweWdc���ZxeWdd���ZyeWde���ZzeWdf���Z{eWdg���Z|eWdh���Z}eWdi���Z~eWdj���Zdk�Z�dl�Z�edm��ej@dnej���j���Z�do�Z�dp�Z�d�dr�Z�ej�fds�Z�d�du�Z�dv�Z�dw�Z�Gdx�dy��Z�Gdz�d{��Z�Gd|�d}e���Z�Gd~�de���Z�Gd��d�e���Z�Gd��d���Z�defd��Z�d��Z�		d�d��Z�d�d��Z�d��Z�e�d�kre���dSdS)�a�
Check Python source code formatting, according to PEP 8.

For usage and a list of options, try this:
$ python pycodestyle.py -h

This program and its regression test suite live here:
https://github.com/pycqa/pycodestyle

Groups of errors and warnings:
E errors
W warnings
100 indentation
200 whitespace
300 blank lines
400 imports
500 line length
600 deprecation
700 statements
900 syntax error
�N��fnmatch)�	lru_cache)�OptionParser)�RawConfigParser)�
TextIOWrapper)��
�_compilez2.9.1z'.svn,CVS,.bzr,.hg,.git,__pycache__,.toxz&E121,E123,E126,E226,E24,E704,W503,W504�win32z~\.pycodestyle�XDG_CONFIG_HOMEz	~/.config�pycodestyle)z	setup.cfgztox.ini�	testsuite�O��)�	top_level�method�H�z+%(path)s:%(row)d:%(col)d: %(code)s %(text)sz%%(path)s:%(row)d: [%(code)s] %(text)s)�default�pylinti)�False�None�True�print�async)�>>�**�*�+�-)rr �/z//r!r"�@)�^�&�|z<<r�%�r	�z:=)z**=z*=z/=z//=z+=z-=z!=�<>�<�>z%=z^=z&=z|=�==z<=z>=z<<=z>>=�=�and�in�is�orz->u 	 )�directories�files�
logical lines�physical linesz([ \t]*)zraise\s+\w+\s*,zraise\s+\w+\s*,.*,\s*\w+\s*$z\b[A-Z]\d{3}\bz	u?r?["\']z[\[({][ \t]|[ \t][\]}),;:](?!=)z[,;:]\s*(?:  |\t)z?(\bNone|\bFalse|\bTrue)?\s*([=!]=)\s*(?(1)|(None|False|True))\bz*\b(?<!is\s)(not)\s+[^][)(}{ ]+\s+(in|is)\szE(?:[=!]=|is(?:\s+not)?)\s+type(?:s.\w+Type|\s*\(\s*([^)]*[^ )])\s*\))z(\s*)\b(?:%s)\b(\s*)r'z*(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+|:=)(\s*)z
\blambda\bz*^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$z^(async\s+def|def)\bz#^(async\s+def\s+|def\s+|class\s+|@)z
^\s*({})\bc#�BK�|]}|�dd��V��dS)� z\s+N)�replace)�.0�ss  �\/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pycodestyle.py�	<genexpr>r>�s@����"�"�Q�!�)�)�C��"8�"8�"�"�"�"�"�"�)�defz	async def�forz	async for�if�elif�else�try�except�finally�withz
async with�class�whilez-^__([^\s]+)__(?::\s*[a-zA-Z.0-9_\[\]\"]+)? = z
except\s*:)�
physical_line�logical_line�treec�l�d�tj|��j���D��S)Nc�<�g|]}|j|jk�|j��S�)�kind�POSITIONAL_OR_KEYWORD�name)r;�	parameters  r=�
<listcomp>z#_get_parameters.<locals>.<listcomp>�s:��B�B�B���~��!@�@�@�
�N�A�@�@r?)�inspect�	signature�
parameters�values)�functions r=�_get_parametersr[�sC��B�B�� ��*�*�5�<�<�>�>�B�B�B�Br?c�b�d�}tj|��rSt|��}|rA|ddvr7|�!t�|jpd��}|||d||��nDtj|��r0t|j��dd�ddgkr||d|d��|S)	zRegister a new check object.c��|t|vr0t||d�|pg��dS|pdg|ft||<dS)Nr�)�_checks�extend)�checkrQ�codes�argss    r=�
_add_checkz"register_check.<locals>._add_check�s\���G�D�M�!�!��D�M�%� ��#�*�*�5�;�B�7�7�7�7�7�$)�M�b�T�4�#8�G�D�M�%� � � r?r)rKrLNr^r�selfrM)rV�
isfunctionr[�ERRORCODE_REGEX�findall�__doc__�isclass�__init__)rarbrdrcs    r=�register_checkrl�s���9�9�9�
��%� � �3��u�%�%���	4�D��G�@�@�@��}�'�/�/��
�0C��D�D���J�u�d�1�g�u�d�3�3�3��	���	�	�3��5�>�*�*�2�A�2�.�6�6�2B�B�B��J�u�f�e�T�2�2�2��Lr?c��t�|���d��}t|��D]\}}||kr|dfcS�dS)aDNever mix tabs and spaces.

    The most popular way of indenting Python is with spaces only.  The
    second-most popular way is with tabs only.  Code indented with a
    mixture of tabs and spaces should be converted to using spaces
    exclusively.  When invoking the Python command line interpreter with
    the -t option, it issues warnings about code that illegally mixes
    tabs and spaces.  When using -tt these warnings become errors.
    These options are highly recommended!

    Okay: if a == 0:\n    a = 1\n    b = 1
    E101: if a == 0:\n        a = 1\n\tb = 1
    rz/E101 indentation contains mixed spaces and tabsN)�INDENT_REGEX�match�group�	enumerate)rK�indent_char�indent�offset�chars     r=�tabs_or_spacesrv�sp���
�
�
�
.�
.�
4�
4�Q�
7�
7�F�!�&�)�)�M�M�����;����L�L�L�L�L��M�Mr?c��t�|���d��}d|vr|�d��dfSdS)z�On new projects, spaces-only are strongly recommended over tabs.

    Okay: if True:\n    return
    W191: if True:\n\treturn
    r�	zW191 indentation contains tabsN)rnrorp�index)rKrss  r=�
tabs_obsoleterz�sM���
�
�
�
.�
.�
4�
4�Q�
7�
7�F��v�~�~��|�|�D�!�!�#C�C�C��~r?c���|�d��}|�d��}|�d��}|�d��}||kr|rt|��dfSdSdS)aTrailing whitespace is superfluous.

    The warning returned varies on whether the line itself is blank,
    for easier filtering for those who want to indent their blank lines.

    Okay: spam(1)\n#
    W291: spam(1) \n#
    W293: class Foo(object):\n    \n    bang = 12
    �
�
�z 	zW291 trailing whitespace)rz#W293 blank line contains whitespaceN��rstrip�len)rK�strippeds  r=�trailing_whitespacer��s���"�(�(��.�.�M�!�(�(��.�.�M�!�(�(��0�0�M��#�#�G�,�,�H��� � ��	<��x�=�=�"<�<�<�;�;�	!� r?c��||kr8|�d��}|r|sdS||krt|d��dfSdSdS)z�Trailing blank lines are superfluous.

    Okay: spam(1)
    W391: spam(1)\n

    However the last line should end with a new line (warning W292).
    �
)rzW391 blank line at end of file���zW292 no newline at end of fileNr)rK�lines�line_number�total_lines�stripped_last_lines     r=�trailing_blank_linesr��sj���k�!�!�*�1�1�&�9�9���	7�!3�	7�6�6���.�.��u�R�y�>�>�#C�C�C�"�!�/�.r?c��|���}t|��}||kr�|s�|dkr|�d��rdS|���}t|��dkr|st|��dkr:|ddkr.t|��t|d��z
|dz
krdS||kr
|d	||fzfSdSdSdS)
a�Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.

    Reports error E501.
    r�#!Nrr�#r��z'E501 line too long (%d > %d characters))r�r��
startswith�split)rK�max_line_length�	multiliner��noqa�line�length�chunkss        r=�maximum_line_lengthr�s�����!�!�D�
��Y�Y�F�
�������!������� 5� 5���F�������
��[�[�A�
�
�)�
�
��[�[�A�
�
�&��)�s�"2�"2��D�	�	�C��r�
�O�O�+�o��.A�A�A��F��O�#�#�#�&+�.4�o�-F�&G�H�
H� ����$�#r?c�P�t�|��sdS|dz
}|dkrd}nt||dz
��}||krdS|t|��krb||���}|�d��st�|��rn|dz
}|t|��k�bdS|dz}|t|��kr3||���rn|dz
}|t|��k�3dSt||��|kS)NFrrr$T)�STARTSWITH_TOP_LEVEL_REGEXro�
expand_indentr��stripr�)rL�indent_levelr�r��line_idx�prev_indentr��next_idxs        r=�
_is_one_linerr�.sA��%�+�+�L�9�9���u��Q��H��!�|�|����#�E�(�Q�,�$7�8�8���\�!�!��u�
�S��Z�Z�
�
��X��$�$�&�&�����s�#�#�	�(B�(H�(H��(N�(N�	����M�H��S��Z�Z�
�
��u��!�|�H�
�S��Z�Z�
�
���?� � �"�"�	����M�H�	�S��Z�Z�
�
��t���x��)�)�\�9�9r?c	#�pK�td}	td}
|s||	krdS|�d��r
|rdV�dSdS||	ks|r||
dzkrdd|zfV�dSt�|���rt	||||��r|dkrdS|r�||
ks�||ks�t
�|��s�|}d	}|||	z
dd
�D]n}
|
���rXt|
��|krEt|
��}t�|
�	����}|s|dkrn�o|rdd|
�d�fV�dSdd
�
|
��fV�dSdSdSdS||	kr
dd|	|fzfV�dSdS|r*|s*||	kr&|�d��rdd|	|fzfV�dSdSdSdSdS)aOSeparate top-level function and class definitions with two blank
    lines.

    Method definitions inside a class are separated by a single blank
    line.

    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).

    Use blank lines in functions, sparingly, to indicate logical
    sections.

    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1

    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass
    rrNr$)rz/E304 blank lines found after function decoratorrrzE303 too many blank lines (%d)Fr�zE306 expected z/ blank line before a nested definition, found 0z$E301 expected {} blank line, found 0z&E302 expected %s blank lines, found %d)zdef zclass zIE305 expected %s blank lines after class or function definition, found %d)�BLANK_LINES_CONFIGr�r�ror��DOCSTRING_REGEXr�r��STARTSWITH_DEF_REGEX�lstrip�format)rL�blank_linesr�r��blank_before�previous_logical� previous_unindented_logical_line�previous_indent_levelr��top_level_lines�method_lines�ancestor_level�nestedr�s              r=r�r�Qs����B)��5�O�%�h�/�L����� >� >����"�"�3�'�'�-/��	G�F�F�F�F�F�F�	G�	G�
��
'�
'�
�(�)�\�A�-=�=�=��1�K�?�?�?�?�?�?�?�	#�	)�	)�,�	7�	7�&/�
�,��e�[�I�I�	��A����F��	/� �L�0�0�)�L�8�8�#�)�)�*:�;�;�9�".����"�+��"?�"C��"C�D�"�"�D��z�z�|�|�"�
�d�(;�(;�n�(L�(L�)6�t�)<�)<��!5�!;�!;�D�K�K�M�M�!J�!J��!�"�^�q�%8�%8�!�E���&��!�8D���G�G�G�G�G�G�G��C�J�J�$�&�&�&�&�&�&�&�&�%1�0�8�8�8�8�&�_�
,�
,��=���A/�/�/�
/�
/�
/�
/�
/�-�
,��/��/��O�+�+�,�7�7�8J�K�K�
,��5���8/�/�/�	/�	/�	/�	/�	/�/�/�/�/�+�+�+�+r?c#�TK�|}t�|��D]�}|���}|���}|���}|d���r
|dzd|zfV��e||dz
dkr|dvrdnd}||�d|�d	�fV���d
S)aHAvoid extraneous whitespace.

    Avoid extraneous whitespace in these situations:
    - Immediately inside parentheses, brackets or braces.
    - Immediately before a comma, semicolon, or colon.

    Okay: spam(ham[1], {eggs: 2})
    E201: spam( ham[1], {eggs: 2})
    E201: spam(ham[ 1], {eggs: 2})
    E201: spam(ham[1], { eggs: 2})
    E202: spam(ham[1], {eggs: 2} )
    E202: spam(ham[1 ], {eggs: 2})
    E202: spam(ham[1], {eggs: 2 })

    E203: if x == 4: print x, y; x, y = y , x
    E203: if x == 4: print x, y ; x, y = y, x
    E203: if x == 4 : print x, y; x, y = y, x
    r�rzE201 whitespace after '%s'�,�}])�E202�E203z whitespace before '�'N)�EXTRANEOUS_WHITESPACE_REGEX�finditerrpr��start�isspace)rLr�ro�textru�found�codes       r=�extraneous_whitespacer��s�����(�D�,�5�5�d�;�;�	>�	>���{�{�}�}���z�z�|�|�����
�
����8�����	>��!�)�9�D�@�@�@�@�@�@�
�%�!�)�_��
#�
#�"�e�m�m�F�F��D��D�=�=�d�=�=�=�=�=�=�=��	>�	>r?c#�K�t�|��D]�}|���\}}d|vr|�d��dfV�n,t	|��dkr|�d��dfV�d|vr|�d��dfV���t	|��dkr|�d��dfV���dS)	z�Avoid extraneous whitespace around keywords.

    Okay: True and False
    E271: True and  False
    E272: True  and False
    E273: True and\tFalse
    E274: True\tand False
    rxrzE274 tab before keywordz#E272 multiple spaces before keywordrzE273 tab after keywordz"E271 multiple spaces after keywordN)�
KEYWORD_REGEXr��groupsr�r��rLro�before�afters    r=�whitespace_around_keywordsr��s������'�'��5�5�G�G�������
����6�>�>��+�+�a�.�.�";�;�;�;�;�;�
��[�[�1�_�_��+�+�a�.�.�"G�G�G�G�G��5�=�=��+�+�a�.�.�":�:�:�:�:�:�
��Z�Z�!�^�^��+�+�a�.�.�"F�F�F�F�F��G�Gr?c#�FK�t||dd���D]�\}}|j|jkrptj|j��rW|jtvrI|jdvr@|jdkr|jdks*|jdkr|jdks|jdvr|jd	fV���dS)
z�Keywords should be followed by whitespace.

    Okay: from foo import (bar, baz)
    E275: from foo import(bar, baz)
    E275: from importable.module import(bar, baz)
    E275: if(foo): bar
    rN�r�awaitrFr �yield�)z:
z%E275 missing whitespace after keyword)�zip�endr��keyword�	iskeyword�string�
SINGLETONS)rL�tokens�tok0�tok1s    r=� missing_whitespace_after_keywordr��s������&�&����*�-�-�D�D�
��d�
�H��
�"�"��!�$�+�.�.�
#���:�-�-���#5�5�5��[�H�,�,����1C�1C��[�G�+�+���s�0B�0B���5�(�(��(�C�C�C�C�C��D�Dr?c#��K�|}tt|��dz
��D]�}||}||dz}|dvr�|tvr�|d|�}|dkrY|�d��|�d��kr-|�d��|�d��kr��|dkr|d	kr��|dkr|d
krt
jdkr��|d|zfV���dS)
z�Each comma, semicolon or colon should be followed by whitespace.

    Okay: [a, b]
    Okay: (3,)
    Okay: a[1:4]
    Okay: a[:4]
    Okay: a[1:]
    Okay: a[1:4:2]
    E231: ['a','b']
    E231: foo(bar,baz)
    E231: [{'a':'b'}]
    rz,;:N�:�[�]�{r�r�r/r)z"E231 missing whitespace after '%s')�ranger��
WHITESPACE�count�rfind�sys�version_info)rLr�ryru�	next_charr�s      r=�missing_whitespacer��s�����D��s�4�y�y�1�}�%�%�E�E���E�{������O�	��5�=�=�Y�j�8�8��&�5�&�\�F��s�{�{�v�|�|�C�0�0�6�<�<��3D�3D�D�D��L�L��%�%����S�(9�(9�9�9���s�{�{�y�C�/�/���s�{�{�y�C�/�/�C�4D��4N�4N���=��D�D�D�D�D��E�Er?c#�4K�|rdnd}|rdnd}||zrd|d|zdt|��zfzfV�|�d��}|r||krd|d|zd	fzfV�n|s||krd|d|zd
fzfV�|r |dkrdnd
}	||	z}
||
kr
d|dzfV�dSdSdS)a�Use indent_size (PEP8 says 4) spaces per indentation level.

    For really old code that you don't want to mess up, you can continue
    to use 8-space tabs.

    Okay: a = 1
    Okay: if a == 0:\n    a = 1
    E111:   a = 1
    E114:   # a = 1

    Okay: for item in items:\n    pass
    E112: for item in items:\npass
    E115: for item in items:\n# Hi\n    pass

    Okay: a = 1\nb = 2
    E113: a = 1\n    b = 2
    E116: a = 1\n    # b = 2
    rr	zE11%d %szE11%d %s (comment)rz!indentation is not a multiple of r�rzexpected an indented blockzunexpected indentationrxr*r)r�z
over-indentedN)�str�endswith)rLr�rrr�r��indent_size�c�tmpl�
indent_expect�expected_indent_amount�expected_indent_levels           r=�indentationr�sM����,� ���q�A�%�?�:�:�+?�D��k�!�
���
��E�/�#�k�2B�2B�B�
�
�
�	
�	
�	
�%�-�-�c�2�2�M��:��)>�>�>����Q�� <�=�=�=�=�=�=�=�
�:�|�.C�C�C����Q�� 8�9�9�9�9�9�9��1�&1�T�&9�&9���q�� 5�8N� N���/�/�/��T�0�0�0�0�0�0�0�0�	1�1�0�/r?c
#�XK�|ddd}d|dddz|z
}	|s|	dkrdS|�d��}
dx}}|dkr|fn||dzf}
dg|	z}dg|	z}dgg}dg}i}|dd}d}d}|dg}|d	kr0td
|dd���z��|D�]�\}}}}}||d|z
k}|r|d|z
}|o|tv}|�r�|}|d	kr$td|���z��t	|��|z
||<|t
jko|d
v}t||��D]}||||z
}||
v} | rn�||r|||k} |o |dko|�|d��}|r!||r|d||kr|dfV�n�|r|s	|r|dfV�n�||r|d||kr|dur|dfV�ny| s|
r||d|zkr|r|s|dfV�|||<nV|dur|d||<nF||tfvrn:|dkrd}!n(||rd}!n|s||rd}!n|||<||krd}!nd}!|d|!zfV�||rZ|t
j
t
jfvr@||s8|d||<d||d<|dkrtd|�d|d����n�|t
jt
jfvs|dvrt||d<nu|s|s|dvrd||ddz<n^|s|s|s|dkrd||ddz<nC|dkr=||dd��
��r||�|��|t
jk�r�|dvr�|dz
}|�d��|�d��t|��|kr|�g��||�|��||xxdz
cc<|dkr$td|�d|d�d ||����n�|d!vr�|dkr�|���p|d}"|���t#|��D]}#||#|"krd||#<�t%|��D]}$|$|"kr||$=�||dzd�=|dz}|rd|||<t#|dd��D]}%||%r||%xxdzcc<n�t|��|dzksJ�|d|vr|||d<|d|dk}|r||||d|z
<���|
r;t	|��||zkr'|d|d|zf}&|rd"}'nd#}'|&d$|'zfV�dSdSdS)%a2Continuation lines indentation.

    Continuation lines should align wrapped elements either vertically
    using Python's implicit line joining inside parentheses, brackets
    and braces, or using a hanging indent.

    When using a hanging indent these considerations should be applied:
    - there should be no arguments on the first line, and
    - further indentation should be used to clearly distinguish itself
      as a continuation line.

    Okay: a = (\n)
    E123: a = (\n    )

    Okay: a = (\n    42)
    E121: a = (\n   42)
    E122: a = (\n42)
    E123: a = (\n    42\n    )
    E124: a = (24,\n     42\n)
    E125: if (\n    b):\n    pass
    E126: a = (\n        42)
    E127: a = (24,\n      42)
    E128: a = (24,\n    42)
    E129: if (a or\n    b):\n    pass
    E131: a = (\n    42\n 24)
    rrrr�Nr�rxFr	z>>> rz... z]})z6E124 closing bracket does not match visual indentationz+E133 closing bracket is missing indentationTz7E128 continuation line under-indented for visual indentzIE123 closing bracket does not match indentation of opening bracket's line)�E122z missing indentation or outdented)�E127zover-indented for visual indent)�E131zunaligned for hanging indent)�E126z over-indented for hanging indent)�E121z!under-indented for hanging indentz%s continuation line %szbracket depth z indent to )�u�ur�b�br)�assert�raiserHrB�([{z seen, col z, visual min = �)]}zE129 visually indented linezE125 continuation linez(%s with same indent as next logical line)r�rr��NEWLINEr��tokenize�OP�reversed�getr��NL�COMMENT�STRINGr��appendr��popr��list)(rLr�r��hang_closingrrr�r��verbose�	first_row�nrows�indent_next�row�depth�valid_hangs�parens�
rel_indent�	open_rows�hangs�indent_chances�last_indent�
visual_indent�last_token_multiliners�
token_typer�r�r�r��newline�
close_bracket�open_row�hang�hanging_indent�errorr��d�ind�idx�posr�s(                                        r=�continued_indentationr ?s"����:�q�	�!��Q��I�
��r�
�1�
�a� � �9�,�E���u��z�z����'�'��,�,�K��O�C�%�$/�4�$7�$7�;�.�.��;��?�
+���S�5�[�F���u��J����I�
�F�E��N���)�A�,�K��M� ���!�n�
�F��!�|�|�
�f�v�a�y��|�*�*�,�,�,�-�-�-�.4�G=�G=�*�
�D�%��d���a��9�,�,���	M���(�Y�&�C�.�.�L�:�W�3L�G��C	?��K��!�|�|��f�t�{�{�}�}�,�-�-�-�,�D�1�1�L�@�J�s�O�(�8�;�6�H�4�5�=�M�%�Y�u�%5�6�6�
�
��!�#���H�)=�=��!%��!4��!���E���U�|�
8�"&�%��,�"6��!.�.�:�4�!�8�:�+�/�/��a��9�9�
��+
?����+
?���8�v�e�}�,�,� �#0�1�1�1�1���&
?�t�&
?� �O��!N�N�N�N�N�����!
?�5��8�f�U�m�#;�#;� ��,�,� �#>�?�?�?�?���
?�K�
?�$.�s�O�q�;��$F�$F� �D��D� �#C�D�D�D�D�#��e����$�&�&� %�a���u�
�
��4��+�-�-���1�9�9�F�E�E��E�]�	L�E�E�E�&�L�5��<�L�B�E�E�#'�E�%�L��k�)�)� J��� K���6��>�>�>�>�>�
�3�K�	)��8�;��0@�"A�A�A��5�M�B�!�!�H�F�5�M�'+�N�5��8�$��!�|�|��C�u�C�C��q��C�C�D�D�D���X�_�h�.>�?�?�?��,�,�,�'*�N�5��8�$�$��	)�U�	)�t�/J�'J�'J�)-�N�3�q�6�A�:�&�&��	)��	)�E�	)�d�d�l�l�)-�N�3�q�6�A�:�&�&�
�S�[�[�T�#�a�&�'�'�]�2�2�4�4�[��e��#�#�C�(�(�(����$�$��u�}�}���
���
�
�a� � � ����T�"�"�"��y�>�>�U�*�*��$�$�R�(�(�(��%� �'�'��,�,�,��s����q� �����a�<�<��E� �5�5�%��(�(�(�F�5�M�M�;�<�<�<������5�1�9�9�$�j�j�l�l�<�k�!�n���	�	�����u���&�&�A��a�y�;�.�.�$%��q�	����/�/�0�0�C��k�)�)�*�3�/���e�a�i�j�j�)���
���9�48�N�6�%�=�1� ��b�"�-�-���C��c�{���s����q�(��������v�;�;�%�!�)�+�+�+�+��Q�x�~�-�-�+/��u�Q�x�(� %�a��C��F� 2���	=�-7��_�J�s�1�v�	�)�*���E�}�T�*�*�l�[�.H�H�H��Q�x����[�0�1���	,�0�D�D�+�D��=��D�D�D�D�D�D�D�
E�E�H�Hr?c#�K�|d\}}}}}tdt|����D]�}||\}}}	}
}|tjkrz|dvrv|	|krp|tjks|dvr\|dks||dz
ddkrAtj|��s-tjdkstj	|��s	|d|zfV�|}|}|
}��d	S)
a�Avoid extraneous whitespace.

    Avoid extraneous whitespace in the following situations:
    - before the open parenthesis that starts the argument list of a
      function call.
    - before the open parenthesis that starts an indexing or slicing.

    Okay: spam(1)
    E211: spam (1)

    Okay: dict['key'] = list[index]
    E211: dict ['key'] = list[index]
    E211: dict['key'] = list [index]
    rr�([r�rrI�r	�	zE211 whitespace before '%s'N)
r�r�r�r��NAMEr�r�r�r��
issoftkeyword)rLr��	prev_type�	prev_text�__�prev_endryrr�r�r�s           r=�whitespace_before_parametersr+s���� .4�A�Y�*�I�y�"�h���q�#�f�+�+�&�&����+1�%�=�(�
�D�%��b��(�+�%�%��D�L�L��X���
�(�-�
'�
'�9��+=�+=�
�Q�Y�Y�&����+�A�.�'�9�9��!�)�,�,�:�
� �6�)�)��)�)�4�4�*��9�D�@�@�@�@�@��	��	����)�r?c#�K�t�|��D]�}|���\}}d|vr|�d��dfV�n,t	|��dkr|�d��dfV�d|vr|�d��dfV���t	|��dkr|�d��dfV���dS)	z�Avoid extraneous whitespace around an operator.

    Okay: a = 12 + 3
    E221: a = 4  + 5
    E222: a = 4 +  5
    E223: a = 4\t+ 5
    E224: a = 4 +\t5
    rxrzE223 tab before operatorz$E221 multiple spaces before operatorrzE224 tab after operatorz#E222 multiple spaces after operatorN)�OPERATOR_REGEXr�r�r�r�r�s    r=�whitespace_around_operatorr.6s����� �(�(��6�6�H�H�������
����6�>�>��+�+�a�.�.�"<�<�<�<�<�<�
��[�[�1�_�_��+�+�a�.�.�"H�H�H�H�H��5�=�=��+�+�a�.�.�";�;�;�;�;�;�
��Z�Z�!�^�^��+�+�a�.�.�"G�G�G�G�G��H�Hr?c#�*K�d}d}tj}dx}}tjtjf}|D�]`\}}	}
}}|tvr�|	dvr|dz
}n|	dkr|dz}|r�|
|kr|dur|ds|ddfV�d}�n|	d	kr|d
vr�n|dkr|	dvs|dkr|	d
krn�|dus|dr|dfV�n7|dkr1d\}
}|dkrd\}
}n|tvrd\}
}|d|
�d|�d�fV�d}n�||vr�|��|	dkr|rnt|	t
vrd}nh|	tvrT|tjkr|dvs=|tjkr/|tvr&tj	dkstj|��sd}n|	tvrd}|�	||
|kf}n|r|
|kr|dfV�d}|}|	}|}��bdS)aVSurround operators with a single space on either side.

    - Always surround these binary operators with a single space on
      either side: assignment (=), augmented assignment (+=, -= etc.),
      comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
      Booleans (and, or, not).

    - If operators with different priorities are used, consider adding
      whitespace around the operators with the lowest priorities.

    Okay: i = i + 1
    Okay: submitted += 1
    Okay: x = x * 2 - 1
    Okay: hypot2 = x * x + y * y
    Okay: c = (a + b) * (a - b)
    Okay: foo(bar, key='word', *args, **kwargs)
    Okay: alpha[:-i]

    E225: i=i+1
    E225: submitted +=1
    E225: x = x /2 - 1
    E225: z = x **y
    E225: z = 1and 1
    E226: c = (a+b) * (a-b)
    E226: hypot2 = x*x + y*y
    E227: c = a|b
    E228: msg = fmt%(errno, errmsg)
    rFN)�(�lambdarr�Tz'E225 missing whitespace around operatorr-)r,r"r#>r�r�r�r�r)�E226�
arithmeticr()�E228�modulo)�E227zbitwise or shiftz missing whitespace around z	 operatorr/r�r#)
r�r�r%�
SKIP_COMMENTS�
ARITHMETIC_OP�WS_NEEDED_OPERATORS�UNARY_OPERATORS�KEYWORDSr�r�r�r&�WS_OPTIONAL_OPERATORS)rLr�r
�
need_spacer'r(r*�operator_typesrr�r�r�r�r��optypes               r=�"missing_whitespace_around_operatorr@Ns�����<�F��J���I���I���k�8�=�1�N�.4�M�M�*�
�D�%��d���&�&���?�"�"��a�K�F�F�
�S�[�[��a�K�F��C	#��� � ��T�)�)�*�Q�-�)�%�a�=�D�F�F�F�F�"�
�
������j�!8�!8����$�$���)@�)@���$�$��������%�%��A��%�"�$M�M�M�M�M�M��$�&�&�#7�L�D�&� �C�'�'�'7���f�f�"�-�7�7�'A���f�%�a�=�37�4�4����+A�B�B�B�B�"�
�
�
�>�
)�
)�h�.B��s�{�{�v�{���,�,�,�!�
�
���(�(����+�+�	�U�0B�0B����,�,��X�-�-��(�6�1�1�#�1�)�<�<�2�"&�J���.�.�.�!�
��!�'���(9�:�
�
��
#��� 1� 1�� I�I�I�I�I�"�
��	��	����[M�Mr?c#�(K�|}t�|��D]r}|���dz}d|���vr"|d|���dzfV��Q|d|���dzfV��sdS)z�Avoid extraneous whitespace after a comma or a colon.

    Note: these checks are disabled by default

    Okay: a = (1, 2)
    E241: a = (1,  2)
    E242: a = (1,\t2)
    rrxzE242 tab after '%s'rzE241 multiple spaces after '%s'N)�WHITESPACE_AFTER_COMMA_REGEXr�r�rp)rLr��mr�s    r=�whitespace_around_commarD�s������D�
)�
2�
2�4�
8�
8�J�J�����	�	�A�
���1�7�7�9�9����.������1��=�=�=�=�=�=��:�Q�W�W�Y�Y�q�\�I�I�I�I�I�I�J�Jr?c#��K�d}d}d}d}d}tt�|����}d}d}	|D]�\}
}}}
}|
tjkr�|rd}||kr||fV�|rd}||kr||	fV�|
tjkre|dvr|dz
}nW|dvr|dz}nM|r|d	kr	|dkrd
}n<|dkr	|dkrd}n-|r+|dkr%|r|dkrd
}||kr||	fV�nd
}||kr||fV�|sd}|
}��dS)
acDon't use spaces around the '=' sign in function arguments.

    Don't use spaces around the '=' sign when used to indicate a
    keyword argument or a default parameter value, except when
    using a type annotation.

    Okay: def complex(real, imag=0.0):
    Okay: return magic(r=real, i=imag)
    Okay: boolean(a == b)
    Okay: boolean(a != b)
    Okay: boolean(a <= b)
    Okay: boolean(a >= b)
    Okay: def foo(arg: int = 42):
    Okay: async def foo(arg: int = 42):

    E251: def complex(real, imag = 0.0):
    E251: return magic(r = real, i = imag)
    E252: def complex(real, image: float=0.0):
    rFNz8E251 unexpected spaces around keyword / parameter equalsz/E252 missing whitespace around parameter equalsr"rz)]r�Tr�r/)�boolr�ror�r�r�)rLr�r
�no_space�
require_spacer*�annotated_func_arg�in_def�message�missing_messagerr�r�r�r�s               r=�(whitespace_around_named_parameter_equalsrM�s�����*�F��H��M��H���
�&�,�,�\�:�:�
;�
;�F�H�G�G�O�.4� � �*�
�D�%��d����$�$���	*��H��� � ���)�)�)�)��	2�!�M��� � ���1�1�1�1����$�$��t�|�|��!���������!�����
2�D�C�K�K�F�a�K�K�%)�"�"��1�������%*�"�"��
2�D�C�K�K�%�2�&�A�+�+�$(�M���(�(�'��9�9�9�9��#�H���(�(�'��1�1�1�1��
+�%*�"����A � r?c#�K�d}|D]�\}}}}}|tjkr�|d|d����}|r-|d|dkr|d|ddzkr|dfV�|�d��\}	}
}|	dvo|	�d	��dd�pd	}|r|s|dd�t
vr|d
fV���|r'|dks|ddkr|d	kr|dfV���|r|d
fV���|tjkr|}��dS)u�Separate inline comments by at least two spaces.

    An inline comment is a comment on the same line as a statement.
    Inline comments should be separated by at least two spaces from the
    statement. They should start with a # and a single space.

    Each line of a block comment starts with a # and one or multiple
    spaces as there can be indented text inside the comment.

    Okay: x = x + 1  # Increment x
    Okay: x = x + 1    # Increment x
    Okay: # Block comments:
    Okay: #  - Block comment list
    Okay: #  - Block comment list
    E261: x = x + 1 # Increment x
    E262: x = x + 1  #Increment x
    E262: x = x + 1  #  Increment x
    E262: x = x + 1  #  Increment x
    E265: #Block comment
    E266: ### Block comment
    )rrNrrrz.E261 at least two spaces before inline commentr9z#:r�z*E262 inline comment should start with '# '�!z)E265 block comment should start with '# 'z+E266 too many leading '#' for block comment)r�rr��	partitionr�r�r�)
rLr�r*rr�r�r�r��inline_comment�symbol�sp�comment�
bad_prefixs
             r=�whitespace_before_commentrVs�����.�H�.4���*�
�D�%��d���)�)�)�!�)�5��8�)�_�2�2�4�4�N��
M��A�;�%��(�*�*�u�Q�x�(�1�+��/�/I�/I�#�K�M�M�M�M�"&�.�.��"5�"5��F�B���t�+�O����s�1C�1C�B�Q�B�1G�1N�3�J��
O��N���!���
�!:�!:��!M�M�M�M�M���
O��s�!2�!2�e�A�h��l�l���$�$��!L�L�L�L�L�L��O��!N�N�N�N�N��
�8�;�
&�
&��H��%�r?c#�K�|}|�d��r/|�d��}d|krd|d|�vr|dfV�dSdSdSdS)a Place imports on separate lines.

    Okay: import os\nimport sys
    E401: import sys, os

    Okay: from subprocess import Popen, PIPE
    Okay: from myclas import MyClass
    Okay: from foo.bar.yourclass import YourClass
    Okay: import myclass
    Okay: import foo.bar.yourclass
    �import r�r��;Nz!E401 multiple imports on one line)r��find)rLr�r�s   r=�imports_on_separate_linesr[Csx�����D����y�!�!�=��	�	�#����
��:�:�#�T�&�5�&�\�1�1��<�<�<�<�<�<�<�=�=��:�1�1r?c#��K�d�}d}|rdS|sdS|rdS|���d��s��d��r|�dd��rdV�dSdStjt���rdSt�fd	�|D����rdS|���r$|�d
d��rd|d<dSd|d
<dSd|d<dS)a�Place imports at the top of the file.

    Always put imports at the top of the file, just after any module
    comments and docstrings, and before module globals and constants.

    Okay: import os
    Okay: # this is a comment\nimport os
    Okay: '''this is a module docstring'''\nimport os
    Okay: r'''this is a module docstring'''\nimport os
    Okay:
    try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
    Okay:
    try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
    E402: a=1\nimport os
    E402: 'One string'\n"Two string"\nimport os
    E402: a=1\nfrom sys import x

    Okay: if x:\n    import os
    c��|ddvr
|dd�}|r|ddvr
|dd�}|o|ddkp|ddkS)Nr�uUbBr�rR�"r�rP)r�s r=�is_string_literalz8module_imports_on_top_of_file.<locals>.is_string_literalms_����7�f�������8�D��	�D��G�t�O�O�����8�D��:��a��C��9�4��7�c�>�:r?)rErFrDrGrHrBrCNrXzfrom �seen_non_importsF)rz+E402 module level import not at top of filec3�B�K�|]}��|��V��dS�N�r�)r;�kwr�s  �r=r>z0module_imports_on_top_of_file.<locals>.<genexpr>�s/�����<�<�R�T�_�_�R�
 �
 �<�<�<�<�<�<r?�seen_docstringT)r�r��rero�DUNDER_REGEX�any)rLr��
checker_stater�ra�allowed_keywordsr�s      @r=�module_imports_on_top_of_filermWsS�����,;�;�;�B���������������D����y�!�!�1�T�_�_�W�%=�%=�1����/��7�7�	C�B�B�B�B�B�B�	C�	C�	��,��	%�	%�1���	�<�<�<�<�+;�<�<�<�	<�	<�1�	��	�	�4�	 �	 �1����-�u�5�5�	3�04�M�,�-�-�-�.2�M�*�+�+�+�,0�
�(�)�)�)r?c#�K�|}t|��dz
}|�d��}d}d�dD��}d|cxkr|k�rin�net|||�|��|d|dk�r|d	|d
kr�|d|dkr�tjd
kr||dzdks�t
�|d|��}|ro|d|�������}|dd�dkr2|dd��	���
��rdV�njt�|��rdV�n t�|��r|dfV�|}|�d|dz��}d|cxkr|k��cn|�d��}d|kr4||kr|dfV�n|dfV�|�d|dz��}d|k�2dSdS)a�Compound statements (on the same line) are generally
    discouraged.

    While sometimes it's okay to put an if/for/while with a small body
    on the same line, never do this for multi-clause statements.
    Also avoid folding such long lines!

    Always use a def statement instead of an assignment statement that
    binds a lambda expression directly to a name.

    Okay: if foo == 'blah':\n    do_blah_thing()
    Okay: do_one()
    Okay: do_two()
    Okay: do_three()

    E701: if foo == 'blah': do_blah_thing()
    E701: for x in lst: total += x
    E701: while t < 10: t = delay()
    E701: if foo == 'blah': do_blah_thing()
    E701: else: do_non_blah_thing()
    E701: try: something()
    E701: finally: cleanup()
    E701: if foo == 'blah': one(); two(); three()
    E702: do_one(); do_two(); do_three()
    E703: do_four();  # useless semicolon
    E704: def f(x): return 2*x
    E731: f = lambda x: 2*x
    rr�rc��i|]}|d��S)rrP)r;rus  r=�
<dictcomp>z'compound_statements.<locals>.<dictcomp>�s��
+�
+�
+�$�d�A�
+�
+�
+r?z{}[]()r�r��}r�r�r0r�r)r/N)rz1E731 do not assign a lambda expression, use a def)rz*E704 multiple statements on one line (def)z,E701 multiple statements on one line (colon)rYz0E702 multiple statements on one line (semicolon)z$E703 statement ends with a semicolon)r�rZ�
update_countsr�r��LAMBDA_REGEX�searchr�r�r��isidentifierr�ro�!STARTSWITH_INDENT_STATEMENT_REGEX)rLr��	last_charr��
prev_found�counts�	lambda_kwr�s        r=�compound_statementsr{�so����<�D��D�	�	�A�
�I��I�I�c�N�N�E��J�
+�
+�(�
+�
+�
+�F�
�u�
 �
 �
 �
 �y�
 �
 �
 �
 �
 ��d�:�e�+�,�f�5�5�5�
�C�[�F�3�K�
'�
'�
�C�[�F�3�K�
'�
'�
�C�[�F�3�K�
'�
'��!�V�+�+��e�a�i��C�'�'�$�+�+�D�!�U�;�;�I��
��0�y���0�0�0�1�8�8�:�:���"�#�#�;�#�%�%�&��"��+�*;�*;�*=�*=�*J�*J�*L�*L�%�%�%�%�%��#�)�)�$�/�/�
L�E�E�E�E�E�2�8�8��>�>�
L��K�K�K�K�K��
��	�	�#�u�q�y�)�)��'
�u�
 �
 �
 �
 �y�
 �
 �
 �
 �(
�I�I�c�N�N�E�
�u�*�*��9����K�K�K�K�K�K��?�?�?�?�?��	�	�#�u�q�y�)�)��
�u�*�*�*�*�*�*r?c#��K�dx}x}}d}d}|D]�\}}}	}
}|tjkrd}|	d|kr|r
|r|s|dfV�|
d|krh|�d���d��r3|
dt	|���d��d	z
f}nd}|
dx}}n|	d}|tjkr|d
vr|d	z
}��|dvr|d	z}��dS)aBAvoid explicit line join between brackets.

    The preferred way of wrapping long lines is by using Python's
    implied line continuation inside parentheses, brackets and braces.
    Long lines can be broken over multiple lines by wrapping expressions
    in parentheses.  These should be used in preference to using a
    backslash for line continuation.

    E502: aaa = [123, \\n       123]
    E502: aaa = ("bbb " \\n       "ccc")

    Okay: aaa = [123,\n       123]
    Okay: aaa = ("bbb "\n       "ccc")
    Okay: aaa = "bbb " \\n    "ccc"
    Okay: aaa = 123  # \\
    rFNTz0E502 the backslash is redundant between bracketsr��\r�rr�r�)r�rr�r�r��
splitlinesr�)rLr��
prev_startr*r
rT�	backslashrr�r�r�r�s            r=�explicit_line_joinr��s7����$&'�&�J�&��F��G��I�.4���*�
�D�%��d���)�)�)��G���8�z�!�!�f�!��!�7�!��O�O�O�O�O��q�6�X����{�{�6�"�"�+�+�D�1�1�
!� ��V�S����):�):�2�)>�%?�%?�!�%C�D�	�	� �	�$'��F�*�J����q��J����$�$��u�}�}��!���������!����#�r?z()[]{},:.;@=%~)z...c�<�|tjkp|dvo|tvS)N>r3r0)r�r��
_SYMBOLIC_OPS)rr�s  r=�_is_binary_operatorr�s-���h�k�!�	��
���	
�M�!�	r?c#�K�d}d}d}d}|D]I\}}}}}	|tjkr�d|vsd|vr|tjkrd}�4|||||||fV�|dv}d}|}|}�JdS)z�Private function to reduce duplication.

    This factors out the shared details between
    :func:`break_before_binary_operator` and
    :func:`break_after_binary_operator`.
    FTNr|r}z([{,;)r�rr)
r��
line_break�
unary_context�previous_token_type�
previous_textrr�r�r�r�s
          r=�_break_around_binary_operatorsr�
s������J��M����M�.4�!�!�*�
�D�%��d���)�)�)���D�L�L�D�D�L�L�j�H�O�.K�.K��J�J��t�%8�-��}�e�5�
5�
5�
5� �G�O�M��J�",�� �M�M�!�!r?c#�K�t|��D]6}|\}}}}}}}	t||��r|r|st||��s|	dfV��7dS)a�
    Avoid breaks before binary operators.

    The preferred place to break around a binary operator is after the
    operator, not before it.

    W503: (width == 0\n + height == 0)
    W503: (width == 0\n and height == 0)
    W503: var = (1\n       & ~2)
    W503: var = (1\n       / -2)
    W503: var = (1\n       + -1\n       + -2)

    Okay: foo(\n    -x)
    Okay: foo(x\n    [])
    Okay: x = '''\n''' + ''
    Okay: foo(x,\n    -y)
    Okay: foo(x,  # comment\n    -y)
    z&W503 line break before binary operatorN�r�r�)
rLr��contextrr�r�r�r�r�r�s
          r=�break_before_binary_operatorr�$s�����(2�&�9�9�B�B��-4�	+��T�.�
�	�]�E��
�D�1�1�	B�j�	B�!�	B�'�(;�(5�7�7�	B��A�A�A�A�A��B�Br?c#�K�d}t|��D]8}|\}}}}}}	}
t||��r|r|	st||��s|dfV�|
}�9dS)aF
    Avoid breaks after binary operators.

    The preferred place to break around a binary operator is before the
    operator, not after it.

    W504: (width == 0 +\n height == 0)
    W504: (width == 0 and\n height == 0)
    W504: var = (1 &\n       ~2)

    Okay: foo(\n    -x)
    Okay: foo(x\n    [])
    Okay: x = '''\n''' + ''
    Okay: x = '' + '''\n'''
    Okay: foo(x,\n    -y)
    Okay: foo(x,  # comment\n    -y)

    The following should be W504 but unary_context is tricky with these
    Okay: var = (1 /\n       -2)
    Okay: var = (1 +\n       -1 +\n       -2)
    Nz%W504 line break after binary operatorr�)rLr�rr�rr�r�r�r�r�r�s           r=�break_after_binary_operatorr�Bs�����.�J�1�&�9�9����-4�	+��T�.�
�	�]�E�� 3�]�C�C�	F��	F�!�	F�(�
�D�9�9�	F��E�E�E�E�E��
�
��r?c#�xK�|rdSt�|��D]�}|�d��p|�d��}|�d��dk}d|rdnd|zz}|d	vrd
}nd}|dkr|p|d
ko|}|d|rdndzz
}|�d��|�d|�d|��fV���dS)aXComparison to singletons should use "is" or "is not".

    Comparisons to singletons like None should always be done
    with "is" or "is not", never the equality operators.

    Okay: if arg is not None:
    E711: if arg != None:
    E711: if None == arg:
    E712: if arg == True:
    E712: if False == arg:

    Also, beware of writing if x when you really mean if x is not None
    -- e.g. when testing whether a variable or argument that defaults to
    None was set to some other value.  The other value might have a type
    (such as a container) that could be false in a boolean context!
    Nrr	rr.z'if cond is %s:'r^znot )r�E711�E712rrz or 'if %scond:'z comparison to z should be )�COMPARE_SINGLETON_REGEXr�rpr�)rLr�ro�	singleton�same�msgr��nonzeros        r=�comparison_to_singletonr�es����$����(�1�1�,�?�?�
7�
7���K�K��N�N�4�e�k�k�!�n�n�	����A���$�&�� �4�%;�R�R�V�y�$H�I���	�!�!��D�D��D�!�V�+�4��;�!�W�,�9�T��
��%�w�)B���F�C�C�C��k�k�!�n�n� $���i�i�i��� 6�7�	7�	7�	7�	7�
7�
7r?c#�K�t�|��}|r>|�d��}|�d��dkr|dfV�dS|dfV�dSdS)aGNegative comparison should be done using "not in" and "is not".

    Okay: if x not in y:\n    pass
    Okay: assert (X in Y or X is Z)
    Okay: if not (X in Y):\n    pass
    Okay: zz = x is not y
    E713: Z = not X in Y
    E713: if not X.B in Y:\n    pass
    E714: if not X is Y:\n    pass
    E714: Z = not X.B is Y
    rrr1z+E713 test for membership should be 'not in'z0E714 test for object identity should be 'is not'N)�COMPARE_NEGATIVE_REGEXrtr�rp)rLrors   r=�comparison_negativer��s�����
#�)�)�,�7�7�E��J��k�k�!�n�n���;�;�q�>�>�T�!�!��D�D�D�D�D�D�D��I�I�I�I�I�I�I�J�Jr?c#��K�t�|��}|rR|sR|�d��}|r|���r|tvrdS|���dfV�dSdSdS)a�Object type comparisons should always use isinstance().

    Do not compare types directly.

    Okay: if isinstance(obj, int):
    E721: if type(obj) is type(1):

    When checking if an object is a string, keep in mind that it might
    be a unicode string too! In Python 2.3, str and unicode have a
    common base class, basestring, so you can do:

    Okay: if isinstance(obj, basestring):
    Okay: if type(a1) is type(b1):
    rNz-E721 do not compare types, use 'isinstance()')�COMPARE_TYPE_REGEXrtrprur�r�)rLr�ro�insts    r=�comparison_typer��s����� 
�%�%�l�3�3�E��M�T�M��{�{�1�~�~���	�D�%�%�'�'�	�D�
�,B�,B��F��k�k�m�m�L�L�L�L�L�L�L�	M�M�M�Mr?c#�~K�|rdSt�|��}|r|���dfV�dSdS)z�When catching exceptions, mention specific exceptions when
    possible.

    Okay: except Exception:
    Okay: except BaseException:
    E722: except:
    NzE722 do not use bare 'except')�BLANK_EXCEPT_REGEXror�)rLr�ros   r=�bare_exceptr��sZ���������$�$�\�2�2�E��=��k�k�m�m�<�<�<�<�<�<�<�=�=r?c#�K�d}d}d}|d\}}}}}	|dd�D]�\}
}}}
}dx}}|dkrd}|dkr)|tjkr|
tjkr	|dkrd}n-|dkr'|
tjkr|dkr|dz
}n|d	kr|dz}|
tjkrd
|vr|dkr||vr|}|}|dvr||vr|}|}|r||vr|}|}|dkr
||vr	|d
|zfV�|dkr
||vr	|d|zfV�|r	|d|zfV�|
}|}|}��dS)a�Never use the characters 'l', 'O', or 'I' as variable names.

    In some fonts, these characters are indistinguishable from the
    numerals one and zero. When tempted to use 'l', use 'L' instead.

    Okay: L = 0
    Okay: o = 123
    Okay: i = 42
    E741: l = 0
    E741: O = 123
    E741: I = 42

    Variables can be bound in several other contexts, including class
    and function definitions, 'global' and 'nonlocal' statements,
    exception handlers, and 'with' and 'for' statements.
    In addition, we have a special handling for function parameters.

    Okay: except AttributeError as o:
    Okay: with lock as L:
    Okay: foo(l=12)
    Okay: for a in foo(l=12):
    E741: except AttributeError as O:
    E741: with lock as l:
    E741: global I
    E741: nonlocal l
    E741: def foo(l):
    E741: def foo(l=12):
    E741: l = foo(l=12)
    E741: for l in range(10):
    E742: class I(object):
    E743: def l(x):
    Fr)�l�O�IrNr@Tr0r�r/)�asrA�global�nonlocalrIz$E742 ambiguous class definition '%s'z'E743 ambiguous function definition '%s'z!E741 ambiguous variable name '%s')r�r%r�)rLr��is_func_def�parameter_parentheses_level�idents_to_avoidr'r(rr*r)rr�r�r�r��identrs                 r=�ambiguous_identifierr��s�����D�K�"#��%�O�5;�A�Y�2�I�y�*�h��.4�Q�R�R�j�+�+�*�
�D�%��d����������K�&�!�+�+��X�]�*�*��h�k�)�)�d�c�k�k�*+�'�'�
(�1�
,�
,��h�k�)�)��s�{�{�+�q�0�+�+�����+�q�0�+����$�$�����+�q�0�0��O�+�+�!�� ���;�;�;���&�&������	���&�&�����������&�&��C�d�J�J�J�J�J�������&�&��F��M�M�M�M�M��	C��:�U�B�B�B�B�B��	��	��
�
�W+�+r?c#�XK�|�d��}|dkr
|s
|dfV�dSdSdS)z�The {}.has_key() method is removed in Python 3: use the 'in'
    operator.

    Okay: if "alph" in d:\n    print d["alph"]
    W601: assert d.has_key('alph')
    z	.has_key(r�z'W601 .has_key() is deprecated, use 'in'N�rZ)rLr�rs   r=�python_3000_has_keyr�sK�����
�
�K�
(�
(�C�
�R�x�x��x��<�<�<�<�<�<�<��x�x�xr?c#�K�t�|��}|r7t�|��s|���dz
dfV�dSdSdS)z�When raising an exception, use "raise ValueError('message')".

    The older form is removed in Python 3.

    Okay: raise DummyError("Message")
    W602: raise DummyError, "Message"
    rz)W602 deprecated form of raising exceptionN)�RAISE_COMMA_REGEXro�RERAISE_COMMA_REGEXr�)rLros  r=�python_3000_raise_commar�*sw����
�#�#�L�1�1�E��K�(�.�.�|�<�<�K��i�i�k�k�A�o�J�J�J�J�J�J�J�K�K�K�Kr?c#�PK�|�d��}|dkr|dfV�dSdS)z�New code should always use != instead of <>.

    The older syntax is removed in Python 3.

    Okay: if a != 'no':
    W603: if a <> 'no':
    r+r�z!W603 '<>' is deprecated, use '!='Nr��rLrs  r=�python_3000_not_equalr�8sC�����
�
�D�
!�
!�C�
�R�x�x��6�6�6�6�6�6�6��xr?c#�PK�|�d��}|dkr|dfV�dSdS)zfUse repr() instead of backticks in Python 3.

    Okay: val = repr(1 + 2)
    W604: val = `1 + 2`
    �`r�z+W604 backticks are deprecated, use 'repr()'Nr�r�s  r=�python_3000_backticksr�FsC�����
�
�C�
 �
 �C�
�R�x�x��@�@�@�@�@�@�@��xr?c#��K�|rdSgd�}|D�]\\}}}}}|tjk�rB|\}	}
|dd�dvr
|dd�n|d}|�|��}|d|����}
|t	|��z}||t	|���}d|
vr�|�d��}|dkr�|d	z
}|||vrw|	|�d
d|��z}||	kr&|
t	|
��zt	|��z|z}n||�d
d|��z
d	z
}||d	z
fd||zfV�|�d|d	z��}|dk����^dS)zsInvalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'
    N)r|r}r�r`�ar��f�n�r�t�v�0�1�2�3�4�5�6�7�x�Nr��U����z"""z'''r�r�r}rrr|z"W605 invalid escape sequence '\%s')r�rry�lowerr�rZr�r�)rLr�r��validrr�r�r�r��
start_line�	start_col�quote�	quote_pos�prefixr�r�cols                 r=�#python_3000_invalid_escape_sequencer�Rs���������
�
�
�E�*/5�5�5�*�
�D�%��d����(�(�$)�!�J�	�!%�b�c�c��n�!<�!<�D����I�I�$�r�(�E��
�
�5�)�)�I��*�9�*�%�+�+�-�-�F���E�
�
�*�E��%��U����+�,�F��&� � ��k�k�$�'�'���Q�h�h��1�H�C��c�{�%�/�/�)�F�L�L��q�#�,F�,F�F���:�-�-�"+�c�&�k�k�"9�C��J�J�"F��"L�C�C�"%����T�1�c�(B�(B�"B�Q�"F�C�!�3��7�O�A�"�3�K�(�����
!�+�+�d�C�!�G�4�4�C��Q�h�h��5�5r?c#�K�d}|D]�\}}}}}d}|tjkr�|�?|tjkr.|dkrd|f}n�|dkrd|f}n�|tjkr|dvrd|f}n�|ddkr|tjkr|d	vrd}ncd
}n`|ddkr/|tjkrd}nA|tjkr	|dkrd}n(d
}n%|ddkr|tjkr|dvrd
}nd}|r|d
dfV�d}��|�|d
dfV�dSdS)z�'async' and 'await' are reserved keywords starting at Python 3.7.

    W606: async = 42
    W606: await = 42
    Okay: async def read(db):
    data = await db.fetch('SELECT ...')
    NFr�
async_stmtr�)r@rA�definer)r@rHrATr0r�rzGW606 'async' and 'await' are reserved keywords starting with Python 3.7)r�r�r%r�)	rLr��staterr�r�r�r�rs	         r=� python_3000_async_await_keywordsr��s�����
�E�.4�,�,�*�
�D�%��d������$�$���=��X�]�*�*��7�?�?�)�5�1�E�E��W�_�_�$�e�,�E�E� �H�M�1�1��n�,�,�%�u�-�E��
�1�X��
%�
%��X�]�*�*�t�7M�/M�/M�������
�1�X��
 �
 ��X�]�*�*�����x�{�*�*�t�s�{�{�������
�1�X��
!�
!��X�]�*�*�t�7I�/I�/I�������	��a����
�
�
�
�E��
���!�H�
�
�	
�	
�	
�	
�	
��r?c#��K�|�|rdSd}t��}|D]D\}}}}	}
|t�tjg��vr|�|
���E|D�]|\}}}}	}
|tjkr|r�|tjtjfv�rC|�
|tv�r7|
���}t|��D�]\}}
|d|zdkr|
�
d��rdSt|
��}|
���}|tjkr5t|��dkr"|t|d��z
tkr��t|��dkrK|dzt|��kr5t|��dkr"|t|d��z
tkr��||kr|d|z|f}|d||fzfV���|}��~dS)z�Limit all doc lines to a maximum of 72 characters.

    For flowing long blocks of text (docstrings or comments), limiting
    the length to 72 characters is recommended.

    Reports warning W505
    Nrrr�rr�z+W505 doc line too long (%d > %d characters))�setr7�unionr�r�addr�SKIP_TOKENSr~rqr�r�r��MAX_DOC_LENGTH)rL�max_doc_lengthr�r��
prev_token�
skip_linesrr�r�r�r�r��line_numrKr�r��	doc_errors                 r=�maximum_doc_lengthr��s'�����������J����J�.4�!�!�*�
�D�%��d��]�0�0�(�/�1B�C�C�C�C��N�N�4� � � ��.4� � �*�
�D�%��d����(�(�Z�(���(�/�8�+;�<�<�<��!�Z�;�%>�%>����)�)��/8��/?�/?�;�;�+�H�m��Q�x�(�*�a�/�/�D�O�O�D�4I�4I�/����� ��/�/�F�*�0�0�2�2�F�!�X�%5�5�5���K�K�1�,�,� &��V�B�Z��� 8�>� I� I�$��6�{�{�a�'�'�H�q�L�3�u�:�:�,E�,E���K�K�1�,�,� &��V�B�Z��� 8�>� I� I�$���.�.�%*�1�X��%8�.�$I�	�(�+A�"(�.�!9�+:�;�;�;�;�� �
�
�5 � r?c�B�	tj|��5}|���cddd��S#1swxYwYdS#ttt
f$rCt|d���5}|���cddd��cYS#1swxYwYYdSwxYw)zRead the source code.Nzlatin-1)�encoding)r��open�	readlines�LookupError�SyntaxError�UnicodeError)�filenamer�s  r=r�r�
s3��!�
�]�8�
$�
$�	!���;�;�=�=�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!����l�3�!�!�!�
�(�Y�
/�
/�
/�	!�1��;�;�=�=�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!�	!�!���sP�A�7�A�;�A�;�A�(B�,B�
B�B	�B�B	�B�Bc�f�ttjjd������S)zRead the value from stdin.�ignore)�errors)rr��stdin�buffer�readrPr?r=�stdin_get_valuer�s&�����)�(�;�;�;�@�@�B�B�Br?iz# no(?:qa|pep8)\bc���|�d��}d|vr1t|��t|�����z
Sd}|D] }|dkr|dzdzdz}�|dkr|dz
}� |S)z�Return the amount of indentation.

    Tabs are expanded to the next multiple of 8.

    >>> expand_indent('    ')
    4
    >>> expand_indent('\t')
    8
    >>> expand_indent('       \t')
    8
    >>> expand_indent('        \t')
    16
    z

rxrr*r9r)r�r�r�)r��resultrus   r=r�r�s����;�;�v���D��4����4�y�y�3�t�{�{�}�}�-�-�-�-�
�F������4�<�<��q�[�1�_�q�(�F�F�
�S�[�[��a�K�F�F���Mr?c���|�|d��dz}t|��dz
}|dd�dvr
|dz
}|dz}|d|�d||z
zz||d�zS)z�Replace contents with 'xxx' to prevent syntax matching.

    >>> mute_string('"abc"')
    '"xxx"'
    >>> mute_string("'''abc'''")
    "'''xxx'''"
    >>> mute_string("r'abc'")
    "r'xxx'"
    r�rr�Nr�rr�)ryr�)r�r�r�s   r=�mute_stringr�9s{��
�J�J�t�B�x� � �1�$�E�

�d�)�)�a�-�C��B�C�C�y�N�"�"�
��
���q�������<�#��u��-�-��S�T�T�
�:�:r?�.c�L���i}dx}}|���D]�}|r|dd�dkr|dz}�|dd�dkrht�|��}d�|���D��\}}||�t|||z������|dd�dkrK|dd��d	d��d
}|dd�dvr
|dd�}t��||<���fd
�|���D��S)z&Return a dictionary of matching lines.Nrr"r	z@@ c3�8K�|]}t|pd��V��dS)r�N)�int)r;�gs  r=r>zparse_udiff.<locals>.<genexpr>Zs,����G�G�a�C���S�M�M�G�G�G�G�G�Gr?z+++rrxrr)zb/zw/zi/c�|��i|]8\}}|�t|����tj��|��|��9SrP)�filename_match�os�path�join)r;�filepath�rows�parent�patternss   ��r=rpzparse_udiff.<locals>.<dictcomp>csY�������X�t���#�8�X�6�6��
����V�X�&�&����r?)	r~�
HUNK_REGEXror��updater�r�r��items)	�diffrr
�rvrrr��
hunk_matchr
s	 ``      r=�parse_udiffrMs_����
�B���D�5����!�!�����	��B�Q�B�x�3�����
�������8�u���#�)�)�$�/�/�J�G�G�:�3D�3D�3F�3F�G�G�G�L�S�%��t�H�O�O�E�#�s�U�{�3�3�4�4�4�4�
�"�1�"�X��
�
�����8�>�>�$��*�*�1�-�D��B�Q�B�x�-�-�-��A�B�B�x���u�u�B�t�H������� "���
�
����r?c�j�|sgSt|t��r|Sg}|�d��D]}|���}d|vr=tj�tj�||����}|�|�	d������|S)zQParse a comma-separated list of paths.

    Return a list of absolute paths.
    r�r#)
�
isinstancerr�r�rr�abspathrrr�)�valuer
�pathsrs    r=�normalize_pathsrjs���
���	��%��������E����C� � �'�'���z�z�|�|���$�;�;��7�?�?�2�7�<�<���#=�#=�>�>�D�
���T�[�[��%�%�&�&�&�&��Lr?Tc�B��|s|St�fd�|D����S)z{Check if patterns contains a pattern that matches filename.

    If patterns is unspecified, this always returns True.
    c3�8�K�|]}t�|��V��dSrdr)r;�patternr�s  �r=r>z!filename_match.<locals>.<genexpr>�s-�����B�B�g�w�x��)�)�B�B�B�B�B�Br?)rj)r�rrs`  r=rr|s5���
�����B�B�B�B��B�B�B�B�B�Br?c�8�|D]}||vr||xxdz
cc<�dS)z^Adds one to the counts of each appearance of characters in s,
        for characters in countsrNrP)r<ryrus   r=rrrr�s=�������6�>�>��4�L�L�L�A��L�L�L���r?c��|dtvp1|d|ddd����dkS)Nrrr	rz\
)r�r�)�tokens r=�
_is_eol_tokenr�s<����8�w��K�%��(�5��8�A�;�<�<�"8�"?�"?�"A�"A�V�"K�Kr?c�b�eZdZdZ		dd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zdd�ZdS)�Checkerz;Load a Python source file, tokenize it, check coding style.Nc��|�t|��j}n|rJ�d|_|j|_|j|_|j|_|j	|_	|j
|_
|j|_d|_|j
|_
|j|_|j|_||_i|_|�d|_|pg|_n�|dkr.d|_t%���d��|_ne|�\	t)|��|_nM#t*$r9t-j��dd�\}}|j�d|��|_g|_YnwxYw||_|jr~t3|jdd��}|dvrZ|d	kr|jdd
d�|jd<n6|jddd�dkr|jddd�|jd<|p|j|_|jj|_d|_dS)
NFr�r"Tr�: r)���r%rr	u)�
StyleGuide�options�	_io_error�physical_checks�_physical_checks�logical_checks�_logical_checks�
ast_checks�_ast_checksr�r�r�r�rrr��_checker_statesr�r�r~r��OSErrorr��exc_info�__name__�ord�reportr�report_errorr�)	rer�r�r'r4�kwargs�exc_type�exc�ord0s	         r=rkzChecker.__init__�s���?� ��(�(�0�G�G����:���� '� 7���&�5���"�-���&�6���%�4���"�.������#�0���"�.������� ��
�!�����#�D�M���"�D�J�J�
��_�_�#�D�M�(�*�*�5�5�d�;�;�D�J�J�
�]�
 �&�x�0�0��
�
���
 �
 �
 �"%�,�.�.��!��"4���3�$,�$5�!>�!>��!>�!>�����
�
�
�
 ����
�D�J��:�	6��t�z�!�}�Q�'�(�(�D��~�%�%��6�>�>�$(�J�q�M�!�"�"�$5�D�J�q�M�M��Z��]�2�A�2�&�.�8�8�$(�J�q�M�!�"�"�$5�D�J�q�M��.����� �K�-�����	�	�	s�.D�AE�Ec	�N�tj��dd�\}}t|j��dkr+|jd}t|��dkr
|dd�}nd}|�|d|dpdd|j�d|jd��|j��dS)	zCheck if the syntax is valid.Nrrr	)rrrzE901 r#)r�r1r�rcr5r2�report_invalid_syntax)rer7r8rts    r=r;zChecker.report_invalid_syntax�s����,�.�.��!��,���3��s�x�=�=�1����X�a�[�F��6�{�{�Q�����!������F����&��)�V�A�Y�^�!�D�(�"3�D�D�s�x��{�D�D��4�	6�	6�	6�	6�	6r?c��|j|jkrdS|j|j}|xjdz
c_|j�|dd�tvr
|d|_|S)z(Get the next line from the input buffer.r^rNr)r�r�r�rrr�)rer�s  r=�readlinezChecker.readline�sg����t�/�/�/��2��z�$�*�+�����A������#��R�a�R��J�(>�(>�#�A�w�D���r?c�`�g}|D]%}|�t||�����&||�S)zRun a check plugin.)r�getattr)rera�argument_names�	argumentsrSs     r=�	run_checkzChecker.run_check�sD���	�"�	2�	2�D����W�T�4�0�0�1�1�1�1��u�i� � r?c�R�d|vr"|j�|i��|_dSdS)z5Prepare custom state for the specific checker plugin.rkN)r/�
setdefaultrk)rerSr@s   r=�init_checker_statezChecker.init_checker_state�s6���n�,�,�!%�!5�!@�!@��r�!J�!J�D����-�,r?c��||_|jD]q\}}}|�||��|�||��}|�=|\}}|�|j|||��|dd�dkr
|d|_�rdS)z,Run all physical checks on a raw input line.Nr�E101r)rKr*rErBr5r�rr)rer�rSrar@r�rtr�s        r=�check_physicalzChecker.check_physical�s���!���+/�+@�	/�	/�'�D�%���#�#�D�.�9�9�9��^�^�E�>�:�:�F��!�!'�����!�!�$�"2�F�D�%�H�H�H�����8�v�%�%�'+�A�w�D�$��	/�	/r?c��g}g}d}dx}x}}|jD]�\}}}	}
}|tvr�|sd|	fg}|tjkr|�|���?|tjkrt
|��}|rK|	\}}
||kr-|j|dz
|dz
}|dks|dvr	|dvrd|z}n||
kr
|||
�|z}|�|��|t|��z
}|�||
f��|
\}}��d�	|��|_
|o!td�	|����|_|S)	z!Build a logical line from tokens.rNrr�z{[(r�r9r^)r�r�r�rrrr�r�r�rrLr�)re�logical�commentsr��prev_row�prev_col�mappingrr�r�r�r��	start_rowr�r(s               r=�build_tokens_linezChecker.build_tokens_line�s���������(,�,��,�8�g�26�+�	'�	'�.�J��e�S�$��[�(�(���
'��u�:�,���X�-�-�-�����%�%�%���X�_�,�,�"�4�(�(���
;�).�&��I��y�(�(� $�
�8�a�<� 8��A�� F�I� �C�'�'�I�U�,B�,B�,0��,=�,=�"�T�z�����*�*���� 2�3�d�:�D��N�N�4� � � ��c�$�i�i��F��N�N�F�C�=�)�)�)�#&� �X�x�x��G�G�G�,�,����8��b�g�g�h�&7�&7�!8�!8��	��r?c��|j���|���}|sdSd�|D��}|dd\}}|j|dz
}t	|d|���|_|j|jkr|j|_|jdkr.t|j
dd������|jD]�\}}}|jdkrtd|z��|�
||��|�||��pd	D]r\}	}
t|	t ��s4|t#j||	��\}}|d|d|	z|z
f}	|�|	d|	d|
|���s��|j
r+|j|_|j
|_|js|j
|_d|_g|_dS)
z:Build a line from tokens and run all logical checks on it.Nc��g|]\}}|��SrPrP)r;rt�_s   r=rUz)Checker.check_logical.<locals>.<listcomp>s��;�;�;�i�f�a�6�;�;�;r?rrr�Prz   rP)r4�increment_logical_linerPr�r�r�r�r�rrrLr�r,rErBr�tuple�bisect�bisect_leftr5r�r�r�r�)
rerN�mapping_offsetsrOr�r�rSrar@rtr��token_offsetrs
             r=�
check_logicalzChecker.check_logicals����*�*�,�,�,��(�(�*�*���	��F�;�;�7�;�;�;��!(���A����I��Z�	�A�
�.�
�)�*�Z�i�Z�*@�A�A�����t�/�/�/� $� 0�D���<�1����$�#�C�R�C�(�/�/�1�1�2�2�2�+/�+?�	E�	E�'�D�%���|�q� � ��e�d�l�#�#�#��#�#�D�.�9�9�9� $���u�n� E� E� K��
E�
E����!�&�%�0�0�F�)0��0B�'��11�11�)2�%�L�#�!�!�f�c�!�f�v�o��&D�E�F��!�!�&��)�V�A�Y��e�D�D�D�D�
E���	J�)-�):�D�&�$(�$5�D�!��$�
J�8<�8I��5��������r?c��	td�|j��ddt��}n1#tt
tf$r|���cYSwxYw|jD]o\}}}|||j	��}|�
��D]C\}}}}	|jrt|j|dz
��s|�||||	���D�pdS)z,Build the file's AST and run all AST checks.r^�execrN)
�compilerr��
PyCF_ONLY_AST�
ValueErrorr��	TypeErrorr;r.r��runr�r5)
rerMrS�clsr)�checker�linenortr�ras
          r=�	check_astzChecker.check_ast;s��	0��2�7�7�4�:�.�.��F�M�J�J�D�D���K��3�	0�	0�	0��-�-�/�/�/�/�/�	0����!�-�	C�	C�M�D�#�r��c�$��
�.�.�G�/6�{�{�}�}�
C�
C�+����e��z�C��d�j��!��.D�)E�)E�C��%�%�f�f�d�E�B�B�B��
C�	C�	Cs�/2�+A �A c#��K�|jr%|�ddd|jzt��tj|j��}	d}|D]`}|dd|jkrdS|dot|d��|_|�||��|V�|d}�adS#ttj
f$r|���YdSwxYw)z9Tokenize file, run physical line checks and yield tokens.rrzE902 %sr^rNr)r(r5r�r��generate_tokensr=r�r��maybe_check_physicalr��
TokenErrorr;)re�tokengen�
prev_physicalrs    r=rhzChecker.generate_tokensGs�����>�	K����a��I���$>�	�J�J�J��+�D�M�:�:��
	)��M�!�
)�
)����8�A�;��!1�1�1��F�F�!�!�H�7��e�A�h����	��)�)�%��?�?�?����� %�a��
�
�

)�
)���X�0�1�	)�	)�	)��&�&�(�(�(�(�(�(�	)���s�	B0�)AB0�0*C�Cc�B�t|��r@|ddkr|�|��dS|�|d��dS|dtjkr�d|dvr�t	|d��rdSd|_|dd|_|\}}\}}}}|j|jdz
d|�|z}|�d��dd	�D]*}|�|dz��|xjdz
c_�+d
|_dSdSdS)z9If appropriate for token, check current physical line(s).rr^rr|rNTrr�F)	rrHr�rr�r�r�r�r�)rerrlrS�srcrtr�s       r=rizChecker.maybe_check_physicalXsJ��
����!	#��Q�x�2�~�~��#�#�M�2�2�2�2�2��#�#�E�!�H�-�-�-�-�-�
�1�X���
(�
(�T�U�1�X�-=�-=� �E�!�H�~�~�
���!�D�N�$�Q�x��{�D��(-�%�A�s�K�Q���A��*�T�-��1�2�7�F�7�;�c�A�C��	�	�$������,�
&�
&���#�#�D�4�K�0�0�0�� � �A�%� � � �"�D�N�N�N�3)�
(�-=�-=r?rc��|j�|j|j||��t	|j��|_|jr|���d|_d|_	dx|_
|_d|_d|_
g|_dx|_|_d}|���D�]t}|j�|��|dd�\}}|jdkr�|dd|ddkr1d�|ddpd|dd��}nd|ddz}t+d	|dd�d
|�d
t,j|d�d
|����|t,jkr|dvr|dz
}��|dvr|dz}��|s||t2vrs|t,jkr|���d|_��.t	|j��dkr|xjdz
c_|jd=��`|�����v|jr4|�|jd
��|���|j���S)z!Run all checks on the input file.rNr^rr	z[{}:{}]rzl.%szl.rxr�r�r�)r4�	init_filer�r�r�r�r.rfr�rrr�r�r�r�r�r�r�rhrrr�rr��tok_namer�r�r[rH�get_file_results)re�expected�line_offsetr
rrr�rs        r=�	check_allzChecker.check_all�s�������d�m�T�Z��;�O�O�O��t�z�?�?�����	��N�N����������9:�:���D�6� "���02��-����/0�0���4�,����)�)�+�+�	-�	-�E��K���u�%�%�%�$�Q�q�S�z��J���|�q� � ���8�A�;�%��(�1�+�-�-�#�*�*�5��8�A�;�+<�"�e�A�h�q�k�J�J�C�C� �5��8�A�;�.�C����Q�x��{�{�{�C�C�C��):�5��8�)D�)D�)D�d�d�L�M�M�M��X�[�(�(��5�=�=��a�K�F�F��U�]�]��a�K�F���

-���(�(�!�X�%5�5�5��*�*�,�,�,�,-��)�)��T�[�)�)�Q�.�.��(�(�A�-�(�(� �K��N�N��*�*�,�,�,���;�	!�����
�2��/�/�/���� � � ��{�+�+�-�-�-r?)NNNN�Nr)r2�
__module__�__qualname__rirkr;r=rBrErHrPr[rfrhrirurPr?r=r!r!�s�������E�E�,0�&*�,�,�,�,�\6�6�6����!�!�!�K�K�K�

/�
/�
/����B!�!�!�F
C�
C�
C�)�)�)�"&#�&#�&#�P+.�+.�+.�+.�+.�+.r?r!c�^�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zdd�Zdd�Z
dd
�Zd�ZdS)�
BaseReportz"Collect the results of the checks.Fc��|j|_|j|_d|_d|_t�|jd��|_i|_	dSrv)
�benchmark_keys�_benchmark_keys�ignore_code�_ignore_code�elapsed�total_errors�dict�fromkeys�counters�messages)rer's  r=rkzBaseReport.__init__�sJ��&�5���#�/����������
�
�d�&:�A�>�>��
���
�
�
r?c�6�tj��|_dS)zStart the timer.N)�time�_start_time�res r=r�zBaseReport.start�s���9�;�;����r?c�F�tj��|jz
|_dS)zStop the timer.N)r�r�r�r�s r=�stopzBaseReport.stop�s���y�{�{�T�%5�5����r?c��||_||_|pd|_||_d|_|jdxxdz
cc<|jdxxt
|��z
cc<dS)�Signal a new file.rPrr5rr7N)r�r�rsrt�file_errorsr�r�)rer�r�rsrts     r=rpzBaseReport.init_file�st�� ��
���
� ��B��
�&�������
�g����!�#�����
�&�'�'�'�3�u�:�:�5�'�'�'�'�'r?c�0�|jdxxdz
cc<dS)zSignal a new logical line.r6rN)r�r�s r=rUz!BaseReport.increment_logical_line�s&���
�o�&�&�&�!�+�&�&�&�&�&r?c�X�|dd�}|�|��rdS||jvr|j|xxdz
cc<nd|j|<|dd�|j|<||jvrdS|jr|jst
|j��|xjdz
c_|xjdz
c_|S)�&Report an error, according to options.Nrr�)	rr�r�rs�print_filenamer�rr�r�)rer�rtr�rar�s      r=rzBaseReport.error�s����B�Q�B�x�����T�"�"�	��F��4�=� � ��M�$����1�$�����"#�D�M�$��"&�q�r�r�(�D�M�$���4�=� � ��F���	!�t�'7�	!��$�-� � � ����A�������Q�����r?c��|jS)z6Return the count of errors and warnings for this file.)r�r�s r=rrzBaseReport.get_file_results�s����r?r^c�H���t��fd��jD����S)z.Return the total count of errors and warnings.c3�\�K�|]&}|������j|V��'dSrd)r�r��r;�keyr�res  ��r=r>z'BaseReport.get_count.<locals>.<genexpr>�sW�����G�G��s�~�~�f�/E�/E�G�4�=��%�G�G�G�G�G�Gr?)�sumr��rer�s``r=�	get_countzBaseReport.get_count�sN�����G�G�G�G�G�"�m�G�G�G�G�G�	Gr?c�H�����fd�t�j��D��S)a
Get statistics for message codes that start with the prefix.

        prefix='' matches all errors and warnings
        prefix='E' matches all errors
        prefix='W' matches all warnings
        prefix='E4' matches all errors that have to do with imports
        c�|��g|]8}|������j|d�d|�d�j|����9S)r�r9)r�r�r�r�s  ��r=rUz-BaseReport.get_statistics.<locals>.<listcomp>�se���L�L�L��C�N�N�6�4J�4J�L��
�c� 2� 2� 2� 2�C�C�C���s�9K�9K�L�L�L�Lr?)�sortedr�r�s``r=�get_statisticszBaseReport.get_statistics�sG����L�L�L�L�L�!�$�-�0�0�L�L�L�	Lr?c�T�|�|��D]}t|���dS)z9Print overall statistics (number of errors and warnings).N)r�r)rer�r�s   r=�print_statisticszBaseReport.print_statistics�s6���'�'��/�/�	�	�D��$�K�K�K�K�	�	r?c���td�|jd����|jr=|jD]7}td|j||jz||j|fz���6dSdS)zPrint benchmark numbers.z{:<7.2f} {}zseconds elapsedz%-7d %s per second (%d total)N)rr�r�r}r�)rer�s  r=�print_benchmarkzBaseReport.print_benchmark�s���
�m�"�"�4�<�1B�C�C�D�D�D��<�	,��+�
,�
,���5��}�S�)�D�L�8�#��}�S�)�+�+�,�,�,�,�	,�	,�
,�
,r?N�r^)r2rwrxrir�rkr�r�rprUrrrr�r�r�r�rPr?r=rzrz�s�������,�,��N����'�'�'�6�6�6�6�6�6�,�,�,����& � � �G�G�G�G�
	L�	L�	L�	L�����
,�,�,�,�,r?rzc��eZdZdZdZdS)�
FileReportz:Collect the results of the checks and print the filenames.TN)r2rwrxrir�rPr?r=r�r�	s������D�D��N�N�Nr?r�c�<��eZdZdZ�fd�Z�fd�Z�fd�Zd�Z�xZS)�StandardReportz,Collect and print the results of the checks.c�
��t���|��t�|j���|j��|_|j|_|j	|_
|j|_dSrd)
�superrk�
REPORT_FORMATr�r�r��_fmt�repeat�_repeat�show_source�_show_source�	show_pep8�
_show_pep8�rer'�	__class__s  �r=rkzStandardReport.__init__	si���
������!�!�!�!�%�%�g�n�&:�&:�&<�&<�&-�n�6�6��	��~���#�/���!�+����r?c�Z��g|_t���||||��S)r�)�_deferred_printr�rp)rer�r�rsrtr�s     �r=rpzStandardReport.init_file	s0���!����w�w� � ��e�X�{�4�4�	4r?c����t���||||��}|rD|j|dks|jr,|j�||||dd�|jf��|S)r�rr�N)r�rr�r�r�rri)rer�rtr�rar�r�s      �r=rzStandardReport.error	sz����w�w�}�}�[�&�$��>�>���	F�T�]�4�(�A�-�-���-�� �'�'��f�d�D����H�e�m�D�
F�
F�
F��r?c
�X�|j���|jD�]\}}}}}t|j|j|j|z|dz||d�z��|jrz|t|j��krd}n|j|dz
}t|�	����ttjdd|d|���dz��|jr&|r$td|�
��z��tj�����|jS)	z9Print results and return the overall count for this file.r)rr
r�r�r�r^z\Sr9Nr%z    )r��sortrr�r�rtr�r�r�r�rh�subr�r�r��stdout�flushr�)rer�rtr�r��docr�s       r=rrzStandardReport.get_file_results'	s8����!�!�#�#�#�48�4H�	�	�0�K���t�S��$�)��
��'�+�5�f�q�j��d����
�
�
�
� �
?���T�Z���0�0��D�D��:�k�A�o�6�D��d�k�k�m�m�$�$�$��b�f�U�C��g�v�g��7�7�#�=�>�>�>���
,�3�
,��f�s�y�y�{�{�*�+�+�+�
�J���������r?)	r2rwrxrirkrprrr�
__classcell__�r�s@r=r�r�	s�������6�6�,�,�,�,�,�4�4�4�4�4������ � � � � � � r?r�c�,��eZdZdZ�fd�Z�fd�Z�xZS)�
DiffReportz9Collect and print the results for the changed lines only.c�b��t���|��|j|_dSrd)r�rk�selected_lines�	_selectedr�s  �r=rkzDiffReport.__init__G	s)���
������!�!�!� �/����r?c�x��||j|jvrdSt���||||��Srd)r�r�r�r)rer�rtr�rar�s     �r=rzDiffReport.errorK	s8����d�n�T�]�;�;�;��F��w�w�}�}�[�&�$��>�>�>r?)r2rwrxrirkrr�r�s@r=r�r�D	sW�������C�C�0�0�0�0�0�?�?�?�?�?�?�?�?�?r?r�c�J�eZdZdZd�Zdd�Zdd�Zd
d�Zd�Zdd	�Z	d
�Z
d�ZdS)r&z-Initialize a PEP-8 instance with few options.c�X�|�dt��|_|�dd��}|�dd��}|�dd��}t|i|��}|rdn|�dd��}|�dd��}t|||||��\}	|_|r+|	j�|��d|vr
|d|_|j	|_
|	|_|	js|	j
rtnt|	_t!|	jpd��|	_|	jsI|	jsB|	js;|	js4t*r-t!t*�d	����|	_n"|	jrd
nt!|	j��|	_t.dd�|	_|j|	_|�d��|	_|�d��|	_|�d
��|	_|���dS)N�
checker_class�
parse_argvF�config_file�parserrrrPr�r�rKrLrM)rr!r�r�r��process_optionsr�__dict__r
�
input_file�runnerr'�reporter�quietrzr�rV�selectr�r�doctest�DEFAULT_IGNOREr��BENCHMARK_KEYSr|r~�
get_checksr)r+r-�init_report)
rercr6r�r�r��options_dict�arglistrr's
          r=rkzStyleGuide.__init__T	s��#�Z�Z���A�A����Z�Z��e�4�4�
��j�j���6�6�����H�d�+�+���T�,�V�,�,��$�I�$�$�,�*:�*:�7�D�*I�*I���"�"�9�d�3�3��-��Z��f�g�?�?������	3���#�#�L�1�1�1��,�&�&�)�'�2��
��o��������	O�-4�]�N�z�z��G���w�~�3��4�4�����	P�'�.�	P��!�	P�%,�_�	P�:H�	P�#�>�#7�#7��#<�#<�=�=�G�N�N�'.�n�O�U�U�%���:O�:O�G�N�!/����!2���"�.���"&�/�/�/�"B�"B���!%����!@�!@���!�_�_�V�4�4����������r?Nc�f�|p|jj|j��|j_|jjS)zInitialize the report instance.)r'r�r4)rer�s  r=r�zStyleGuide.init_reportz	s-��@�x�@�4�<�+@�$�,�O�O�����|�"�"r?c��|�|j}|jj}|j}|���	|D]W}t
j�|��r|�|���7|�	|��s||���Xn#t$rtd��YnwxYw|���|S)zRun all checks on the paths.Nz... stopped)
rr'r4r�r�rr�isdir�	input_dir�excluded�KeyboardInterruptrr�)rerr4r�rs     r=�check_fileszStyleGuide.check_files	s����=��J�E���$�����������	!��
!�
!���7�=�=��&�&�!��N�N�4�(�(�(�(����t�,�,�!��F�4�L�L�L��	
!��
!�	!�	!�	!��-� � � � � �	!�������
�
�
��
s�AB
�
B)�(B)rc��|jjrtd|z��|�|||j���}|�||���S)z'Run all checks on a Python source file.zchecking %s)r�r')rsrt)r'rrr�ru)rer�r�rsrt�fcheckers      r=r�zStyleGuide.input_file�	s^���<��	,��-�(�*�+�+�+��%�%��E�4�<�&�9�9���!�!�8��!�M�M�Mr?c�x�|�d��}|�|��rdS|jjj}|jj}|jj}|j}tj	|��D]�\}}}|rtd|z��|dxxdz
cc<t|��D]-}	|�|	|��r|�|	���.t|��D]Q}
t|
|��r?|�|
|��s)|tj�||
�����R��dS)z9Check all files in this directory and all subdirectories.r#rz
directory r4rN)r�r�r'r4r�rr�r�r�walkrr��removerrr)re�dirnamer�r�filepatternsr��root�dirsr5�subdirr�s           r=r�zStyleGuide.input_dir�	sZ���.�.��%�%���=�=��!�!�	��1��<�&�/���,�&���|�,�����!#���!1�!1�
	9�
	9��D�$���
+��l�T�)�*�*�*��]�#�#�#�q�(�#�#�#� ��,�,�
(�
(���=�=���.�.�(��K�K��'�'�'��"�5�M�M�
9�
9��#�8�\�:�:�9��
�
�h��5�5�9��F�2�7�<�<��h�7�7�8�8�8��

9�
	9�
	9r?c�J�|jjsdStj�|��}t||jj��rdS|r tj�||��}tj�|��}t||jj��S)zxCheck if the file should be excluded.

        Check if 'options.exclude' contains a pattern matching filename.
        FT)r'�excluderr�basenamerrr)rer�r
r�s    r=r�zStyleGuide.excluded�	s���
�|�#�	��5��7�#�#�H�-�-���(�D�L�$8�9�9�	��4��	6��w�|�|�F�H�5�5�H��7�?�?�8�,�,���h���(<�=�=�=r?c���t���dkr't�fd�|jjD����rdS��|jj��o��|jj��S)z�Check if the error code should be ignored.

        If 'options.select' contains a prefix of the error code,
        return False.  Else, if 'options.ignore' contains a prefix of
        the error code, return True.
        rc3�B�K�|]}|����V��dSrdre)r;r<r�s  �r=r>z)StyleGuide.ignore_code.<locals>.<genexpr>�	sC�����!?�!?�%&�"#���d�!3�!3�!?�!?�!?�!?�!?�!?r?F)r�rjr'r�r�r�)rer�s `r=r~zStyleGuide.ignore_code�	s�����t�9�9�q�=�=�S�!?�!?�!?�!?�*.�,�*=�!?�!?�!?�?�?�=��5������ 3�4�4�9��O�O�D�L�$7�8�8�8�	:r?c����g}t|���D]B\}}|\}}t�fd�|D����r|�|j||f���Ct|��S)z�Get all the checks for this category.

        Find all globally visible functions where the first argument
        name starts with argument_name and which contain selected tests.
        c3�H�K�|]}|o��|��V��dSrd)r~)r;r�res  �r=r>z(StyleGuide.get_checks.<locals>.<genexpr>�	s9�����K�K�T��7��!1�!1�$�!7�!7�8�K�K�K�K�K�Kr?)r_rrjrr2r�)re�
argument_name�checksra�attrsrbrcs`      r=r�zStyleGuide.get_checks�	s������#�M�2�8�8�:�:�	=�	=�L�E�5�!�M�U�D��K�K�K�K�U�K�K�K�K�K�
=��
�
�u�~�u�d�;�<�<�<���f�~�~�r?rd)NNr)r2rwrxrirkr�r�r�r�r�r~r�rPr?r=r&r&Q	s�������7�7�$�$�$�L#�#�#�#�
����$N�N�N�N�9�9�9�0
>�
>�
>�
>�:�:�:�����r?r&c���t||d���}gd�|_|�ddddd�	��|�d
dddd�	��|�d
dddd�	��|�dddd���|�ddtd���|�dddd���|�ddd d!���|�d"dd d#tz���|�d$dd%�&��|�d'dd(�&��|�d)dd*�&��|�d+dd,�&��|�d-d.d/t
d0�1��|�d2d.d/d3d4�1��|�d5d.d/td6�1��|�d7dd8�&��|�d9d:d;d<���|�d=dd>�&��|�d?��}tj	�
t��r0|�d@dAdB�C��|�dDddE�&��|�dFddG�&��|S)Hz"Create the parser for the program.z%prog [options] input ...)�prog�version�usage)r�r�r�r�zmax-line-lengthzmax-doc-lengthzindent-sizezhang-closingr�r�r�z	show-pep8zshow-source�
statisticsrz-vz	--verboserr�z(print status messages, or debug with -vv)r�action�helpz-qz--quietz+report only file names, or nothing with -qqz-rz--repeatT�
store_truez1(obsolete) show all occurrences of the same errorz--first�store_falser�z#show first occurrence of each error)r��destr�z	--excluderz[exclude files or directories which match these comma separated patterns (default: %default)��metavarrr�z
--filenamez*.pyzjwhen parsing directories, only check filenames matching these comma separated patterns (default: %default)z--selectr�r^z&select errors and warnings (e.g. E,W6)z--ignorez2skip errors and warnings (e.g. E4,W) (default: %s)z
--show-sourcezshow source code for each error)r�r�z--show-pep8z3show text of PEP 8 for each error (implies --first)z--statisticszcount errors and warningsz--countzgprint total number of errors and warnings to standard error and set exit code to 1 if total is not nullz--max-line-lengthrr�z3set maximum allowed line length (default: %default))�typerrr�z--max-doc-lengthNzSset maximum allowed doc line length and perform these checks (unchecked if not set)z
--indent-sizez9set how many spaces make up an indent (default: %default)z--hang-closingzNhang closing bracket instead of matching indentation of opening bracket's linez--formatr�rz.set the error format [default|pylint|<custom>]z--diffzSreport changes only within line number ranges in the unified diff received on STDINzTesting Optionsz--testsuite�dirzrun regression tests from dir)rr�z	--doctestzrun doctest on myselfz--benchmarkzmeasure processing speed)r�config_options�
add_option�DEFAULT_EXCLUDEr��MAX_LINE_LENGTH�INDENT_SIZE�add_option_grouprr�exists�TESTSUITE_PATH)r�r�r�rps    r=�
get_parserr�	s���
�t�W� ;�=�=�=�F�F�F�F�F�����d�K��7�E��G�G�G�
���d�I�q��H��J�J�J�
���d�J��\�N��P�P�P�
���i�
�H�@��B�B�B�
���k�:��J��K�K�K����l�J��1��2�2�2����j�(�B�C��E�E�E�
���j�(�B�+�-;�<��=�=�=����o�l�<��>�>�>�
���m�L�/��0�0�0����n�\�6��8�8�8�
���i��/��0�0�0����)��s�-�1��2�2�2����(�u�c�"�A��B�B�B����o�E�3�)�1��2�2�2����&�|�C��D�D�D����j�(�I�K��M�M�M�
���h�|�@��A�A�A�
�#�#�$5�6�6�E�	�w�~�~�n�%�%�7�
�����=�	�	?�	?�	?�
����\�5�	�	7�	7�	7�	���]�<�4��6�6�6��Mr?c
�~��t��}|j}tj}tr\tj�t��r8|jrtdtz��|�	t��|o;tj�
tj�|����x�}|rf|�	�fd�tD����r�}|jrtd�z��n$tj�
���\�}|�f|rMtj�|��r.|jrtd|z��|�	|��d}|�|j��r|j}n+|�d��rd}t!jd��|�r`d�|jD��}	|�g��\}
}|�|��D�]}|�d	d
��|jvrtd|z���3|jdkr7td
�||�||������|�d
d	��}
|	|
}|dvr|�||��}nG|dvr|�||��}n,|�||��}|
dkrt7||��}t9|
|
|����|�||
���\}}dx|_|_|S)a{Read and parse configurations.

    If a config file is specified on the command line with the
    "--config" option, then only it is used for configuration.

    Otherwise, the user configuration (~/.config/pycodestyle) and any
    local configurations in the current directory or above will be
    merged together (in that order) using the read method of
    ConfigParser.
    zuser configuration: %sc3�X�K�|]$}tj��|��V��%dSrd)rrr)r;�fnr
s  �r=r>zread_config.<locals>.<genexpr>9
s3�����I�I�B�r�w�|�|�F�B�/�/�I�I�I�I�I�Ir?zlocal configuration: in %szcli configuration: %sN�pep8z0[pep8] section is deprecated. Use [pycodestyle].c�6�i|]}|j|jp|j��SrP)r�rr��r;�os  r=rpzread_config.<locals>.<dictcomp>M
s%��N�N�N�a�q�v�q�v�1���N�N�Nr?rSr"z  unknown option '%s' ignoredrz	  {} = {})rr�)r�r�r�)rYF)r�configr�curdir�USER_CONFIGr�isfilerrr�r�commonprefix�PROJECT_CONFIGr��has_sectionr��warnings�warn�option_list�
parse_argsr'r:rr�r��getint�
getbooleanr�setattrr�r)r'rcr�r�r�cli_conf�	local_dir�tail�pycodestyle_sectionr�new_optionsr)�opt�normalized_opt�opt_typerr
s                @r=�read_configr)!
sc����
�
�F��~�H��	�I��!�r�w�~�~�k�2�2�!��?�	:��*�[�8�9�9�9����K� � � ��H�R�W�_�_�R�W�-A�-A�$�-G�-G�H�H�H�F�T�
�/��;�;�I�I�I�I�.�I�I�I�I�I�	��I���
=��2�V�;�<�<�<������v�.�.����
�/���B�G�N�N�8�,�,���?�	6��)�H�4�5�5�5����H������
���&�+�&�&�J�$�k���	�	�	�F�	#�	#�J�$���
�H�I�I�I��G�N�N�6�;M�N�N�N��#�-�-�b�1�1���b��>�>�"5�6�6�	8�	8�C��{�{�3��$�$�F�,A�A�A��5��;�<�<�<�����"�"��k�(�(��)/���4G��)M�)M�O�O�P�P�P� �[�[��c�2�2�N�"�>�2�H��+�+�+��
�
�&9�3�?�?����:�:�:��)�)�*=�s�C�C����
�
�#6��<�<��!�Y�.�.�+�E�9�=�=�E��K���7�7�7�7��)�)�'�+�)�F�F�
��"�*/�/�G�O�g�'��Nr?Fc	�4�|st��}|�d��sT|�dd|j�dd�|j���d����}|�dd|d	�
��|s|sg}|�|��\}}d|_|�||_	|�
dd
��r|�|j��n�|�
dd
��sm|r@|s>|j
std�tD����rdg}n|�d��t#||||��}|o|jdkot&|_t)|j��|_t-|j��|_t)|j��|_t)|j��|_|j
rOt4|_t7��}t9||j|d��|_t=|j��}||fS)z�Process options passed either via arglist or command line args.

    Passing in the ``config_file`` parameter allows other tools, such as
    flake8 to specify their own options to be processed in pycodestyle.
    z--config�
Configurationz'The project options are read from the [z�] section of the tox.ini file or the setup.cfg file located in any parent folder of the path(s) being processed.  Allowed options are: z, r�)�descriptionrzuser config file locationr�NrFr�c3�TK�|]#}tj�|��V��$dSrd)rrr	)r;rSs  r=r>z"process_options.<locals>.<genexpr>�
sD����#?�#?�'+�$&�7�>�>�$�#7�#7�#?�#?�#?�#?�#?�#?r?zinput not specifiedrr)r�
has_optionrr�rrrrr�r�ensure_valuerrrrjrrr)r�r��_parse_multi_optionsr�rr�r�r�r�r�rr�r�)	r�r�r�r�rrpr'rcr�s	         r=r�r�l
sN�����������Z�(�(�;��'�'����[�[�[�$�)�)�F�$9�:�:�:�:�
<�(�>�>��
	����V�[�9�	�	;�	;�	;���:�����'�'��0�0�O�W�d��G����!������K��/�/�
L����G�%�&�&�&�&�
�
!�
!�)�U�
3�
3�L��	4�d�	4��|�
4�s�#?�#?�/=�#?�#?�#?� ?� ?�
4��u������2�3�3�3��g�t�W�f�=�=��%�K�'�-�1�*<�K����+�G�,<�=�=�G��%�g�o�6�6�G�O�)�'�.�9�9�G�N�)�'�.�9�9�G�N��|�.�%����!�!��!,�U�G�4D�d�1�g�!N�!N����g�,�-�-���D�=�r?r�c�H�|rd�|�|��D��S|S)zgSplit and strip and discard empties.

    Turns the following:

    A,
    B,

    into ["A", "B"]
    c�^�g|]*}|����|�����+SrP)r�rs  r=rUz(_parse_multi_options.<locals>.<listcomp>�
s-��K�K�K�a������K����	�	�K�K�Kr?)r�)r'�split_tokens  r=r0r0�
s1����K�K�7�=�=��#=�#=�K�K�K�K��r?c�`�ddl}	|�|jd���n#t$rYnwxYwtd���}|j}|js|jrddlm}||��}n|�	��}|j
r|���|jr|�
��|jr|js|���|jrQ|jr4t$j�t+|j��dz��t%jd��dSdS)	z.Parse options and run checks on Python source.rNc�*�tjd��S)Nr)r��exit)�signum�frames  r=�<lambda>z_main.<locals>.<lambda>�
s��C�H�Q�K�K�r?T)r�)�	run_testsr|r)�signal�SIGPIPE�AttributeErrorr&r'r�r�testsuite.supportr:r�r�r��	benchmarkr�r��
print_resultsr�r�r��stderr�writer�r6)r;�style_guider'r:r4s     r=�_mainrD�
se���M�M�M�
��
�
�f�n�&G�&G�H�H�H�H���
�
�
���
������-�-�-�K��!�G���+�'�+�+�/�/�/�/�/�/���;�'�'����(�(�*�*����"����!�!�!���!���� � � �������������
����=�	>��J���S��!4�5�5��<�=�=�=����������s�#�
0�0�__main__rd)Nr�)T)NFNNN)r�)�rirWrVr�rrhr�r�r�rr�	functoolsr�optparser�configparserr�ior�ImportError�ConfigParserr��callabler?r�__version__rr��platformr�
expanduserrr�getenvrr��__file__r
rr�r�rr�r_�	frozensetr��kwlistr;r:r8r�r<�ASSIGNMENT_EXPRESSION_OPr9r�r�r��INDENT�DEDENTr�r�
ERRORTOKENr7r�r^rnr�r�rgr�r�rBr�r�r�r�r-rsrr�r�r�rvrir�r_r[rlrvrzr�r�r�r�r�r�r�r�r�r�r r+r.r@rDrMrVr[rmr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rtr�r�r�rrrrrrrr!rzr�r�r�r&rr)r�r0rDr2rPr?r=�<module>rXs`��8��*�
�
�
���������	�	�	�	�	�	�	�	�
�
�
�
�������������������������!�!�!�!�!�!�-�,�,�,�,�,�,� � � � � � � ���-�-�-�,�,�,�,�,�,�,�,�-����
	��7�"�"������:�t�4�4�5�5�	#�$�	�	���H�$5�6�6�H����;��9��	�
�|�w����g�(�(�):�;�;����g�l�l��B�I�'�(�(�K�B�G�,>�,>�{�,K�,K��
�
���������K�K�K�����*������b�g�o�o�h�7�7��E�E������	�������<�5���
�
�
�
�Y�0�0�0�
1�
1�
��9�W�^�w��&8�8�9�9�J�F���)�7�7�7�8�8���	�?�?�?�@�@�
�%�+�+�,L�,L�,L�M�M��%(�%5��%?�%?�D�6�6�R���i�!#�!#�!#��	!����
�Y�y�
!�
!�
�
�)�X�[�(�"2�3�
4�
4���m�m�X�_�h�o�>�?�?���!�!�8�#3�X�5H�"I�J�J�
�L�L�L���r�z�+�&�&���B�J�1�2�2�� �b�j�!@�A�A���"�*�.�/�/���"�*�\�*�*��(�b�j�)K�L�L��)�r�z�*>�?�?��$�"�*�&F�G�G��#���%1�2�2���R�Z�!?�@�@����
�2�T�Y�Y�x�5H�5H�H�I�I�
����I�J�J���r�z�-�(�(��
�R�Z�E�
F�
F�
�!�r�z�"9�:�:��'�R�Z�(N�O�O��$.�B�J�������"�"�C�"�"�"�����
%�
%�!��r�z�J�K�K���R�Z�
�.�.����B�
?�
?��B�B�B�����.�M�M���M�(�D�D���D��<�<���<�*�
D�
D���
D� �H�H���H�J :� :� :�F�R/�R/���R/�j�>�>���>�@�G�G���G�.�D�D���D�,�E�E���E�:�&1�&1���&1�R�KE�KE���KE�\�$�$���$�N�H�H���H�.�o�o���o�d�J�J���J�$�>�>���>�B�)�)���)�X�=�=���=�&�71�71���71�t�<*�<*���<*�~�%�%���%�V�	�*�+�+�i�i��.A�.A�A�
����!�!�!�4�B�B���B�:������D�!7�!7���!7�H�J�J���J�*�M�M���M�.�
=�
=���
=� �P�P���P�f�	=�	=���	=��
K�
K���
K��
7�
7���
7��A�A���A��85�85���85�v�B
�B
���B
�L�, �, ���, �h!�!�!�C�C�C�
�y�y��~�~�j�b�j�!5�r�t�<�<�C�D�D�����8;�;�;�(����:#%�)�����$C�C�C�C����L�L�L�T.�T.�T.�T.�T.�T.�T.�T.�nW,�W,�W,�W,�W,�W,�W,�W,�t���������3 �3 �3 �3 �3 �Z�3 �3 �3 �l
?�
?�
?�
?�
?��
?�
?�
?�G�G�G�G�G�G�G�G�T"�;�C�C�C�C�LH�H�H�VAE�)-�4�4�4�4�n
�
�
�
� ���D�z���	�E�G�G�G�G�G��s$�A�A�A�A)D�D�D