AlkantarClanX12

Your IP : 18.218.190.118


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/pyflakes/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/pyflakes/__pycache__/checker.cpython-311.pyc

�

�܋f�6��v�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZejdkZeed��Zee��Zej��jZd�ZejejfZerd�Znd�Zd	�Zerd
�Znd�Zd�Z d
�Z!e
j"d��Z#d�$d�e%d��D����Z&e
j"e#j'de&�d�z��Z(e
j"d��Z)e
j"d��Z*e
j"d��Z+e
j"d��Z,e
j"d��Z-e
j"d��Z.e/d��Z0d�Z1d�Z2Gd�de3��Z4d�Z5de4��fd �Z6d!�Z7d"�Z8Gd#�d$��Z9Gd%�d&e9��Z:Gd'�d(e:��Z;Gd)�d*��Z<Gd+�d,��Z=Gd-�d.e:��Z>Gd/�d0e>��Z?Gd1�d2e>��Z@Gd3�d4e>��ZAGd5�d6e@��ZBGd7�d8e9��ZCGd9�d:e9��ZDGd;�d<eD��ZEGd=�d>e9��ZFGd?�d@e:��ZGGdA�dBe:��ZHGdC�dDe9��ZIGdE�dFe3��ZJGdG�dHeJ��ZKGdI�dJeJ��ZLGdK�dLeJ��ZMGdM�dNeJ��ZNGdO�dPeN��ZOGdQ�dR��ZPGdS�dT��ZQgdU�ZRdV�ZSe/dW��ZTdX�ZUdY�ZVdZ�ZWd[�ZXGd\�d]��ZYd^�ZZd_�Z[d`�Z\Gda�dbej]��Z^dc�Z_Gdd�de��Z`dS)fz]
Main module.

Implement the central Checker class.
Also, it models the Bindings and Scopes.
�N)�messages)���pypy_version_infoc���t|tj��r|jgSt|tj��r"|j|jzgd�|jD��zSdS)Nc��g|]}|g��S�r	)�.0�hdls  �a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pyflakes/checker.py�
<listcomp>z#getAlternatives.<locals>.<listcomp>#s��%B�%B�%B��s�e�%B�%B�%B�)�
isinstance�ast�If�body�Try�orelse�handlers)�ns r�getAlternativesrsh���!�S�V������x���!�S�W���C�����!�"�%B�%B�q�z�%B�%B�%B�B�B�C�Crc��t|tj��o;t|jttt��td��f��S�N)rr�Constant�value�bool�type�Ellipsis��nodes r�
_is_singletonr!)s>���t�S�\�*�*�
G��t�z�D�$�x�.�.�$�t�*�*�#E�F�F�	
rc�N�t|tjtjf��Sr)rr�NameConstantrrs rr!r!/s���$��!1�3�<� @�A�A�Arc�r�t|tj��otd�|jD����S)Nc3�4K�|]}t|��V��dSr)�_is_constant�r
�elts  r�	<genexpr>z%_is_tuple_constant.<locals>.<genexpr>6s*����3�3�#�L����3�3�3�3�3�3r)rr�Tuple�all�eltsrs r�_is_tuple_constantr-3s7���4���#�#�	4��3�3���3�3�3�3�3�rc�T�t|tj��pt|��Sr)rrrr-rs rr&r&;s"���$���-�-�I�1C�D�1I�1I�Irc��t|tjtjtjf��pt|��pt
|��Sr)rr�Str�Num�Bytesr!r-rs rr&r&>sA���t�c�g�s�w��	�:�;�;�
%��$���
%��t�$�$�	
rc�@�t|��ot|��Sr)r&r!rs r�_is_const_non_singletonr4Fs ������9�m�D�&9�&9�"9�9rc��t|tj��r|j|kp$t|tj��o
|j|kSr)rr�Name�id�	Attribute�attr)r �names  r�_is_name_or_attrr;JsB��	�D�#�(�	#�	#�	7���4��	@�	�D�#�-�	(�	(�	>�T�Y�$�->�rz
^#\s*type:\s*�c�n�g|]2}t|������#t|����3Sr	)�chr�isalnum�r
�is  rr
r
Ts3��N�N�N�a�S��V�V�^�^�=M�=M�N�3�q�6�6�N�N�Nr�zignore([z]|$)z^(\(.*?\))\s*->\s*(.*)$z\(([^()]*)\)z[#0+ -]*z
(?:\*|\d*)z(?:\.(?:\*|\d*))?z[hlL]?zdiouxXeEfFgGcrsa%c�:�|�||��}|�J�|Sr)�match)�regex�string�posrDs    r�_must_matchrHds&���K�K���$�$�E������Lrc�<���fd�}t|����S)z�Parses the string component of a `'...' % ...` format call

    Copied from https://github.com/asottile/pyupgrade at v1.20.1
    c3��K�d}d}d}d}|t���k�r�|sA	��d|��}|}|dz
}d}�n�#t$r�|d�dfV�YdSwxYwt��|��}|r*|�d��}|���}nd}tt�|��}|���pd}|���}tt�|��}|���pd}	|���}tt�|��}
|
���pd}|
���}tt�|�����}	�|}n#t$rtd���wxYw|dz
}|||	||f}
�||�|
fV�d}|}|t���k���|rtd���dS)NrF�%�Tz"end-of-string while parsing format)
�len�index�
ValueError�MAPPING_KEY_RErD�group�endrH�CONVERSION_FLAG_RE�WIDTH_RE�PRECISION_RE�	LENGTH_RE�
IndexError)�string_start�
string_end�in_fmtrA�	key_match�key�conversion_flag_match�conversion_flag�width_match�width�precision_match�	precision�
conversion�fmt�ss              �r�_parse_innerz*parse_percent_format.<locals>._parse_innerps^��������
���
���#�a�&�&�j�j��+
!�"�����Q���A�
"#�J���F�A�!�F�F��
"�����L�M�M�*�D�0�0�0�0��F�F�����+�0�0��A�6�6�	���#�/�/�!�,�,�C�!�
�
���A�A��C�(3�4F��1�(M�(M�%�"7�"=�"=�"?�"?�"G�4��)�-�-�/�/��)�(�A�q�9�9��#�)�)�+�+�3�t���O�O�%�%��"-�l�A�q�"A�"A��+�1�1�3�3�;�t�	�#�'�'�)�)�� �	�1�a�0�0�4�4�6�6��K�!"�1��J�J��!�K�K�K�$�%I�J�J�J�K�����Q����O�U�I�z�J����Z�/�0�#�5�5�5�5��� ��Y�#�a�&�&�j�j�\�	C��A�B�B�B�	C�	Cs�A�A �A �F�F8)�tuple)rerfs` r�parse_percent_formatrhjs8���5C�5C�5C�5C�5C�n����� � � rc��eZdZdZd�Zd�ZdS)�_FieldsOrderzFix order of AST node fields.c��|j}d|vrdj}nd|vrdj}ndj}tt||d�����S)N�iter�
generatorsrT)r\�reverse)�_fields�findrg�sorted)�self�
node_class�fields�	key_firsts    r�_get_fieldsz_FieldsOrder._get_fields�sW���#���V�����I�I�
�V�
#�
#�$�)�I�I���I��V�F�	�4�@�@�@�A�A�Arc�:�|�|��x||<}|Sr)rv)rrrsrts   r�__missing__z_FieldsOrder.__missing__�s$��$(�$4�$4�Z�$@�$@�@��Z��6��
rN)�__name__�
__module__�__qualname__�__doc__rvrxr	rrrjrj�s;������'�'�	B�	B�	B�����rrjc�L�i}|D]}|�|d��dz||<�|S)z|
    Simplest required implementation of collections.Counter. Required as 2.6
    does not have Counter in collections.
    rrL)�get)�items�results�items   r�counterr��s;��
�G��1�1�����D�!�,�,�q�0���
�
��Nrc#�K�||jD]q}|r||vr�	t||d��}t|tj��r|V��9t|t
��r#|D] }t|tj��r|V��!�rdS)a�
    Yield all direct child nodes of *node*, that is, all fields that
    are nodes and all items of fields that are lists of nodes.

    :param node:          AST node to be iterated upon
    :param omit:          String or tuple of strings denoting the
                          attributes of the node to be omitted from
                          further parsing
    :param _fields_order: Order of AST node fields
    N)�	__class__�getattrrr�AST�list)r �omit�
_fields_orderr:�fieldr�s      r�iter_child_nodesr��s������d�n�-�	�	���	�D�D�L�L����d�D�)�)���e�S�W�%�%�	��K�K�K�K�
��t�
$�
$�	��
�
���d�C�G�,�,���J�J�J���	�	rc�V�t|tj��r|jSt	td��r!t|tj��r|jSt|tj��rtd�|jD����St|tj	��r|j
St|tj��r1t|���}dddd�}|�
|j|��St|tj��r|jSt#��S)Nr2c3�4K�|]}t|��V��dSr��convert_to_valuer@s  rr)z#convert_to_value.<locals>.<genexpr>�s+����<�<�Q�%�a�(�(�<�<�<�<�<�<r)r�TF)�True�False�None)rrr0re�hasattrr2r*rgr,r1rr6�VariableKeyr~r:r#r�UnhandledKeyType)r��result�constants_lookups   rr�r��s���$��� � �"��v�
�	��g�	�	�"�:�d�C�I�#>�#>�"��v�
�	�D�#�)�	$�	$�"��<�<�$�)�<�<�<�<�<�<�	�D�#�'�	"�	"�"��v�
�	�D�#�(�	#�	#�"��$�'�'�'�����
�
��
 �#�#��K��
�
�	
�
�D�#�*�	+�	+�"��z���!�!�!rc�\�t|tj��ot|��dkS)N�NotImplemented)rrr6�getNodeNamers r�is_notimplemented_name_noder��s'���d�C�H�%�%�O�+�d�*;�*;�?O�*O�Orc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�Bindingar
    Represents the binding of a value to a name.

    The checker uses this to keep track of which names have been bound and
    which names have not. See L{Assignment} for a special type of binding that
    is checked with stricter rules.

    @ivar used: pair of (L{Scope}, node) indicating the scope and
                the node that this binding was last used.
    c�0�||_||_d|_dS�NF)r:�source�used)rrr:r�s   r�__init__zBinding.__init__	s����	������	�	�	rc��|jSr)r:�rrs r�__str__zBinding.__str__s
���y�rc�~�d�|jj|j|jjt
|����S)Nz)<{} object {!r} from line {!r} at 0x{:x}>)�formatr�ryr:r��linenor7r�s r�__repr__zBinding.__repr__s8��:�A�A��N�#��I��K���t�H�H�	
�
�	
rc�L�t|t��o|j|jkSr)r�
Definitionr:�rr�others  r�	redefineszBinding.redefiness ���%��,�,�H���e�j�1H�HrN)ryrzr{r|r�r�r�r�r	rrr�r��s_������	�	����
���
�
�
�I�I�I�I�Irr�c��eZdZdZdS)r�z7
    A binding that defines a function or a class.
    N�ryrzr{r|r	rrr�r�����������rr�c�(��eZdZdZ�fd�Zd�Z�xZS)�Builtinz-A definition created for all Python builtins.c�L��t���|d��dSr)�superr�)rrr:r�s  �rr�zBuiltin.__init__&s#���
������t�$�$�$�$�$rc�h�d�|jj|jt	|����S)Nz<{} object {!r} at 0x{:x}>)r�r�ryr:r7r�s rr�zBuiltin.__repr__)s0��+�2�2��N�#��I��t�H�H�
�
�	
r)ryrzr{r|r�r��
__classcell__�r�s@rr�r�#sM�������7�7�%�%�%�%�%�
�
�
�
�
�
�
rr�c��eZdZdZdS)r�zS
    A dictionary key of a type that we cannot or do not check for duplicates.
    Nr�r	rrr�r�1r�rr�c�$�eZdZdZd�Zd�Zd�ZdS)r�zY
    A dictionary key which is a variable.

    @ivar item: The variable AST object.
    c��|j|_dSr)r7r:)rrr�s  rr�zVariableKey.__init__=s���G��	�	�	rc�B�|j|jko|j|jkSr)r�r:)rr�compares  r�__eq__zVariableKey.__eq__@s%������/�
