HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/pyflakes/__pycache__/checker.cpython-310.pyc
o

we{'�@s:dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZeed�Zee�Ze
��jZdd�ZejejfZdd�Zd	d
�Zdd�Zd
d�Zdd�Ze	�d�Z e	�d�Z!e	�d�Z"e	�d�Z#e	�d�Z$e%d�Z&dd�Z'dd�Z(Gdd�de)�Z*dd�Z+de*�fdd �Z,d!d"�Z-d#d$�Z.Gd%d&�d&�Z/Gd'd(�d(e/�Z0Gd)d*�d*e0�Z1Gd+d,�d,�Z2Gd-d.�d.�Z3Gd/d0�d0e0�Z4Gd1d2�d2e4�Z5Gd3d4�d4e4�Z6Gd5d6�d6e4�Z7Gd7d8�d8e6�Z8Gd9d:�d:e/�Z9Gd;d<�d<e/�Z:Gd=d>�d>e:�Z;Gd?d@�d@e/�Z<GdAdB�dBe0�Z=GdCdD�dDe0�Z>GdEdF�dFe/�Z?GdGdH�dHe)�Z@GdIdJ�dJe@�ZAGdKdL�dLe@�ZBGdMdN�dNe@�ZCGdOdP�dPe@�ZDGdQdR�dRe@�ZEGdSdT�dTeE�ZFGdUdV�dV�ZGgdW�ZHdXdY�ZIe%dZ�ZJd[d\�ZKd]d^�ZLd_d`�ZMdadb�ZNGdcdd�dd�ZOdedf�ZPdgdh�ZQGdidj�dj�ZRdS)kz]
Main module.

Implement the central Checker class.
Also, it models the Bindings and Scopes.
�N)�messages�pypy_version_infocCslt|tj�r
|jgSt|tj�r|j|jgdd�|jD�Stjdkr2t|tj	�r4dd�|j
D�SdSdS)NcSsg|]}|g�qS�r)�.0�hdlrr�I/home/arjun/projects/env/lib/python3.10/site-packages/pyflakes/checker.py�
<listcomp>!�z#getAlternatives.<locals>.<listcomp>)��
cS�g|]}|j�qSr)�body)r�mcrrrr#r	)�
isinstance�ast�Ifr
�Try�orelse�handlers�sys�version_info�Match�cases)�nrrr�getAlternativess�rcCs&t|tj�ot|jttt�td�f�S�N)rr�Constant�value�bool�type�Ellipsis��noderrr�
_is_singleton)s�r#cCs t|tj�otdd�|jD��S)Ncs��|]}t|�VqdSr)�_is_constant�r�eltrrr�	<genexpr>3��z%_is_tuple_constant.<locals>.<genexpr>)rr�Tuple�all�eltsr!rrr�_is_tuple_constant0s�r-cCst|tj�p	t|�Sr)rrrr-r!rrrr%7sr%cCst|�ot|�Sr)r%r#r!rrr�_is_const_non_singleton;�r.cCs,t|tj�r|j|kpt|tj�o|j|kSr)rr�Name�id�	Attribute�attr)r"�namerrr�_is_name_or_attr?s�r5z\(([^()]*)\)z[#0+ -]*z
(?:\*|\d*)z(?:\.(?:\*|\d*))?z[hlL]?zdiouxXeEfFgGcrsa%cCs|�||�}|dusJ�|Sr)�match)�regex�string�posr6rrr�_must_matchOsr:cs�fdd�}t|��S)z�Parses the string component of a `'...' % ...` format call

    Copied from https://github.com/asottile/pyupgrade at v1.20.1
    c3st�d}d}d}d}|t��kr�|s6z��d|�}Wnty,�|d�dfVYdSw|}|d7}d}nvt��|�}|rH|�d�}|��}nd}tt�|�}|��pUd}|��}tt	�|�}|��ped}	|��}tt
�|�}
|
��pud}|
��}tt�|���}z�|}Wnty�td��w|d7}|||	||f}
�||�|
fVd}|}|t��ks|r�td��dS)NrF�%�Tz"end-of-string while parsing format)
�len�index�
ValueError�MAPPING_KEY_REr6�group�endr:�CONVERSION_FLAG_RE�WIDTH_RE�PRECISION_RE�	LENGTH_RE�
IndexError)�string_start�
string_end�in_fmt�i�	key_match�key�conversion_flag_match�conversion_flag�width_match�width�precision_match�	precision�
conversion�fmt��srr�_parse_inner[sZ��

��.�z*parse_percent_format.<locals>._parse_inner)�tuple)rWrXrrVr�parse_percent_formatUs
7rZc@s eZdZdZdd�Zdd�ZdS)�_FieldsOrderzFix order of AST node fields.cCs>|j}d|vrdj}nd|vrdj}ndj}tt||dd��S)N�iter�
generatorsrT)rM�reverse)�_fields�findrY�sorted)�self�
node_class�fields�	key_firstrrr�_get_fields�sz_FieldsOrder._get_fieldscCs|�|�||<}|Sr)rf)rbrcrdrrr�__missing__�sz_FieldsOrder.__missing__N)�__name__�
__module__�__qualname__�__doc__rfrgrrrrr[�sr[cCs&i}|D]}|�|d�d||<q|S)z|
    Simplest required implementation of collections.Counter. Required as 2.6
    does not have Counter in collections.
    rr<)�get)�items�results�itemrrr�counter�srpccsj�||jD],}|r||vrqt||d�}t|tj�r|Vqt|t�r2|D]}t|tj�r1|Vq&qdS)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_orderr4�fieldrorrr�iter_child_nodes�s�
��rxcCsNt|tj�r	|jSt|tj�rtdd�|jD��St|tj�r$t|d�St	�S)Ncsr$r��convert_to_value)rrKrrrr(�r)z#convert_to_value.<locals>.<genexpr>�ro)
rrrrr*rYr,r0�VariableKey�UnhandledKeyTyper{rrrrz�s
rzcCst|tj�ot|�dkS)N�NotImplemented)rrr0�getNodeNamer!rrr�is_notimplemented_name_node�sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�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.
    cCs||_||_d|_dS�NF)r4�source�used�rbr4r�rrr�__init__�s
