Hacked By AnonymousFox

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

�

�܋fG��	��UdZddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZddlmZmZmZddlZdd	lmZmZmZmZdd
lmZddlmZddlm Z m!Z!dd
l"m#Z#m$Z$m%Z%ddl&m'Z'm(Z(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.ddl/m0Z0ej1dkrddlm2Z2nddl3m4Z2erddl5m6Z6ej7d��Z8dZ9ej7d��Z:ddiZ;dZ<dZ=e>hd���Z?ej@jAej@jBej@jCejjDjEfZFejGejHejIejJejKejLfZMGd�de��ZNd�d%�ZOed&�'��d�d,���ZPd�d1�ZQd�d6�ZRd�d9�ZSd�d=�ZTd�d>�ZUd�dB�ZVd�dE�ZWd�dG�ZXd�dK�ZYidLdM�dNdO�dPdQ�dRdS�dTdU�dVdW�dXdY�dZd[�d\d]�d^d_�d`da�dbdc�ddde�dfdg�dhdi�djdk�dldm�dndodpdqdrgifdsdtdudqdvgifdwdxdydzd{d|��ZZd}e[d~<Gd�d�e��Z\Gd��d���Z]Gd��d�e ��Z^d�d��Z_dS)�z#Variables checkers for Python code.�)�annotationsN)�defaultdict)�	Generator�Iterable�Iterator)�Enum)�	lru_cache)�
TYPE_CHECKING�Any�
NamedTuple)�bases�extract_node�nodes�util)�_base_nodes)�InferenceResult)�BaseChecker�utils)�in_type_checking_block�is_postponed_evaluation_enabled�is_sys_guard)�	PY39_PLUS�TYPING_NEVER�TYPING_NORETURN)�CONTROL_FLOW�HIGH�	INFERENCE�INFERENCE_FAILURE)�MessageDefinitionTuple)��)�cached_property)�cachedproperty)�PyLinterz^_{2}[a-z]+_{2}$�
__future__z_.*|^ignored_|^unused_�_py_abc�abczbuiltins.range�typing>5r�Set�Dict�List�Text�Type�Deque�Sized�Tuple�Union�AnyStr�Counter�Generic�Mapping�Pattern�TypeVar�BinaryIO�Callable�ClassVar�Hashablerr�KeysView�Optional�Sequence�	Awaitable�	Container�	Coroutine�	FrozenSetr�	ItemsView�
ByteString�
Collection�
MutableSetr�
Reversible�
ValuesView�AbstractSet�DefaultDict�MappingView�SupportsAbs�SupportsInt�
AsyncIterable�
AsyncIterator�
SupportsBytes�
SupportsFloat�
SupportsRound�AsyncGenerator�ContextManager�MutableMapping�MutableSequence�SupportsComplex�AsyncContextManagerc��eZdZdZdZdZdS)�VariableVisitConsumerActionz�Reported by _check_consumer() and its sub-methods to determine the
    subsequent action to take in _undefined_and_used_before_checker().

    Continue -> continue loop to next consumer
    Return -> return and thereby break the loop
    r�N)�__name__�
__module__�__qualname__�__doc__�CONTINUE�RETURN���j/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/variables.pyrZrZ�s$���������H�
�F�F�FrcrZ�stmt�nodes.ImportFrom�name�str�return�bool | Nonec��	|�|j��}n#tj$rYdSwxYw|j�|g��D]/}t
|tj��r|jtkrdS�0dS)z9Check if the name is a future import from another module.NT)
�do_import_module�modname�astroid�AstroidBuildingException�locals�get�
isinstancer�
ImportFrom�FUTURE)rerg�module�
local_nodes    rd�_is_from_future_importrw�s�����&�&�t�|�4�4�����+�����t�t������m�'�'��b�1�1���
��j�%�"2�3�3�	�
�8J�f�8T�8T��4�4���4s��0�0i�)�maxsize�klass�nodes.LocalsDictNodeNG�
str | None�nodes.FunctionDef | Nonec���	t|�|����}n#ttf$rYdSwxYw	||}n#t$rYdSwxYwt	|t
j��r|SdS)zGet overridden method if any.N)�next�local_attr_ancestors�
StopIteration�KeyErrorrrr�FunctionDef)ryrg�parent�	meth_nodes    rd�overridden_methodr��s���
��e�0�0��6�6�7�7�����8�$�����t�t�������4�L�	�	�������t�t������)�U�.�/�/�����4s�"%�:�:�A�
A�A�node�nodes.Assign�inferredrc��d}t|t��rit|tj��r|j���}n3t|tj��r|j���}|S|���j	}|���j	|kr;|j
|j
krd|����d�}n&|j
r
d|j
��}n|j
r
d|j
�d|��}|S)z~Return extra information to add to the message for unpacking-non-sequence
    and unbalanced-tuple/dict-unpacking errors.
    ��'zdefined at line z of )rr�
DICT_TYPESr�Assign�value�	as_string�For�iter�rootrg�lineno)r�r��more�inferred_modules    rd�_get_unpacking_extra_infor��s���D��(�J�'�'���d�E�L�)�)�	)��:�'�'�)�)�D�D�
��e�i�
(�
(�	)��9�&�&�(�(�D����m�m�o�o�*�O��y�y�{�{��?�*�*��;�(�/�)�)�.�x�)�)�+�+�.�.�.�D�D�
�_�	8�7�h�o�7�7�D��	��I�H�(�/�H�H��H�H���Krc�
nodes.Name�frame�defframe�boolc�j�dx}}|r |jr|j���}|r |jr|j���}t|tj��r'||ur#|tj|tj��urdSt|tj��rS|�|��r|j	|j	kSt|jtjtj
f��sdSntd�||fD����rdSg}||fD]f}|}|r`t|tjtjf��s|�
|��n$|jr|j���}nn|�`�g|r"tt|����dkrdS|j	|j	kS)a�Detect that the given frames share a global scope.

    Two frames share a global scope when neither
    of them are hidden under a function scope, as well
    as any parent scope of them, until the root scope.
    In this case, depending from something defined later on
    will only work if guarded by a nested function definition.

    Example:
        class A:
            # B has the same global scope as `C`, leading to a NameError.
            # Return True to indicate a shared scope.
            class B(C): ...
        class C: ...

    Whereas this does not lead to a NameError:
        class A:
            def guard():
                # Return False to indicate no scope sharing.
                class B(C): ...
        class C: ...
    NFc3�dK�|]+}t|tjtjf��V��,dS�N)rrr�ClassDef�Module)�.0�fs  rd�	<genexpr>z'_detect_global_scope.<locals>.<genexpr>�sI����
�
�>?�J�q�5�>�5�<�8�9�9�9�
�
�
�
�
�
rcr[)r��scoperrrr�r�get_node_first_ancestor_of_typer��	parent_ofr��	Arguments�anyr��append�len�set)r�r�r��	def_scoper��break_scopes�
current_scope�parent_scopes        rd�_detect_global_scoper��s���2��I���%���%���"�"�$�$���,�H�O�,��O�)�)�+�+�	��5�%�.�)�)����"�"��U�:�4��AR�S�S�S�S��u��%��*�+�+���?�?�8�$�$�	1��;���0�0��$�+��(9�5�?�'K�L�L�	��5�	�	�
�
�DI�8�CT�
�
�
�
�
��
�u��L���+���
�%���	��l�U�^�U�\�,J�K�K�
��#�#�L�1�1�1���"�
�+�2�8�8�:�:�����	�����C��-�-�.�.�!�3�3��u��<�(�/�)�)rc�nodes.Import�&Generator[InferenceResult, None, None]c�z�tj���}||_|�|d���S)NF)�asname)rn�context�InferenceContext�
lookupname�infer)r�rgr�s   rd�_infer_name_moduler�s5���o�.�.�0�0�G��G���:�:�g�e�:�,�,�,rc�not_consumed�dict[str, list[nodes.NodeNG]]�(list[tuple[str, _base_nodes.ImportNode]]c���i}|���D]�\}}td�|D����r�|D]�}t|tjtjf��s�)|jD]Z}d}|d}|dkr|}n:d}|�|��r|�d��dkrd}|s||vr|}|r	||vr|||<�[����t|���d	��
��S)aTry to fix imports with multiple dots, by returning a dictionary
    with the import names expanded.

    The function unflattens root imports,
    like 'xml' (when we have both 'xml.etree' and 'xml.sax'), to 'xml.etree'
    and 'xml.sax' respectively.
    c3�K�|]J}t|tj��o+t|���tj��V��KdSr�)rrr�
AssignName�assign_type�	AugAssign�r�res  rdr�z#_fix_dot_imports.<locals>.<genexpr>+sf����
�
��
�t�U�-�.�.�
@��4�+�+�-�-�u��?�?�
�
�
�
�
�
rcNr�*F�.���Tc��|djS)Nr[)�
fromlineno)�as rd�<lambda>z"_fix_dot_imports.<locals>.<lambda>Js��q��t��rc)�key)
�itemsr�rrrrs�Import�names�
startswith�find�sorted)	r�r�rg�stmtsre�imports�second_name�import_module_name�name_matches_dotted_imports	         rd�_fix_dot_importsr�sY��02�E�#�)�)�+�+�.�.���e��
�
��
�
�
�
�
�	�

��	.�	.�D��d�U�%5�u�|�$D�E�E�
���:�
.�
.��"��%,�Q�Z�"�%��,�,�#'�K�K�16�.�*�5�5�d�;�;�:�.�3�3�C�8�8�2�=�=�59�2�1�9�T�W�_�_�'9���.�;�e�#;�#;�)-�E�+�&��+
.�	.�2�%�+�+�-�-�%>�%>�?�?�?�?rcc��|t|�tj����vrdS|�tjtjf��}|D](}|jD]\}}|r||krdS�|r
||krdS��)dS)z�Detect imports in the frame, with the required *name*.

    Such imports can be considered assignments if they are not globals.
    Returns True if an import for the given name was found.
    FT)�_flattened_scope_names�nodes_of_classr�Globalr�rsr�)rgr�r��import_node�import_name�import_aliass      rd�_find_frame_importsr�Ms����%�e�&:�&:�5�<�&H�&H�I�I�I�I��u��"�"�E�L�%�2B�#C�D�D�G�����)4�):�	�	�%�K���
��4�'�'��4�4�4�(��
���!4�!4��t�t�t��	��5rc�%nodes.Global | _base_nodes.ImportNode�global_names�set[str]c�B�|jD]\}}|r||vrdS�||vrdS�dS)NTF)r�)rer�r�r�s    rd�_import_name_is_globalr�csW��&*�Z���!��\��	��|�+�+��t�t�,�
�L�
(�
(��4�4�)��5rc�iterator�'Iterator[nodes.Global | nodes.Nonlocal]c�r�d�|D��}ttj�|����S)Nc3�>K�|]}t|j��V��dSr�)r�r�r�s  rdr�z)_flattened_scope_names.<locals>.<genexpr>ts*����
3�
3�$�c�$�*�o�o�
3�
3�
3�
3�
3�
3rc)r��	itertools�chain�
from_iterable)r��valuess  rdr�r�qs5��4�
3�(�
3�
3�
3�F��y��,�,�V�4�4�5�5�5rc�	name_nodec��������}|�tj��}t	�fd�|D����pt�j|��S)zEChecks if name_node has corresponding assign statement in same scope.c3�8�K�|]}|j�jkV��dSr��rg)r�r�r�s  �rdr�z$_assigned_locally.<locals>.<genexpr>|s,�����>�>�A�q�v���'�>�>�>�>�>�>rc)r�r�rr�r�r�rg)r��name_node_scope�assign_stmtss`  rd�_assigned_locallyr�xsh����o�o�'�'�O�"�1�1�%�2B�C�C�L��>�>�>�>��>�>�>�>�>��BU����C�C�rc�nodes.NodeNGr��nodes.FunctionDefc�T�tjtjtjtjf}|�tj|���D]W}tj|j	��}tj
|��r(t|dd��dkr|j|jkrdS�XdS)N)�
skip_klassrgrpTF)
rr�r�r�rsr��Callr�
safe_infer�func�is_builtin_object�getattrr�)rer��
skip_nodes�callr�s     rd�_has_locals_call_after_noder��s���
��
��
��
��	�J��$�$�U�Z�J�$�G�G�����#�D�I�.�.���#�H�-�-�	���&�$�/�/�8�;�;��{�T�[�(�(��t�t���5rc�E0601)z#Using variable %r before assignment�used-before-assignmentafEmitted when a local variable is accessed before its assignment took place. Assignments in try blocks are assumed not to have occurred when evaluating associated except/finally blocks. Assignments in except blocks are assumed not to have occurred when evaluating statements outside the block, except when the associated try block contains a return statement.�E0602)zUndefined variable %r�undefined-variablez,Used when an undefined variable is accessed.�E0603)z%Undefined variable name %r in __all__�undefined-all-variablez>Used when an undefined variable name is referenced in __all__.�E0604)z7Invalid object %r in __all__, must contain only strings�invalid-all-objectz;Used when an invalid (non-string) object occurs in __all__.�E0605)z1Invalid format for __all__, must be tuple or list�invalid-all-formatz(Used when __all__ has an invalid format.�E0611)zNo name %r in module %r�no-name-in-modulez-Used when a name cannot be found in a module.�W0601)z0Global variable %r undefined at the module level�global-variable-undefinedzsUsed when a variable is defined through the "global" statement but the variable is not defined in the module scope.�W0602)z-Using global for %r but no assignment is done�global-variable-not-assignedz�When a variable defined in the global scope is modified in an inner scope, the 'global' keyword is required in the inner scope only if there is an assignment operation done in the inner scope.�W0603)zUsing the global statement�global-statementz�Used when you use the "global" statement to update a global variable. Pylint discourages its usage. That doesn't mean you cannot use it!�W0604)z.Using the global statement at the module level�global-at-module-levelzTUsed when you use the "global" statement at the module level since it has no effect.�W0611)z	Unused %s�
unused-importz5Used when an imported module or variable is not used.�W0612)zUnused variable %r�unused-variablez-Used when a variable is defined but not used.�W0613)zUnused argument %r�unused-argumentz4Used when a function or method argument is not used.�W0614)z.Unused import(s) %s from wildcard import of %s�unused-wildcard-importz]Used when an imported module or variable is not used from a `'from X import *'` style import.�W0621)z-Redefining name %r from outer scope (line %s)�redefined-outer-namezUUsed when a variable's name hides a name defined in an outer scope or except handler.�W0622)zRedefining built-in %r�redefined-builtinz5Used when a variable or function override a built-in.�W0631)z)Using possibly undefined loop variable %r�undefined-loop-variablez�Used when a loop variable (i.e. defined by a for loop or a list comprehension or a generator expression) is used outside the loop.ziPossible unbalanced tuple unpacking with sequence %s: left side has %d label%s, right side has %d value%s�unbalanced-tuple-unpackingz>Used when there is an unbalanced tuple unpacking in assignment�	old_names)�E0632zold-unbalanced-tuple-unpackingz%Attempting to unpack a non-sequence%s�unpacking-non-sequencezKUsed when something which is not a sequence is used in an unpack assignment)�W0633zold-unpacking-non-sequence)z Cell variable %s defined in loop�cell-var-from-loopz�A variable used in a closure is defined in a loop. This will result in all closures using the same value for the closed-over variable.)zPossibly unused variable %r�possibly-unused-variablez�Used when a variable is defined but might not be used. The possibility comes from the fact that locals() might be used, which could consume or not the said variable)z"Invalid assignment to %s in method�self-cls-assignmentzKInvalid assignment to self or cls in instance or class method respectively.)z!Invalid index for iterable length�potential-index-errorzREmitted when an index used on an iterable goes beyond the length of that iterable.)z_Possible unbalanced dict unpacking with %s: left side has %d label%s, right side has %d value%s�unbalanced-dict-unpackingzIUsed when there is an unbalanced dict unpacking in assignment or for loop)�W0632�E0633�W0640�W0641�W0642�E0643�W0644z!dict[str, MessageDefinitionTuple]�MSGSc�<�eZdZUdZded<ded<ded<ded<d	S)
�
ScopeConsumerz)Store nodes and their consumption states.r��
to_consume�consumed�$defaultdict[str, list[nodes.NodeNG]]�consumed_uncertainrh�
scope_typeN)r\r]r^r_�__annotations__rbrcrdr3r3&sC�������3�3�-�-�-�-�+�+�+�+�<�<�<�<��O�O�O�O�Orcr3c�z�eZdZdZd/d�Zd0d	�Zd1d�Zed2d
���Zed2d���Z	ed3d���Z
ed0d���Zd4d�Zd5d�Z
ed6d���Zed7d���Zd8d�Zed9d"���Zed6d#���Zed6d$���Zed:d'���Zed;d+���Zed<d,���Zed<d-���Zd.S)=�
NamesConsumerzQA simple class to handle consumed, to consume and scope type info of node locals.r�r�r8rhri�Nonec���ttj|j��itjt
��|��|_||_t��|_	dSr�)
r3�copyrp�collectionsr�list�_atomicr�r��_if_nodes_deemed_uncertain)�selfr�r8s   rd�__init__zNamesConsumer.__init__2sN��$��I�d�k�"�"�B��(?��(E�(E�z�
�
�����	�9<����'�'�'rcc	��d�|jj���D��}d�|jj���D��}d�|jj���D��}d�|��}d�|��}d�|��}d|�d|�d|�d|jj�d	�	S)
Nc�"�g|]\}}|�d|����
S�z->rb�r��k�vs   rd�
<listcomp>z*NamesConsumer.__repr__.<locals>.<listcomp>:s&��P�P�P���1�1������P�P�Prcc�"�g|]\}}|�d|����
SrGrbrHs   rdrKz*NamesConsumer.__repr__.<locals>.<listcomp>;s&��K�K�K�T�Q���[�[�Q�[�[�K�K�Krcc�"�g|]\}}|�d|����
SrGrbrHs   rdrKz*NamesConsumer.__repr__.<locals>.<listcomp><s3��
�
�
� �A�q�q�K�K�A�K�K�
�
�
rc�, z
to_consume : z
consumed : z
consumed_uncertain: z
scope_type : �
)rAr4r�r5r7�joinr8)rC�_to_consumes�	_consumed�_consumed_uncertain�to_consumesr5r7s       rd�__repr__zNamesConsumer.__repr__9s���P�P���0G�0M�0M�0O�0O�P�P�P��K�K�T�\�-B�-H�-H�-J�-J�K�K�K�	�
�
�$(�L�$C�$I�$I�$K�$K�
�
�
���i�i��-�-���9�9�Y�'�'��!�Y�Y�':�;�;���������(����l�%�	���	rc�
Iterator[Any]c�*�t|j��Sr�)r�rA�rCs rd�__iter__zNamesConsumer.__iter__Is���D�L�!�!�!rcr�c��|jjSr�)rAr4rXs rdr4zNamesConsumer.to_consumeL�
���|�&�&rcc��|jjSr�)rAr5rXs rdr5zNamesConsumer.consumedPs
���|�$�$rcr6c��|jjS)a�Retrieves nodes filtered out by get_next_to_consume() that may not
        have executed.

        These include nodes such as statements in except blocks, or statements
        in try blocks (when evaluating their corresponding except and finally
        blocks). Checkers that want to treat the statements as executed
        (e.g. for unused-variable) may need to add them back.
        )rAr7rXs rdr7z NamesConsumer.consumed_uncertainTs���|�.�.rcc��|jjSr�)rAr8rXs rdr8zNamesConsumer.scope_type`r[rcrg�consumed_nodes�list[nodes.NodeNG]c�z���fd�|j|D��}�|j|<|r||j|<dS|j|=dS)z�Mark the given nodes as consumed for the name.

        If all of the nodes for the name were consumed, delete the name from
        the to_consume dictionary
        c�6��g|]}|t���v�|��Srb)r�)r��nr_s  �rdrKz2NamesConsumer.mark_as_consumed.<locals>.<listcomp>js+���W�W�W�A�!�3�~�CV�CV�:V�:V�a�:V�:V�:VrcN)r4r5)rCrgr_�
unconsumeds  ` rd�mark_as_consumedzNamesConsumer.mark_as_consumedds\���X�W�W�W����!6�W�W�W�
�,��
�d���	&�$.�D�O�D�!�!�!����%�%�%rcr��list[nodes.NodeNG] | Nonec������j}�j}|j�|��}��d���}|rPt|tj��r6||djkr%|djjd}|j|krd}|r0t|tj	��r|j
�kr|j|vrd}t�fd���
d������D����r|St����r|S|rM|�|���}|j�jxx|z
cc<t'|����fd�|D��}|r�fd�|D��}|rN|�|�|��}|j�jxx|z
cc<t'|����fd�|D��}|rM|�||��}|j�jxx|z
cc<t'|����fd	�|D��}|rM|�||��}|j�jxx|z
cc<t'|����fd
�|D��}|S)aGReturn a list of the nodes that define `node` from this scope.

        If it is uncertain whether a node will be consumed, such as for statements in
        except blocks, add it to self.consumed_uncertain instead of returning it.
        Return None to indicate a special case that needs to be handled by the caller.
        T��futurerNc3�h�K�|],}t|tj��o
�j|jvV��-dSr��rrr�Nonlocalrgr��r��childr�s  �rdr�z4NamesConsumer.get_next_to_consume.<locals>.<genexpr>�sQ�����
�
��
�u�e�n�-�-�J�$�)�u�{�2J�
�
�
�
�
�
rcc���g|]}|�v�|��	Srbrb�r�rc�uncertain_nodes_sets  �rdrKz5NamesConsumer.get_next_to_consume.<locals>.<listcomp>��$���R�R�R��Q�>Q�5Q�5Q�1�5Q�5Q�5Qrcc����g|][}t|�d���tj��r)|�d��������Y|��\S)Trh)rr�	statementr�
ExceptHandlerr�)r�rcr�s  �rdrKz5NamesConsumer.get_next_to_consume.<locals>.<listcomp>�sp�������!�!�+�+�T�+�":�":�E�<O�P�P���;�;�d�;�+�+�5�5�d�;�;�	����rcc���g|]}|�v�|��	Srbrbrps  �rdrKz5NamesConsumer.get_next_to_consume.<locals>.<listcomp>�rrrcc���g|]}|�v�|��	Srbrbrps  �rdrKz5NamesConsumer.get_next_to_consume.<locals>.<listcomp>�rrrcc���g|]}|�v�|��	Srbrbrps  �rdrKz5NamesConsumer.get_next_to_consume.<locals>.<listcomp>�rrrc)rgr�r4rqrtrrrr��targetsr�r��targetr�r��get_children�VariablesChecker�%_comprehension_between_frame_and_node�_uncertain_nodes_in_false_testsr7r��!_uncertain_nodes_in_except_blocks�=_uncertain_nodes_in_try_blocks_when_evaluating_finally_blocks�<_uncertain_nodes_in_try_blocks_when_evaluating_except_blocks)	rCr�rg�parent_node�found_nodes�node_statement�lhs�uncertain_nodesrqs	 `      @rd�get_next_to_consumez!NamesConsumer.get_next_to_consumersC�����y���k���o�)�)�$�/�/�����t��4�4���	#��;���5�5�	#��{�1�~�4�4�4��a�.�'�/��2�C��x�4���"��
�	��;��	�2�2�	�� �D�(�(��"�k�1�1��K��
�
�
�
����4��0�0�=�=�?�?�
�
�
�
�
�	����A�A�$�G�G�	����	S�"�B�B�;�PT�U�U�O��#�D�I�.�.�.�/�A�.�.�.�"%�o�"6�"6��R�R�R�R�k�R�R�R�K��	�����$����K��	S�"�D�D��T�>���O�
�#�D�I�.�.�.�/�A�.�.�.�"%�o�"6�"6��R�R�R�R�k�R�R�R�K��	S��R�R�����
�

�#�D�I�.�.�.�/�A�.�.�.�"%�o�"6�"6��R�R�R�R�k�R�R�R�K��	S��Q�Q�����
�

�#�D�I�.�.�.�/�A�.�.�.�"%�o�"6�"6��R�R�R�R�k�R�R�R�K��rcr�c����t|tjtjf��rUt��|��p9t|tj��ot
�fd�|jD����St|tj��rt��|��St|tj	��sdSt|�tj����rdSt�
�|��rdS|jsdSt��|j��ot��|j��S)z�Return True if there is a collectively exhaustive set of paths under
        this `if_node` that define `name`, raise, or return.
        c3�N�K�|]}t��|��V�� dSr�)r;�)_defines_name_raises_or_returns_recursive)r��handlerrgs  �rdr�zJNamesConsumer._exhaustively_define_name_raise_or_return.<locals>.<genexpr>�sN������� �"�K�K��g��������rcFT)rrr�	TryExcept�
TryFinallyr;r��all�handlers�With�Ifr�r��Break�_defines_name_raises_or_returns�orelse�_branch_handles_name�body)rgr�s` rd�)_exhaustively_define_name_raise_or_returnz7NamesConsumer._exhaustively_define_name_raise_or_return�sd����d�U�_�e�.>�?�@�@�	��G�G��d�S�S���d�E�O�4�4�������$(�=�	�����	
��d�E�J�'�'�	W� �J�J�4�QU�V�V�V��$���)�)�	��5��t�"�"�5�;�/�/�0�0�	��4��8�8��t�D�D�	��4��{�	��5��1�1��$�)�
�
�D��0�0��t�{�C�C�	Drcr��Iterable[nodes.NodeNG]c�:��t�fd�|D����S)Nc3��K�|]v}t��|��pVt|tjtjtjtjf��ot��|��V��wdSr�)	r;r�rrrr�r�r�r�r�)r��if_body_stmtrgs  �rdr�z5NamesConsumer._branch_handles_name.<locals>.<genexpr>�s������

�

��
�9�9�$��M�M�
�����5�?�E�,<�e�j�I�����G�G��l���

�

�

�

�

�

rc)r�)rgr�s` rdr�z"NamesConsumer._branch_handles_name�s=����

�

�

�

�!%�

�

�

�

�

�
	
rcr�c�
��g}|D�]{}t|��r�t|tj��s�.t	j|tj������P|�������ur�y����|��r��t�
|j���r��t�fd�|j
D����r|�|����t�jtj��r
�jj}n�j}t	j|��}|rt'd�|D����s��L|�|��|j
������}|S)aIdentify nodes of uncertain execution because they are defined under
        tests that evaluate false.

        Don't identify a node if there is a collectively exhaustive set of paths
        that define the name, raise, or return (e.g. every if/else branch).
        Nc3�B�K�|]}|����V��dSr��r�)r��if_node�
closest_ifs  �rdr�z@NamesConsumer._uncertain_nodes_in_false_tests.<locals>.<genexpr>%sE���������!�!�*�-�-������rcc3�ZK�|]&}t|tj��o|jV��'dSr�)rrr�Constr�)r�r�s  rdr�z@NamesConsumer._uncertain_nodes_in_false_tests.<locals>.<genexpr>2sL����+�+���8�U�[�1�1�H�(�.�6H�+�+�+�+�+�+rc)rrrrr�rr�r�r�r�r;r�rgr�rBr��test�	NamedExprr��	infer_allr��add)rCr�r�r��
other_noder��all_inferredr�s       @rdr~z-NamesConsumer._uncertain_nodes_in_false_testss������%�*	<�*	<�J�%�j�1�1�
���j�%�*:�;�;�
���>�z�5�8�T�T�J��!���z�z�|�|�:�#3�#3�#5�#5�5�5���%�*�*>�*>�t�*D�*D�%���F�F������
�������#�>������
� �&�&�z�2�2�2���*�/�5�?�;�;�
'�!��,���!��� �?�4�0�0�L��
�s�+�+� ,�+�+�+�(�(�
���"�"�:�.�.�.��+�/�/�
�;�;�;�;��rcr��nodes.Statementc���g}|D�]�}|�d���}tj|tj��}|s�;|����r�Q|j}td�|jD����}td�|j	D����}	td�|j	D����}
|s|	s|
r�t|jtj��r>||jjvr0|j�|��r|�
|��nt|jtj��r>||jj	vr0|j�|��r|�
|��n"t�fd�|jD����r���t"��|��r���|�
|�����|S)z}Return any nodes in ``found_nodes`` that should be treated as uncertain
        because they are in an except block.
        Trhc3�JK�|]}t|tj��V��dSr��rrr�Return)r��
try_statements  rdr�zBNamesConsumer._uncertain_nodes_in_except_blocks.<locals>.<genexpr>TsB����$�$�!��=�%�,�7�7�$�$�$�$�$�$rcc3�JK�|]}t|tj��V��dSr�r��r��else_statements  rdr�zBNamesConsumer._uncertain_nodes_in_except_blocks.<locals>.<genexpr>XsB����%�%�"��>�5�<�8�8�%�%�%�%�%�%rcc3�K�|]V}t|tj��o7t|jtj��otj|j��V��WdSr�)rrr�Exprr�r�r�is_terminating_funcr�s  rdr�zBNamesConsumer._uncertain_nodes_in_except_blocks.<locals>.<genexpr>\ss����#�#�#��>�5�:�6�6�D��~�3�U�Z�@�@�D��-�n�.B�C�C�#�#�#�#�#�#rcc3�X�K�|]$}t��j|��V��%dSr�)r;r�rg)r�r�r�s  �rdr�zBNamesConsumer._uncertain_nodes_in_except_blocks.<locals>.<genexpr>usP������� �"�K�K��	�7��������rc)rtrr�rrur�r�r�r�r�rrr��	finalbodyr�r�r�r�r;�_check_loop_finishes_via_except)r�r�r�r�r��other_node_statement�closest_except_handler�closest_try_except�try_block_returns�else_block_returns�else_block_exitss `         rdrz/NamesConsumer._uncertain_nodes_in_except_blocks=sa�����%�:	/�:	/�J�#-�#7�#7�t�#7�#D�#D� �%*�%J�$�e�&9�&�&�"�*�
��%�/�/��5�5�
��2H�2O�� #�$�$�%7�%<�$�$�$�!�!��"%�%�%�&8�&?�%�%�%�"�"�� #�#�#�'9�&?�	#�#�#� � ��!�
�$6�
�:J�
��~�4�e�6F�G�G��&�.�*?�*I�I�I�*�1�;�;�N�K�K�J�$�*�*�:�6�6�6�6��~�4�e�o�F�F��&�.�*?�*F�F�F�*�1�;�;�N�K�K�G�$�*�*�:�6�6�6�6������$6�#>�	��������<�<�T�CU�V�V�
��
�"�"�:�.�.�.�.��rcc����t|tjtjtjf��rdSt|tj��r8|jr1t|jtj��r|jj	�krdSt|tj
��rk|jD]c}tj
|��D]L}t|tj��r|j}t|tj��r|j	�krdS�M�dt|tj��r:t!�fd�|�tj��D����rdSdS)NTc3�8�K�|]}|jj�kV��dSr�)rzrg)r��child_named_exprrgs  �rdr�z@NamesConsumer._defines_name_raises_or_returns.<locals>.<genexpr>�sB�������$�!�'�,��4������rcF)rrr�Raise�Assertr��	AnnAssignr�rzr�rgr�ryr�get_all_elements�Starredr�r�r�r�)rgr�rz�elts`   rdr�z-NamesConsumer._defines_name_raises_or_returns�si����d�U�[�%�,���E�F�F�	��4��t�U�_�-�-�	��
�	��4�;��(8�9�9�	��� �D�(�(��4��d�E�L�)�)�	$��,�
$�
$�� �1�&�9�9�$�$�C�!�#�u�}�5�5�(�!�i��!�#�u�'7�8�8�$�S�X��=M�=M�#�t�t�t��	$�
�d�E�H�%�%�	������(,�(;�(;�E�O�(L�(L������
��t��urcc���|���D]v}t��|��rdSt|tjtjf��r0t�fd�|���D����rdS�wdS)zaReturn True if some child of `node` defines the name `name`,
        raises, or returns.
        Tc3�N�K�|]}t��|��V�� dSr�)r;r�)r��nested_stmtrgs  �rdr�zJNamesConsumer._defines_name_raises_or_returns_recursive.<locals>.<genexpr>�sG�������#�"�A�A�$��T�T������rcF)r{r;r�rrrr�r�r�)rgr�res`  rdr�z7NamesConsumer._defines_name_raises_or_returns_recursive�s�����%�%�'�'�	 �	 �D��<�<�T�4�H�H�
��t�t��$���5�:� 6�7�7�
 ������'+�'8�'8�':�':������ � �4�4���urc�other_node_try_except�nodes.TryExceptc���|jsdStj�tjtjf��}|�dSt
�fd�|jD����sdS|jD] }t|tj��r|}n�!dSdd
�}|||��sM|�	��D]6}t|tjtjf��r|||��rn�7dS|j
D]}t�||��rn� dSdS)
aQCheck for a case described in https://github.com/PyCQA/pylint/issues/5683.

        It consists of a specific control flow scenario where the only
        non-break exit from a loop consists of the very except handler we are
        examining, such that code in the `else` branch of the loop can depend on it
        being assigned.

        Example:

        for _ in range(3):
            try:
                do_something()
            except:
                name = 1  <-- only non-break exit from loop
            else:
                break
        else:
            print(name)
        FNc3�J�K�|]}|�up|����V��dSr�r�)r�r�r�s  �rdr�z@NamesConsumer._check_loop_finishes_via_except.<locals>.<genexpr>�sO�����
�
��
�d�"�D�n�&>�&>�t�&D�&D�
�
�
�
�
�
rcr�r��loop�nodes.For | nodes.Whilerir�c�D��t�fd�|jD����S)zAReturn True if `other_node_try_except` is a descendant of `loop`.c3�J�K�|]}|�up|����V��dSr�r�)r��loop_body_statementr�s  �rdr�z[NamesConsumer._check_loop_finishes_via_except.<locals>._try_in_loop_body.<locals>.<genexpr>�sW�������(�$�'<�<�H�&�0�0�1F�G�G������rc)r�r�)r�r�s` rd�_try_in_loop_bodyzHNamesConsumer._check_loop_finishes_via_except.<locals>._try_in_loop_body�sA��������,0�9������
rcT)r�r�r�r�rir�)
r�rr�rr��Whiler�rrr��node_ancestorsr�r;�+_recursive_search_for_continue_before_break)r�r��closest_loop�inner_else_statement�
break_stmtr��ancestor�	loop_stmts`       rdr�z-NamesConsumer._check_loop_finishes_via_except�s����.%�+�	��5�
�1�$���E�K�8P�Q�Q�	����5��
�
�
�
�".�"5�
�
�
�
�
�	�
�5�$9�$@�	�	� ��.���<�<�
�1�
���
�
�5�	�	�	�	�!� �!6��E�E�	�(�7�7�9�9�
�
���h���E�K�(@�A�A��(�(�)>��I�I������u�%�*�	�	�I��H�H��:���
���
��4��urcrer��nodes.Breakc��||urdSt|tj��rdS|���D]G}t|tjtjf��r�)t�||��rdS�HdS)z�Return True if any Continue node can be found in descendants of `stmt`
        before encountering `break_stmt`, ignoring any nested loops.
        FT)rrr�Continuer{r�r�r;r�)rer�rns   rdr�z9NamesConsumer._recursive_search_for_continue_before_break�s����:����5��d�E�N�+�+�	��4��&�&�(�(�	�	�E��$���E�K� 8�9�9�
���H�H��z���
��t�t�
��urcc�`���g}tj|tj�����|S|D]�}|�d���}|�ur�tj|tj��\�}���B|�jvr�Lt��fd��j	D����s�n|�
|����|S)z�Return any nodes in ``found_nodes`` that should be treated as uncertain.

        Nodes are uncertain when they are in a try block and the ``node_statement``
        being evaluated is in one of its except handlers.
        NTrhc3�V�K�|]#}��jvp|����vV��$dSr�)r�r�)r��&other_node_try_ancestor_except_handlerr��other_node_try_ancestors  ��rdr�z]NamesConsumer._uncertain_nodes_in_try_blocks_when_evaluating_except_blocks.<locals>.<genexpr>2s^�������;�'�*A�*J�J�;�9�)�8�8�:�:�;������rc)rr�rrurt�-get_node_first_ancestor_of_type_and_its_childr�r�r�r�r�)r�r�r�r�r��%other_node_try_ancestor_visited_childr�r�s      @@rdr�zJNamesConsumer._uncertain_nodes_in_try_blocks_when_evaluating_except_blocks