&��L�D�I�%�	
rc�*�t|j��Sr)�hashr:r�s r�__hash__zVariableKey.__hash__Fs���D�I���rN)ryrzr{r|r�r�r�r	rrr�r�7sK��������
���
�
�
�����rr�c�L��eZdZdZd�fd�	Zd�Zd�Zed���Zd�Z	�xZ
S)	�Importationz�
    A binding created by an import statement.

    @ivar fullName: The complete name given to the import statement,
        possibly including multiple dotted components.
    @type fullName: C{str}
    Nc�l��|p||_g|_t���||��dSr)�fullName�	redefinedr�r�)rrr:r��	full_namer�s    �rr�zImportation.__init__Ss6���!�)�T��
����
������v�&�&�&�&�&rc��t|t��r|j|jkSt|t��o|j|jkSr)r�SubmoduleImportationr�r�r:r�s  rr�zImportation.redefinesXsB���e�1�2�2�	3��=�E�N�2�2��%��,�,�H���e�j�1H�Hrc�V�|j�d��d|jkS)z.Return whether importation needs an as clause.�.���)r��splitr:r�s r�
_has_aliaszImportation._has_alias^s'���=�&�&�s�+�+�B�/�4�9�<�<�<rc�b�|���rd|j�d|j��Sd|jzS)z5Generate a source statement equivalent to the import.�import � as z	import %s�r�r�r:r�s r�source_statementzImportation.source_statementbs=���?�?���	/�;�T�]�;�;��	�;�;�;����.�.rc�\�|���r|jdz|jzS|jS�z#Return import full name with alias.r�r�r�s rr�zImportation.__str__js0���?�?���	!��=�6�)�D�I�5�5��=� rr)ryrzr{r|r�r�r��propertyr�r�r�r�s@rr�r�Js����������'�'�'�'�'�'�
I�I�I�=�=�=��/�/��X�/�!�!�!�!�!�!�!rr�c�H��eZdZdZ�fd�Z�fd�Zd�Zed���Z�xZ	S)r�a�
    A binding created by a submodule import statement.

    A submodule import is a special case where the root module is implicitly
    imported, without an 'as' clause, and the submodule is also imported.
    Python does not restrict which attributes of the root module may be used.

    This class is only used when the submodule import is without an 'as' clause.

    pyflakes handles this case by registering the root module name in the scope,
    allowing any attribute of the root module to be accessed.

    RedefinedWhileUnused is suppressed in `redefines` unless the submodule
    name is also the same, to avoid false positives.
    c����d|vr|rt|tj��sJ�|�d��d}t	���||��||_dS)Nr�r)rr�Importr�r�r�r�)rrr:r��package_namer�s    �rr�zSubmoduleImportation.__init__�s^����d�{�{�F�{�j����.L�.L�{�{�M��z�z�#���q�)��
������v�.�.�.���
�
�
rc���t|t��r|j|jkSt���|��Sr)rr�r�r�r�)rrr�r�s  �rr�zSubmoduleImportation.redefines�s<����e�[�)�)�	3��=�E�N�2�2��w�w� � ��'�'�'rc��|jSr�r�r�s rr�zSubmoduleImportation.__str__�s
���}�rc��d|jzS)Nr�r�r�s rr�z%SubmoduleImportation.source_statement�s���4�=�(�(r)
ryrzr{r|r�r�r�r�r�r�r�s@rr�r�rs���������� �����(�(�(�(�(�
����)�)��X�)�)�)�)�)rr�c�<��eZdZd�fd�	Zd�Zed���Z�xZS)�ImportationFromNc����||_|p||_|�d��r||jz}n
|dz|jz}t���|||��dS�Nr�)�module�	real_name�endswithr�r�)rrr:r�r�r�r�r�s      �rr�zImportationFrom.__init__�sj������"�*�d����?�?�3���	6����/�I�I����t�~�5�I�
������v�y�1�1�1�1�1rc�T�|j|jkr|jdz|jzS|jSr�)r�r:r�r�s rr�zImportationFrom.__str__�s-���>�T�Y�&�&��=�6�)�D�I�5�5��=� rc�z�|j|jkrd|j�d|j�d|j��Sd|j�d|j��S)N�from z import r�)r�r:r�r�s rr�z ImportationFrom.source_statement�sO���>�T�Y�&�&�O�4�;�O�O���O�O�D�I�O�O�O�;�4�;�;�;��	�;�;�;rr)ryrzr{r�r�r�r�r�r�s@rr�r��sg�������	2�	2�	2�	2�	2�	2�!�!�!��<�<��X�<�<�<�<�<rr�c�>��eZdZdZ�fd�Zed���Zd�Z�xZS)�StarImportationz3A binding created by a 'from x import *' statement.c�n��t���d|��|dz|_||_dS)N�*z.*)r�r�r:r�)rrr:r�r�s   �rr�zStarImportation.__init__�s5���
������f�%�%�%��4�K��	���
�
�
rc��d|jzdzS)Nr�z	 import *r�r�s rr�z StarImportation.source_statement�s�����&��4�4rc�R�|j�d��r|jS|jSr�)r�r�r�r:r�s rr�zStarImportation.__str__�s+���=�!�!�#�&�&�	��(�(��9�r)	ryrzr{r|r�r�r�r�r�r�s@rr�r��sh�������=�=�������5�5��X�5�������rr�c�"��eZdZdZ�fd�Z�xZS)�FutureImportationzs
    A binding created by a from `__future__` import statement.

    `__future__` imports are implicitly used.
    c�`��t���||d��||f|_dS)N�
__future__)r�r�r�)rrr:r��scoper�s    �rr�zFutureImportation.__init__�s.���
������v�|�4�4�4��F�O��	�	�	r�ryrzr{r|r�r�r�s@rr�r��sB���������$�$�$�$�$�$�$�$�$rr�c��eZdZdZdS)�Argumentz3
    Represents binding a name as an argument.
    Nr�r	rrr�r��r�rr�c��eZdZdZdS)�
Assignmenta
    Represents binding a name with an explicit assignment.

    The checker will raise warnings for any Assignment that isn't used. Also,
    the checker does not consider assignments in tuple/list unpacking to be
    Assignments, rather it treats them as simple Bindings.
    Nr�r	rrr�r��s���������rr�c��eZdZdZdS)�NamedExprAssignmentzB
    Represents binding a name with an assignment expression.
    Nr�r	rrr�r��r�rr�c��eZdZdZd�ZdS)�
Annotationa
    Represents binding a name to a type without an associated value.

    As long as this name is not assigned a value in another binding, it is considered
    undefined for most purposes. One notable exception is using the name as a type
    annotation.
    c��dS)zAAn Annotation doesn't define any name, so it cannot redefine one.Fr	r�s  rr�zAnnotation.redefines�s���urN)ryrzr{r|r�r	rrr�r��s-������������rr�c��eZdZdS)�FunctionDefinitionN�ryrzr{r	rrr�r����������Drr�c��eZdZdS)�ClassDefinitionNrr	rrrr�rrrc�"��eZdZdZ�fd�Z�xZS)�
ExportBindinga�
    A binding created by an C{__all__} assignment.  If the names in the list
    can be determined statically, they will be treated as names for export and
    additional checking applied to them.

    The only recognized C{__all__} assignment via list/tuple concatenation is in the
    following format:

        __all__ = ['a'] + ['b'] + ['c']

    Names which are imported and not otherwise used but appear in the value of
    C{__all__} will not have an unused import warning reported for them.
    c�$���d|vr:t|tj��r t|dj���_ng�_�fd�}t|jtjtjf��r||j��n�t|jtj��r�|j}t|j	tjtjf��r�|j
}|j	}||��t|tj��r|}n3t|tjtjf��r||��n,n+t|j	tjtjf����t���||��dS)N�__all__c���|jD];}t|tj��r�j�|j���<dSr)r,rrr0�names�appendre)�	containerr rrs  �r�
_add_to_namesz-ExportBinding.__init__.<locals>._add_to_namessK���!��
.�
.���d�C�G�,�,�.��J�%�%�d�f�-�-�-��
.�
.r)
rr�	AugAssignr�r	r�Listr*�BinOp�right�leftr�r�)	rrr:r�r�r�currentValuerrr�s	`       �rr�zExportBinding.__init__sx��������*�V�S�]�"C�"C���e�I�.�4�5�5�D�J�J��D�J�	.�	.�	.�	.�	.�
�f�l�S�X�s�y�$9�:�:�	��M�&�,�'�'�'�'�
���c�i�
0�
0�	�!�<�L��\�/�#�(�C�I�1F�G�G�
�#�(��$�*���
�e�$�$�$��d�C�I�.�.�	�#'�L�L���s�x���&;�<�<��!�M�$�'�'�'����\�/�#�(�C�I�1F�G�G�
�	������v�&�&�&�&�&rr�r�s@rrrsB���������'�'�'�'�'�'�'�'�'rrc��eZdZdZd�ZdS)�ScopeFc�~�|jj}d|�dt|��d�dt�|���d�S)N�<z at 0x�x� �>)r�ryr7�dictr�)rr�	scope_clss  rr�zScope.__repr__5sB���N�+�	�G�9�G�G�B�t�H�H�G�G�G����t�1D�1D�G�G�G�GrN)ryrzr{�
importStarredr�r	rrrr2s-�������M�H�H�H�H�Hrrc��eZdZdS)�
ClassScopeNrr	rrrr:rrrc�4��eZdZdZdZhd�Z�fd�Zd�Z�xZS)�
FunctionScopezp
    I represent a name scope for a function.

    @ivar globals: Names declared 'global' in this function.
    F>�__tracebackhide__�__traceback_info__�__traceback_supplement__c���t�����|j���|_d|_d|_dSr�)r�r��
alwaysUsed�copy�globals�returnValue�isGenerator)rrr�s �rr�zFunctionScope.__init__HsD���
����������+�+�-�-������ ����rc#�K�|���D]=\}}|js1|dkr+||jvr"|jst	|t
��r||fV��>dS)zR
        Return a generator for the assignments which have not been used.
        �_N)rr�r'�
usesLocalsrr�)rrr:�bindings   r�unusedAssignmentszFunctionScope.unusedAssignmentsOs|����"�Z�Z�\�\�	$�	$�M�D�'��L�
$��C�K�K����,�,���-��w�
�3�3�-��G�m�#�#�#��
	$�	$r)	ryrzr{r|r,r%r�r.r�r�s@rr r >si���������
�J�.�.�.�J�!�!�!�!�!�
$�
$�
$�
$�
$�
$�
$rr c��eZdZdS)�GeneratorScopeNrr	rrr0r0\rrr0c��eZdZdZdZdZdS)�ModuleScopezScope for a module.TFN)ryrzr{r|�_futures_allowed�_annotations_future_enabledr	rrr2r2`s"����������"'���rr2c��eZdZdZdS)�DoctestScopezScope for a doctest.Nr�r	rrr6r6fs���������rr6c��eZdZdZd�ZdS)�	DummyNodez<Used in place of an `ast.AST` to set error message positionsc�"�||_||_dSr)r��
col_offset)rrr�r:s   rr�zDummyNode.__init__ls�����$����rN)ryrzr{r|r�r	rrr8r8js)������F�F�%�%�%�%�%rr8c�"�eZdZe��ZdS)�DetectClassScopedMagicN)ryrzr{�dirr	r	rrr<r<qs�������C�E�E�E�E�Err<)�__file__�__builtins__�__annotations__�WindowsErrorc��t|d��r|jSt|d��r|jSt|d��r|jSdS)Nr7r:�rest)r�r7r:rCrs rr�r�zsY���t�T�����w���t�V�����y���t�V�����y���r)�typing�typing_extensionsc�,�����fd�}�fd�}t|tj��o||j��p]t|tj��oCt|jtj��o$||jj��o�|j��S)aX
    Internal helper to determine whether or not something is a member of a
    typing module. This is used as part of working out whether we are within a
    type annotation context.

    Note: you probably don't want to use this function directly. Instead see the
    utils below which wrap it (`_is_typing` and `_is_any_typing_member`).
    c����t���D]M}||vrGt||t��o)||jtvo�||j��cS�NdSr�)�reversedrr�r��TYPING_MODULESr�)r:r��is_name_match_fn�scope_stacks  ��r�_bare_name_is_attrz-_is_typing_helper.<locals>._bare_name_is_attr�s}����k�*�*�	�	�E��u�}�}��u�T�{�O�<�<�<��$�K�&�.�8�<�$�$�U�4�[�%:�;�;������urc���t���D]7}||vr1t||t��o||jtvcS�8dSr�)rHrr�r�rI)r:r�rKs  �r�_module_scope_is_typingz2_is_typing_helper.<locals>._module_scope_is_typing�sc����k�*�*�	�	�E��u�}�}��u�T�{�K�8�8�;��$�K�(�N�:������ur)rrr6r7r8rr9)r rJrKrLrNs ``  r�_is_typing_helperrO�s�����	�	�	�	�	�	������
�t�S�X�&�&�
(���t�w�'�'�	
�
�t�S�]�+�+�
(��t�z�3�8�,�,�
(�#�#�D�J�M�2�2�
(�
��T�Y�'�'�
rc�,��t|�fd�|��S)z�
    Determine whether `node` represents the member of a typing module specified
    by `typing_attr`.

    This is used as part of working out whether we are within a type annotation
    context.
    c���|�kSrr	)r�typing_attrs �r�<lambda>z_is_typing.<locals>.<lambda>�s���Q�+�-=�r�rO)r rRrKs ` r�
_is_typingrU�s!����T�#=�#=�#=�#=�{�K�K�Krc�&�t|d�|��S)z�
    Determine whether `node` represents any member of a typing module.

    This is used as part of working out whether we are within a type annotation
    context.
    c��dS�NTr	)rs rrSz'_is_any_typing_member.<locals>.<lambda>�s��T�rrT)r rKs  r�_is_any_typing_memberrY�s���T�>�>�;�?�?�?rc���t|jtjtjf��o$t�fd�|jjD����S)Nc3�:�K�|]}t|d���V��dS)�overloadN)rU)r
�decrKs  �rr)z%is_typing_overload.<locals>.<genexpr>�sC�����
�
��
�s�J��4�4�
�
�
�
�
�
r)rr�r�FunctionDef�AsyncFunctionDef�any�decorator_list)rrKs `r�is_typing_overloadrb�s^����5�<�#�/�3�3G�!H�I�I�	
��
�
�
�
��|�2�
�
�
�	
�	
�rc��eZdZdZdZdZdS)�AnnotationStaterrL�N)ryrzr{�NONE�STRING�BAREr	rrrdrd�s�������D�
�F��D�D�Drrdc�F��tj����fd���}|S)Nc�x��|���5�|g|�Ri|��cddd��S#1swxYwYdSr)�_enter_annotation�rr�args�kwargs�funcs   �r�in_annotation_funcz)in_annotation.<locals>.in_annotation_func�s����
�
#�
#�
%�
%�	/�	/��4��.�t�.�.�.�v�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s�/�3�3��	functools�wraps�rorps` r�
in_annotationru��9����_�T���/�/�/�/���/��rc�F��tj����fd���}|S)Nc���|�tj��5�|g|�Ri|��cddd��S#1swxYwYdSr)rkrdrgrls   �rrpz0in_string_annotation.<locals>.in_annotation_func�s����
�
#�
#�O�$:�
;�
;�	/�	/��4��.�t�.�.�.�v�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s
�:�>�>rqrts` r�in_string_annotationry�rvrc����t|t��s|�d��}t|�d�����tt
j�fd�����S)NzUTF-8Tc�$��t�d��S)Nr)�next)�liness�rrSzmake_tokens.<locals>.<lambda>�s���4��s�+;�+;�r)r�bytes�encoderl�
splitlinesrg�tokenize)�coder}s @r�make_tokensr��sb����d�E�"�"�$��{�{�7�#�#�������&�&�'�'�E���"�#;�#;�#;�#;�<�<�=�=�=rc�:�eZdZdZd�Zd�ZexZxZxZZ	exZ
xZZdS)�_TypeableVisitorz�Collect the line number and nodes which are deemed typeable by
    PEP 484

    https://www.python.org/dev/peps/pep-0484/#type-comments
    c�"�g|_i|_dSr)�typeable_lines�typeable_nodesr�s rr�z_TypeableVisitor.__init__�s�� ��� ����rc��|j�|j��||j|j<|�|��dSr)r�r
r�r��
generic_visit�rrr s  r�	_typeablez_TypeableVisitor._typeable�sD����"�"�4�;�/�/�/�+/���D�K�(����4� � � � � rN)
ryrzr{r|r�r��visit_Assign�	visit_For�visit_FunctionDef�
visit_With�visit_AsyncFor�visit_AsyncFunctionDef�visit_AsyncWithr	rrr�r��s_��������
!�!�!�!�!�!�AJ�I�L�I�9�I�0�:�@I�I�N�I�+�o�o�orr�c���t��}|�|��tjt��}|D]�\}}}}}|t
jks4t�|��rt�|��r�M|\}}tj|j|��}	|	dkr�s|j
|j|	dz
}
||
�||f����|S)NrrL)r��visit�collections�defaultdictr�r��COMMENT�TYPE_COMMENT_RErD�TYPE_IGNORE_RE�bisect�bisect_rightr�r�r
)�tree�tokens�visitor�
type_comments�tp�text�startr+r��idxr s           r�_collect_type_commentsr�s���� � �G��M�M�$�����+�D�1�1�M�!'�2�2���D�%��A��h�&�&�&�#�)�)�$�/�/�'��$�$�T�*�*�'�
��	����!�'�"8�&�A�A���!�8�8���%�g�&<�S�1�W�&E�F���d��"�"�E�4�=�1�1�1�1��rc�p�eZdZdZejeejeej	e
eje
eje
ej
eejeejeejei	ZdZdZejZdZee���e��Zej� d��Z!e!r(e�"e!�#d����[!dddejvd	fd
�Z$d�Z%d�Z&d
�Z'd�Z(e)d���Z*e*j+d���Z*e)d���Z,e,j+d���Z,e)d���Z-d�Z.d�Z/e
fd�Z0d�Z1d�Z2d�Z3d�Z4d�Z5d�Z6d�Z7d�Z8d�Z9d �Z:d!�Z;d"�Z<d#�Z=e>j?ej@fd$���ZAe)d%���ZBd&�ZCdPd'�ZDd(�ZEd)�ZFd*�ZGd+�ZHeIjJ��jKZLd,�ZMeNd-���ZOePd.���ZQd/�ZReDxZSxZTxZUxZVxZWxZXxZYxZZZ[eRZ\eDxZ]xZ^xZ_xZ`xZaxZbZcd0�Zdd1�Zed2�Zfd3�Zgd4�Zhd5�Ziejrd6�ZkneRxZlxZmxZnZkeDxZoxZpZqeRxZrxZsxZtxZuxZvZweRxZxxZyxZzxZ{xZ|xZ}xZ~xZxZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�xZ�Z�d7�Z�eDxZ�xZ�Z�dZ�d8�Z�d9�Z�d:�Z�e�Z�d;�Z�d<�Z�e�Z�d=�Z�e�xZ�xZ�Z�d>�Z�d?�Z�e�Z�d@�Z�dA�Z�e�xZ�Z�dB�Z�e�Z�dC�Z�dD�Z�dE�Z�dF�Z�dG�Z�dH�Z�e�Z�dI�Z�dJ�Z�dK�Z�e�Z�dL�Z�dM�Z�dN�Z�eDxZ�xZ�xZ�xZ�Z�eDxZ�Z�dO�Z�e�xZ�xZ�Z�dS)Q�Checkera�
    I check the cleanliness and sanity of Python code.

    @ivar _deferredFunctions: Tracking list used by L{deferFunction}.  Elements
        of the list are two-tuples.  The first element is the callable passed
        to L{deferFunction}.  The second element is a copy of the scope stack
        at the time L{deferFunction} was called.

    @ivar _deferredAssignments: Similar to C{_deferredFunctions}, but for
        callables which are deferred assignment checks.
    rNF�PYFLAKES_BUILTINS�,z(none)�PYFLAKES_DOCTESTr	c��i|_g|_g|_g|_g|_||_|r|j�|��|_||_	tj
t|����g|_n #t$rtd|z���wxYwdg|_||_t#||��|_|jD]%}|�dt)|�����&|�|��d|_|�|j��d|_|�|j��d|_|jdd�=|���|���dS)Nz$No scope implemented for the node %rr	TrL)�
_nodeHandlers�_deferredFunctions�_deferredAssignments�
deadScopesr�filename�builtIns�union�withDoctestr��_ast_node_scoper�
scopeStack�KeyError�RuntimeError�exceptHandlers�rootr��_type_comments�
addBindingr��handleChildren�_in_deferred�runDeferred�popScope�checkDeadScopes)rrr�r��builtinsr��file_tokens�builtins       rr�zChecker.__init__Hs������"$���$&��!������
� ��
��	:� �M�/�/��9�9�D�M�&���	N�&�6�t�D�z�z�B�D�D�E�D�O�O���	N�	N�	N��E��L�M�M�M�	N����!�d�����	�4�T�;�G�G����}�	4�	4�G��O�O�D�'�'�"2�"2�3�3�3�3����D�!�!�!� �������0�1�1�1�#'�������2�3�3�3�%)��!��O�A�B�B���
�
�����������s�,B�Bc�d�|j�||jdd�|jf��dS)a{
        Schedule a function handler to be called just before completion.

        This is used for handling function bodies, which must be deferred
        because code later in the file might modify the global scope. When
        `callable` is called, the scope at the time this is called will be
        restored, however it will contain any new bindings added to it.
        N)r�r
r��offset�rr�callables  r�
deferFunctionzChecker.deferFunctionjs5��	
��&�&��$�/�!�!�!�2D�d�k�'R�S�S�S�S�Src�d�|j�||jdd�|jf��dS)zl
        Schedule an assignment handler to be called just after deferred
        function handlers.
        N)r�r
r�r�r�s  r�deferAssignmentzChecker.deferAssignmentus5��
	
�!�(�(�(�D�O�A�A�A�4F���)T�U�U�U�U�Urc�H�|D]\}}}||_||_|���dS)zV
        Run the callables in C{deferred} using their associated scope stack.
        N)r�r�)rr�deferred�handlerr�r�s     rr�zChecker.runDeferred|s?��'/�	�	�"�G�U�F�#�D�O� �D�K��G�I�I�I�I�	�	rc�r�t|j��dkot|jdt��S)NrerL)rMr�rr6r�s r�_in_doctestzChecker._in_doctest�s2���D�O�$�$��)�=��4�?�1�-�|�<�<�	>rc�Z�td�|jD����sdS|jjS)Nc3�@K�|]}t|t��V��dSr)rr2)r