zBinding.__init__cC�|jSr)r4�rbrrr�__str__��zBinding.__str__cCsd�|jj|j|jjt|��S)Nz)<{} object {!r} from line {!r} at 0x{:x}>)�formatrqrhr4r��linenor1r�rrr�__repr__�s�zBinding.__repr__cCst|t�o
|j|jkSr)r�
Definitionr4�rb�otherrrr�	redefines��zBinding.redefinesN)rhrirjrkr�r�r�r�rrrrr��sr�c� eZdZdZ�fdd�Z�ZS)r�z7
    A binding that defines a function or a class.
    cs"t��|�pt|t�o|j|jkSr)�superr�r�
Assignmentr4r��rqrrr��s�zDefinition.redefines)rhrirjrkr��
__classcell__rrr�rr��sr�cs(eZdZdZ�fdd�Zdd�Z�ZS)�Builtinz-A definition created for all Python builtins.cst��|d�dSr)r�r�)rbr4r�rrr�r/zBuiltin.__init__cCsd�|jj|jt|��S)Nz<{} object {!r} at 0x{:x}>)r�rqrhr4r1r�rrrr�
s
�zBuiltin.__repr__)rhrirjrkr�r�r�rrr�rr�sr�c@�eZdZdZdS)r}zS
    A dictionary key of a type that we cannot or do not check for duplicates.
    N�rhrirjrkrrrrr}�r}c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r|zY
    A dictionary key which is a variable.

    @ivar item: The variable AST object.
    cCs|j|_dSr)r1r4)rbrorrrr�szVariableKey.__init__cCs|j|jko|j|jkSr)rqr4)rb�comparerrr�__eq__!s
�zVariableKey.__eq__cCs
t|j�Sr)�hashr4r�rrr�__hash__'s
zVariableKey.__hash__N)rhrirjrkr�r�r�rrrrr|s
r|csFeZdZdZd
�fdd�	Zdd�Zdd�Zed	d
��Zdd�Z	�Z
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}
    Ncs"|p||_g|_t��||�dSr)�fullName�	redefinedr�r�)rbr4r��	full_namer�rrr�4s
zImportation.__init__cCs,t|t�r|j|jkSt|t�o|j|jkSr)r�SubmoduleImportationr�r�r4r�rrrr�9s
zImportation.redefinescCs|j�d�d|jkS)z.Return whether importation needs an as clause.�.���)r��splitr4r�rrr�
_has_alias?szImportation._has_aliascCs&|��rd|j�d|j��Sd|jS)z5Generate a source statement equivalent to the import.�import � as z	import %s�r�r�r4r�rrr�source_statementCs
zImportation.source_statementcCs|��r|jd|jS|jS�z#Return import full name with alias.r�r�r�rrrr�KszImportation.__str__r)rhrirjrkr�r�r��propertyr�r�r�rrr�rr�+s
r�cs@eZdZdZ�fdd�Z�fdd�Zdd�Zedd	��Z�Z	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.
    csBd|vr|rt|tj�sJ�|�d�d}t��||�||_dS)Nr�r)rr�Importr�r�r�r�)rbr4r��package_namer�rrr�ds
zSubmoduleImportation.__init__cs"t|t�r|j|jkSt��|�Sr)rr�r�r�r�r�r�rrr�ks
zSubmoduleImportation.redefinescCr�r�r�r�rrrr�pr�zSubmoduleImportation.__str__cCs
d|jS)Nr�r�r�rrrr�s�
z%SubmoduleImportation.source_statement)
rhrirjrkr�r�r�r�r�r�rrr�rr�Ssr�cs2eZdZd�fdd�	Zdd�Zedd��Z�ZS)	�ImportationFromNcsH||_|p||_|�d�r||j}n|d|j}t��|||�dS�Nr�)�module�	real_name�endswithr�r�)rbr4r�r�r�r�r�rrr�zs

zImportationFrom.__init__cCs"|j|jkr|jd|jS|jSr�)r�r4r�r�rrrr��szImportationFrom.__str__cCs<|j|jkrd|j�d|j�d|j��Sd|j�d|j��S)N�from z import r�)r�r4r�r�rrrr��sz ImportationFrom.source_statementr)rhrirjr�r�r�r�r�rrr�rr�xs
r�cs4eZdZdZ�fdd�Zedd��Zdd�Z�ZS)�StarImportationz3A binding created by a 'from x import *' statement.cs"t��d|�|d|_||_dS)N�*z.*)r�r�r4r�r�r�rrr��s

zStarImportation.__init__cCsd|jdS)Nr�z	 import *r�r�rrrr��sz StarImportation.source_statementcCs|j�d�r	|jS|jSr�)r�r�r�r4r�rrrr��szStarImportation.__str__)	rhrirjrkr�r�r�r�r�rrr�rr��s
r�cr�)�FutureImportationzs
    A binding created by a from `__future__` import statement.

    `__future__` imports are implicitly used.
    cst��||d�||f|_dS)N�
__future__)r�r�r�)rbr4r��scoper�rrr��szFutureImportation.__init__�rhrirjrkr�r�rrr�rr��sr�c@r�)�Argumentz3
    Represents binding a name as an argument.
    Nr�rrrrr��r�r�c@r�)r�a
    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�rrrrr��r�r�c@r�)�NamedExprAssignmentzB
    Represents binding a name with an assignment expression.
    Nr�rrrrr��r�r�c@�eZdZdZdd�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.
    cC�dS)zAAn Annotation doesn't define any name, so it cannot redefine one.Frr�rrrr��szAnnotation.redefinesN)rhrirjrkr�rrrrr��sr�c@�eZdZdS)�FunctionDefinitionN�rhrirjrrrrr���r�c@r�)�ClassDefinitionNr�rrrrr��r�r�cr�)�
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.
    cs�d|vrt|tj�rt|dj��_ng�_�fdd�}t|jtjtjf�r,||j�n@t|jtj�rl|j}t|j	tjtjf�rl|j
}|j	}||�t|tj�rS|}nt|tjtjf�ra||�nn
t|j	tjtjf�s@t��||�dS)N�__all__cs6|jD]}t|tj�rt|jt�r�j�|j�qdSr)r,rrrr�str�names�append)�	containerr"r�rr�
_add_to_names�s