s����/1��!&�!F��E�/�"
�"
��"�)�"�"�%�	/�	/�J�#-�#7�#7�t�#7�#D�#D� �#�'=�=�=��
�C�$�e�o���
�'�5�'�.��5�.�3�4�4��������?V�>^�	�����
���"�"�:�.�.�.�.��rcc�v��g}tj|tj��\�}��|S|�jvr|S|D]�}|�d���}tj|tj��\}}|��=||jvr�G|�ur!t�fd�|jD����s�l|�|����|S)NTrhc3�J�K�|]}|�up|����V��dSr�r�)r��other_node_final_statement�closest_try_finally_ancestors  �rdr�z^NamesConsumer._uncertain_nodes_in_try_blocks_when_evaluating_finally_blocks.<locals>.<genexpr>esZ�������
3�	/�2N�N��1�;�;�4��������rc)	rr�rr�r�rtr�r�r�)	r�r�r��%child_of_closest_try_finally_ancestorr�r��other_node_try_finally_ancestor�(child_of_other_node_try_finally_ancestorr�s	        @rdr�zKNamesConsumer._uncertain_nodes_in_try_blocks_when_evaluating_finally_blocks=s7���/1��
�?��E�,�
�
�	
�(�1�(�/�"�"�1�/�9�
:�
:�#�"�%� 	/� 	/�J�#-�#7�#7�t�#7�#D�#D� ��C�$�e�&6���
�/�8�/�6��9�6�;�<�<��0�7S�S�S������
7V�6_������T���"�"�:�.�.�.�.��rcN)r�r�r8rhrir<)rirh)rirV)rir�)rir6)rgrhr_r`rir<)r�r�rirf)rgrhr�r�rir�)rgrhr�r�rir�)r�r`r�r�rir`)r�r`r�r�r�r�rir`)r�r�r�r�rir�)rer�r�r�rir�)r�r`r�r�rir`)r\r]r^r_rDrUrY�propertyr4r5r7r8rer��staticmethodr�r�r~rr�r�r�r�r�r�rbrcrdr;r;/sH������[�[�?�?�?�?����� "�"�"�"��'�'�'��X�'��%�%�%��X�%��	/�	/�	/��X�	/��'�'�'��X�'�&�&�&�&�Y�Y�Y�Y�v�'D�'D�'D��\�'D�R�
�
�
��\�
�6�6�6�6�p�D�D�D��\�D�L�����\��2�����\��"�F�F�F��\�F�P�����\��&�-�-�-��\�-�^�2�2�2��\�2�2�2rcr;c
�@��eZdZdZdZeZdddddd�fd	d
ddd
d�fdddddd�fdddddd�fdddddd�fdedddd�fdddddd�fddddd d�ffZdˈfd%�Z	e
jd&��d�d)���Zd�d*�Z
d�d,�Ze
jd-d.d/d0d1d2d3d4��d�d5���Zd�d7�Zd�d8�Zd�d:�Zd�d<�Zd�d>�Zd�d?�Zd�dA�Zd�dB�Zd�dD�Zd�dE�Zd�dG�Zd�dH�ZeZeZe
jdIdJdKdLd/��d�dN���Zd�dP�Zd�dR�Z d�dT�Z!e
jdU��d�dW���Z"e
jdU��d�dX���Z#d�d\�Z$d�da�Z%d�dh�Z&e
jdi��d�dk���Z'e
jdi��d�dm���Z(e
jdndodpdq��d�ds���Z)d�du�Z*d�dv�Z+d�dw�Z,d�dy�Z-d�d{�Z.e/d�d|���Z0e/d�d~���Z1e/d�d���Z2e3d�d����Z4e3d�d����Z5e3d�d����Z6e3d�d����Z7d�d��Z8e3d�d����Z9e3d�d����Z:d�d��Z;d�d��Z<d�d��Z=d�d��Z>d�d��Z?d�d��Z@d�d��ZAd�d��ZBe3d�d����ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGe3d�d����ZHd�d��ZId�d��ZJd�d��ZKd�d��ZL�dd��ZM�dd��ZN�dd��ZO�ddÄZP�ddńZQ�ddȄZRe
jd-d3���ddʄ��ZS�xZTS(r|aBaseChecker for variables.

    Checks for
    * unused variables / imports
    * undefined variables
    * redefinition of variable from builtins or from an outer scope or except handler
    * use of variable before assignment
    * __all__ consistency
    * self/cls assignment
    �	variableszinit-importF�ynz<y or n>zBTells whether we should check for unused import in __init__ files.)�default�type�metavar�helpzdummy-variables-rgxz;_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_�regexpz<regexp>zYA regular expression matching the name of dummy variables (i.e. expected to not be used).zadditional-builtinsrb�csvz<comma separated list>z�List of additional names supposed to be defined in builtins. Remember that you should avoid defining new builtins when possible.�	callbacks)�cb_�_cbz<callbacks>z|List of strings which can identify a callback function by name. A callback name must start or end with one of those strings.zredefining-builtins-modules)z	six.movesz
past.builtinszfuture.builtins�builtins�iozQList of qualified module names which can have objects that can redefine builtins.zignored-argument-namesz:Argument names that match this expression will be ignored.zallow-global-unused-variablesTzGTells whether unused global variables should be treated as a violation.zallowed-redefined-builtinsz(List of names allowed to shadow builtins�linterr$rir<c���t���|��g|_g|_g|_	d|_dS�NF)�superrD�_to_consume�_type_annotation_names�_except_handler_names_queue�_postponed_evaluation_enabled)rCr��	__class__s  �rdrDzVariablesChecker.__init__�sK���
������ � � �02���13��#�
�	
�(�	2�-2��*�*�*rcr)r��	nodes.Forc�X�t|jtj��sdS|jj}tj|j��}t|t��sdS|�	|��}|sdSt|tjj��rIt|��dkrtd�|D����rdStd�|D����rdSt|��t|��kr+t!||��}|�|||||��dSdS)N�c3�FK�|]}t|j��dkV��dS)rN)r��elts)r��xs  rdr�z-VariablesChecker.visit_for.<locals>.<genexpr>�s/����(J�(J�a��Q�V����)9�(J�(J�(J�(J�(J�(Jrcc3�JK�|]}t|tj��V��dSr��rrrr��r�rzs  rdr�z-VariablesChecker.visit_for.<locals>.<genexpr>s.����K�K��:�f�e�m�4�4�K�K�K�K�K�Krc)rrrzrr0r	rr�r�r��_nodes_to_unpackrn�objects�	DictItemsr�r�r�r��_report_unbalanced_unpacking)rCr�ryr�r��detailss      rd�	visit_forzVariablesChecker.visit_for�s3���$�+�u�{�3�3�	��F��+�"���#�D�I�.�.���(�J�/�/�	��F��&�&�x�0�0���	��F��h��� 9�:�:�	�
�7�|�|�q� � �S�(J�(J�6�(J�(J�(J�%J�%J� ����K�K�7�K�K�K�K�K�
����w�<�<�3�v�;�;�&�&�/��h�?�?�G��-�-�d�H�g�v�w�W�W�W�W�W�'�&rcc�0�|�|��dSr���_store_type_annotation_names�rCr�s  rd�	leave_forzVariablesChecker.leave_for����)�)�$�/�/�/�/�/rc�nodes.Modulec�@�t|d��g|_t|��|_|j���D]Y\}}t
j|��r@|�|d��s|dkr�;|�	d||d����ZdS)zoVisit module : update consumption analysis variable
        checks globals doesn't overrides builtins.
        rurr_r��argsr�N)
r;rrrrpr�r�
is_builtin� _should_ignore_redefined_builtin�add_message)rCr�rgr�s    rd�visit_modulezVariablesChecker.visit_module
s���*�$��9�9�:���-L�T�-R�-R��*��;�,�,�.�.�	P�	P�K�D�%����%�%�
P��8�8��q��B�B��d�i�FW�FW��� � �!4�4�e�A�h� �O�O�O��		P�	Prcrrrrrrrrc�t�t|j��dksJ�|�|��|j���j}d|jvr|�||��|�|��|jj	j
s	|jrdS|�|��g|_
dS)zLeave module: check globals.r[�__all__N)r�r�_check_metaclasses�popr4rp�
_check_all�_check_globalsr��config�init_import�package�_check_importsr)rCr�r�s   rd�leave_modulezVariablesChecker.leave_modules����4�#�$�$��)�)�)�)�����%�%�%��'�+�+�-�-�8�����#�#��O�O�D�,�/�/�/�	
���L�)�)�)��{�!�-�	�$�,�	��F����L�)�)�)�&(��#�#�#rc�nodes.ClassDefc�V�|j�t|d����dS)z2Visit class: update consumption analysis variable.�classN�rr�r;rs  rd�visit_classdefzVariablesChecker.visit_classdef5s)������
�d�G� <� <�=�=�=�=�=rcc��|�tj��D]�}t|jtj��r�t|jjtj��rt|jjjtj��rV|jjj}|j	D]=}|j
|jvr-|�|j
|j|j
��n�>��|j	�
��dS)z2Leave class: update consumption analysis variable.N)r�r�Namerrr�r�r��	Attribute�exprrrgr4rer%)rCr�r��hidden_name_node�consumers     rd�leave_classdefzVariablesChecker.leave_classdef9s����,�,�U�Z�8�8�
	�
	�I��9�+�U�Z�8�8�
��y�/�4�e�o�F�F�
��y�/�4�9�5�:�F�F�
�
$-�#3�#8�#=� � $� 0���H�'�,��0C�C�C� �1�1�,�1�$�/�0@�0E�F������D��	
��������rc�nodes.Lambdac�V�|j�t|d����dS)z3Visit lambda: update consumption analysis variable.�lambdaNr0rs  rd�visit_lambdazVariablesChecker.visit_lambdaMs)������
�d�H� =� =�>�>�>�>�>rc�_c�8�|j���dS)z3Leave lambda: update consumption analysis variable.N�rr%�rCr=s  rd�leave_lambdazVariablesChecker.leave_lambdaQ���	
��������rc�nodes.GeneratorExpc�V�|j�t|d����dS)z4Visit genexpr: update consumption analysis variable.�
comprehensionNr0rs  rd�visit_generatorexpz#VariablesChecker.visit_generatorexpV�)������
�d�O� D� D�E�E�E�E�Ercc�8�|j���dS)z4Leave genexpr: update consumption analysis variable.Nr?r@s  rd�leave_generatorexpz#VariablesChecker.leave_generatorexpZrBrc�nodes.DictCompc�V�|j�t|d����dS)z5Visit dictcomp: update consumption analysis variable.rENr0rs  rd�visit_dictcompzVariablesChecker.visit_dictcomp_rGrcc�8�|j���dS)z5Leave dictcomp: update consumption analysis variable.Nr?r@s  rd�leave_dictcompzVariablesChecker.leave_dictcompcrBrc�
nodes.SetCompc�V�|j�t|d����dS)z4Visit setcomp: update consumption analysis variable.rENr0rs  rd�
visit_setcompzVariablesChecker.visit_setcomphrGrcc�8�|j���dS)z4Leave setcomp: update consumption analysis variable.Nr?r@s  rd�
leave_setcompzVariablesChecker.leave_setcomplrBrcr�c�6�|j�t|d����|j�d��s|j�d��sdS|���j}|���D�]\}}||vr�t|tj
��s�||d}t|tj��r|jtkr�]td�||D����r�}|j}|�||��s|�d||f|�����t%j|��rB|�|��s-|�|��s|�d||�����
dS)zFVisit function: update consumption analysis variable and check locals.�functionrrNrc3�4K�|]}t|��V��dSr�)r)r��
definitions  rdr�z5VariablesChecker.visit_functiondef.<locals>.<genexpr>�s<������;E�*�:�6�6������rcr)rr�r;r��is_message_enabledr��globalsr�rrrr�rsrmrtr�r��_is_name_ignoredr rr�_allowed_redefined_builtinr)rCr��globsrgrerW�lines       rd�visit_functiondefz"VariablesChecker.visit_functiondefqs�������
�d�J� ?� ?�@�@�@��K�*�*�+A�B�B�	��{�-�-�.A�B�B�	�
�F��	�	���#���*�*�,�,�	L�	L�J�D�$��u�}�}�Z��e�l�%C�%C�}�"�4�[��^�
��z�5�+;�<�<��"�*�f�4�4�����IN�t���������!�,���,�,�T�4�8�8���$�$�.�d�D�\��%�����
� ��&�&�
L��7�7��=�=�
L��=�=�d�C�C�
L�� � �!4�4�d� �K�K�K��;	L�	Lrcc	��|�|��|jr|�|j��|jr|jD]}|�|���|j���j}|j�d��s6|j�d��s|j�d��sdStj
|��rdS|���}|r|���rdSt|�tj����}t|�tj����}t%��}|�tj��D]=}|jD]3}	tj|	j��D]}
|�|
����4�>|���D]%\}
}|�|
||d|||���&dS)z5Leave function: check function's locals are consumed.rr&rNr)r$�type_comment_returns�_store_type_annotation_node�type_comment_argsrr%r4r�rXr�is_error�	is_method�is_abstractr�r�rr�rlr��ComprehensionScope�
generators�find_assigned_names_recursiverzr�r��_check_is_unused)rCr��argument_annotationr�rdr��nonlocal_names�comprehension_target_names�comprehension_scope�	generatorrgr�s            rd�leave_functiondefz"VariablesChecker.leave_functiondef�s:������%�%�%��$�	H��,�,�T�-F�G�G�G��!�	F�'+�'=�
F�
F�#��0�0�1D�E�E�E�E��'�+�+�-�-�8���K�*�*�+<�=�=�	��{�-�-�.H�I�I�	��{�-�-�.?�@�@�	�

�F��>�$���	��F��N�N�$�$�	��	��)�)�+�+�	��F�-�d�.A�.A�%�,�.O�.O�P�P��/��0C�0C�E�N�0S�0S�T�T��/2�u�u�"�#'�#6�#6�u�7O�#P�#P�	9�	9��0�;�
9�
9�	�!�?�	�@P�Q�Q�9�9�D�.�2�2�4�8�8�8�8�9�
9�(�-�-�/�/�	�	�K�D�%��!�!����a����*�

�
�
�
�	�	rcrr
rr�nodes.Globalc��|�d���}t|tj��r|�d|t
���dS|���}d}|���j}|j	D�]`}	|�
|��}n#tj$rg}YnwxYwtd�|�|d��D����}tj||��s8tj||��s#|r!|�d||t
�	��d
}��|D]�}	t|	tj��r(|	j|jvr|�d||���nn|	�d���|urnTt|	tjtjf��r|	j|urn#��|r |�d
||t
�	��d
}��b|r|�d|t
���dSdS)z0Check names imported exists in the global scope.Trhr�r��
confidenceNc3�bK�|]*}t|tjtjf��V��+dSr�)rrrr�rs)r��locals  rdr�z0VariablesChecker.visit_global.<locals>.<genexpr>�sJ����4�4���5�5�<��1A�"B�C�C�4�4�4�4�4�4rcrbr
�rr�rsFrrrr)r�rrrr�r rr�r�rpr�r�rn�
NotFoundErrorr�rqr�is_reassigned_after_current�is_deleted_after_currentr�rg�special_attributesr�r�r�)
rCr�r�ru�default_message�locals_rg�assign_nodes�not_defined_locally_by_import�anodes
          rd�visit_globalzVariablesChecker.visit_global�s~���
�
�$�
�'�'���e�U�\�*�*�	����5�D�T��R�R�R��F����������*�*�,�,�%���J�2	,�2	,�D�
"�%�~�~�d�3�3�����(�
"�
"�
"�!����
"����14�4�4�$�[�[��r�2�2�4�4�4�1�1�-�)�
�5�d�D�A�A�
��6�t�T�B�B�
�2�
�
� � �2���#�	!����#(���%�
,�
,���u�e�&6�7�7���
�f�&?�?�?��$�$�%8�t�$�$�O�O�O��E��;�;�d�;�+�+�v�5�5��E��u�u�~�u�7H�&I�J�J�����.�.��E��0�,��$�$�3�!�!�#'�	%����',�O���	M����/�d�t��L�L�L�L�L�	M�	Ms�
B � B4�3B4�nodes.AssignNamec��t|���tj��r|�|��dSdSr�)rrr�rr��
visit_namers  rd�visit_assignnamez!VariablesChecker.visit_assignnamesD���d�&�&�(�(�%�/�:�:�	"��O�O�D�!�!�!�!�!�	"�	"rc�
nodes.DelNamec�0�|�|��dSr�)r�rs  rd�
visit_delnamezVariablesChecker.visit_delnames����������rc�-nodes.Name | nodes.AssignName | nodes.DelNamec��|�d���}|j�0|���j�d��rJ�dS|�||��|�|��dS)z�Don't add the 'utils.only_required_for_messages' decorator here!

        It's important that all 'Name' nodes are visited, otherwise the
        'NamesConsumers' won't be correct.
        TrhNz.py)rtr�r��file�endswith�"_undefined_and_used_before_checker�
_loopvar_name)rCr�res   rdr�zVariablesChecker.visit_namesy���~�~�T�~�*�*���?�"��y�y�{�{�'�0�0��7�7�7�7�7��F��/�/��d�;�;�;����4� � � � � rcr�nodes.ExceptHandlerc�(�|jrt|jtj��sdS|jD]@\}}|jj|jkr&|�d|j|jf|���n�A|j�||jf��dS)Nrr)rgrrrr�rr r�r�)rCr��outer_except�outer_except_assign_names    rd�visit_excepthandlerz$VariablesChecker.visit_excepthandler(s����y�	�
�4�9�e�6F� G� G�	��F�6:�6V�	�	�2�L�2��y�~�!9�!>�>�>�� � �*�2�7��9P�Q��!����
��
?�	
�(�/�/��t�y�0A�B�B�B�B�Brcc��|jrt|jtj��sdS|j���dSr�)rgrrrr�rr%rs  rd�leave_excepthandlerz$VariablesChecker.leave_excepthandler8sB���y�	�
�4�9�e�6F� G� G�	��F��(�,�,�.�.�.�.�.rcr�rer�c�V�|���}t|j��dz
}|j|j}t	|dd��D]�}|j|}|�||||k��r�+|�|||||��\}}	|	r0|	|j|jz
}	|�	|j|	��|tjur��|tjurdS��|jtjjvs�t!j|j��s�|j|jjjvss|jdkr+t+d�|���D����sAt!j|t0��s%|�d|j|���dSdSdSdSdSdS)Nr[r�rc3�rK�|]2}t|tj���|���V��3dSr�)rrrr�rd�r��is  rdr�zFVariablesChecker._undefined_and_used_before_checker.<locals>.<genexpr>esQ�������!�!�U�%6�7�7���K�K�M�M������rcrr)r�r�rr8�range�_should_node_be_skipped�_check_consumerr7rgrerZr`rarr��scope_attrsrrr�r(�additional_builtinsr�r��node_ignores_exception�	NameErrorr )
rCr�rer��start_index�base_scope_typer��current_consumer�action�nodes_to_consumes
          rdr�z3VariablesChecker._undefined_and_used_before_checker>s����
�
�����$�*�+�+�a�/���*�;�7�B���{�B��+�+�	�	�A�#�/��2���+�+�D�2B�A��DT�U�U�
��'+�';�';��d�E�#3�_�(�(�$�F�$� �
O�
!�$4�$G��	�$R�R� � �1�1�$�)�=M�N�N�N��4�=�=�=���4�;�;�;����<�
�I���1�1�1����	�*�*�
2��y�D�K�.�B�B�B��	�[�(�(����!�0�0�2�2������)��.�t�Y�?�?�)�
���1��	���M�M�M�M�M�
2�1�1�1�B�B�(�(�(�(rcr7r;�is_start_indexr�c��|jdkrytj|j|��s|s|�|��rdSt|jtj��r&t|jjtj	��rdSnO|jdkr|�
||j��rdS|jdkrtj||j��rdSdS)z�Tests a consumer and node for various conditions in which the node shouldn't
        be checked for the undefined-variable and used-before-assignment checks.
        r/TrUr;F)r8r�is_ancestor_namer��_ignore_class_scoperrr�r�Keywordr��_defined_in_function_definition�is_default_argument)rCr�r7r�s    rdr�z(VariablesChecker._should_node_be_skippedns�����'�)�)��%�h�m�T�:�:�
�"�
�'+�'?�'?��'E�'E�
��t��$�+�u�}�5�5�
�*���"�E�N�;�;�
��t��
�
 �J�
.�
.�4�3W�3W��(�-�4
�4
�
.��4�
�
 �H�
,�
,��1J��(�-�2
�2
�
,��4��urcr�rzr�r�rh�=tuple[VariableVisitConsumerAction, list[nodes.NodeNG] | None]c
�"�|j|jvrVtj|j��st|tj��s#|�|��tj
dfS|�|��}|�tjdfS|sY|j|j
vrt}nt}|�d|j||���tj
|j
|jfS|�|��tj|d��}|�d���}	|	�d���}
||
uo>|
�|��o)t|
tj��o|j|
jk}|rntj|tj��rOtj|��r-|���j���|
urtj
dfS|�||||	||
||��\}}
}|rtjdfS|�rtj|���s�t;j||	d���s�|	|uo%t|tjtj f��}|s|s|
st|	tj!��r�tj"|tF��sw|j$rQt|tj%tj&tj'f��r |j|�(��j)vs|rtj|gfStjdfS�nT|dkr�|j$r&t|tj%tj&f��sjt|tj%��rtj|tj&��s1|�d|j|t���tj
|fS�n�|dkr[t|tj��rA|j|j)vr3|j*|	j*kr#|�d|j|t����nR|�+||	��r�|���j)�,|j��r$|�d|j|t���n#|�d	|j|t���tj
|fSt|	tj��r|�-||	|��St|tj.��rkt|jtj/��rL|�0||j��r1|�d	|j|tb���tj
|fStj
|fS)
z>Checks a consumer for conditions that should trigger messages.Nr�rvrTrh)r�r;r)2rgr5r�is_func_decoratorr�rrrrf�_check_late_binding_closurerZrar�r`r7rrr �
assign_parentrtr�r�r�r��Lambdar�r�r��_is_variable_violation�is_defined_beforern�
are_exclusive�DelNamer��Deleter�r�rr�r�r�r�rpr��_is_only_type_assignmentrq�_is_first_level_self_referencer��IfExp�_is_never_evaluatedr)rCr�rer�r�r�r�rs�defnode�defstmtr��is_recursive_klass�maybe_before_assign�annotation_return�use_outer_definition�defined_by_stmts                rdr�z VariablesChecker._check_consumer�s���9�(�1�1�1��&�'7�'<�=�=�
B�Z��e�.�F�F�
B��0�0��6�6�6�3�:�D�A�A�&�:�:�4�@�@����/�8�$�?�?��	��y�,�?�?�?�)�
�
�!�
����(��Y��%�	
�
�
�
�,�2� �3�D�I�>��
�
	
�(�(��.�.�.��%�k�!�n�5�5���#�#�4�#�0�0���=�=��=�-�-��
�X��
+��"�"�4�(�(�
+��8�U�^�4�4�
+��	�X�]�*�		�
�	>��5�d�E�L�I�I�	>��-�d�3�3�		>�
�:�:�<�<�&�,�,�.�.�h�>�>�(0�6��=�=�
�'�'���������	
�	
�		
��� � �	@�/�8�$�?�?�
 �b	M��+�D�1�1�b	M��)�$���H�H�b	M�&��o��*��u�}�e�&6�7�3�3�O�#�@
�"�@
�%�@
��g�u�|�4�4�	@
��3�D�)�D�D�L��:�L�&� � %�� %� 1� %�����L�!�I������);�;�;�*�R�$?�$H�4�&�#Q�Q� ;� D�d�K�K�� �H�,�,��6�
M�"�4�%�/�5�;L�)M�N�N�
M��t�U�_�5�5�	
M�
�=�d�E�DU�V�V�
M��$�$�0�!�Y�!�#'�	%����8�>��L�L�� �H�,�,��u�e�n�5�5�
��	�U�\�1�1���7�+=�=�=��$�$�0�!�Y�!�#'�	%������
*�
*�4��
9�
9�	M��z�z�|�|�"�&�&�t�y�1�1�
�� � �,�4�9�4�TX�!������ � �(�t�y�t�PT�!����0�6��D�D�
����
0�
0�	M��6�6�t�W�k�R�R�R�
����
1�
1�		M��'�.�%�+�6�6�
M��+�+�G�W�^�D�D�M��$�$�,�!�Y�!�#,�	%����8�>��L�L�+�2�K�@�@rcr	r�c��|jstj|��rdSt|��rdSt	|jtj��rt|j��rdS|j	D]�\}}|�
d��}	tt||d����}n#tj$rY�PwxYwt	|tj��s�o|�|||dd�����dS)�!Check modules attribute accesses.Nr�rr[)�_analyse_fallback_blocksr�is_from_fallback_blockrrrr�rr�rr��splitr~r�rn�ResolveErrorr��_check_module_attrs)rCr�rgr=�partsrus      rd�visit_importzVariablesChecker.visit_import`s���,�	��1M�d�1S�1S�	�
�F�!�$�'�'�	��F��d�k�5�8�,�,�	��d�k�1J�1J�	��F��z�	>�	>�G�D�!��J�J�s�O�O�E�
��0��u�Q�x�@�@�A�A�����'�
�
�
���
�����f�e�l�3�3�
���$�$�T�6�5����9�=�=�=�=�	>�	>s�#B*�*B<�;B<rfc�(�|jstj|��rdSt|��rdSt	|jtj��rt|j��rdS|j	�
d��}	|�|d��}n#tj
$rYdSwxYw|�|||dd���}|sdS|jD]6\}}|dkr�|�|||�
d�����7dS)r�Nr�rr[r�)r�rr�rrrr�rr�rrmr�rlrnror�r�)rCr��
name_partsrurgr=s      rd�visit_importfromz!VariablesChecker.visit_importfromwsC���,�	��1M�d�1S�1S�	�
�F�"�$�'�'�	��F��d�k�5�8�,�,�	��d�k�1J�1J�	��F��\�'�'��,�,�
�	��*�*�:�a�=�9�9�F�F���/�	�	�	��F�F�	�����)�)�$��
�1�2�2��G�G���	��F��z�	D�	D�G�D�!��s�{�{���$�$�T�6�4�:�:�c�?�?�C�C�C�C�	D�	Ds�?B�B.�-B.r r#r'�unbalanced_dict_unpackingr�c��|�|��t|jdtjtjf��sdS|jd���}td�|D����rdS	tj	|j
��}|�|�|||��dSdS#tj
$rYdSwxYw)z�Check unbalanced tuple unpacking for assignments and unpacking
        non-sequences as well as in case self/cls get assigned.
        rNc3�JK�|]}t|tj��V��dSr�rr
s  rdr�z0VariablesChecker.visit_assign.<locals>.<genexpr>�s.����G�G�V�z�&�%�-�0�0�G�G�G�G�G�Grc)�_check_self_cls_assignrrryrr0r+�iteredr�rr�r��_check_unpackingrn�InferenceError)rCr�ryr�s    rd�visit_assignzVariablesChecker.visit_assign�s���	
�#�#�D�)�)�)��$�,�q�/�E�K���+D�E�E�	��F��,�q�/�(�(�*�*���G�G�w�G�G�G�G�G�	��F�	��'��
�3�3�H��#��%�%�h��g�>�>�>�>�>�$�#���%�	�	�	��F�F�	���s�2B:�:C
�C
�nodes.ListCompc�V�|j�t|d����dS)z5Visit listcomp: update consumption analysis variable.rENr0rs  rd�visit_listcompzVariablesChecker.visit_listcomp�rGrcc�8�|j���dS)z5Leave listcomp: update consumption analysis variable.Nr?r@s  rd�leave_listcompzVariablesChecker.leave_listcomp�rBrcc�0�|�|��dSr�rrs  rd�leave_assignzVariablesChecker.leave_assign�rrc�
nodes.Withc�0�|�|��dSr�rrs  rd�
leave_withzVariablesChecker.leave_with�rrc�nodes.Argumentsc�D�|jD]}|�|���dSr�)rbra)rCr��
annotations   rd�visit_argumentsz VariablesChecker.visit_arguments�s5���0�	9�	9�J��,�,�Z�8�8�8�8�	9�	9rcc�>�t|jjj��Sr�)r�r�r(�analyse_fallback_blocksrXs rdr�z)VariablesChecker._analyse_fallback_blocks�s���D�K�&�>�?�?�?rc�
Iterable[str]c�$�|jjjSr�)r�r(�ignored_modulesrXs rd�_ignored_modulesz!VariablesChecker._ignored_modules�s���{�!�1�1rcc�>�t|jjj��Sr�)r�r�r(�allow_global_unused_variablesrXs rd�_allow_global_unused_variablesz/VariablesChecker._allow_global_unused_variables�s���D�K�&�D�E�E�Ercc���d}t|tj��r�|�d���|ur�||jjvp7||jjvp)||jjvp||jjup
||jj	upd|j�
|��pJ|jo|j�
|��p)|jo"||jup|j�
|��}|S)NFTrh)
rrrr�rtrr�posonlyargs_annotations�kwonlyargs_annotations�varargannotation�kwargannotationr��
decorators�returns)r�r��%in_annotation_or_default_or_decorators   rdr�z0VariablesChecker._defined_in_function_definition�s��16�-��u�e�/�0�0�	����d��+�+�u�4�4��E�J�2�2�:��u�z�A�A�:��u�z�@�@�:��u�z�:�:�:��u�z�9�9���:�'�'��-�-���$�I��)9�)C�)C�D�)I�)I���M�Q����.�O�%�-�2I�2I�$�2O�2O�
2�5�4rcc�6�|}|j}|��||urdSt|tj��r||jurdSt|tj��r||jurdSt|tj��r|jr||jdusdS|}|j}|��dS)z�Return True if node within a lambda/comprehension body (or similar) and thus
        should not have access to class attributes in frame.
        NFTr)	r�rrrr�r�
Comprehensionr�rfrg)r�r�rnr�s    rd� _in_lambda_or_comprehension_bodyz1VariablesChecker._in_lambda_or_comprehension_body�s��������� ������u��&�%�,�/�/�
�E���4L�4L��t��&�%�"5�6�6�
�5���;S�;S��t��&�%�":�;�;�
��!�
�&+�v�/@��/C�&C�&C��t��E��]�F�!� �"�urcr�r�r�r�r��tuple[bool, bool, bool]c��
���d}d}	d}
||urt�||��}�n"|j�0�j|jvst	j�j��drd}n�t
|tj��p-t
��	d���tj
��ot���}|sV|����
�j��dr$d}||kot
�tj��}
n<�j|jvr.t!�fd�|���D����}|dkrtt
|tj��rZ�j|jvrLt
�tj��o.��jvo%|j�jdj|jk}�n�t
|tj��r�t
|tj��r��|jurZ|�|j��r@d}	|jj|jvr)|j�jdj|jkrd}nd}t
�jtj��r|j|jk}�n�|rd}�n�|o|j|jk}|�r�|j|jk�r�t
|tj��r!||ur|����r||urd}�n_t
|t2��r;t4�|��r!||ur|����r||urd}�nt
�tj��r�||ur�|�|��r�||ur؉j�jkr�j�jks��j�jksrt<s��j�jkr�t
|tjtj tj!tj"f��rUt
|j#tj$��r6�j#�up,t!�fd���%��D����}t
|tj&tj'f��r�t
|jtj(��r�tS|��r�tS���s�|j}tUj+�tj ��}
|
rtUj+|
tj��su|����}|s^|�,��r&tUj-�j|j.d��}n t!�fd	�|j.D����}|sd}||	|
fS)
NTFr[rhc3�h�K�|],}t|tj��o
�j|jvV��-dSr�rkrms  �rdr�z:VariablesChecker._is_variable_violation.<locals>.<genexpr>.sQ�����.�.���u�e�n�5�5�R�$�)�u�{�:R�.�.�.�.�.�.rcr;rc3�*�K�|]
}|�juV��dSr�)r�)r��ancr�s  �rdr�z:VariablesChecker._is_variable_violation.<locals>.<genexpr>�sC�����G�G�14��w�}�,�G�G�G�G�G�Grcc3�L�K�|]}tj�j|��V��dSr�)r�
is_definedrg)r��contentr�s  �rdr�z:VariablesChecker._is_variable_violation.<locals>.<genexpr>�sF�����5�5�$+�!&� 0���G� D� D�5�5�5�5�5�5rc)/r�r�rgr�rn�builtin_lookuprrrr�r�r�r�r��lookupr�rpr�r{r�r��defaultsr�r�r�r��NODES_WITH_VALUE_ATTRr|� _maybe_used_and_assigned_at_oncer��
col_offsetrr�r�r�r�r��	JoinedStrr�r�rsr�rrr��has_elif_blockr�r�)r�r�rer�r�r�r�r�r�r�r��
forbid_lookup�defstmt_parent�maybe_annotation�used_in_branch�defined_in_or_elses``              rdr�z'VariablesChecker._is_variable_violations0����#��!��$���� � �"6�t�U�H�"M�"M���
�_�
$��	�X�1�1�1��)�$�)�4�4�Q�7�2�',�#���5�%�"3�4�4�E��d�j�j��j�5�5�u�|�D�D�*�$�D�)�)�
�!�

�X�]�]�_�_�%;�%;�D�I�%F�%F�q�%I�

�&+�#�'+�w��(�z��U�0�@�@�<�$�$���h�o�-�-�*-�.�.�.�.�!)�!6�!6�!8�!8�.�.�.�+�+�'�#�
�x�'�'��5�%�.�1�1�
(��	�U�\�)�)��7�E�O�4�4�O��G�,�,�O��L���+�A�.�9�G�<N�N�#���
��%�.�
1�
1�x	7�j��5�$�7
�7
�x	7�
�u�}�$�$��);�);�E�M�)J�)J�$�$(�!��M�&�(�/�9�9� ���	�2�1�5�<�u�|�K�K�+0�'�'�*.�'��$�+�u��7�7�
L�&*�o��9K�&K�#��
�f	7�"&���$�M���7�;M�(M�
 �#�<
�t��'�:L�'L�'L��x��):�;�;�;���)�)� �*�*�4�0�0�*��G�+�+�+0�'�'��w�(=�>�>�2�(�I�I�'�R�R�2���)�)� �*�*�4�0�0�*�����
+0�'�'�������'���)�)� �*�*�4�0�0�*�����$�N�d�k�9�9� '� 2�T�_� D� D�#�N�T�[�8�8�
!*�9�!(��$�+� =� =� *� '�$)�L�$)�O�$)�O�$)�L�	!"�!�!�!>�!+�7�=�%�/� J� J�!>�&+2�-�4�*?�+�3�G�G�G�G�8<�8K�8K�8M�8M�G�G�G�D�D�'��7�U�\�5�3C�$D�E�E� 
7��w�~�u�x�8�8� 
7�+�7�3�3� 
7�/�t�4�4�	 
7�")���#(�#H��%�/�$�$� �%�7��=�(�%�*;���7�&4�%=�%=�d�%C�%C�N�)�7�)�8�8�:�:��16�1A� $�	�>�+@��+C�2�2�.�.�25�5�5�5�5�/=�/D�5�5�5�2�2�.�
 2�7�26�/�"�$5�7K�K�Krcc��t|tj��rtd�|jD����St|tj��rdSt|jtj��r#td�|jjD����S|j}t|tj��rdSt|tj	��r!t|j
tj��rdSt|tj��r td�|jD����rdSt|tj
��sdStd�|�tj
���D����S)zeCheck if `defstmt` has the potential to use and assign a name in the
        same statement.
        c3�$K�|]}|jV��dSr�)�guard)r��cases  rdr�zDVariablesChecker._maybe_used_and_assigned_at_once.<locals>.<genexpr>�s$����<�<�d�t�z�<�<�<�<�<�<rcTc3�K�|]L}t|ttjtjfz���0t