r�s  rr)z)Checker.futuresAllowed.<locals>.<genexpr>�s@����1�1���e�[�1�1�1�1�1�1�1�1rF)r+r�r�r3r�s r�futuresAllowedzChecker.futuresAllowed�sB���1�1� $��1�1�1�1�1�	��5��z�*�*rc�b�|dusJ�t|jt��rd|j_dSdSr�)rr�r2r3�rrrs  rr�zChecker.futuresAllowed�s=����~�~�~�~��d�j�+�.�.�	0�*/�D�J�'�'�'�	0�	0rc�X�|jd}t|t��sdS|jS)NrF)r�rr2r4)rrr�s  r�annotationsFutureEnabledz Checker.annotationsFutureEnabled�s.�����"���%��-�-�	��5��0�0rc�b�|dusJ�t|jt��sJ�d|j_dSrX)rr�r2r4r�s  rr�z Checker.annotationsFutureEnabled�s7����}�}�}�}��$�*�k�2�2�2�2�2�15��
�.�.�.rc��|jdS)Nr�)r�r�s rr�z
Checker.scope�s����r�"�"rc�h�|j�|j�����dSr)r�r
r��popr�s rr�zChecker.popScope�s,������t��2�2�4�4�5�5�5�5�5rc	����|jD�]e�t�t��r���d��}|rt|t��sd}|r(t|j��}�fd�|jD��}ngx}}|�r
�jsYtj	�
|j��dkr1|D].}|�tj�dj|���/�jr�g}����D]8}t|t"��r!||_|�|j���9d�t-|����}|D]/}|�tj�dj||���0����D]�}t|t0��r�|jp|j|v}|s5tj}	|�|	|jt7|����|jD]h}
t|�|
��t<��r
tj}	n|r�:tj }	|�|	|
|j|j���i�ϐ�gdS)z�
        Look at scopes which have been fully examined and report names in them
        which were imported but unused.
        rNc���g|]}|�v�|��	Sr	r	)r
r:r�s  �rr
z+Checker.checkDeadScopes.<locals>.<listcomp>�s.������!��5�(�(��(�(�(r�__init__.py�, )!r�rrr~r�setr	r�os�path�basenamer��reportr�UndefinedExportr��valuesr�r�r
r��joinrq�ImportStarUsager�r:�UnusedImport�strr��	getParent�	FOR_TYPES�ImportShadowedByLoopVar�RedefinedWhileUnused)rr�all_binding�	all_names�	undefinedr:�	from_listr-rr��messgr r�s           @rr�zChecker.checkDeadScopes�s����
�_�5	K�5	K�E��%��,�,�
���)�)�I�.�.�K��
#�:�k�=�#I�#I�
#�"���
+��� 1�2�2�	�����%0�%6����	�	�
)+�*�	�I��
N��*�C��7�#�#�D�M�2�2�m�C�C� )�C�C�����H�$<�$)�)�$4�$;�T�C�C�C�C��&�
N� "�I�#(�<�<�>�>�?�?��%�g��?�?�?�+6�G�L�%�,�,�W�-=�>�>�>�� $�	�	�&��*;�*;� <� <�I� )�N�N�����H�$<�$)�)�$4�$;�T�9�N�N�N�N������

K�

K���e�[�1�1�K� �:�@���y�)@�D��E� (� 5�����E�5�<��U���D�D�D� %��K�K��%�d�n�n�T�&:�&:�I�F�F�B�$,�$D�E�E�!�B�$�$,�$A�E����E�4���U�\�J�J�J�J��

K�Q5	K�5	Krc�J�|j�|����dSr)r�r
)rr�
scopeClasss  r�	pushScopezChecker.pushScope�s$������z�z�|�|�,�,�,�,�,rc�X�|j�||jg|�Ri|����dSr)rr
r�)rr�messageClassrmrns    rr�zChecker.report�s:���
���\�\�$�-�I�$�I�I�I�&�I�I�J�J�J�J�Jrc�X�	|j}t|d��st|d��s|S�*)NTr,�ctx)�_pyflakes_parentr�r�s  rr�zChecker.getParent�s<��	��(�D��4��(�(�
���u�1E�1E�
���	rc�P�|||fvs t|d��rt|d��sdS||ur|S|j|jkr|�|j||��S|j|jkr|�||j|��S|�|j|j|��S)Nr�)r��_pyflakes_depth�getCommonAncestorr�)rr�lnode�rnode�stops    rr�zChecker.getCommonAncestor�s�������&�&��E�#5�6�6�'��E�#5�6�6�'��4��E�>�>��L��!�E�$9�9�9��)�)�%�*@�%��N�N�N��!�E�$9�9�9��)�)�%��1G��N�N�N��%�%��"��"��
�
�	
rc�D�|D]}|�|||��rdS�dS)NTF)r�)rrr �	ancestorsr�as     r�descendantOfzChecker.descendantOf
s<���	�	�A��%�%�d�A�t�4�4�
��t�t�
��urc�n�|}	||jurdS|�|��}t||��r|S�3r)r�r�r)rrr �
ancestor_type�parents    r�_getAncestorzChecker._getAncestorsK����	����"�"��t��^�^�F�+�+�F��&�-�0�0�
��
�	rc��|�|ttj�������Sr)rrgr�r��keysr�s  r�getScopeNodezChecker.getScopeNodes/��� � ��u�W�-D�-I�-I�-K�-K�'L�'L�M�M�Mrc���|�|||j��}t|��}|r7|D]4}|�|||��|�|||��zrdS�5dS)zATrue, if lnode and rnode are located on different forks of IF/TRYTF)r�r�rr)rrr�r��ancestor�partsrs      r�differentForkszChecker.differentForkss����)�)�%���	�B�B����)�)���	 ��
 �
 ���$�$�U�E�8�<�<��$�$�U�E�8�<�<�=� ��4�4� ��urc��|jddd�D]
}|j|vrn�|�|j��}|�rnt|t���sX|�||j���s<|�|j��}t|t��rBt|t��r-|�
tj||j|j��n�||j
ur~|jsv|�|��ra|jdkst|t��rAt!||j��s,|�
tj||j|j��nDt|t��r/|�|��r|j�|��|j|j
vr|j
|jj|_|j|j
vst|t(��s�d}t|t*��rZt|j|t,��r:|dz}t|t*��r t|j|t,���:||j||j<dSdS)z�
        Called when a binding is altered.

        - `node` is the statement responsible for the change
        - `value` is the new value, a Binding instance
        Nr�r+rL)r�r:r~rr�rr�r�r�r�r�rr�r�r�r�rbr�r�r
r�r�r0)rrr rr��existing�parent_stmt�
cur_scope_poss       rr�zChecker.addBinding's{���_�T�T�r�T�*�	�	�E��z�U�"�"���#��9�9�U�Z�(�(���	0�Z��'�:�:�	0��'�'��h�o�>�>�	0��.�.���6�6�K��(�K�0�0�
0�Z��Y�5W�5W�
0����H�<� �%�*�h�o�?�?�?�?��$�*�$�$�%�]�C�/4���x�/H�/H�C���s�*�*�j��;�.O�.O�*�.�x���I�I�+��K�K�� =� $�e�j�(�/�C�C�C���H�k�2�2�
0�u���x�7P�7P�
0��"�)�)�$�/�/�/��:���#�#���E�J�/�4�E�J��:�T�Z�'�'�z�%��/L�/L�'��M��5�"5�6�6�
#��4�?�=�9�>�J�J�
#���"�
��5�"5�6�6�
#��4�?�=�9�>�J�J�
#�
:?�D�O�M�*�5�:�6�6�6�(�'rc��tj�d��rtdt	|�������|�|��dS)N�PYFLAKES_ERROR_UNKNOWNzUnexpected type: )r��environr~�NotImplementedErrorrr�r�s  r�_unknown_handlerzChecker._unknown_handlerXsR���:�>�>�2�3�3�	&�%�&F�$�t�*�*�&F�&F�G�G�G�����%�%�%�%�%rc��	|j|S#t$r|j���}YnwxYwt	|||j��x|j|<}|Sr)r�r�ry�upperr�r)rrrs�nodeTyper�s    r�getNodeHandlerzChecker.getNodeHandlerhsw��	3��%�j�1�1���	3�	3�	3�!�*�0�0�2�2�H�H�H�	3����3:��(�D�1�4
�4
�	
���:�&���s��#5�5c���t|��}|sdSd}d}|jddd�D�]�}t|t��r|dkrdS|dur�&|�|d��}t|t
��r|js�Y|dkr�t|t��rn|�|��}t|tj
��r?t|jtj��r |�
tj|��	|j|f||_||}t|t$��r?|���r+	|j|f||j_n#t*$rYnwxYwdS#t*$rYnwxYw|p|j}|durt|t.��}���|r�g}	|jddd�D]V}|���D]?}t|t2��r(|j|f|_|	�|j���@�Wd�t9|	����}	|�
tj|||	��dS|dkr*t<j� |j!��dkrdS|tDj#vrt|jt��rdSd|j$dvr#|�
tj%||��dSdS)	Nr�r�F�printr��__path__r��	NameError)&r�r�rrr~r��_in_postponed_annotationr�r�rr�op�RShiftr�r�InvalidPrintSyntaxr�r�r�r�r�r�rr0r�r�r
r�rqr�r�r�r�r�r<r	r��
UndefinedName)
rrr r:�
in_generatorsrr�r-rrr�s
          r�handleNodeLoadzChecker.handleNodeLoadrs3���4� � ���	��F��
��
��_�R�V��V�,�(	B�(	B�E��%��,�,�
��;�&�&��F�F�"�e�+�+���i�i��d�+�+�G��'�:�.�.�
�t�7T�
���w���:�g�w�#?�#?������-�-���v�s�y�1�1�C�"�6�9�c�j�9�9�C��K�K�� ;�T�B�B�B�
�$(�J��#5��d�� �
�$�K���a��-�-��!�,�,�.�.���26�*�d�1C��a�j�)�.�.��#����������
�����
�
�
���
����
*�@�U�-@�M��E�)�)� *�5�.� A� A�
���
	��I�����R��0�
;�
;��$�|�|�~�~�;�;�G�!�'�?�;�;�;�(,�
�D�'9���!�(�(��)9�:�:�:��	;��	�	�&��"3�"3�4�4�I��K�K��0�$��i�H�H�H��F��:���"�'�"2�"2�4�=�"A�"A�]�"R�"R��F��)�/�/�/�J�t�z�:�4V�4V�/��F��d�1�"�5�5�5��K�K��.��d�;�;�;�;�;�6�5s7�AE>�E+�*E>�+
E8�5E>�7E8�8E>�>
F�
Fc�x�t|��}|sdSt|jt��r�||jvr�|jdd�D]�}t|tt
f��s�||vo||j}|r]|d|jurN||jjvr@|�tj
||jd|||j��n��|�|��}t|tj��r|j�t!||��}�nt|t"tjf��s ||jkr&|�|��st+||��}n�|dkrlt|jt
��rRt|jtjtjtjf��rt1||j|j��}nBt2r+t|tj��rt7||��}nt9||��}|�||��dS)Nr�rrLr)r�rr�r r�r2r�r'r�r�UndefinedLocalr�r�r�	AnnAssignrr�r��
comprehensionr��isLiteralTupleUnpackingr��Assignr
r�	PY38_PLUS�	NamedExprr�r�r�)rrr r:r�r�rr-s       r�handleNodeStorezChecker.handleNodeStore�s/���4� � ���	��F��d�j�-�0�0�
	�T���5K�5K����"��-�
�
��!�%�-��)E�F�F����u�}�9��t��)9����D��G�t�z�1�1�d�$�*�BT�6T�6T��K�K�� 7� %�d�� 0�� 3�T�5��;�;M�O�O�O��E���n�n�T�*�*���k�3�=�1�1�	-�k�6G�6O� ��t�,�,�G�G�
��i��1B�%C�
D�
D�	-��t�4�4�4��0�0��=�=�5��d�D�)�)�G�G��	�!�!��4�:�{�3�3�"���)��Z����
�>���"�$�D�$�*?���L�L�G�G�
�	-�:�k�3�=�A�A�	-�)�$��5�5�G�G� ��t�,�,�G�����g�&�&�&�&�&rc�X���fd�}t���}|sdS|��rdSt|jt��r/||jjvr!|jj�|��dS	|j|=dS#t$r%|�tj	�|��YdSwxYw)Nc���t�dd��}|rFt|tjtjtjf��rdSt|dd��}|�FdS)zN
            Return `True` if node is part of a conditional body.
            r�NTF)r�rrr�While�IfExp)�currentr s �r�on_conditional_branchz7Checker.handleNodeDelete.<locals>.on_conditional_branch�sh����d�$6��=�=�G��
E��g����	�3�9�'E�F�F� ��4�!�'�+=�t�D�D���
E��5r)
r�rr�r r'�remover�r�rr%)rrr r6r:s `  r�handleNodeDeletezChecker.handleNodeDelete�s����		�		�		�		�		��4� � ���	��F� � �"�"�	�
�F��d�j�-�0�0�	@�T�T�Z�=O�5O�5O��J��%�%�d�+�+�+�+�+�
@��J�t�$�$�$���
@�
@�
@����H�2�D�$�?�?�?�?�?�?�
@���s�0A:�:+B)�(B)c#�XK�|j|c}|_	dV�||_dS#||_wxYwr)�_in_annotation)rr�ann_type�origs   rrkzChecker._enter_annotationsH����$(�$7��!��d�!�	'��E�E�E�"&�D�����$�D��&�&�&�&s� �	)c�:�|jtjkp|jSr)r:rdrgr�r�s rr!z Checker._in_postponed_annotations"��
��?�#9�9�
*��)�	
rc�&�|j�|d��D]�\\}}}|�dd��d���}t�|��}|rQ|�d���dd��|�d�����f}n|f}|D]K}|�tj
|j|t||��||tj�����L��dS)Nr	�:rLr�r<re)r�r~r��strip�TYPE_FUNC_RErDrQ�replacer�rr�partial�handleStringAnnotationr8r�CommentAnnotationSyntaxError)rrr r�r:�comment�
func_matchr�parts        r�_handle_type_commentszChecker._handle_type_commentss&��-1�-@�-D�-D�T�2�-N�-N�	�	�)� �V�Z�'��m�m�C��+�+�A�.�4�4�6�6�G�%�+�+�G�4�4�J��
#��$�$�Q�'�'�/�/��R�8�8��$�$�Q�'�'�-�-�/�/����
!�
���
�
���"�"�9�#4��/��)�F�J�7�7����9�$�$�����
�	�	rc��|�|��t||���D]}|�||���dS)N�r�)rIr��
handleNode)rrr�r�r s    rr�zChecker.handleChildren)sS���"�"�4�(�(�(�$�T��5�5�5�	(�	(�D��O�O�D�$�'�'�'�'�	(�	(rc��t|tj��r(|j|jgzD]}t|d��sdS�dSdS)Nr,FT)rrr-�targetsrr�)rrr �childs   rr,zChecker.isLiteralTupleUnpacking.s]���d�C�J�'�'�	������4�
!�
!���u�f�-�-�!� �5�5�!��4�		�	rc��t|tj��p8t|tj��ot|jtj��S)z}
        Determine if the given node is a docstring, as long as it is at the
        correct place in the node tree.
        )rrr0�Exprrr�s  r�isDocstringzChecker.isDocstring5sD��
�$���(�(�N�Z��c�h�-G�-G�.M�-7��
�C�G�-L�-L�	Nrc�
�t|tj��r|j}t|tj��sdSt
str|jdz
}n%|j|j�	d��z
dz
}|j|fS)N)NNrL�
)
rrrQrr0�PYPYr.r�re�count)rrr �doctest_linenos   r�getDocstringzChecker.getDocstring=s����d�C�H�%�%�	��:�D��$���(�(�	 ��<��	B�9�	B�!�[�1�_�N�N�"�[�4�6�<�<��+=�+=�=��A�N����'�'rc��|�dS|jrGt|dd���6|xj|jdz
c_|xj|jdz
c_|jr6t|tj��s|�|��sd|_|xj	dz
c_	|j	|_
||_	|�|j
��}||��|xj	dzc_	dS#|xj	dzc_	wxYw)Nr�rrLF)r�r�r�r:r�rr�
ImportFromrR�	nodeDepthr�r�rr�)rrr rr�s    rrLzChecker.handleNodeKs���<��F��;�	.�7�4��4�8�8�D��K�K�4�;�q�>�)�K�K��O�O�t�{�1�~�-�O�O���	(�
�4���(H�(H�	(�(,�(8�(8��(>�(>�	(�"'�D�����!����#�~��� &���	 ��)�)�$�.�9�9�G��G�D�M�M�M��N�N�a��N�N�N�N��D�N�N�a��N�N�N�N�N�Ns�4%C+�+C=c�T�	|�|jd��\}}|o|�|��}n#ttf$rYdSwxYw|sdS|j}|jdg|_|jpd}|�t��d|jdvr#|�	dtd����|D]�}	tj|j
d��}|d|z|jz|d|jzdzf|_|�|��||_�e#t"$rQ}	||jz|	jz|jdz|	jpdzf}
|�t&j||
��Yd}	~	��d}	~	wwxYw|���||_dS)Nr)rrr+z	<doctest>rL�)rXr�_getDoctestExamplesrOrWr�r�r�r6r�r�r�parser�r��indentr��SyntaxErrorr�r�DoctestSyntaxErrorr�)rrr �	docstring�node_lineno�examples�saved_stack�node_offset�exampler��e�positions           r�handleDoctestszChecker.handleDoctests_s���	�'+�'8�'8���1��'F�'F�$�Y�� �H�T�%=�%=�i�%H�%H�H�H���J�'�	�	�	�
�F�F�	�����	��F��o���?�1�-�.����k�+�V�����|�$�$�$��d�o�a�(�(�(��O�O�D�'�#�,�,�/�/�/��	*�	*�G�

*��y����=�=�� +�1�~��;�g�n�L�*�1�~���>��B�D����#�#�D�)�)�)�)������
I�
I�
I�'�'�.�8�1�8�C�#�N�Q�.�!�(�-�a�@�B�����H�7��x�H�H�H�H�H�H�H�H�����
I����	
�
�
����%����s(�:=�A�A�
D/�/
F
�9AF�F
c���	tj|��}n(#t$r|�|||��YdSwxYw|j}t|��dks t
|dtj��s|�|||��dS|jdj}tj	|��D]"}	d|	j
vrd|	j
vr||	_||	_�#|�
||��dS)NrLrr�r:)rr_rar�rrMrrQr�walk�_attributesr�r:rL)
rrrer �
ref_lineno�ref_col_offset�errr�r�parsed_annotation�
descendants
          rrDzChecker.handleStringAnnotation�s��	��9�Q�<�<�D�D���	�	�	��K�K��T�1�%�%�%��F�F�	�����y���t�9�9��>�>��D��G�S�X�!>�!>�>��K�K��T�1�%�%�%��F� �I�a�L�.���(�#4�5�5�	7�	7�J��
� 6�6�6� �J�$:�:�:�$.�
�!�(6�
�%�����)�4�0�0�0�0�0s��!<�<c
������t�tj��rL��t	j�j�j��j�j	tj����dS�jr6ttj���������fd���dS������dS)Nc���������Srr	)�
annotation�fnr rrs����rrSz*Checker.handleAnnotation.<locals>.<lambda>�s���r�r�$�
�D�'A�'A�r)rrr0r�rrrCrDrer�r:r�ForwardAnnotationSyntaxErrorr�rur�rL)rrrvr rws```@r�handleAnnotationzChecker.handleAnnotation�s��������j�#�'�*�*�	.����y�0��+�����!��%��5�
 � �
�
�
�
�
��
*�	.��w�1�2�2�B����A�A�A�A�A�A�A�B�B�B�B�B��O�O�J��-�-�-�-�-rc��dSrr	r�s  r�ignorezChecker.ignore�s���rc��t|jd��rO|�tj��5|�|��ddd��dS#1swxYwYdSt|jd���rh|�|j|��t|jtj
��r|j}nRt|jtj��r1t|jjtj
��r
|jj}nd}|�t|j
��dkr|�|j|��n�|�|j
d|��|�tj��5|j
dd�D]}|�||���	ddd��n#1swxYwY|�|j|��dSt|j|j��rD|���5|�|��ddd��dS#1swxYwYdS|�|��dS)N�Literal�	AnnotatedrerrL)r;rrkrdrfr�rLr�slicerr*�IndexrMr,r�rYr�)rrr �slice_tuple�args    r�	SUBSCRIPTzChecker.SUBSCRIPT�s���D�J�	�2�2�#	*��'�'��(<�=�=�
*�
*��#�#�D�)�)�)�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*����
*�
*�
*�
*�
*�
*�
�d�j�+�
6�
6� 	*��O�O�D�J��-�-�-��$�*�c�i�0�0�	
#�"�j����t�z�3�9�5�5�
#��t�z�/���;�;�
#�#�j�.���"���"�c�+�*:�&;�&;�a�&?�&?�����
�D�1�1�1�1����� 0�� 3�T�:�:�:��+�+�O�,@�A�A�3�3�*�/����3�3�3������T�2�2�2�2�3�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3�
�O�O�D�H�d�+�+�+�+�+�$�T�Z���A�A�
*��+�+�-�-�.�.��'�'��-�-�-�.�.�.�.�.�.�.�.�.�.�.�.����.�.�.�.�.�.��#�#�D�)�)�)�)�)s5�A�A�A�)F;�;F?�F?�H4�4H8�;H8c
��������	tt�jjj����}n9#t
$r,}��tj�|��Yd}~dSd}~wwxYwd�d�t���t���������fd�}|D]�\}}}}||��rdS|��	tt|����}n:#t
$r-}��tj�|��Yd}~dSd}~wwxYw|D]A\}}	}
}|
�)d|
vr%��tj�d��dS||	��rdS�B��td��jD����std��jD����rdSttt�j������}d��jD��}|�z
}
|�z
}��z||zz
}|
rK��tj�d�t#d	�|
D��������|rA��tj�d�t#|������|rM��tj�d�t#d
�|D��������dSdS)Nrc����|�dS|�d��\}}}|�d��\}}}	t|��}�dur"��tj���dSd�n#t
$rYnwxYw|dkr/�dur"��tj���dSd��}�dz
�t
|t��r��|��n��|��dS)z9Returns True if there is an error which should early-exitNFr��[Tr<rL)�	partition�intr�r�StringDotFormatMixingAutomaticrOr�add)�fmtkeyr+�auto�	next_autor �placeholder_named�placeholder_positionalrrs  ������r�_add_keyz3Checker._handle_string_dot_format.<locals>._add_key�s(����~��u�"�+�+�C�0�0�L�F�A�q�!�+�+�C�0�0�L�F�A�q�	
!��V�����4�<�<��K�K�� G��N�N�N��4� �D�D���
�
�
���
������|�|��5�=�=��K�K�� G��N�N�N��4��D�"���Q��	��&�#�&�&�
.�&�*�*�6�2�2�2�2�!�%�%�f�-�-�-��5s�A1�1
A>�=A>�{zMax string recursion exceededc3�JK�|]}t|tj��V��dSr�rr�Starred�r
r�s  rr)z4Checker._handle_string_dot_format.<locals>.<genexpr>,s.����F�F�S�J�s�C�K�0�0�F�F�F�F�F�Frc3�(K�|]
}|jduV��dSr�r��r
�kwds  rr)z4Checker._handle_string_dot_format.<locals>.<genexpr>.s(����=�=��C�G�t�O�=�=�=�=�=�=rc��h|]	}|j��
Sr	r�r�s  r�	<setcomp>z4Checker._handle_string_dot_format.<locals>.<setcomp>3s��?�?�?�#�c�g�?�?�?rr�c3�4K�|]}t|��V��dSr�r��r
rs  rr)z4Checker._handle_string_dot_format.<locals>.<genexpr>As(���� B� B�A��Q��� B� B� B� B� B� Brc3�4K�|]}t|��V��dSrr�r�s  rr)z4Checker._handle_string_dot_format.<locals>.<genexpr>Ms(���� C� C�A��Q��� C� C� C� C� C� Cr)rg�parse_format_stringrorrerOr�r�StringDotFormatInvalidFormatr�r`rm�keywords�rangerM�'StringDotFormatExtraPositionalArgumentsr�rq�"StringDotFormatExtraNamedArguments�StringDotFormatMissingArgument)rrr �placeholdersrir�r+r��spec�spec_placeholders�spec_fmtkey�	spec_spec�substitution_positional�substitution_named�extra_positional�extra_named�missing_argumentsr�r�r�r�s``              @@@@r�_handle_string_dot_formatz!Checker._handle_string_dot_format�s���������	� �!4�T�Y�_�5F�!G�!G�H�H�L�L���	�	�	��K�K��=�t�Q�G�G�G��F�F�F�F�F�����	�������	�!$�����E�E��%	�%	�%	�%	�%	�%	�%	�%	�%	�%	�N#/�	�	��A�v�t�Q��x����
�������(-�.A�$�.G�.G�(H�(H�%�%��!�����K�K�� E�t�Q�O�O�O��F�F�F�F�F�F���������5F�
�
�0�A�{�I�q� �,��	�1A�1A����$�A� �;����
�����x��,�,���������F�F�D�I�F�F�F�F�F�	��=�=�t�}�=�=�=�=�=�		�
�F�"%�e�C��	�N�N�&;�&;�"<�"<��?�?���?�?�?��2�5K�K��(�+<�<��$�&7�
7�
$�'9�
9�
;�	�
�	��K�K��@���	�	�&� B� B�1A� B� B� B�B�B�C�C�
�
�
�
�	��K�K��;���	�	�&��-�-�.�.�
�
�
�
�	��K�K��7���	�	�&� C� C�1B� C� C� C�C�C�D�D�
�
�
�
�
�	�	s,�+4�
A*�!A%�%A*�1C�
D�!D�Dc�f�t|jtj��rIt|jjtj��r%|jjdkr|�|��g}g}g}t|jd|j	��rgt|j��dkrO|���5|�
|jd|��ddd��n#1swxYwY�nqt|jd|j	��rR|dgz
}|d�|jdd�D��z
}|dgz
}|d	�|jD��z
}|d
�|jD��z
}�nt|jd|j	��r�t|j��dkrat|jdtj��r<|dgz
}||jdjz
}|d�t#|j��D��z
}|dgz
}|d
�|jD��z
}|d�|jD��z
}�n@t|jd|j	���r$t|j��dkr�t|jdtjtjf��r�t)d�|jdjD����r�|dgz
}|d�|jdjD��z
}|d�|jdjD��z
}|d�t#|j��D��z
}|d�|jdjD��z
}|dgz
}|d�|jD��z
}|d�|jD��z
}|r�|�t,j��5|D]\}}|�||����|�||���ddd��n#1swxYwY|���5|D]}|�
||���	ddd��dS#1swxYwYdS|�|��dS)Nr��castrLr�TypeVarrmc��g|]}|��Sr	r	r�s  rr
z Checker.CALL.<locals>.<listcomp>gs��7�7�7�#�#�7�7�7rr�c�2�g|]}|jdk�
|j��S)�bound)r�r�r
�ks  rr
z Checker.CALL.<locals>.<listcomp>ks&��M�M�M�a�A�E�W�<L�<L�!�'�<L�<L�<Lrc�2�g|]}||jdkrdgndf��S)r�rNr�r�s  rr
z Checker.CALL.<locals>.<listcomp>ls?���������'�!1�!1�W�I�I�t�<���r�	TypedDictc�.�g|]\}}||dkrdgndf��S)rLr�Nr	�r
rAr�s   rr
z Checker.CALL.<locals>.<listcomp>vs?��"�"�"���3���Q���8�*�*�D�9�"�"�"rc��g|]	}|j��
Sr	�rr�s  rr
z Checker.CALL.<locals>.<listcomp>}���9�9�9�a�!�'�9�9�9rc��g|]}|dgf��Sr�r	r�s  rr
z Checker.CALL.<locals>.<listcomp>~���D�D�D��q�7�)�n�D�D�Dr�
NamedTuplec3�K�|]B}t|tjtjf��ot	|j��dkV��CdS)reN)rrr*rrMr,r�s  rr)zChecker.CALL.<locals>.<genexpr>�sf����A�A�)*��q�3�9�c�h�"7�8�8�%����K�K�1�$�A�A�A�A�A�Arc�(�g|]}|jd��S�rL�r,r's  rr
z Checker.CALL.<locals>.<listcomp>�s��G�G�G�c�c�h�q�k�G�G�Grc�,�g|]}|jddf��S)rNr�r's  rr
z Checker.CALL.<locals>.<listcomp>�s#��!S�!S�!S�#�3�8�A�;��"5�!S�!S�!Src�.�g|]\}}||dkrdgndf��S)rLr,Nr	r�s   rr
z Checker.CALL.<locals>.<listcomp>�s?��"�"�"���3��a�1�f�f�6�(�(�$�7�"�"�"rc��g|]}|df��Sr�r	r's  rr
z Checker.CALL.<locals>.<listcomp>�s��!M�!M�!M�C�3��-�!M�!M�!Mrc��g|]	}|j��
Sr	r�r�s  rr
z Checker.CALL.<locals>.<listcomp>�r�rc��g|]}|dgf��Sr�r	r�s  rr
z Checker.CALL.<locals>.<listcomp>�r�rrK)rrorr8rr0r9r�rUr�rMrmrkrLr��Dictr��	enumerater*rr+r,rdrfr�)rrr r��	annotated�
not_annotated�na_node�na_omit�annotated_nodes        r�CALLzChecker.CALLPs����4�9�c�m�4�4�	1��4�9�?�C�G�4�4�	1��	��(�*�*��*�*�4�0�0�0����	��
�
�t�y�&�$�/�:�:�8	E���	�N�N�a����'�'�)�)�
4�
4�����	�!��d�3�3�3�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4����
4�
4�
4�
4����	�9�d�o�
>�
>�1	E�
�V�H��D��7�7���1�2�2��7�7�7�7�I�
�Z�L� �D��M�M�4�=�M�M�M�M�I���������
�M�M�
��	�;���
@�
@�#	E��4�9�~�~��!�!�j���1��s�x�&H�&H�!���� ���T�Y�q�\�0�0�	��"�"�"+�D�I�"6�"6�"�"�"��
�
�Z�L� �D��9�9�4�=�9�9�9�9�I��D�D�d�m�D�D�D�D�M�M�
��	�<���
A�
A�	E��D�I����"�"��4�9�Q�<�#�)�S�X�)>�?�?�#��A�A�.2�i��l�.?�A�A�A�A�A�#�
��� ���G�G�T�Y�q�\�5F�G�G�G�G�	��!S�!S���1��AR�!S�!S�!S�S�
��"�"�"+�D�I�"6�"6�"�"�"��
��!M�!M�4�9�Q�<�;L�!M�!M�!M�M�
�
�Z�L� �D��9�9�4�=�9�9�9�9�I��D�D�d�m�D�D�D�D�M��
	&��'�'��(<�=�=�
5�
5�(5�?�?�$�G�W��'�'��g�'�>�>�>�>��#�#�D�t�#�4�4�4�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5�
�'�'�)�)�
:�
:�&/�:�:�N��O�O�N�D�9�9�9�9�:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:����
:�
:�
:�
:�
:�
:�
����%�%�%�%�%s6�6"C$�$C(�+C(�7O�O
�
O
�%P�P�Pc	�@�	t|jj��}n2#t$r%|�t
j|d��YdSwxYwt��}d}d}|D]�\}}|��|\}}}	}
}|dkr�|tvr!|�t
j	||��|�|r|du}|	|
fD]0}|�,d|vr(|s!|�t
j
|���+|dz
}�1|r%|�#|�t
j|��dS|s%|�#|�t
j|��dS|r|dz
}��|�|����t|jtjtjf��r�t%d�|jjD����sft)|jj��}
|r)||
kr#|�t
j|||
��n"|s |�t
j|��t|jtj��r�t1d�|jjD����r�|r(|dkr"|�t
j|��dSd�|jjD��}||z
}||z
}|sC|rA|�t
j|d	�t;|������|sI|rI|�t
j|d	�t;|������dSdSdSdSdS)
Nzincomplete formatrrKr�rLc3�JK�|]}t|tj��V��dSrr�r's  rr)z1Checker._handle_percent_format.<locals>.<genexpr>�sB��������s�C�K�0�0������rc3�JK�|]}t|tj��V��dSr)rrr0r�s  rr)z1Checker._handle_percent_format.<locals>.<genexpr>�s.����D�D�q�J�q�#�'�*�*�D�D�D�D�D�Drc��h|]	}|j��
Sr	)rer�s  rr�z1Checker._handle_percent_format.<locals>.<setcomp>�s�� >� >� >���� >� >� >rr�)rhrrerOr�r�PercentFormatInvalidFormatr��VALID_CONVERSIONS�'PercentFormatUnsupportedFormatCharacter�!PercentFormatStarRequiresSequence�$PercentFormatMixedPositionalAndNamedr�rrrrr*r`r,rM�$PercentFormatPositionalCountMismatch�PercentFormatExpectedMappingr�r+r
�PercentFormatExpectedSequence� PercentFormatExtraNamedArgumentsr�rq�PercentFormatMissingArgument)rrr r��named�positional_count�
positionalr+�placeholderr:r`rbrcrH�substitution_count�substitution_keys�
extra_keys�missing_keyss                 r�_handle_percent_formatzChecker._handle_percent_format�s��	�/��	��<�<�L�L���	�	�	��K�K��3��#�
�
�
�

�F�F�
	�����������
�*�,	 �,	 �N�A�{��"��4?�1�D�!�U�I�z��S� � ���!2�2�2�����D�������!�j�!�!�T�\�
��	�*�
.�
.���#��t���%�.����$�F� �����
)�A�-�(���
�d�.�����A���������
�D�L�����A���������
 � �A�%� � ��	�	�$������4�:���#�)�'<�=�=�	I����#�z�������	I�"%�T�Z�_�!5�!5���
I�.�2D�D�D�����A��$�&�	���� �
I����H�A�4�H�H�H��4�:�s�x�0�0�	��D�D�D�J�O�D�D�D�D�D�	��
�.��2�2����H�B�D�I�I�I��� >� >�d�j�o� >� >� >��*�U�2�J� �#4�4�L��
�*�
�����=���I�I�f�Z�0�0�1�1����
�
�,�
�����9���I�I�f�\�2�2�3�3������%	�	�	�	�"
�
�
�
s��+A�
Ac���t|jtj��r4t|jtj��r|�|��|�|��dSr)rr"r�Modrr0r�r�r�s  r�BINOPz
Checker.BINOP	s^���4�7�C�G�,�,�	.��4�9�c�g�.�.�	.�
�'�'��-�-�-����D�!�!�!�!�!rc���|jratj|j|j||j|jtj��}|j	r|��dS|�
|��dSdSr)r:rrrCrDrer�r:rrxr�r�)rrr rws   r�STRzChecker.STRs}����	'��"��+���������5�
��B�� �
'���������"�"�2�&�&�&�&�&�	'�	'rc�d�t|jt��r|�|��SdSr)rrr�r�r�s  r�CONSTANTzChecker.CONSTANT!s0���$�*�c�*�*�
&��x�x��~�~�%�
&�
&rc�D�|�|��|j}t|tj��r8t|j��r"|�tj	|��dSdSt|��r"|�tj	|��dSdSr)
r��excrr�Callr�ror�r�RaiseNotImplemented)rrr r�s   r�RAISEz
Checker.RAISE3s������D�!�!�!��h���c�3�8�$�$�	<�*�3�8�4�4�
@����H�8�$�?�?�?�?�?�
@�
@�)��
-�
-�	<��K�K��4�d�;�;�;�;�;�	<�	<rc��|js>td�|jD����s |�tj|��d|jc|_}	|�|��||_dS#||_wxYw)Nc3�JK�|]}t|tj��V��dSr)rr�FormattedValuer�s  rr)z$Checker.JOINEDSTR.<locals>.<genexpr>Js/����O�O�a�
�1�c�&8�9�9�O�O�O�O�O�OrT)�_in_fstringr`r�r�r�FStringMissingPlaceholdersr�)rrr r<s   r�	JOINEDSTRzChecker.JOINEDSTREs����$�	C��O�O�4�;�O�O�O�O�O�		C�
�K�K��;�T�B�B�B�!%�t�'7����$�	$�����%�%�%�#�D�����t�D��#�#�#�#s�A4�4	A=c�Z��	�d��jD��}t|��}d�|���D��}|D]Ҋ	�	fd�t|��D��}t�fd�|D����}t	d�|���D����ro|D]l}�j|}t�	t��r'|�tj	|�	j
���K|�tj|�	���m��|����dS)Nc�,�g|]}t|����Sr	r�)r
r\s  rr
z Checker.DICT.<locals>.<listcomp>Xs.��
�
�
�&)��S�!�!�
�
�
rc�$�g|]
\}}|dk�|��Sr�r	)r
r\rVs   rr
z Checker.DICT.<locals>.<listcomp>]s-��
�
�
��C���q�y�y�
��y�yrc�&��g|]
\}}|�k�|��Sr	r	)r
rA�i_keyr\s   �rr
z Checker.DICT.<locals>.<listcomp>cs"���M�M�M���E�����1���rc3�L�K�|]}t�j|��V��dSr)r�r�)r
rNr s  �rr)zChecker.DICT.<locals>.<genexpr>esF��������!���U�!3�4�4������rc3�(K�|]
\}}|dkV��dS)rLNr	)r
rrVs   rr)zChecker.DICT.<locals>.<genexpr>is*����A�A�,�%��5�A�:�A�A�A�A�A�Ar)
r
r�rr�r`rr�r�r�MultiValueRepeatedKeyVariabler:�MultiValueRepeatedKeyLiteralr�)
rrr r
�
key_counts�duplicate_keys�key_indicesr��	key_index�key_noder\s
 `       @r�DICTzChecker.DICTTs�����
�
�-1�Y�
�
�
���T�]�]�
�
�
�",�"2�"2�"4�"4�
�
�
��
"�	�	�C�M�M�M�M�Y�t�_�_�M�M�M�K������(������F��A�A�&�,�,�.�.�A�A�A�A�A�
�!,���I�#�y��3�H�!�#�{�3�3�	����H�$J�$,�$'�H�.�.�.�.����$�A�$�������
	
���D�!�!�!�!�!rc���t|jtj��r0|jjgkr |�tj|��|�|��dSr)	r�testrr*r,r�r�IfTupler�r�s  r�IFz
Checker.IFxsW���d�i���+�+�	0��	��"�0D�0D��K�K��(�$�/�/�/����D�!�!�!�!�!rc���t|jtj��r0|jjgkr |�tj|��|�|��dSr)	rrrr*r,r�r�AssertTupler�r�s  r�ASSERTzChecker.ASSERTsW���d�i���+�+�	4��	��"�0D�0D��K�K��,�d�3�3�3����D�!�!�!�!�!rc�>��|���rdnd}|j|}|j|urk|jD]e�t	�|��}�fd�|jD��|_|��|��||f|_|j|dzd�D]}||�<��ddSdS)z5
        Keep track of globals declarations.
        rLrc�j��g|]/}t|tj��r|jd�k�-|��0S)r)rrr%�message_args)r
�m�	node_names  �rr
z"Checker.GLOBAL.<locals>.<listcomp>�sL���!4�!4�!4���q�(�"8�9�9�!4��N�1�%��2�2��2�2�2rN)r�r�r�r	r�r�
setdefaultr�)rrr �global_scope_index�global_scope�
node_valuer�rs      @r�GLOBALzChecker.GLOBAL�s����#'�"2�"2�"4�"4�;�Q�Q�!����'9�:���:�\�)�)�"�Z�
2�
2�	�'�	�4�8�8�
�
!4�!4�!4�!4�#�}�!4�!4�!4��
��'�'�	�:�>�>�>�$0��"6�
��!�_�-?�!�-C�-D�-D�E�2�2�E�'1�E�)�$�$�2�'*�)�
2�
2rc��|�t��|�|��|���dSr)r�r0r�r�r�s  r�GENERATOREXPzChecker.GENERATOREXP�s9�����~�&�&�&����D�!�!�!��
�
�����rc� �t|jtj��rm|�|��|jdkrGt|jt��r/t|jtj	��rd|j_
dSdSdSdSt|jtj��r|�|��dSt|jtj
��r|�|��dStd|j�����)zV
        Handle occurrence of Name (which can be a load/store/delete access.)
        �localsTz#Got impossible expression context: N)rr�r�Loadr'r7r�r r�r�r,�Storer0�Delr8r�r�s  r�NAMEzChecker.NAME�s	��
�d�h���)�)�	S�����%�%�%���8�#�#�
�4�:�}�(M�(M�#��t�4�c�h�?�?�$�)-��
�%�%�%�$�#�#�#�#�#����#�)�
,�
,�	S�� � ��&�&�&�&�&�
���#�'�
*�
*�	S��!�!�$�'�'�'�'�'��Q�T�X�Q�Q�R�R�Rrc��|}t|d��r�|j|}}t|tjtjtjf��r||jvrdSt|tjtj	f��rnlt|d��rLt|tj
��r2||jvr)ts"|�
tj|��dSt|d����t|tj
��r"|�
tj|��dS|�
tj|��dS)Nr��	finalbody)r�r�rrr3�For�AsyncForrr^�ClassDef�Continuer'r.r�r�ContinueInFinally�ContinueOutsideLoop�BreakOutsideLoop)rrr r�n_childs    r�CONTINUEzChecker.CONTINUE�s/��
���a�+�,�,�	��+�Q�w�A��!�c�i���#�,�?�@�@�
��!�(�*�*��F��!�c�o�s�|�<�=�=�
���q�+�&�&�
�:�d�C�L�+I�+I�
��a�k�)�)�)�)��K�K�� :�D�A�A�A��F��a�+�,�,�	��d�C�L�)�)�	9��K�K��4�d�;�;�;�;�;��K�K��1�4�8�8�8�8�8rc�4�t|jttf��r"|�t
j|��dS|jr2t|jd��r|jj	s|j|j_	|�
|j|��dS)Nr()rr�rr2r�r�ReturnOutsideFunctionrr�r(rLr�s  r�RETURNzChecker.RETURN�s����d�j�:�{�";�<�<�	��K�K��6��=�=�=��F�
�J�	0��D�J�
�.�.�	0��
�&�	0�
&*�Z�D�J�"�����
�D�)�)�)�)�)rc���t|jttf��r"|�t
j|��dSd|j_|�|j	|��dSrX)
rr�rr2r�r�YieldOutsideFunctionr)rLrr�s  r�YIELDz
Checker.YIELD�s]���d�j�:�{�";�<�<�	��K�K��5�t�<�<�<��F�!%��
������
�D�)�)�)�)�)rc�n����jD]}��|������������t	�j������jrI����s7t�j	t��s����fd���dSdSdSdS)Nc�.�������Sr�rk�r rrs��rrSz%Checker.FUNCTIONDEF.<locals>.<lambda>�����t�':�':�4�'@�'@�r)rarL�LAMBDAr�r�r:r�r�rr�r r�)rrr �decos`` r�FUNCTIONDEFzChecker.FUNCTIONDEF�s������'�	(�	(�D��O�O�D�$�'�'�'�'����D��������0���D�A�A�B�B�B�
��	B��$�$�&�&�	B��t�z�=�9�9�	B�
���@�@�@�@�@�A�A�A�A�A�	B�	B�	B�	B�	B�	Brc����g}g}trC�jjD]6}|�|j��|�|j���7�jj�jjzD]6}|�|j��|�|j���7�jj�jjz}t�tj��}dD]P}t�j|��}|s�|�|j��|r|�|j���Q|r|��j
��tt|����t|��krBt!|��D]2\}	}||d|	�vr!��t$j�|���3|D]}
��|
����|D]}��|������fd�}��|��dS)N)�vararg�kwargc����������ddg����fd�}��|������dS)Nra�returnsrKc����j���D]+\}}��tj|j|���,dS)zU
                Check to see if any assignments have not been used.
                N)r�r.r�r�UnusedVariabler�)r:r-rrs  �r�checkUnusedAssignmentszCChecker.LAMBDA.<locals>.runFunction.<locals>.checkUnusedAssignments'sR���&*�Z�%A�%A�%C�%C�O�O�M�D�'��K�K�� 7����N�N�N�N�O�Or)r�r�r�r�)rFr rrs ��r�runFunctionz#Checker.LAMBDA.<locals>.runFunction!sx����N�N��������,<�i�+H��I�I�I�
O�
O�
O�
O�
O�
� � �!7�8�8�8��M�M�O�O�O�O�Or)r.rm�posonlyargsr
r�rv�
kwonlyargs�defaults�kw_defaultsrr�Lambdar�rCrMr�r�r�r�DuplicateArgumentryrLr�)
rrr rm�annotationsr�rJ�has_annotations�arg_name�wildcardr�rv�defaultrGs
``           rr<zChecker.LAMBDA�s3���������	3��y�,�
3�
3�����C�G�$�$�$��"�"�3�>�2�2�2�2��9�>�D�I�$8�8�	/�	/�C��K�K��� � � ����s�~�.�.�.�.��9�%��	�(=�=��(��s�z�:�:�:��+�	8�	8�H��t�y�(�3�3�H��
���K�K���%�%�%��
8��"�"�8�#6�7�7�7���	-����t�|�,�,�,��s�4�y�y�>�>�C��I�I�%�%�'��o�o�
G�
G�
��c��$�t��t�*�$�$��K�K�� :�D�#�F�F�F��%�	4�	4�J��!�!�*�d�3�3�3�3��	+�	+�G��O�O�G�T�*�*�*�*�	�	�	�	�	�	� 	
���;�'�'�'�'�'rc�4�|�|d���dS)N)rJrKrK)r�r�s  r�	ARGUMENTSzChecker.ARGUMENTS3s"�����D�'B��C�C�C�C�Crc	�~�|�|t|j|�|������dSr)r�r�r�rr�s  r�ARGzChecker.ARG6s6������h�t�x��1B�1B�4�1H�1H�I�I�J�J�J�J�Jrc�T����jD]}��|�����jD]}��|�����jD]}��|������t
���jrG����s3t�j	t��s����fd����jD]}��|������
�����t�j�����dS)z�
        Check names used in a class definition, including its decorators, base
        classes, and the body of its definition.  Additionally, add its name to
        the current scope.
        c�.�������Srr9r:s��rrSz"Checker.CLASSDEF.<locals>.<lambda>Kr;rN)rarL�basesr�r�rr�r�rr�r r�rr�r�rr:)rrr r=�baseNode�keywordNode�stmts``    r�CLASSDEFzChecker.CLASSDEF9sG�����'�	(�	(�D��O�O�D�$�'�'�'�'��
�	,�	,�H��O�O�H�d�+�+�+�+��=�	/�	/�K��O�O�K��.�.�.�.����z�"�"�"�
��	B��$�$�&�&�	B��t�z�=�9�9�	B�
���@�@�@�@�@�A�A�A��I�	(�	(�D��O�O�D�$�'�'�'�'��
�
��������o�d�i��>�>�?�?�?�?�?rc��|�|j��|�|j|��|�|j|��dSr)r'�targetrLrr�s  r�	AUGASSIGNzChecker.AUGASSIGNQsJ�����D�K�(�(�(�����
�D�)�)�)������T�*�*�*�*�*rc��t|jtj��r�d}d}t	|j��D]G\}}t|tj��r(|r"|�tj	|��nd}|}�H|dkst|j��|z
dz
dkr |�tj|��|�|��dS)NFr�T�rLi)
rr�rr#r�r,r�r�r�TwoStarredExpressionsrM�%TooManyExpressionsInStarredAssignmentr�)rrr �has_starred�star_locrArs      r�TUPLEz
Checker.TUPLEVs����d�h��	�*�*�	R� �K��H�!�$�)�,�,�
!�
!���1��a���-�-�!�"�����H�$B�D�I�I�I���"&�K� �H���6�!�!�S���^�^�h�%>��%B�g�%M�%M����H�J�D�Q�Q�Q����D�!�!�!�!�!rc���|jD]b}d|jvr|jst|j|��}n$|jp|j}t	|||j��}|�||���cdSr�)r	r:�asnamer�r�r�)rrr �alias�importationr:s     r�IMPORTzChecker.IMPORTos|���Z�	/�	/�E��e�j� � ��� �2�5�:�t�D�D����|�1�u�z��)�$��e�j�A�A���O�O�D�+�.�.�.�.�
	/�	/rc��|jdkr(|js |�tj|��nd|_d|jz|jpdz}|jD�]0}|jp|j}|jdkrbt|||j
��}|jtjvr&|�tj
||j��|jdkrd|_n�|jdkrzt|j
t ��s"|�tj||����d|j
_|�tj||��t)||��}nt+||||j��}|�||����2dS)Nr�Fr�r<rNTr�)r�r�r�r�LateFutureImport�levelr	rir:r�r�r��all_feature_names�FutureFeatureNotDefinedr�rr2�ImportStarNotPermittedr�ImportStarUsedr�r�r�)rrr r�rjr:rks      r�
IMPORTFROMzChecker.IMPORTFROMxs����;�,�&�&��&�
=����H�5�t�<�<�<��"'�D����
�"�t�{�'8�b�9���Z�	/�	/�E��<�-�5�:�D��{�l�*�*�/��d�D�J�G�G���:�Z�%A�A�A��K�K�� @� $�e�j�2�2�2��:��.�.�48�D�1����s�"�"�!�$�*�k�:�:���K�K�� ?� $�f�.�.�.��+/��
�(����H�3�T�6�B�B�B�-�f�d�;�;���-�d�D�.4�e�j�B�B���O�O�D�+�.�.�.�.�+	/�	/rc��g}t|j��D]�\}}t|jtj��r2|jjD]$}|�t|�����%n.|jr'|�t|j����|j�;|t|j��dz
kr |�
tj|����|j
�|��|jD]}|�||���|j
���|�|d���dS)NrLrrK)r�rrrrr*r,r
r�rMr�r�DefaultExceptNotLastr�rrLr�r�)rrr �
handler_namesrAr��exc_typerOs       r�TRYzChecker.TRY�sM���
�#�D�M�2�2�	D�	D�J�A�w��'�,��	�2�2�
@� '�� 1�@�@�H�!�(�(��X�)>�)>�?�?�?�?�@���
@��$�$�[���%>�%>�?�?�?��|�#��C��
�,>�,>��,B�(B�(B����H�9�7�C�C�C����"�"�=�1�1�1��Y�	)�	)�E��O�O�E�4�(�(�(�(�����!�!�!����D�v��.�.�.�.�.rc�$�|j�|�|��dS|j|jvr|�|��	|j�|j��}n#t
$rd}YnwxYw|�|��|�|��	|j�|j��}|js&|�tj	||j��n#t
$rYnwxYw|r||j|j<dSdSr)
r:r�r�r0r�r�r�r�rrE)rrr �prev_definitionr-s    r�
EXCEPTHANDLERzChecker.EXCEPTHANDLER�s@���9������%�%�%��F��9��
�"�"�� � ��&�&�&�	#�"�j�n�n�T�Y�7�7�O�O���	#�	#�	#�"�O�O�O�	#����	
���T�"�"�"����D�!�!�!�	F��j�n�n�T�Y�/�/�G��<�
F����H�3�T�4�9�E�E�E���	�	�	�	��D�	�����	4�$3�D�J�t�y�!�!�!�	4�	4s$�A#�#A2�1A2� C-�-
C:�9C:c�*�|�|j|��|�|j|��|jrUt|jd|j��r|�|j|��dS|�|j|��dSdS)N�	TypeAlias)rLr_ryrvrrUr�r�s  r�	ANNASSIGNzChecker.ANNASSIGN�s��������T�*�*�*����d�o�t�4�4�4��:�	2��$�/�;���H�H�
2��%�%�d�j�$�7�7�7�7�7�����
�D�1�1�1�1�1�	2�	2rc�J�|j}t|j|j��D]k\}}t	|t
jt
jf��r>t|��st|��r |�	tj|��|}�l|�|��dSr)
r�zip�ops�comparatorsrr�Is�IsNotr4r�r�	IsLiteralr�)rrr rr"rs     r�COMPAREzChecker.COMPARE�s����y���T�X�t�'7�8�8�	�	�I�B���r�C�F�C�I�#6�7�7�
6�/��5�5�
6�0��6�6�
6����H�.��5�5�5��D�D����D�!�!�!�!�!rc�Z�|�|��|�|��dSr)r0r�r�s  r�
_match_targetzChecker._match_target�s0�����T�"�"�"����D�!�!�!�!�!rr)�ryrzr{r|r�Moduler2r*rr^r r_rL�ListCompr0�SetComp�GeneratorExp�DictCompr�r[r�rdrfr:r�r��builtin_varsr��_MAGIC_GLOBALSr�r�rr~�_customBuiltIns�updater�r�r�r�r�r�r�r��setterr�r�r�r�r�r�r�r�rrrrr�rrr'r0r8�
contextlib�contextmanagerrhrkr!rIr�r,rRrXrL�doctest�
DocTestParser�get_examplesr^rkryrDruryr{�DELETE�FOR�ASYNCFOR�WHILE�WITH�WITHITEM�	ASYNCWITH�EXPR�ASSIGN�PASS�BOOLOP�UNARYOP�SET�	ATTRIBUTE�STARRED�NAMECONSTANT�	NAMEDEXPRr�r�r�r�r�r�r.r��NUM�BYTES�ELLIPSIS�SLICE�EXTSLICE�INDEX�LOAD�STORE�DEL�AUGLOAD�AUGSTORE�PARAM�AND�OR�ADD�SUB�MULT�DIV�MOD�POW�LSHIFT�RSHIFT�BITOR�BITXOR�BITAND�FLOORDIV�INVERT�NOT�UADD�USUB�EQ�NOTEQ�LT�LTE�GT�GTE�IS�ISNOT�IN�NOTIN�MATMULTr��
COMPREHENSION�KEYWORD�FORMATTEDVALUEr�r�rr�IFEXPrr�NONLOCALr�LISTCOMP�DICTCOMP�SETCOMPr%r0�BREAKr3r6�AWAIT�	YIELDFROMr>�ASYNCFUNCTIONDEFr<rTrVr]r`rg�LISTrlrtry�TRYSTARr|rr��MATCH�
MATCH_CASE�
MATCHCLASS�MATCHOR�
MATCHSEQUENCE�MATCHSINGLETON�
MATCHVALUEr��MATCHAS�MATCHMAPPING�	MATCHSTARr	rrr�r�!s1������
�
�	�
�K���j������m��
�M���n���^���.���n�
�O��I�
�F�$�)�N��L��s�<� � �&�&�~�6�6�H��j�n�n�%8�9�9�O��4�����-�-�c�2�2�3�3�3��
'/��/�2�:�=�2� � � � �D	T�	T�	T�V�V�V����>�>�>��+�+��X�+���0�0���0�
�1�1��X�1��$�6�6�%�$�6�
�#�#��X�#�6�6�6�:K�:K�:K�x$1�-�-�-�-�K�K�K����
�
�
�,������N�N�N�	�	�	�/?�/?�/?�b&�&�&� ���K<�K<�K<�Z('�('�('�T@�@�@�<��)8�)=�'�'�'���'��
�
��X�
����&(�(�(�(�
���N�N�N�(�(�(� � � �$0�'�/�1�1�>��&�&�&�B�1�1���1�.�.�.��]�.�"
�
�
�
'�'�F�'�S�'�8�'�e�'�d�'�X�'�	�'��v��D�#�#�F�#�W�#�s�#�Y�#��#�<��$*�$*�$*�Lq�q�q�fP&�P&�P&�de�e�e�N"�"�"�
'�
'�
'��3�	&�	&�	&�	&�-3�2��2�e�2�h�� .�-�E�-�H�u�7=�<�D�<�5�<�3�<��<�8�e���C��"��s��S��4��#����c��F��V��
������"*��-3��69��<@��CG��
��
������ "��%(��+-��05��8:��=B��<�<�<�0>�=�M�=�G�n��K�
$�
$�
$�""�""�""�H"�"�"�

�E�"�"�"�
2�2�2�<�H����
%1�0�H�0�x�'�S�S�S�&9�9�9�.
�E�*�*�*�*�*�*���E�I�
B�
B�
B�#��5(�5(�5(�nD�D�D�K�K�K�@�@�@�0+�+�+�
"�"�"�.�D�/�/�/�/�/�/�@/�/�/�(�G�+4�+4�+4�Z	2�	2�	2�"�"�"�AO�N�E�N�J�N��N�g�
�"0�0�N�Z�"�"�"�*7�6�G�6�l�Y�Y�Yrr�)ar|r�r�rr�r�r�r�rrr��rerF�sysr��pyflakesr�version_infor.r�rUr=r��	Formatterr_r�rr(r)r�r!r-r&r4r;�compiler�r�r��ASCII_NON_ALNUM�patternr�rArPrSrTrUrV�	frozensetr�rHrhrrjr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr r0r2r6r8r<r�r�rIrOrUrYrbrdruryr��NodeVisitorr�r�r�r	rr�<module>r�s}������������
�
�
�
�
�
�
�
�����������������	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
��������������&�	��w�s�'�(�(���s�8�}�}��&�f�&�(�(�.��C�C�C��W�c�l�#�	��B�
�
�
�
�B�B�B����
�	
�J�J�J�J�
�
�
�:�:�:�����"�*�-�.�.���'�'�N�N�5�5��:�:�N�N�N�O�O�������?�/�?�?�?�?�A�A���r�z�4�5�5�����O�,�,���R�Z�
�+�+���2�:�m�$�$���r�z�.�/�/���B�J�x� � �	��I�1�2�2�����=!�=!�=!�@�����4����&���!%�L�L�N�N�����."�"�"�4P�P�P�I�I�I�I�I�I�I�I�@���������
�
�
�
�
�j�
�
�
�����������������&%!�%!�%!�%!�%!�*�%!�%!�%!�P")�")�")�")�")�;�")�")�")�J<�<�<�<�<�k�<�<�<�8�����k����,	$�	$�	$�	$�	$��	$�	$�	$������w������������������*�������������	�	�	�	�	��	�	�	�	�	�	�	�	�j�	�	�	�.'�.'�.'�.'�.'�G�.'�.'�.'�bH�H�H�H�H�D�H�H�H�	�	�	�	�	��	�	�	�$�$�$�$�$�E�$�$�$�<	�	�	�	�	�U�	�	�	�(�(�(�(�(�%�(�(�(������;����%�%�%�%�%�%�%�%���������Q�P�P�������:�;�;��)�)�)�XL�L�L�@�@�@����
�
�
�
�
�
�
�
�������>�>�>�J�J�J�J�J�s��J�J�J�*���6Z7�Z7�Z7�Z7�Z7�Z7�Z7�Z7�Z7�Z7r