��z-ExportBinding.__init__.<locals>._add_to_names)
rr�	AugAssignrtr�r�Listr*�BinOp�right�leftr�r�)rbr4r�r�r��currentValuer�r�r�r�rr��s(�zExportBinding.__init__r�rrr�rr��sr�c@r�)�ScopeFcCs,|jj}d|�dt|�d�dt�|��d�S)N�<z at 0x�x� �>)rqrhr1�dictr�)rb�	scope_clsrrrr�s$zScope.__repr__N)rhrirj�
importStarredr�rrrrr�sr�c@r�)�
ClassScopeNr�rrrrr�r�r�cs<eZdZdZdZhd�Z�fdd�Zdd�Zdd	�Z�Z	S)
�
FunctionScopezp
    I represent a name scope for a function.

    @ivar globals: Names declared 'global' in this function.
    F>�__tracebackhide__�__traceback_info__�__traceback_supplement__cs t���|j��|_d|_dSr)r�r��
alwaysUsed�copy�globals�returnValuer�r�rrr�)s

zFunctionScope.__init__ccsJ�|��D]\}}|js"|dkr"||jvr"|js"t|t�r"||fVqdS)zR
        Return a generator for the assignments which have not been used.
        �_N)rmr�r��
usesLocalsrr��rbr4�bindingrrr�unused_assignments/s�
��
��z FunctionScope.unused_assignmentsccs2�|��D]\}}|jst|t�r||fVqdS)zR
        Return a generator for the annotations which have not been used.
        N)rmr�rr�r�rrr�unused_annotations;s�
��z FunctionScope.unused_annotations)
rhrirjrkr�r�r�r�r�r�rrr�rr�sr�c@r�)�	TypeScopeNr�rrrrr�Dr�r�c@r�)�GeneratorScopeNr�rrrrr�Hr�r�c@�eZdZdZdZdZdS)�ModuleScopezScope for a module.TFN)rhrirjrk�_futures_allowed�_annotations_future_enabledrrrrr�L�r�c@r�)�DoctestScopezScope for a doctest.Nr�rrrrr�Rr�r�c@seZdZe�ZdS)�DetectClassScopedMagicN)rhrirj�dirr�rrrrr�Vs
r�)�__file__�__builtins__�__annotations__�WindowsErrorcCs4t|d�r|jSt|d�r|jSt|d�r|jSdS)Nr1r4�rest)�hasattrr1r4r�r!rrrr_s


�r)�typing�typing_extensionscs`��fdd�}�fdd�}t|tj�o||j�p/t|tj�o/t|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`).
    csHt��D]}||vr!t||t�o||jtvo�||j�SqdSr�)�reversedrr�r��TYPING_MODULESr��r4r���is_name_match_fn�scope_stackrr�_bare_name_is_attrvs���z-_is_typing_helper.<locals>._bare_name_is_attrcs:t��D]}||vrt||t�o||jtvSqdSr�)r�rr�r�rr�rrr�_module_scope_is_typing�s��z2_is_typing_helper.<locals>._module_scope_is_typing)rrr0r1r2rr3)r"rrrrrrr�_is_typing_helperls
��
��rcst|�fdd�|�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.
    cs|�kSrr�r���typing_attrrr�<lambda>�sz_is_typing.<locals>.<lambda>�r)r"rrrr
r�
_is_typing�srcCst|dd�|�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.
    cSr��NTrr	rrrr�sz'_is_any_typing_member.<locals>.<lambda>r
)r"rrrr�_is_any_typing_member�srcs.t|jtjtjf�ot�fdd�|jjD��S)Nc3s�|]	}t|d��VqdS)�overloadN)r)r�decrrrr(��
�
�
�z%is_typing_overload.<locals>.<genexpr>)rr�r�FunctionDef�AsyncFunctionDef�any�decorator_list)rrrrr�is_typing_overload�s
��rc@r�)�AnnotationStaterr<�N)rhrirj�NONE�STRING�BARErrrrr�r�rc�t����fdd��}|S)NcsB|����|g|�Ri|��Wd�S1swYdSr)�_enter_annotation�rb�args�kwargs��funcrr�in_annotation_func�s
$�z)in_annotation.<locals>.in_annotation_func��	functools�wraps�r$r%rr#r�
in_annotation��r*cr)NcsF|�tj���|g|�Ri|��Wd�S1swYdSr)rrrr r#rrr%�s$�z0in_string_annotation.<locals>.in_annotation_funcr&r)rr#r�in_string_annotation�r+r,c@sPeZdZdZejeejeej	e
eje
eje
ej
eejeejeejei	ZdZdZejZee��e�Zej�d�Z e rAe�!e �"d��[ dddejvdfd	d
�Z#dd�Z$d
d�Z%dd�Z&e'dd��Z(e(j)dd��Z(e'dd��Z*e*j)dd��Z*e'dd��Z+e,j-dd��Z.dd�Z/dd�Z0dd �Z1d!d"�Z2d#d$�Z3d%d&�Z4d'd(�Z5d)d*�Z6d+d,�Z7d-d.�Z8d/d0�Z9d1d2�Z:d3d4�Z;d5d6�Z<e,j-ej=fd7d8��Z>e'd9d:��Z?d�d;d<�Z@d=d>�ZAd?d@�ZBdAdB�ZCdCdD�ZDeE�F�jGZHdEdF�ZIeJdGdH��ZKdIdJ�ZLeMdKdL��ZNdMdN�ZOe@ZPZQZRZSZTZUZVZWZXeOZYe@ZZZ[Z\Z]Z^Z_Z`dOdP�ZadQdR�ZbdSdT�ZcdUdV�ZddWdX�ZedYdZ�Zfe@ZgZhZieOZjZkZlZmZnZoeOZpZqZrZsZtZuZvZwZxZyZzZ{Z|Z}Z~ZZ�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�Z�d[d\�Z�e@Z�Z�Z�d]Z�d^d_�Z�d`da�Z�dbdc�Z�e�Z�ddde�Z�dfdg�Z�e�Z�dhdi�Z�e�Z�Z�Z�djdk�Z�dldm�Z�e�Z�dndo�Z�dpdq�Z�e�Z�Z�drds�Z�e�Z�dtdu�Z�dvdw�Z�dxdy�Z�dzd{�Z�d|d}�Z�d~d�Z�e�Z�d�d��Z�d�d��Z�d�d��Z�e�Z�d�d��Z�d�d��Z�d�d��Z�e@Z�Z�Z�Z�Z�e@Z�Z�d�d��Z�e�Z�Z�Z�e,j-d�d���Z�d�d��Z�d�d��Z�dS)��Checkerz2I check the cleanliness and sanity of Python code.rN�PYFLAKES_BUILTINS�,z(none)�PYFLAKES_DOCTESTrcCs�i|_t��|_g|_g|_||_|r|j�|�|_||_	dg|_
||_g|_z	t
jt|�}Wn
ty=td|��w|�|��|jD]
}|�dt|��qG|�|�|��Wd�n1sewY|��|rytjddd�dSdS)Nrz$No scope implemented for the node %rz1`file_tokens` will be removed in a future versionr)�
stacklevel)�
_nodeHandlers�collections�deque�	_deferred�
deadScopesr�filename�builtIns�union�withDoctest�exceptHandlers�root�
scopeStackr-�_ast_node_scoper�KeyError�RuntimeError�in_scope�
addBindingr��handleChildren�
_run_deferred�checkDeadScopes�warnings�warn)rb�treer7�builtinsr:�file_tokens�scope_tp�builtinrrrr��s:
�


�
��zChecker.__init__cCs"|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)r5r�r=�offset)rb�callablerrr�
deferFunctions"	zChecker.deferFunctioncCsL|j|jf}|jr|j��\}}}|||_|_|�|js	|\|_|_dSr)r=rMr5�popleft)rb�orig�handlerr�rMrrrrDs�zChecker._run_deferredcCst|j�dkot|jdt�S)Nrr<)r=r=rr�r�rrr�_in_doctests�zChecker._in_doctestcCs tdd�|jD��sdS|jjS)Ncss�|]}t|t�VqdSr)rr�)rr�rrrr("s��z)Checker.futuresAllowed.<locals>.<genexpr>F)r+r=r�r�r�rrr�futuresAllowed s
�zChecker.futuresAllowedcCs(|dusJ�t|jt�rd|j_dSdSr�)rr�r�r��rbrrrrrT(s�cCs|jd}t|t�sdS|jS)NrF)r=rr�r�)rbr�rrr�annotationsFutureEnabled.s

z Checker.annotationsFutureEnabledcCs(|dusJ�t|jt�sJ�d|j_dSr)rr�r�r�rUrrrrV5scCs
|jdS)Nr�)r=r�rrrr�;r�z
Checker.scopec
csD�|j�|��zdVW|j�|j���dS|j�|j���wr)r=r�r6�pop)rb�clsrrrrA?s
�*zChecker.in_scopec	s�|jD]�t�t�rqt�t�r4���D]
\}}|�tj|j|�q��	�D]
\}}|�tj
|j|�q&��d�}|rBt|t�sBd}|rTt
|j�}�fdd�|jD�}ng}}|r��jsvtj�|j�dkrv|D]
}|�tj�dj|�qh�jr�g}���D]}t|t�r�||_|�|j�qd�t|��}|D]}|�tj�dj||�q����D]@}t|t�r�|jp�|j|v}|s�tj}	|�|	|jt |��|j!D]}
t|�"|
�t#�r�tj$}	n|r�q�tj%}	|�|	|
|j|j�q�q�qdS)z�
        Look at scopes which have been fully examined and report names in them
        which were imported but unused.
        r�Ncsg|]}|�vr|�qSrr)rr4�r�rrr]s
�z+Checker.checkDeadScopes.<locals>.<listcomp>�__init__.py�, )&r6rr�r�r��reportr�UnusedVariabler�r��UnusedAnnotationrlr��setr�r��os�path�basenamer7�UndefinedExport�valuesr�r�r�r��joinra�ImportStarUsager�r4�UnusedImportr�r��	getParent�	FOR_TYPES�ImportShadowedByLoopVar�RedefinedWhileUnused)rbr4r��all_binding�	all_names�	undefined�	from_listrr��messgr"rrYrrEGsh





�
�
��

���zChecker.checkDeadScopescOs$|j�||jg|�Ri|���dSr)rr�r7)rb�messageClassr!r"rrrr\�s$zChecker.reportcCs"	|j}t|d�st|d�s|Sq)NTr,�ctx)�_pyflakes_parentr��rbr"rrrrh�s
�zChecker.getParentcCsz|||fvst|d�rt|d�sdS||ur|S|j|jkr&|�|j||�S|j|jkr4|�||j|�S|�|j|j|�S�Nrs)r��_pyflakes_depth�getCommonAncestorrs)rb�lnode�rnode�stoprrrrw�s"���zChecker.getCommonAncestorcCs"|D]}|�|||�rdSqdS)NTF)rw)rbr"�	ancestorsrz�arrr�descendantOf�s
�zChecker.descendantOfcCs.|}	||jur
dS|�|�}t||�r|Sqr)r<rhr)rbr"�
ancestor_type�parentrrr�_getAncestor�s