�|��V��MdSr�)rrrrr��Matchr|r�r�r�s  rdr�zDVariablesChecker._maybe_used_and_assigned_at_once.<locals>.<genexpr>�sc��������c�#8�E�K���;U�#U�V�V�� �A�A�#�F�F������rcc3�K�|]D}t|dtj��pt|dtj��V��EdS)rr[N�rrrr�)r��items  rdr�zDVariablesChecker._maybe_used_and_assigned_at_once.<locals>.<genexpr>�s[����1
�1
��
�t�A�w���,�,�P�
�4��7�E�K�0P�0P�1
�1
�1
�1
�1
�1
rcFc3�K�|]�}td�|jD����p`td�|jD����pBt|jt
j��o#t|jjt
j��V���dS)c3�TK�|]#}t|jtj��V��$dSr�)rrr�rr�)r��kwargs  rdr�zNVariablesChecker._maybe_used_and_assigned_at_once.<locals>.<genexpr>.<genexpr>�s0����P�P��
�5�;���4�4�P�P�P�P�P�Prcc3�JK�|]}t|tj��V��dSr�r)r��args  rdr�zNVariablesChecker._maybe_used_and_assigned_at_once.<locals>.<genexpr>.<genexpr>�s.����E�E�C�:�c�5�;�/�/�E�E�E�E�E�ErcN)	r��keywordsrrrr�rr4r5r�)r�r�s  rdr�zDVariablesChecker._maybe_used_and_assigned_at_once.<locals>.<genexpr>�s�����
�
��

�P�P�$�-�P�P�P�P�P�
��E�E�4�9�E�E�E�E�E�
��4�9�e�o�6�6�<��t�y�~�u�{�;�;�
�
�
�
�
�
rc)ry)rrrrr��casesr�r��
BaseContainerr	r�r�r*r�r�r�)r�r�s  rdrz1VariablesChecker._maybe_used_and_assigned_at_once�s���
�g�u�{�+�+�	=��<�<�g�m�<�<�<�<�<�<��g�u�{�+�+�	��4��g�m�U�%8�9�9�	����"�=�-������
�
�
���e�U�[�)�)�	��4��e�U�\�*�*�	�z�%�*�e�k�/R�/R�	��4��e�U�Z�(�(�	�S�1
�1
���1
�1
�1
�.
�.
�	��4��%���,�,�	��5��
�
��,�,�5�:�,�>�>�
�
�
�
�
�	
rcc���	�t|tj��r|jrdS�j|jjjvstj	�j��rdS|�
d���}��
d���}�}||ju�rv|���}|�
tj��D]z}||ur�t�fd�|�
tj��D����r;t�fd�|�
tj��D����rdS�{|j��jg��}|D]��	||kr�	j�jkrn{t�	jtj��r�	jjrOt�	jtj��r-t�	fd�����D����sdS��|j}||ju��vdS)z>Check if variable only gets assigned a type and never a value.FTrhc3�4�K�|]}�j|jvV��dSr�)rgr�)r��nlr�s  �rdr�z<VariablesChecker._is_only_type_assignment.<locals>.<genexpr>	s@���������I���)������rcc3�8�K�|]}�j|jkV��dSr�r�)r��anr�s  �rdr�z<VariablesChecker._is_only_type_assignment.<locals>.<genexpr>	s@���������I���(������rcc3�4�K�|]}|�jjuV��dSr�)r�r�)r�r��ref_nodes  �rdr�z<VariablesChecker._is_only_type_assignment.<locals>.<genexpr>	s>�������9<��x��4�4������rc)rrrr�r�rgr�r(r�rrr�r�r�r�r�r�rlr�rprqr�r�r�)
rCr�r��
defstmt_frame�
node_framer�r��
inner_func�
local_refsr%s
 `       @rdr�z)VariablesChecker._is_only_type_assignment�sg�����'�5�?�3�3�	�w�}�	��5��9���*�>�>�>�%�BR��I�C
�C
�>��5��
�
�T�
�2�2�
��Z�Z�t�Z�,�,�
����M�0�0�0�!�<�<�>�>�L�+�9�9�%�:K�L�L�

!�

!�
���-�-�������(�7�7���G�G������!������(�7�7��8H�I�I������!�!�5�5��%�,�0�0���B�?�?�J�&�
!�
!��!�J�.�.�8�?�T�[�3P�3P��E�#�8�?�E�O�D�D�!���,�!��x����@�@�!������@D�@S�@S�@U�@U������!�!�5�5��!�(�F�W�M�0�0�0�X�trcr�r`c���|�d���j|kr�|�d���|�d���kr�tj|��r0tj|��stjdfStjdfSt|jtj��r2t|jjtj��rtjdfStj|fS)z�Check if a first level method's annotation or default values
        refers to its own class, and return a consumer action.
        TrhN)
r�r�rtr�"is_node_in_type_annotation_contextrrZr`rarrrr�r�)r�r�r�s   rdr�z/VariablesChecker._is_first_level_self_reference'	s����:�:�T�:�"�"�)�W�4�4�����:H�:
�:
�
�Z�Z�t�Z�
$�
$�:%�:%�
�7��=�=�
B��<�T�B�B�H�7�@�$�G�G�3�:�D�A�A��$�+�u�z�2�2�
D�z���"�E�O�8�8�
D�4�<�d�C�C�+�2�K�@�@rc�nodes.NamedExpr�defnode_parent�nodes.IfExpc���tj|j��}t|tj��r,|jdur
||jkrdS|jdur
||jkrdSdS)z`Check if a NamedExpr is inside a side of if ... else that never
        gets evaluated.
        TF)	rr�r�rrrr�r�r�r�)r�r-�
inferred_tests   rdr�z$VariablesChecker._is_never_evaluated>	sp���(��)<�=�=�
��m�U�[�1�1�	��"�d�*�*�w�.�:O�/O�/O��t��"�e�+�+��>�;N�0N�0N��t��urcc�z�|j}|�d������}|�||��}t	j||��}|s|r|j���j}n|j}t|tj
��s|o|�||��o||vS)aReturn True if the node is in a local class scope, as an assignment.

        Detect if we are in a local class scope, as an assignment.
        For example, the following is fair game.

        class A:
           b = 1
           c = lambda b=b: b * b

        class B:
           tp = 1
           def func(self, arg: tp):
               ...
        class C:
           tp = 2
           def func(self, arg=tp):
               ...
        class C:
           class Tp:
               pass
           class D(Tp):
               ...
        Trh)rgrtr�r�rr�r�rprrrr�r�)rCr�rgr�r��in_ancestor_list�frame_localss       rdr�z$VariablesChecker._ignore_class_scopeM	s���0�y�����d��+�+�1�1�3�3��04�0T�0T��%�1
�1
�-�!�1�%��>�>��0�	(�4D�	(� �<�-�-�/�/�6�L�L� �<�L�
��u�~�
.�
.�
W�2W�
%��9�9�$��F�F�F�
%���$�
�	
rc�astroid.Namec	���d�|�|j��dD��}|����t�tj��rt
�fd�|D����rdS|r�|dj|d���kr |dj�	|��sa|dj
sTt|djtj��s2|d�d����	|��rg}n
|dd�}t|dd���D]y\}}||�d����	|��r0tj||�d���|��s�d|�|���z|}t#|��dkrdS|d���}t|tjtjtjf��r,|�d���|�d���usdSt|tj��s|�d|j|���dS|jD�]K}t|tjtjtjtjf��rdSt|tj��r�t|jtj��r�tj|jj ��}t|tj!��r�|j"r�tj|j"��}	t|	tj!��r)|	�#��htH�tJ�d	�vrdSt|	tLj'��r|	�#��d	krdS��Mtj(|tj)��}
|
rntj(|
tj��}|rMtj(|tj*��}|�n+|j����ur|j|j+vrdS	tY|j-�.����}
t|
t^j'��r�|
�#��d
krx|j-}t|j-tj0��r|j-j1}t|tj��r,tY|j2d�.����}
t|
t^j'��r|
�#��tfkrdStj4tj5tj6tj7t^j8j9f}t|
|��s|�d|j|���dStu|
dtu|
dg����}|s|�d|j|���dSdS#t^j;$r!|�d|j|���YdSwxYw)
Nc�2�g|]}t|d���|��S)r�)�hasattr)r��ss  rdrKz2VariablesChecker._loopvar_name.<locals>.<listcomp>x	s'��T�T�T��'�!�]�:S�:S�T�!�T�T�Trcr[c3�f�K�|]+}|�������V��,dSr�)r�r�)r��asmtr�s  �rdr�z1VariablesChecker._loopvar_name.<locals>.<genexpr>�	sJ�����3
�3
�.2�D�J�J�L�L�"�"�5�)�)�3
�3
�3
�3
�3
�3
rcrTrhrrztyping._SpecialFormzbuiltins.enumerater	r�)<rrgr�rrrr�r�r�r�r��is_statementr�rt�	enumerater�in_for_else_branchr�r�r�r�r��GeneratorExpr r�r�r�r�r�r�r�r�r�r�r�r��qnamerrr
�Instancer�r�rfrpr~r�r�rnr�r�r�
BUILTIN_RANGEr+r0r*r)rrBr�r�)rCr��astmts�_astmtsr�re�assign�	else_stmt�
inferred_func�inferred_return�maybe_walrus�maybe_comprehensionrmr��likely_call�	sequences�elementsr�s                 @rdr�zVariablesChecker._loopvar_namev	sW���T�T�T�[�[���3�3�A�6�T�T�T��
�
�
�����e�U�\�*�*�	�s�3
�3
�3
�3
�6<�3
�3
�3
�0
�0
�	�
�F��	!��q�	� �F�1�I�N�N�$4�$4�4�4��1�I�$�.�.�t�4�4�5��q�	�&�	5�
"�&��)�"2�E�L�A�A�5��1�I�'�'�t�'�4�4�>�>�t�D�D�
5��G�G��R�a�R�j�G� ������,�,�	!�	!�G�A�t��a�y�"�"�$�"�/�/�9�9����
��.�v�a�y�/B�/B�$�/B�/O�/O�QU�V�V�
���N�N�4� � � � ����v�;�;�!����F����&�&�(�(���v��	�5�+>��@R�S�T�T�	�� � �� �-�-�T�^�^�4�^�5P�5P�P�P��F��&�%�)�,�,�	����6�T�Y�T��R�R�R��F���	�	�I���E�L�%�+�u�{�E�N�S���
�����)�U�Z�0�0�
�Z�����6�6�
�!&� 0���1E� F� F�
��}�e�.?�@�@��%�-��',�&6�}�7L�&M�&M�O�!�'��):����)�/�/�1�1�6�(�6�%�6�.�6���
���#�?�E�N�C�C��+�1�1�3�3�7L�L�L������<�T�5�?�S�S���	�"'�"G��e�1�#�#��#�
�&+�&K�'��)A�'�'�#�'�.��'�.�4�4�6�6�%�?�?��	�%8�%?�?�?��F�$	W��F�K�-�-�/�/�0�0�H��8�W�%5�6�6�
A��N�N�$�$�(<�<�<�$�k���f�k�5�;�7�7�3�"(�+�"2�K��k�5�:�6�6�A�#�K�$4�Q�$7�$=�$=�$?�$?�@�@�H�
�8�W�%5�6�6�
��N�N�$�$�
�5�5����
����
��	���)��I��h�	�2�2�
�� � �!:���QU� �V�V�V����x����7�B�1O�1O�P�P�H��
W�� � �!:���QU� �V�V�V�V�V�
W�
W��/�%�	S�	S�	S����6�T�Y�T��R�R�R�R�R�R�	S���s�.CX'�',Y�Yrgr�r�rkrlc�"��|�|���rdSt|tj��rQ�dkrKt	|jd��dkr-t|jddtj��rdSt|tjtjtj	f��r|rt||��rdS�|vrdS�|jvrdS|���}�|vrg|j
dkrAd}|j���D]!}	t!|	d��o
|	j
dk}|rn�"|rdS|��||||��dS|jrGt|jtjtjtjtjf��r�|vrdSdx}
}t|tjtj	f��rRt	|j��dkr"t/�fd�|jD��d��}n
|jd}|r	|\}
}|p|
�t1||�����rd	}
n�t|tj��r)|�|
�d
|��}nd���}|�d||�
��dSt|tj	��r8|�|
�d|j�d|��}n��d|j��}|�d||�
��dSd}
t|tj��r	|jrdSt;j|��rdSt|jtj��r?tA�fd�|j�!tj"��D����rdS|�|
�|�
��dS)Nrr[r�__new__FrgrDc3�$�K�|]
}�|v�|V��dSr�rb)r�r�rgs  �rdr�z4VariablesChecker._check_is_unused.<locals>.<genexpr>D
s'�����H�H�5�$�%�-�-��-�-�-�-�H�Hrcr&�
 imported as �import rr� imported from � as rc3�.�K�|]}|j�kV��dSr�r�)r�rcrgs  �rdr�z4VariablesChecker._check_is_unused.<locals>.<genexpr>g
sB�����D�D�#$���$��D�D�D�D�D�Drc)#rZrrrr�r�rpr�r�r�rsr�r�argnamesrgr�r{r7�_check_unused_argumentsr�r�r0r�r�r~r�r�r rmr�r�is_overload_stubrur�r�r3)rCrgr�rer�rkrlrU�is_init_defrcr?r��import_names�message_name�msgs `             rdriz!VariablesChecker._check_is_unused
s%���� � ��t�,�,�	��F�
�t�U�.�/�/�	���#�#��D�K��,�-�-��2�2��4�;�{�3�A�6���G�G�3�
�F��d�U�\�5�<��9I�J�K�K�	��
� 6�t�\� J� J�
����-�-�-��F��4�.�.�.��F��=�=�?�?���8����y�I�%�%�#����1�1�3�3���A�")�!�V�"4�"4�"O�!�&�J�:N�K�"��������F��(�(��t�T�8�^�T�T�T�T�T��{�
�z���e�l�E�O�U�[�%�)�T� � �
��>�)�)��F�!�!�E�F��$���u�/?� @�A�A�

+��t�z�?�?�Q�&�&�#'�H�H�H�H�D�J�H�H�H�$�$�$�L�L�$(�:�a�=�L��+�$0�M�E�6�!�?�U�D�*�4������>�>�
1�9����d�E�L�1�1���)�!&�=�=�V�=�=���.��.�.���$�$�_�3�T�$�J�J�J��F��d�E�$4�5�5���)�!&�Q�Q�t�|�Q�Q��Q�Q���!%�D�D�d�l�D�D���$�$�_�3�T�$�J�J�J��F�0���$�� 1�2�2�
�t��
����%�d�+�+�
����$�+�u�':�;�;�
��D�D�D�D�(,��(B�(B�5�:�(N�(N�D�D�D�A�A�
������\��4��@�@�@�@�@rc�&re.Pattern[str] | re.Match[str] | Nonec� �|jjj}t|tj��rt|jtj��st|tj��r|jjj}n|}|o|�	|��Sr�)
r�r(�dummy_variables_rgxrrrr�r�r��ignored_argument_names�match)rCrerg�authorized_rgx�regexs     rdrZz!VariablesChecker._is_name_ignoredn
s�����+�?���t�U�-�.�.�	#��4�;���8�8�	#��$���0�0�	#�
&*�[�%7�%N�E�E�"�E��*����T�*�*�*rcrU�	list[str]c��������}�j�d���}|r=t|tj��r#t
j|��rtnt}nt}|rf�jdkr||dkrdSt|�j
��}	|	�||	���vrdS�j
tjvr�j
dvrdSt!�fd�|jjjD����rdSt
j���rdSt
j���rdSt
j|��rdS||vrdS|�d|||���dS)	NTrhr�r)rDrNc3��K�|]8}�j�|��p�j�|��V��9dSr�)rgr�r�)r��cbr�s  �rdr�z;VariablesChecker._check_unused_arguments.<locals>.<genexpr>�
s\�����
�
��
�I� � ��$�$�>��	�(:�(:�2�(>�(>�
�
�
�
�
�
rcrrv)rdr�r�rrrr�r�has_known_basesrrrr�r�rgrU�	PYMETHODSr�r�r(r��(is_registered_in_singledispatch_functionrW�is_protocol_classr )
rCrgr�rerUrkrdryrs�
overriddens
  `       rdrVz(VariablesChecker._check_unused_arguments
s�����N�N�$�$�	���!�!��!�.�.���	��E�5�>�:�:�	�"�2�5�9�9�P�	�	�?P�
�J��J��	��y�N�*�*�t�x��{�/B�/B���*�5�$�)�<�<�J��%�$�*�2E�2E�2G�2G�*G�*G����y�E�O�+�+��	�B�1�1����
�
�
�
��k�(�2�
�
�
�
�
�	�
�F��9�$�?�?�	��F��!�$�'�'�	��F��"�5�)�)�	��F��>�!�!��F����*��D�Z��X�X�X�X�Xrcc��|j�d��sdS|�d���}tj||��r|j�d���}t
|tjtj	f��r|j
|jvrdS|�|j
��\}}|r|�
|��sdStj|��r|�d||j
���dS|d}|}|rCt
|tj��s)||urdS|j}|rt
|tj���)|r}|�
|��rjtj|��sX|jrSt
|�d���tj��s'|�d||j
���dSdSdSdSdSdS)a:Check whether node is a cell var that is assigned within a containing loop.

        Special cases where we don't care about the error:
        1. When the node's function is immediately called, e.g. (lambda: i)()
        2. When the node's function is returned from within the loop, e.g. return lambda: i
        r%NTrh�r�rr)r�rXr�rr�r�rrrr�r�rgrprr��is_comprehensionr r��is_being_calledrtr�)rCr��
node_scope�assign_scoper��assignment_node�	maybe_fors       rdr�z,VariablesChecker._check_late_binding_closure�
s>���{�-�-�.B�C�C�	��F��Z�Z�t�Z�,�,�
��$�T�:�6�6�	>�#�*�0�0��0�=�=�J��:���e�6G�'H�I�I�	��y�J�-�-�-��F�"�k�k�$�)�4�4���e��	�L�2�2�:�>�>�	��F��!�,�/�/�	V����1��4�9��M�M�M�M�M�$�A�h�O�'�I��
V�J�y�%�)�$D�$D�
V���,�,��E�%�,�	��
V�J�y�%�)�$D�$D�
V��V�!�+�+�J�7�7�V�"�1�*�=�=�V�#�)�	V�
'�z�';�';�4�';�'H�'H�%�,�W�W�V��$�$�%9��4�9�$�U�U�U�U�U�V�V�V�V�V�V�V�V�V�Vrcc�j�t|tj��sdS|j|jjjvSr�)rrrrsrmr�r(�redefining_builtins_modules)rCres  rdrz1VariablesChecker._should_ignore_redefined_builtin�
s1���$�� 0�1�1�	��5��|�t�{�1�M�M�Mrcc�(�||jjjvSr�)r�r(�allowed_redefined_builtins)rCrgs  rdr[z+VariablesChecker._allowed_redefined_builtin�
s���t�{�)�D�D�Drcc��tj|tj��}|duo(|�d����|��S)z]Return True if a ComprehensionScope intervenes between `node` and its
        frame.
        NTrh)rr�rrfr�r�)r��closest_comprehension_scopes  rdr}z6VariablesChecker._comprehension_between_frame_and_node�
sZ��
',�&K��%�*�'
�'
�#�+�$�6�1�4�:�:��<F�<
�<
�
�)�/�
0�
0�	1rc�type_annotationc��t|tj��r!|j�|j��dSt|tj��r|�|j��dSt|tj	��sdSt|j
tj��r_t|j
jtj��r;|j
jjtkr!|j�t��dS|j�d�|�
tj��D����dS)z?Given a type annotation, store all the name nodes it refers to.Nc3�$K�|]}|jV��dSr�r�)r�r�s  rdr�z?VariablesChecker._store_type_annotation_node.<locals>.<genexpr>s5����+
�+
� *�J�O�+
�+
�+
�+
�+
�+
rc)rrrr3rr�rgr4rar5�	Subscriptr��
TYPING_MODULE�extendr�)rCrzs  rdraz,VariablesChecker._store_type_annotation_node�
s4���o�u�z�2�2�	��'�.�.��/C�D�D�D��F��o�u��7�7�	��,�,�_�-A�B�B�B��F��/�5�?�;�;�	��F�
��,�e�o�>�>�	��?�0�5�u�z�B�B�	� �%�*�/�=�@�@��'�.�.�}�=�=�=��F��#�*�*�+
�+
�.=�.L�.L�U�Z�.X�.X�+
�+
�+
�	
�	
�	
�	
�	
rc�%nodes.For | nodes.Assign | nodes.Withc�P�|j}|sdS|�|j��dSr�)rzra)rCr�rzs   rdrz-VariablesChecker._store_type_annotation_namess6���.���	��F��(�(��)=�>�>�>�>�>rcc���t��}|jD]u}t|tj��r|�|j���7t|tj��r$|�d�|j	D�����v|�
��}td�|jD����}|r+|�
��j
�
��}t|tj��r*|���rd|���vsdS|���}|sdS|d}||vr|�d||f���dSdS)z'Check that self/cls don't get assigned.c3�XK�|]%}t|tj���|jV��&dSr�)rrrr�rgrs  rdr�z:VariablesChecker._check_self_cls_assign.<locals>.<genexpr>"sJ����$�$�!$�z�#�u�GW�7X�7X�$��H�$�$�$�$�$�$rcc3�NK�|] }t|tj���|V��!dSr�)rrrrl)r�rns  rdr�z:VariablesChecker._check_self_cls_assign.<locals>.<genexpr>&sG����'
�'
��Z��u�~�-N�-N�'
��'
�'
�'
�'
�'
�'
rczbuiltins.staticmethodNrr'rm)r�ryrrrr�r�rgr0�updater	r�r�r�r�r�rd�decoratornamesrUr )rCr��assign_namesrzr��nonlocals_with_same_name�argument_names�
self_cls_names        rdr�z'VariablesChecker._check_self_cls_assigns���(+�����l�	�	�F��&�%�"2�3�3�
�� � ���-�-�-�-��F�E�K�0�0�
��#�#�$�$�(.��$�$�$������
�
����#&�'
�'
�$�z�'
�'
�'
�$
�$
� �$�	0��J�J�L�L�'�-�-�/�/�E�
�u�e�/�0�0�	����!�!�	�(�u�/C�/C�/E�/E�E�E��F����)�)���	��F�&�q�)�
��L�(�(����2��]�DT��U�U�U�U�U�)�(rcr�rryc�j�tj|��rdStj|��rdSt|tj��rdSt|jtj��r;t|j	tj
��r|j	j|jjkrdS|�
|��}t||��}|�=t|��t|��kr|�|||||��dSdStj|��s|�||��dSdS)zRCheck for unbalanced tuple unpacking
        and unpacking non sequences.
        N)r�is_inside_abstract_classrnrrr�UninferableBaser�rr�r�r3rg�varargrr�r�r�is_iterable�_report_unpacking_non_sequence)rCr�r�ryr�rs      rdr�z!VariablesChecker._check_unpacking9sH���)�$�/�/�	��F��!�$�'�'�	��F��h�� 4�5�5�	��F��x����8�8�	��4�:�u�z�2�2�	��
��8�?�#9�9�9�
�F��&�&�x�0�0��+�D�(�;�;�����7�|�|�s�6�{�{�*�*��1�1��(�G�V�W������+�*�
�"�8�,�,�	?��/�/��g�>�>�>�>�>�	?�	?rcrfc�P�t|tjtjftz��r|���St|tj��rItd�|�	��D����rd�|�
��D��SdS)z/Return the list of values of the `Assign` node.c3�FK�|]}|���dkV��dS)ztyping.NamedTupleN)r?)r�r�s  rdr�z4VariablesChecker._nodes_to_unpack.<locals>.<genexpr>_sC����6
�6
�8@�H�N�N��� 3�3�6
�6
�6
�6
�6
�6
rcc�F�g|]}t|tj���|��Srb)rrrr�r�s  rdrKz5VariablesChecker._nodes_to_unpack.<locals>.<listcomp>bs*��P�P�P�!�
�1�e�>N�0O�0O�P�A�P�P�PrcN)rrrr0r+r�r�rnr@r��	ancestorsr�)r�s rdrz!VariablesChecker._nodes_to_unpackZs����d�U�[�%�*�5�
�B�C�C�	!��;�;�=�=� ��d�G�,�-�-�	Q�#�6
�6
�DH�N�N�DT�DT�6
�6
�6
�3
�3
�	Q�Q�P�t�{�{�}�}�P�P�P�P��trcr�rc�
�|t|��t|��dkrdndt|��t|��dkrdndf}t|t��rdnd}|�|||t���dS)Nr[r�r8r)r )r�rrs)r�rrr�r r)rCr�r�ryr�rr�symbols        rdrz-VariablesChecker._report_unbalanced_unpackinges���
���L�L��g�,�,�!�#�#�B�B����K�K��f�+�+��"�"�B�B��
���(�J�/�/�
.�'�'�-�	�
	
����d��)��L�L�L�L�Lrcc�n�|r|�d��sd|��}|�d||���dS)N� r#rm)r�r )rCr�rs   rdr�z/VariablesChecker._report_unpacking_non_sequence|sL���	$�7�-�-�c�2�2�	$�#�'�m�m�G����1��7��K�K�K�K�Krc�_base_nodes.ImportNoderu�module_names�nodes.Module | Nonec�X�|r�|�d��}|dkrd}n�	t|�|��d�����}t	|t
j��sdSnW#tj$r4|j	|j
vrYdS|�d||j	f|���YdStj$rYdSwxYw|��|r:|r|j	nd}|�d|d�
|��|f���dSt	|t
j��r|SdS)z�Check that module_names (list of string) are accessible through the
        given module, if the latest access name corresponds to a module, return it.
        r�__dict__Nr	rr�rm)r%r~r�r�rrrr�rnrwrgr�r r�rP)rCr�rur�rgrms      rdr�z$VariablesChecker._check_module_attrs�s����	��#�#�A�&�&�D��z�!�!����
��f�n�n�T�2�2�1�5�;�;�=�=�>�>��!�&�%�,�7�7� ��4� ���(�
�
�
��;�$�"7�7�7��4�4�� � �'�t�V�[�.A��!�����t�t��)�
�
�
��t�t�
����!�	�$�	�%+�;�f�k�k��G����#�$�c�h�h�|�6L�6L�g�5V�
�
�
�
��4��f�e�l�+�+�	��M��ts�AA9�9C
�C
�;C
�C
r�r�c��t|�d����}t|tj��rdS|���dvr)|j|j}}|�d|||���dSt|dd��D�]�}	t|�
����}n#tj$rY�7wxYwt|tj��r�V|j
s�^t|tj��rt|jt"��s+|�d|���|�����|j}||vr||=��||jvr�|js|�d	|f|�����t*j�|j��d
}t*j�|��dkrx|jdz|z}		tj�|	�d�������#t<$r|�d	|f|���Y���t>$rY���wxYw���dS)
Nr#>�
builtins.list�builtins.tupler)r]rr�r	rbrrrrrDr�) r~�igetattrrrrr��pytype�tolinenorr r�r�rnr�r�rr�r�rhr�rpr*�os�path�splitextr��basenamerg�modutils�file_from_modpathr��ImportError�SyntaxError)
rCr�r��assignedr]�colr��elt_namer�rgs
          rdr&zVariablesChecker._check_all�s�����
�
�i�0�0�1�1���h�� 4�5�5�	��F��?�?���$G�G�G� �)�8�+>�#�D����1���SW��X�X�X��F��8�V�R�0�0�)	!�)	!�C�
���	�	���,�,�����)�
�
�
���
�����(�D�$8�9�9�
���?�
���h���4�4�
�J����=�=�
�� � �!5�C�M�M�O�O�RU� �V�V�V���~�H��<�'�'� ��*���t�{�*�*��|�!��$�$�0��{��%����� "�w�/�/��	�:�:�1�=�H��w�'�'��1�1�Z�?�?�#�y�3���9��
!�#�,�>�>�t�z�z�#���O�O�O�O��*���� �,�,� 8��{�QT�-������ +�!�!�!�!�D�	!�����K)	!�)	!s*�!B5�5C�C� 2H�#I�:	I�I�dict[str, nodes.NodeNG]c��|jrdS|���D]#\}}|D]}|�d|f|�����$dS)Nrr)r�r�r )rCr�rg�node_lstr�s     rdr'zVariablesChecker._check_globals�sw���.�	��F�*�0�0�2�2�	M�	M�N�D�(� �
M�
M��� � �!2�$��t� �L�L�L�L�
M�	M�	Mrcc��t|��}t��}tjt��}|D�]\}}|jD�]}|dx}}	|	dkr|}|d}
||vr�"|||
fvr�)|�|��|	|jvp|
|jv}|
o4|jj	j
o#|jj	j
�|
��}t|tj��s!t|tj��ry|jsrt|tj��rt"�|	��r��|s|r��|
�d|	��}
n|	�d|
��}
t'|��s|�d|
|�����4t|tj��r�|jt*kr�t"�|	��r��zt-||��r���|s|r���|	dkr$||j|f�|�����|
�
|	�d|j��}
n|	�d|j�d	|
��}
t'|��s|�d|
|�������|���D]y\}}t3|��dkr	|d}n2d
�d�|dd�D�����d
|d��}|�d||df|d����z|`dS)Nrr�r[rQrPrrrRrSrNc3�K�|]}|V��dSr�rbr�s  rdr�z2VariablesChecker._check_imports.<locals>.<genexpr>5s"���� =� =�q�� =� =� =� =� =� =rcr�z and r)r�r�r?rr@r�r�rr�r(r^r`rrrr�rsrm�SPECIAL_OBJ�searchrr rtrwr�r�r�rPr)rCr��local_names�checked�unused_wildcard_importsrgrer��	real_name�
imported_name�as_name�is_type_annotation_import�is_dummy_importr[ru�unused_list�
arg_strings                 rdr+zVariablesChecker._check_imports�s���&�|�4�4���%�%��
�#�D�)�)�	 �&�D	S�D	S�J�D�$��:�C
S�C
S��,3�A�J�6�	�M� �C�'�'� $�I�!�!�*����'�'���	�7�3�3�3�����I�&�&�&�"�T�%@�@�>��$�"=�=�*��N���*�>�N���*�>�D�D�W�M�M� ��d�E�L�1�1�-S��t�U�%5�6�6�-S�?C�|�-S�"�$��(8�9�9�!�k�>P�>P�%�?�?�!�
!�0�!�O�!�!���7�
�7�7���!.�F�F�W�F�F��1�$�7�7�O��(�(��s��(�N�N�N����e�&6�7�7�S�D�L�F�<R�<R�"�)�)�-�8�8�!�!�-�d�D�9�9�!�!�0�!�O�!�!�$��+�+�/���t�0D�E�L�L�T�R�R�R�R�"�?�%2�"Q�"Q�4�<�"Q�"Q�C�C�%2�"^�"^�4�<�"^�"^�U\�"^�"^�C�5�d�;�;�S� �,�,�_�3�T�,�R�R�R��GC
S�L$;�#@�#@�#B�#B�		�		��F�K��;���1�$�$�(��^�
�
��y�y� =� =�K����,<� =� =� =�=�=�U�U�K�PR�O�U�U��
���(�
�F�1�I�/F�V�TU�Y�
�
�
�
�
�
���rc� nodes.Module | nodes.FunctionDefc��g}|���D]E}t|tj��r)|�|�||�����F|D]\}}|�|d���dS)z,Update consumption analysis for metaclasses.N)r{rrrr�r�_check_classdef_metaclassesr%)rCr�r5�
child_node�scope_localsrgs      rdr$z#VariablesChecker._check_metaclasses<s���DF���+�+�-�-�	T�	T�J��*�e�n�5�5�
T����� @� @��T� R� R�S�S�S��#+�	)�	)��L�$����T�4�(�(�(�(�	)�	)rcryr��/list[tuple[dict[str, list[nodes.NodeNG]], str]]c��|jsgSg}|���}d}t|jtj��r
|jj}n�t|jtj��r[|jjrO|jj}t|tj��s!|j}t|tj���!|j}npt|jtj��r6t|jj	tj��r|jj	j}n|r|�
��j}d}t�||��}|r�|j
ddd�D]M\}}	}	}	|�|g��}
|
D]-}|j|jkr|�||f��d}n�.�N|j�|g��}|D]}
|
j|jkrd}n�|sU|sS|tjjvs@t'j|��s,||jjjvs|�d||f���|S)Nr�Fr�Trrm)�
_metaclass�	metaclassrrrr3rgr4r5r�r�r��METACLASS_NAME_TRANSFORMSrqrr�r�rpr�r�rrr�r(r�r )rCryr�r5r�rg�attr�foundr�r=r��
found_node�nodes_in_parent_scope�found_node_parents              rdr�z,VariablesChecker._check_classdef_metaclassesIsy����	��I�DF���O�O�%�%�	����e�&��
�3�3�	)��#�(�D�D�
��(�%�/�
:�
:�
	)�u�?O�?T�
	)��#�(�D� ��u�z�2�2�
!��y��!��u�z�2�2�
!��9�D�D�
��(�%�*�
5�
5�	)�*���!�5�:�;
�;
�	)��#�(�-�D�D�
�	)��>�>�#�#�(�D���(�,�,�T�4�8�8���	�)-�)9�$�$�B�$�)?�
�
�%��a��A�*�.�.�t�R�8�8��"-���J�!�(�E�L�8�8� ����t�(<�=�=�=� $����9��
%0�$6�$:�$:�4��$D�$D�!�%:�
�
�!�$�+�u�|�;�;� �E��E�<��		M��		M����0�0�0��#�D�)�)�1��4�;�-�A�A�A�
���1��T�G��L�L�L��rc�nodes.Subscriptc�d�tj|j��}|�||��dSr�)rr��slice�_check_potential_index_error�rCr��inferred_slices   rd�visit_subscriptz VariablesChecker.visit_subscripts0���)�$�*�5�5���)�)�$��?�?�?�?�?rcr��nodes.NodeNG | Nonec�P�t|tj��rt|jt��sdSt|jtjtjf��rDt|jj��|jdzkr|�	d|t���dSdS)z,Check for the potential-index-error message.Nr[r(rr)rrrr�r��intr0r+r�r	r rr�s   rdr�z-VariablesChecker._check_potential_index_error�s���
�.�%�+�6�6�	�j�� �#�?
�?
�	�
�F��d�j�5�;��
�";�<�<�	��4�:�?�#�#�n�&:�Q�&>�>�>�� � �+�$�9�!����
�F�
	�	rc�nodes.Constc��|���dkrdStj|��sdS|j}t	|t
j��r|j}t	|t
j��r;t|�	��d��}|�tj
|d��rdS	t|j��}|�
|��dS#t$rYdStj$rYdSwxYw)z�Take note of names that appear inside string literal type annotations
        unless the string is a parameter to `typing.Literal` or `typing.Annotation`.
        zbuiltins.strN)�	Annotated�Literal)r�rr+r�rrrr0r}r~r{�is_typing_memberrr�ra�
ValueErrorrn�AstroidSyntaxError)rCr�r��originr�s     rd�visit_constzVariablesChecker.visit_const�s���;�;�=�=�N�*�*��F��7��=�=�	��F�����f�e�k�*�*�	#��]�F��f�e�o�.�.�	��&�-�-�/�/��6�6�F��!�e�&<��0�'�'�!���	�%�d�j�1�1�J��,�,�Z�8�8�8�8�8���	�	�	��D�D��)�	�	�	��D�D�	���s�/)C�
C9�'C9�8C9�r�r$rir<)r�rrir<)r�rrir<)r�r-rir<)r�r9rir<)r=r9rir<)r�rCrir<)r=rCrir<)r�rJrir<)r=rJrir<)r�rOrir<)r=rOrir<)r�r�rir<)r�rprir<)r�r�rir<)r�r�rir<)r�r�rir<)r�r�rir<)r�r�rer�rir<)r�r�r7r;r�r�rir�)r�r�rer�r�rzr�r;r�rhrir�)r�r�rir<)r�rfrir<)r�r�rir<)r�r�rir<)r=r�rir<)r�r�rir<)r�r�rir<)rir�)rir�)r�r�r�r�rir�)r�r�r�r�rer�r�r�r�rzr�rzr�rhr�r�rir�)r�r�rir�)r�r�r�r�rir�)r�r�r�r-r�r`rir�)r�r,r-r.rir�)r�r�rir�)r�r4rir<)rgrhr�r�rer�r�r�rkr�rlr�rir<)rer�rgrhrir\)rgrhr�r�rer�rUrcrkr�rir<)r�r�rir<)rer�rir�)rgrhrir�)r�r�rir�)rzr�rir<)r�r�rir<)r�rr�r�ryr`rir<)r�r�rirf)r�r�r�rryr`r�r`rrhrir<)r�r�rrhrir<)r�r�rurr�rcrir�)r�rr�r�rir<)r�r�rir<)r�r�rir<)r�r�rir<)ryr-r�r�rir�)r�r�rir<)r�r�r�r�rir<)r�r�rir<)Ur\r]r^r_rgr1�msgs�IGNORED_ARGUMENT_NAMES�optionsrDr�only_required_for_messagesrrr!r,r1r8r<rArFrIrLrNrQrSr^ro�visit_asyncfunctiondef�leave_asyncfunctiondefr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r�r�r�r�r�r�r�rr�r�r�r�r�rirZrVr�rr[r}rarr�r�rrr�r�r&r'r+r$r�r�r�r��
__classcell__)rs@rdr|r|ts	�������	�	��D��D�
� ��%�"�	
�
�		
�
"�X� �%�<�	
�
�		
�
"���3�!�	
�
�
	
�
�)��(�1�	
�
�
	
�
*���3�.�
�
�	
�"
%�1� �%�T�	
�
�	
�
,���%�a�	
�
�	
�
)���3�B�	
�
�	
�[V�G�p3�3�3�3�3�3�&�U�%�#���X�X�X���X�@0�0�0�0�P�P�P�P�&�U�%�� �� �����	�	�)�)�)�	�	�)�(>�>�>�>�����(?�?�?�?�����
F�F�F�F�����
F�F�F�F�����
F�F�F�F�����
&L�&L�&L�&L�P,�,�,�,�\/��.��%�U�%�#�&�� ����?M�?M�?M���?M�B"�"�"�"�����
!�
!�
!�
!�&�U�%�&<�=�=�
C�
C�
C�>�=�
C�&�U�%�&<�=�=�/�/�/�>�=�/�
.N�.N�.N�.N�`%�%�%�%�PHA�HA�HA�HA�T&�U�%�&9�:�:�>�>�>�;�:�>�,&�U�%�&9�:�:�D�D�D�;�:�D�4&�U�%�$� ��#�	�����
���,F�F�F�F�����
0�0�0�0�0�0�0�0�9�9�9�9�
�@�@�@��_�@��2�2�2��_�2��F�F�F��_�F��5�5�5��\�5�2�����\��8�|L�|L�|L��\�|L�|�"
�"
�"
��\�"
�H<�<�<�<�|�A�A�A��\�A�,�����\��&
�&
�&
�&
�RNW�NW�NW�NW�beA�eA�eA�eA�N+�+�+�+�"3Y�3Y�3Y�3Y�j0V�0V�0V�0V�dN�N�N�N�
E�E�E�E��	1�	1�	1��\�	1�
�
�
�
�2?�?�?�?�V�V�V�V�<?�?�?�?�B�����\��M�M�M�M�.L�L�L�L�
#�#�#�#�J3!�3!�3!�3!�jM�M�M�M�W�W�W�W�r)�)�)�)�4�4�4�4�l@�@�@�@�
����&&�U�%��������	������rcr|r�r$r<c�J�|�t|����dSr�)�register_checkerr|)r�s rd�registerr��s%��
���,�V�4�4�5�5�5�5�5rc)rerfrgrhrirj)ryrzrgr{rir|)r�r�r�rrirh)r�r�r�rzr�rzrir�)r�r�rgrhrir�)r�r�rir�)rgrhr�rzrir�)rer�r�r�rir�)r�r�rir�)r�r�rir�)rer�r�r�rir�r�)`r_r%rr?r>r�r��re�sysr�collections.abcrrr�enumr�	functoolsr	r(r
rrrnr
rrr�
astroid.nodesr�astroid.typingr�pylint.checkersrr�pylint.checkers.utilsrrr�pylint.constantsrrr�pylint.interfacesrrrr�
pylint.typingr�version_infor"�astroid.decoratorsr#�pylint.lintr$�compiler�rtr�r�rAr~�	frozenset�TYPING_NAMESr�
DictValues�DictKeysr�node_classesr*r�r�r�r�r�r�rrrZrwr�r�r�r�r�r�r�r�r�r�r1r9r3r;r|r�rbrcrd�<module>rsH��
*�)�)�"�"�"�"�"�"�������������	�	�	�	�	�	�	�	�
�
�
�
�#�#�#�#�#�#�9�9�9�9�9�9�9�9�9�9�������������1�1�1�1�1�1�1�1�1�1�����4�4�4�4�4�4�4�4�4�4�4�4�%�%�%�%�%�%�*�*�*�*�*�*�.�.�.�.�.�.�.�.�����������
F�E�E�E�E�E�E�E�E�E�N�N�N�N�N�N�N�N�N�N�N�N�0�0�0�0�0�0���v���)�)�)�)�)�)�)�D�D�D�D�D�D��%�$�$�$�$�$�$��b�j�+�,�,��	��#���$<�=�=��'��.�� �
��
��y�6�6�6�8�8��v�O���O���O���M��#�	�
�
�L�	�O�	�O�	�J�	�L�	�K�
��	�	�	�	�	�$�	�	�	�
�
�
�
���4����������&����.O*�O*�O*�O*�d-�-�-�-�+@�+@�+@�+@�\����,����6�6�6�6���������$P+���P+���P+���P+�(��)P+�2��3P+�<��=P+�F��GP+�R��SP+�`��aP+�n��oP+�z��{P+�D��EP+�N��OP+�X��YP+�d��eP+�n��oP+�x��yP+�H	-�$�H�	�B�C�D��	0� �U�	�>�?�@�	������UP+�P+�P+��P�P�P�P�f�����J����A	�A	�A	�A	�A	�A	�A	�A	�JC!�C!�C!�C!�C!�{�C!�C!�C!�LB6�6�6�6�6�6rc

Hacked By AnonymousFox1.0, Coded By AnonymousFox