�zChecker._getAncestorcCs|�|ttj����Sr)r�rYr-r>�keysrtrrr�getScopeNode�r�zChecker.getScopeNodecCsL|�|||j�}t|�}|r$|D]}|�|||�|�|||�Ar#dSqdS)zATrue, if lnode and rnode are located on different forks of IF/TRYTF)rwr<rr})rbrxry�ancestor�partsrmrrr�differentForks�s��zChecker.differentForkscCs�|jddd�D]	}|j|vrnq|�|j�}|r{t|t�s{|�||j�s{|�|j�}t|t�rBt|t	�rB|�
tj||j|j�n9||j
urk|jsj|�|�rj|jdksYt|t�rjt||j�sj|�
tj||j|j�nt|t�r{|�|�r{|j�|�|j|j
vr�|j
|jj|_|j|j
vs�t|t�s�d}t|t�r�t|j|t�r�|d8}t|t�r�t|j|t�s�||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�r<)r=r4rlrr�r�r�rhr�rir\rrjr�r�r�rrkr�r�r�r�r�)rbr"rr��existing�parent_stmt�
cur_scope_posrrrrB�sT
��
�
��
�
��������zChecker.addBindingcCs,tj�d�rtdt|�����|�|�dS)N�PYFLAKES_ERROR_UNKNOWNzUnexpected type: )r`�environrl�NotImplementedErrorrrCrtrrr�_unknown_handler�szChecker._unknown_handlercCsFz|j|WSty|j��}Ynwt|||j�|j|<}|Sr)r2r?rh�upperrrr�)rbrc�nodeTyperRrrr�getNodeHandlers��zChecker.getNodeHandlerc
	Cs2t|�}|sdSd}d}|jddd�D]�}t|t�r'|dkr"dS|dur'q|�|d�}t|t�r>|js>|j|f||_q|dkr[t|t	�r[t|t
j�r[t|jt
j
�r[|�tj|�z8|j|f||_||}t|t�r�|��r�z|j|f||j_WWdSty�YWdSwWdSWdSty�Ynw|p�|j}|dur�t|ttf�}q|r�g}	|jddd�D]}|��D]}t|t�r�|j|f|_|	�|j�q�q�d�t|	��}	|�tj|||	�dS|dkr�tj� |j!�dkr�dS|t"j#v�rt|jt��rdSd|j$dv�r|�tj%||�dSdS)	Nr�rqF�printr[�__path__rZ�	NameError)&rr=rr�rlr��_in_postponed_annotationr�r�r�rr��op�RShiftr\r�InvalidPrintSyntaxr�r�r�r?r�r�r�rdr�r�rerarfr`rarbr7r�r�r;�
UndefinedName)
rbr"rr4�can_access_class_varsr�r�r�rrorrr�handleNodeLoads~
�������
��
���zChecker.handleNodeLoadcCslt|�}|sdSt|jt�rP||jvrP|jdd�D]5}t|ttf�s$q||vo,||j}|rO|d|jurO||jjvrO|�t	j
||jd|||j�nq|�|�}t|t
j�rf|jdurft||�}nHt|tt
jf�sx||jkr~|�|�s~t||�}n0|dkr�t|jt�r�t|jt
jt
jt
jf�r�t||j|j�}nt|t
j�r�t||�}nt||�}|�||�dS)Nr�rr<r�)rrr�r�r=r�r�r�r\r�UndefinedLocalr�rhr�	AnnAssignrr�ri�
comprehensionrs�isLiteralTupleUnpackingr��Assignr�r��	NamedExprr�r�rB)rbr"r4r�r�r�r�rrr�handleNodeStoreesF��

�
���
zChecker.handleNodeStorecs��fdd�}t��}|sdS|�rdSt|jt�r(||jjvr(|jj�|�dSz|j|=WdStyA|�tj	�|�YdSw)Ncs>t�dd�}|rt|tjtjtjf�rdSt|dd�}|sdS)zN
            Return `True` if node is part of a conditional body.
            rsNTF)rrrrr�While�IfExp)�currentr!rr�on_conditional_branch�s�z7Checker.handleNodeDelete.<locals>.on_conditional_branch)
rrr�r�r��remover?r\rr�)rbr"r�r4rr!r�handleNodeDelete�s�zChecker.handleNodeDeleteccs,�|j|}|_z	dVW||_dS||_wr)�_in_annotation)rb�ann_typerQrrrr�s
�zChecker._enter_annotationcCs|jtjkp|jSr)r�rrrVr�rrrr��s�z Checker._in_postponed_annotationcCs"t||d�D]}|�||�qdS)N�ru)rx�
handleNode)rbrHrur"rrrrC�s�zChecker.handleChildrencCs8t|tj�r|j|jgD]
}t|d�sdSq
dSdS)Nr,FT)rrr��targetsrr�)rbr"�childrrrr��s
��zChecker.isLiteralTupleUnpackingcCs(t|tj�ot|jtj�ot|jjt�S)z}
        Determine if the given node is a docstring, as long as it is at the
        correct place in the node tree.
        )rr�Exprrrr�rtrrr�isDocstring�s
��zChecker.isDocstringcCs>t|tj�rt|jtj�rt|jjt�r|jj|jdfSdS)Nr<)NN)rrr�rrr�r�rtrrr�getDocstring�s
���zChecker.getDocstringc	Cs�|durdS|jr%t|dd�dur%|j|jd7_|j|jd7_|jr;|jdkr;t|tj�s;|�	|�s;d|_|jd7_|j|_
||_z|�|j
�}||�W|jd8_dS|jd8_w)Nr�rr<F)rMrrr��
col_offsetrT�	nodeDepthrr�
ImportFromr�rvrsr�rq)rbr"rrRrrrr��s(�

��
"zChecker.handleNodecCsdz|�|jd�\}}|o|�|�}WnttfyYdSw|s$dS|j}|jdg|_|jp2d}|�t��md|jdvrH|�	dt
d��|D]S}z	t�|j
d�}Wn,ty�}	z ||j|	j|jd|	jpldf}
|�tj||
�WYd}	~	qJd}	~	ww|d||j|d|jdf|_|�|�||_qJWd�n1s�wY||_dS)Nr)rrr�z	<doctest>�r<)r�r
�_getDoctestExamplesr?rGr=rMrAr�rBr�r�parser��SyntaxErrorr��indentr\r�DoctestSyntaxErrorrC)rbr"�	docstring�node_lineno�examples�saved_stack�node_offset�examplerH�e�positionrrr�handleDoctests�s@�
����
��
zChecker.handleDoctestsc
Cs�zt�|�}Wnty|�|||�YdSw|j}t|�dks*t|dtj�s3|�|||�dS|jdj}t�	|�D]}	d|	j
vrPd|	j
vrP||	_||	_q>|�
||�dS)Nr<rr�r�)rr�r�r\r
r=rr�r�walk�_attributesr�r�r�)
rbrWr"�
ref_lineno�ref_col_offset�errrHr
�parsed_annotation�
descendantrrr�handleStringAnnotations$�

�zChecker.handleStringAnnotationcs&ttj��������fdd��dS)Ncs�����Srrr��
annotation�fnrrbrrr.sz;Checker.handle_annotation_always_deferred.<locals>.<lambda>)r*r-r�rO)rbr�rrr�r�!handle_annotation_always_deferred,s
z)Checker.handle_annotation_always_deferredc
Csft|tj�r t|jt�r |�t�|j|j||j	|j
tj��dS|j
r+|�||�dS|�||�dSr)rrrrr�rOr'�partialr�r�r�r�ForwardAnnotationSyntaxErrorrVr�r�)rbr�r"rrr�handleAnnotation0s
�
�
�zChecker.handleAnnotationcCsdSrrrtrrr�ignoreDszChecker.ignorecCs�t|jd�r$|�tj��|�|�Wd�dS1swYdSt|jd�r�|�|j|�t|jt	j
�r<|j}nt|jt	j�rPt|jjt	j
�rP|jj}nd}|dus]t|j
�dkre|�|j|�n/|�|j
d|�|�tj��|j
dd�D]}|�||�q|Wd�n1s�wY|�|j|�dSt|j|j�r�|���|�|�Wd�dS1s�wYdS|�|�dS)N�Literal�	Annotatedrrr<)r5rrrrrCr�r�slicerr*�Indexr=r,rrrr=)rbr"�slice_tuple�argrrr�	SUBSCRIPTQs8"���
��
"�zChecker.SUBSCRIPTcsztt�jjj��}Wnty&}z��tj�|�WYd}~dSd}~wwd�d�t��t��������fdd�}|D][\}}}}||�rKdS|dur�ztt|��}Wntys}z��tj�|�WYd}~dSd}~ww|D]"\}}	}
}|
dur�d|
vr���tj�d�dS||	�r�dSqvq>t	dd��j
D��s�t	dd��jD��r�dSttt
�j
���}d	d
��jD�}|�}
|�}��B||B}|
r��tj�d�tdd�|
D����|r��tj�d�t|���|�r��tj�d�td
d�|D����dSdS)Nrcs�|durdS|�d�\}}}|�d�\}}}zt|�}Wn	ty%Ynw�dur3��tj��dSd�|dkrN�durF��tj��dSd��}�d7�t|t�rZ��|�dS��|�dS)z9Returns True if there is an error which should early-exitNFr��[T�r<)�	partition�intr?r\r�StringDotFormatMixingAutomaticr�add)�fmtkeyr���auto�	next_autor"�placeholder_named�placeholder_positionalrbrr�_add_key�s2�


�z3Checker._handle_string_dot_format.<locals>._add_key�{zMax string recursion exceededcs��|]	}t|tj�VqdSr�rr�Starred�rr�rrrr(���z4Checker._handle_string_dot_format.<locals>.<genexpr>css�|]}|jduVqdSr�r��r�kwdrrrr(�s�cS�h|]}|j�qSrr�r�rrr�	<setcomp>�r	z4Checker._handle_string_dot_format.<locals>.<setcomp>r[csr$r�r��rr�rrrr(�r)csr$rr�r�rrrr(�r))rY�parse_format_stringr$rr?r\r�StringDotFormatInvalidFormatr_rr!�keywords�ranger=�'StringDotFormatExtraPositionalArgumentsrera�"StringDotFormatExtraNamedArguments�StringDotFormatMissingArgument)rbr"�placeholdersr�r�r�r��spec�spec_placeholders�spec_fmtkey�	spec_spec�substitution_positional�substitution_named�extra_positional�extra_named�missing_argumentsrr�r�_handle_string_dot_formatws���'�������������z!Checker._handle_string_dot_formatcCsZt|jtj�r"t|jjtj�r"t|jjjt�r"|jjdkr"|�|�g}g}g}t	|jd|j
�rUt|j�dkrU|�
��|�|jd|�Wd�n1sOwYn�t	|jd|j
�r�|dg7}|dd�|jdd�D�7}|d	g7}|d
d�|jD�7}|dd�|jD�7}n�t	|jd|j
�r�t|j�dkr�t|jdtj�r�|dg7}||jdj7}|d
d�t|j�D�7}|d	g7}|dd�|jD�7}|dd�|jD�7}n}t	|jd|j
��rRt|j�dk�r9t|jdtjtjf��r9tdd�|jdjD���r9|dg7}|dd�|jdjD�7}|dd�|jdjD�7}|dd�t|j�D�7}|dd�|jdjD�7}|d	g7}|dd�|jD�7}|dd�|jD�7}|�r�|�
tj��|D]\}}|j||d��q^|j||d�Wd�n	1�s}wY|�
��|D]	}|�||��q�Wd�dS1�s�wYdS|�|�dS)Nr��castr<r�TypeVarr!cSsg|]}|�qSrrr�rrrrsz Checker.CALL.<locals>.<listcomp>r�cSsg|]
}|jdkr|j�qS)�bound)r�r�r�krrrr�cSs$g|]}||jdkr
dgndf�qS)rrNr�rrrrrs���	TypedDictcS�&g|]\}}||dkrdgndf�qS)r<rdNr�rrKr�rrrr���cSrr�rrrrrrr	cS�g|]}|dgf�qSrrrrrrr��
NamedTuplecss0�|]}t|tjtjf�ot|j�dkVqdS)rN)rrr*r�r=r,r�rrrr( s��
�zChecker.CALL.<locals>.<genexpr>cSsg|]}|jd�qS�r<�r,r&rrrr$rcSsg|]	}|jddf�qS)rNrr&rrrr%scSr)r<r,Nrr
rrrr&rcSsg|]}|df�qSrrr&rrrr*scSrrrrrrrr.r	cSrrrrrrrr/rr�)rr$rr2rrr�r3rrr=r=r!rr�r��Dictrd�	enumerater*r�r+r,rrrC)rbr"ru�	annotated�
not_annotated�na_node�na_omit�annotated_noderrr�CALL�s����
�
��


� 
�
�
��
�
�
�$�zChecker.CALLcCsbzt|jj�}Wnty|�tj|d�YdSwt�}d}d}|D]t\}}|dur-q$|\}}}	}
}|dkr9q$|tvrE|�tj	||�|durO|rO|du}|	|
fD]}|durkd|vrk|sg|�tj
|�qS|d7}qS|r||dur||�tj|�dS|s�|dur�|�tj|�dS|r�|d7}q$|�|�q$t
|jtjtjf�r�tdd�|jjD��s�t|jj�}
|r�||
kr�|�tj|||
�n	|s�|�tj|�t
|jtj��r)tdd�|jjD���r+|r�|dkr�|�tj|�dSd	d
�|jjD�}||}||}|�s|�r|�tj|d�t|���|�s-|�r/|�tj|d�t|���dSdSdSdSdS)Nzincomplete formatrr;r�r<csr�rr�r&rrrr(|rz1Checker._handle_percent_format.<locals>.<genexpr>css(�|]}t|tj�ot|jt�VqdSr)rrrrr�rrrrr(�s
��
�cSr�rrrrrrr��r	z1Checker._handle_percent_format.<locals>.<setcomp>r[)rZr�rr?r\r�PercentFormatInvalidFormatr_�VALID_CONVERSIONS�'PercentFormatUnsupportedFormatCharacter�!PercentFormatStarRequiresSequence�$PercentFormatMixedPositionalAndNamedr�rr�rr�r*rr,r=�$PercentFormatPositionalCountMismatch�PercentFormatExpectedMappingrr+r��PercentFormatExpectedSequence� PercentFormatExtraNamedArgumentsrera�PercentFormatMissingArgument)rbr"r��named�positional_count�
positionalr��placeholderr4rQrSrT�part�substitution_count�substitution_keys�
extra_keys�missing_keysrrr�_handle_percent_format=s��������
����������zChecker._handle_percent_formatcCsBt|jtj�rt|jtj�rt|jjt�r|�|�|�	|�dSr)
rr�r�Modr�rrr�r0rCrtrrr�BINOP�s���
z
Checker.BINOPcCsFt|jt�r|jr!t�|j|j||j|jt	j
�}|�|�dSdSdSr)rrr�r�r'r�r�r�r�rr�rO)rbr"r�rrr�CONSTANT�s��zChecker.CONSTANTcCsZ|�|�|j}t|tj�rt|j�r|�tj	|�dSdSt|�r+|�tj	|�dSdSr)
rC�excrr�Callr�r$r\r�RaiseNotImplemented)rbr"r�rrr�RAISE�s

��z
Checker.RAISEFcCsV|jstdd�|jD��s|�tj|�d|j|_}z|�|�W||_dS||_w)Ncsr�r)rr�FormattedValuer�rrrr(�r�z$Checker.JOINEDSTR.<locals>.<genexpr>T)�_in_fstringrrdr\r�FStringMissingPlaceholdersrC)rbr"rQrrr�	JOINEDSTR�s��zChecker.JOINEDSTRc	s�dd��jD�}t|�}dd�|��D�}|D]D��fdd�t|�D�}t�fdd�|D��}tdd�|��D��r[|D]}�j|}t�t�rR|�tj	|�j
�q<|�tj|��q<q|���dS)NcSsg|]}t|��qSrry)rrMrrrr�s�z Checker.DICT.<locals>.<listcomp>cSsg|]
\}}|dkr|�qSrr)rrM�countrrrr�s
�csg|]
\}}|�kr|�qSrr)rrK�i_key)rMrrr�r
c3s�|]
}t�j|�VqdSr)rzrd)rr>r!rrr(�s
��
�zChecker.DICT.<locals>.<genexpr>css�|]	\}}|dkVqdS)r<Nr)rrr<rrrr(�r�)
r�rprmrrrr|r\r�MultiValueRepeatedKeyVariabler4�MultiValueRepeatedKeyLiteralrC)	rbr"r��
key_counts�duplicate_keys�key_indicesrd�	key_index�key_noder)rMr"r�DICT�s6���

���zChecker.DICTcC�6t|jtj�r|jjgkr|�tj|�|�|�dSr)	r�testrr*r,r\r�IfTuplerCrtrrr�IF
�z
Checker.IFcCrFr)	rrGrr*r,r\r�AssertTuplerCrtrrr�ASSERTrJzChecker.ASSERTcs�|��rdnd}|j|}|j|urC|jD]/�t�|�}�fdd�|jD�|_|��|�||f|_|j|dd�D]}||�<q;qdSdS)z5
        Keep track of globals declarations.
        r<rcs*g|]}t|tj�r|jd�kr|�qS)r)rrr��message_args)r�m��	node_namerrr*s
��z"Checker.GLOBAL.<locals>.<listcomp>N)rSr=r�r�r�r�
setdefaultr�)rbr"�global_scope_index�global_scope�
node_valuer�rrOr�GLOBALs




�

��zChecker.GLOBALcCs:|�t��|�|�Wd�dS1swYdSr)rAr�rCrtrrr�GENERATOREXP9s"�zChecker.GENERATOREXPcCs�t|jtj�r.|�||�|��|jdkr(t|jt�r*t|j	tj
�r,d|j_dSdSdSdSt|jtj�r<|�
|�dSt|jtj�rJ|�|�dStd|j����)zV
        Handle occurrence of Name (which can be a load/store/delete access.)
        �localsTz#Got impossible expression context: N)rrrr�Loadr�rhr1r�r�rsr5r��Storer��Delr�r@rtrrr�NAME?s��zChecker.NAMEcCs�|}t|d�r.|j|}}t|tjtjtjf�r||jvrdSt|tjtj	f�r)nt|d�st|tj
�r=|�tj
|�dS|�tj|�dSru)r�rsrrr��For�AsyncForrr�ClassDef�Continuer\r�ContinueOutsideLoop�BreakOutsideLoop)rbr"r�n_childrrr�CONTINUERs


�zChecker.CONTINUEcCsXt|jttf�r|�tj|�dS|jr#t|jd�r#|jj	s#|j|j_	|�
|j|�dS)Nr�)rr�r�r�r\r�ReturnOutsideFunctionrr�r�r�rtrrr�RETURNfs�
��
zChecker.RETURNcCs4t|jttf�r|�tj|�dS|�|j|�dSr)	rr�r�r�r\r�YieldOutsideFunctionr�rrtrrr�YIELDssz
Checker.YIELDcs��jD]}��|��q�����
����Wd�n1s!wY���t�j����jrI���sKt	�j
t�sM����fdd��dSdSdSdS)Nc�
����Sr�r�r�r"rbrrr��
z%Checker.FUNCTIONDEF.<locals>.<lambda>)
rr��_type_param_scope�LAMBDArBr�r4r:rSrr�r�rO)rbr"�decorrjr�FUNCTIONDEF|s
��
��zChecker.FUNCTIONDEFc
sPg}g}�jjD]}|�|j�|�|j�q�jj�jjD]}|�|j�|�|j�q�jj�jj}t�t	j
�}dD]}t�j|�}|sJq?|�|j�|rX|�|j�q?|ra|��j�t
t|��t
|�kr�t|�D]\}	}||d|	�vr���tj�|�qo|D]}
��|
��q�|D]}��|��q���fdd�}��|�dS)N)�vararg�kwargcs>��t���j�dd�Wd�dS1swYdS)N)r�returns�type_paramsr�)rAr�rCrrjrr�runFunction�s�"�z#Checker.LAMBDA.<locals>.runFunction)r!�posonlyargsr�r�r��
kwonlyargs�defaults�kw_defaultsrr�Lambdarrrrr=r_rr\r�DuplicateArgumentr�r�rO)
rbr"r!�annotationsr�rw�has_annotations�arg_name�wildcard�idxr��defaultrtrrjrrm�s>��zChecker.LAMBDAcCs|j|dd�dS)N)rwrxr�)rCrtrrr�	ARGUMENTS�r/zChecker.ARGUMENTScCs|�|t|j|�|���dSr)rBr�r�r�rtrrr�ARG�szChecker.ARGc	s��jD]}��|��q�����X�jD]}��|��q�jD]}��|��q!��t��+�jrG���sGt	�j
t�sG����fdd���j
D]}��|��qJWd�n1s]wYWd�n1slwY���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.
        crhrrirrjrrr�rkz"Checker.CLASSDEF.<locals>.<lambda>N)rr�rl�basesr�rAr�r:rSrr�r�rOr
rBr�r4)rbr"rn�baseNode�keywordNode�stmtrrjr�CLASSDEF�s*


�
�
����zChecker.CLASSDEFcCs.|�|j|�|�|j|�|�|j|�dSr)r��targetr�rrtrrr�	AUGASSIGN�szChecker.AUGASSIGNcCs�t|jtj�r@d}d}t|j�D]\}}t|tj�r)|r%|�tj	|�nd}|}q|dks9t
|j�|ddkr@|�tj|�|�|�dS)NFr�T�r<i)
rrrrrYrr,r�r\r�TwoStarredExpressionsr=�%TooManyExpressionsInStarredAssignmentrC)rbr"�has_starred�star_locrKrrrr�TUPLE�s�z
Checker.TUPLEcCsT|jD]$}d|jvr|jst|j|�}n
|jp|j}t|||j�}|�||�qdSr�)r�r4�asnamer�r�rB)rbr"�alias�importationr4rrr�IMPORT�s
�zChecker.IMPORTcCs|jdkr|js|�tj|�nd|_d|j|jpd}|jD]`}|jp'|j}|jdkrLt	|||j
�}|jtjvrC|�tj
||j�|jdkrKd|_n.|jdkrrt|j
t�s`|�tj||�q d|j
_|�tj||�t||�}nt||||j�}|�||�q dS)Nr�Fr�r�r{Tr�)r�rTr\r�LateFutureImport�levelr�r�r4r�r�r��all_feature_names�FutureFeatureNotDefinedrVrr��ImportStarNotPermittedr��ImportStarUsedr�r�rB)rbr"r�r�r4r�rrr�
IMPORTFROMs>
�

�
�
���zChecker.IMPORTFROMcCs�g}t|j�D]:\}}t|jtj�r!|jjD]	}|�t|��qn|jr,|�t|j��|jdurA|t	|j�dkrA|�
tj|�q|j
�|�|jD]}|�||�qK|j
��|j|dd�dS)Nr<r
r�)rrrrrr*r,r�rr=r\r�DefaultExceptNotLastr;r
r�rWrC)rbr"�
handler_namesrKrR�exc_typer�rrr�TRY!s ��

zChecker.TRYcCs�|jdur|�|�dS|j|jvr|�|�z	|j�|j�}Wnty+d}Ynw|�|�|�|�z	|j�|j�}Wn	tyHYn
w|jsU|�tj	||j�|r_||j|j<dSdSr)
r4rCr�r�rWr?r�r\rr])rbr"�prev_definitionr�rrr�
EXCEPTHANDLER7s,


�

��zChecker.EXCEPTHANDLERcCsT|�|j|�|jr!t|jd|j�r|�|j|�n|�|j|�|�|j|�dS)N�	TypeAlias)r�r�rrr=r�r�rtrrr�	ANNASSIGNdszChecker.ANNASSIGNcCs`|j}t|j|j�D]\}}t|tjtjf�r&t|�st|�r&|�	t
j|�|}q
|�|�dSr)
r��zip�ops�comparatorsrr�Is�IsNotr.r\r�	IsLiteralrC)rbr"r�r�r�rrr�COMPAREos���zChecker.COMPAREcCs|�|�|�|�dSr)r�rCrtrrr�
_match_target�s
zChecker._match_targetccsh�t���%}tjdkr|�|�t��|jD]}|�||�qdVWd�dS1s-wYdS)N)r
�)	�
contextlib�	ExitStackrr�
enter_contextrAr�rsr�)rbr"rr�paramrrrrl�s�


"�zChecker._type_param_scopecCs|�|�|�|j|�dSr)r�r�rrtrrr�TYPEVAR�s
zChecker.TYPEVARcCsL|�|j|�|�|��|�|j|�Wd�dS1swYdSr)r�r4rlr�rrtrrr�	TYPEALIAS�s"�zChecker.TYPEALIASr)�rhrirjrkr�Moduler�r^r�rr�rry�ListCompr��SetComp�GeneratorExp�DictCompr>r�rMrrr�r_�builtin_varsr9�_MAGIC_GLOBALSr8r`r�rl�_customBuiltIns�updater�r�rOrDrSr�rT�setterrVr�r��contextmanagerrArEr\rhrwr}r�r�r�rBr�r�r�r�r�rrr�rCr�r�r�r��doctest�
DocTestParser�get_examplesr�r�r,r�r�r*r�r��DELETE�FOR�ASYNCFOR�WHILE�WITH�WITHITEM�	ASYNCWITH�EXPR�ASSIGN�PASS�BOOLOP�UNARYOP�SET�	ATTRIBUTE�STARRED�NAMECONSTANT�	NAMEDEXPRr�rrr0r2r3�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�MATMULTr7�
COMPREHENSION�KEYWORD�FORMATTEDVALUEr9r;rErI�IFEXPrLrU�NONLOCALrV�LISTCOMP�DICTCOMP�SETCOMPr[rc�BREAKrerg�AWAIT�	YIELDFROMro�ASYNCFUNCTIONDEFrmr�r�r�r�r��LISTr�r�r��TRYSTARr�r�r��MATCH�
MATCH_CASE�
MATCHCLASS�MATCHOR�
MATCHSEQUENCE�MATCHSINGLETON�
MATCHVALUEr��MATCHAS�MATCHMAPPING�	MATCHSTARrlr�r�rrrrr-�sH�

�!






B	1
T*



 

��&sSj	
*������������������$
-	 -
r-)Srkr�rIrr3r�r�r'r`�rer8rrF�pyflakesrr��PYPYr�r��	Formatterr�r�rr\r]rir#r-r%r.r5�compiler@rCrDrErF�	frozensetrr:rZr�r[rprxrzr�r�r�r�r}r|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr*r,r-rrrr�<module>s�

	




@ (%
1%
,