
    c?+                    R   d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZ e
j        dk    Z ee
d          Z ee          Z e	j                    j        Zd Zej        ej        fZerd Znd Zd	 Zerd
 Znd Zd Zd Z ej         d          Z! ej         d          Z" ej         d          Z# ej         d          Z$ ej         d          Z% e&d          Z'd Z(d Z) G d de*          Z+d Z,d e+            fdZ-d Z.d Z/ G d d          Z0 G d de0          Z1 G d  d!e1          Z2 G d" d#          Z3 G d$ d%          Z4 G d& d'e1          Z5 G d( d)e5          Z6 G d* d+e5          Z7 G d, d-e5          Z8 G d. d/e7          Z9 G d0 d1e0          Z: G d2 d3e0          Z; G d4 d5e;          Z< G d6 d7e0          Z= G d8 d9e1          Z> G d: d;e1          Z? G d< d=e0          Z@ G d> d?e*          ZA G d@ dAeA          ZB G dB dCeA          ZC G dD dEeA          ZD G dF dGeA          ZE G dH dIeE          ZF G dJ dK          ZGg dLZHdM ZI e&dN          ZJdO ZKdP ZLdQ ZMdR ZN G dS dT          ZOdU ZPdV ZQ G dW dX          ZRdS )Yz]
Main module.

Implement the central Checker class.
Also, it models the Bindings and Scopes.
    N)messages)      pypy_version_infoc                     t          | t          j                  r| j        gS t          | t          j                  r"| j        | j        z   gd | j        D             z   S d S )Nc                     g | ]}|gS  r	   ).0hdls     0lib/python3.11/site-packages/pyflakes/checker.py
<listcomp>z#getAlternatives.<locals>.<listcomp>!   s    %B%B%Bse%B%B%B    )
isinstanceastIfbodyTryorelsehandlers)ns    r   getAlternativesr      sh    !SV x!SW C!"%B%Bqz%B%B%BBBC Cr   c                     t          | t          j                  o;t          | j        t          t          t                    t          d           f          S N)r   r   ConstantvaluebooltypeEllipsisnodes    r   _is_singletonr!   '   s>    tS\** GtzD$x..$t**#EFF	
r   c                 N    t          | t          j        t          j        f          S r   )r   r   NameConstantr   r   s    r   r!   r!   -   s    $!13< @AAAr   c                 r    t          | t          j                  ot          d | j        D                       S )Nc              3   4   K   | ]}t          |          V  d S r   )_is_constantr
   elts     r   	<genexpr>z%_is_tuple_constant.<locals>.<genexpr>4   s*      33#L333333r   )r   r   Tuplealleltsr   s    r   _is_tuple_constantr-   1   s7    4## 	43333333r   c                 T    t          | t          j                  pt          |           S r   )r   r   r   r-   r   s    r   r&   r&   9   s"    $--I1CD1I1IIr   c                     t          | t          j        t          j        t          j        f          pt          |           pt          |           S r   )r   r   StrNumBytesr!   r-   r   s    r   r&   r&   <   sA    tcgsw	:;; %$%t$$	
r   c                 @    t          |           ot          |            S r   )r&   r!   r   s    r   _is_const_non_singletonr4   D   s     9mD&9&9"99r   c                     t          | t          j                  r| j        |k    p$t          | t          j                  o
| j        |k    S r   )r   r   Nameid	Attributeattr)r    names     r   _is_name_or_attrr;   H   sB    	D#(	#	#	74 	@	D#-	(	(	>TY$->r   z\(([^()]*)\)z[#0+ -]*z
(?:\*|\d*)z(?:\.(?:\*|\d*))?z[hlL]?zdiouxXeEfFgGcrsa%c                 :    |                      ||          }|J |S r   )match)regexstringposr=   s       r   _must_matchrA   X   s&    KK$$ELr   c                 <      fd}t           |                      S )zParses the string component of a `'...' % ...` format call

    Copied from https://github.com/asottile/pyupgrade at v1.20.1
    c               3      K   d} d}d}d}|t                    k     r|sA	                     d|          }|}|dz  }d}n# t          $ r | d          d fV  Y d S w xY wt                              |          }|r*|                    d          }|                                }nd }t          t          |          }|                                pd }|                                }t          t          |          }|                                pd }	|                                }t          t          |          }
|
                                pd }|
                                }t          t          |                                          }	 |         }n# t          $ r t          d          w xY w|dz  }|||	||f}| |         |fV  d}|} |t                    k     |rt          d          d S )Nr   F%   Tz"end-of-string while parsing format)lenindex
ValueErrorMAPPING_KEY_REr=   groupendrA   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ss                 r   _parse_innerz*parse_percent_format.<locals>._parse_innerd   sd     
#a&&j ,	! +!"QA
 "#JFA!FF "   LMM*D0000FF +00A66	 #//!,,C!AAC(34F1(M(M%"7"="="?"?"G4)--//)(Aq99#))++3tOO%%"-lAq"A"A+1133;t	#''))  	1a004466K!"1JJ! K K K$%IJJJKQOUIzJZ/0#5555 Y #a&&j ,	!\  	CABBB	C 	Cs   A A A F F8)tuple)r_   r`   s   ` r   parse_percent_formatrb   ^   s8    5C 5C 5C 5C 5Cn    r   c                       e Zd ZdZd Zd ZdS )_FieldsOrderzFix order of AST node fields.c                     |j         }d|v rdj        }nd|v rdj        }ndj        }t          t          ||d                    S )Niter
generatorsr   T)rV   reverse)_fieldsfindra   sorted)self
node_classfields	key_firsts       r   _get_fieldsz_FieldsOrder._get_fields   s[    #V 	%IIV# 	%$)IIIVF	4@@@AAAr   c                 :    |                      |          x| |<   }|S r   )rp   )rl   rm   rn   s      r   __missing__z_FieldsOrder.__missing__   s$    $($4$4Z$@$@@Z6r   N)__name__
__module____qualname____doc__rp   rr   r	   r   r   rd   rd      s;        ''	B 	B 	B    r   rd   c                 L    i }| D ]}|                     |d          dz   ||<   |S )z|
    Simplest required implementation of collections.Counter. Required as 2.6
    does not have Counter in collections.
    r   rE   )get)itemsresultsitems      r   counterr|      s;    
 G 1 1D!,,q0Nr   c              #     K   || j                  D ]q}|r||v r	t          | |d          }t          |t          j                  r|V  9t          |t
                    r#|D ] }t          |t          j                  r|V  !rdS )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__getattrr   r   ASTlist)r    omit_fields_orderr:   fieldr{   s         r   iter_child_nodesr      s       dn- 	 	 	DDL 	dD))eSW%% 	KKKKt$$ 	  dCG,, JJJ	 	r   c                 V   t          | t          j                  r| j        S t	          t          d          r!t          | t          j                  r| j        S t          | t          j                  rt          d | j        D                       S t          | t          j	                  r| j
        S t          | t          j                  r1t          |           }ddd d}|                    |j        |          S t          | t          j                  r| j        S t#                      S )Nr2   c              3   4   K   | ]}t          |          V  d S r   convert_to_value)r
   rT   s     r   r)   z#convert_to_value.<locals>.<genexpr>   s+      <<Q%a((<<<<<<r   )r{   TF)TrueFalseNone)r   r   r0   r_   hasattrr2   r*   ra   r,   r1   r   r6   VariableKeyrx   r:   r#   r   UnhandledKeyType)r{   resultconstants_lookups      r   r   r      s   $   "v	g		 ":dCI#>#> "v	D#)	$	$ "<<$)<<<<<<	D#'	"	" "v	D#(	#	# "$'''
 

  ##K
 
 	
 
D#*	+	+ "z!!!r   c                 \    t          | t          j                  ot          |           dk    S )NNotImplemented)r   r   r6   getNodeNamer   s    r   is_notimplemented_name_noder      s'    dCH%%O+d*;*;?O*OOr   c                   *    e Zd ZdZd Zd Zd Zd Zd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.
    c                 0    || _         || _        d| _        d S NF)r:   sourceused)rl   r:   r   s      r   __init__zBinding.__init__   s    				r   c                     | j         S r   )r:   rl   s    r   __str__zBinding.__str__  s
    yr   c                 ~    d                     | j        j        | j        | j        j        t          |                     S )Nz)<{} object {!r} from line {!r} at 0x{:x}>)formatr~   rs   r:   r   linenor7   r   s    r   __repr__zBinding.__repr__  s8    :AAN#IKtHH	
 
 	
r   c                 L    t          |t                    o| j        |j        k    S r   )r   
Definitionr:   rl   others     r   	redefineszBinding.redefines  s     %,,Hej1HHr   N)rs   rt   ru   rv   r   r   r   r   r	   r   r   r   r      s_        	 	  
  
 
 
I I I I Ir   r   c                       e Zd ZdZdS )r   z7
    A binding that defines a function or a class.
    Nrs   rt   ru   rv   r	   r   r   r   r                r   r   c                   (     e Zd ZdZ fdZd Z xZS )Builtinz-A definition created for all Python builtins.c                 L    t                                          |d            d S r   )superr   )rl   r:   r~   s     r   r   zBuiltin.__init__  s#    t$$$$$r   c                 h    d                     | j        j        | j        t	          |                     S )Nz<{} object {!r} at 0x{:x}>)r   r~   rs   r:   r7   r   s    r   r   zBuiltin.__repr__  s0    +22N#ItHH
 
 	
r   )rs   rt   ru   rv   r   r   __classcell__r~   s   @r   r   r     sM        77% % % % %
 
 
 
 
 
 
r   r   c                       e Zd ZdZdS )r   zS
    A dictionary key of a type that we cannot or do not check for duplicates.
    Nr   r	   r   r   r   r   %  r   r   r   c                   $    e Zd ZdZd Zd Zd ZdS )r   zY
    A dictionary key which is a variable.

    @ivar item: The variable AST object.
    c                     |j         | _        d S r   )r7   r:   )rl   r{   s     r   r   zVariableKey.__init__1  s    G			r   c                 B    |j         | j         k    o|j        | j        k    S r   )r~   r:   )rl   compares     r   __eq__zVariableKey.__eq__4  s%    / &LDI%	
r   c                 *    t          | j                  S r   )hashr:   r   s    r   __hash__zVariableKey.__hash__:  s    DIr   N)rs   rt   ru   rv   r   r   r   r	   r   r   r   r   +  sK         
  
 
 
    r   r   c                   L     e Zd ZdZd fd	Zd Zd Zed             Zd Z	 x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}
    Nc                 l    |p|| _         g | _        t                                          ||           d S r   )fullName	redefinedr   r   )rl   r:   r   	full_namer~   s       r   r   zImportation.__init__G  s6    !)Tv&&&&&r   c                     t          |t                    r| j        |j        k    S t          |t                    o| j        |j        k    S r   )r   SubmoduleImportationr   r   r:   r   s     r   r   zImportation.redefinesL  sB    e122 	3=EN22%,,Hej1HHr   c                 V    | j                             d          d         | j        k     S )z.Return whether importation needs an as clause..)r   splitr:   r   s    r   
_has_aliaszImportation._has_aliasR  s'    =&&s++B/49<<<r   c                 b    |                                  rd| j         d| j         S d| j        z  S )z5Generate a source statement equivalent to the import.import  as z	import %sr   r   r:   r   s    r   source_statementzImportation.source_statementV  s=     ?? 	/;T];;	;;;..r   c                 \    |                                  r| j        dz   | j        z   S | j        S z#Return import full name with alias.r   r   r   s    r   r   zImportation.__str__^  s0    ?? 	!=6)DI55= r   r   )rs   rt   ru   rv   r   r   r   propertyr   r   r   r   s   @r   r   r   >  s         ' ' ' ' ' '
I I I= = = / / X/! ! ! ! ! ! !r   r   c                   H     e Zd ZdZ fdZ fdZd Zed             Z x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.
    c                     d|v r|rt          |t          j                  sJ |                    d          d         }t	                                          ||           || _        d S )Nr   r   )r   r   Importr   r   r   r   )rl   r:   r   package_namer~   s       r   r   zSubmoduleImportation.__init__w  sb    d{MFMj.L.LMMMzz#q)v...r   c                     t          |t                    r| j        |j        k    S t                                          |          S r   )r   r   r   r   r   )rl   r   r~   s     r   r   zSubmoduleImportation.redefines~  s<    e[)) 	3=EN22ww  '''r   c                     | j         S r   r   r   s    r   r   zSubmoduleImportation.__str__  s
    }r   c                     d| j         z   S )Nr   r   r   s    r   r   z%SubmoduleImportation.source_statement  s    4=((r   )
rs   rt   ru   rv   r   r   r   r   r   r   r   s   @r   r   r   f  s              ( ( ( ( (
   ) ) X) ) ) ) )r   r   c                   <     e Zd Zd fd	Zd Zed             Z xZS )ImportationFromNc                     || _         |p|| _        |                    d          r|| j        z   }n|dz   | j        z   }t                                          |||           d S Nr   )module	real_nameendswithr   r   )rl   r:   r   r   r   r   r~   s         r   r   zImportationFrom.__init__  sj    "*d??3 	6/IIt~5Ivy11111r   c                 T    | j         | j        k    r| j        dz   | j        z   S | j        S r   )r   r:   r   r   s    r   r   zImportationFrom.__str__  s/    >TY& 	!=6)DI55= r   c                 z    | j         | j        k    rd| j         d| j          d| j         S d| j         d| j         S )Nfrom z import r   )r   r:   r   r   s    r   r   z ImportationFrom.source_statement  sQ    >TY& 	<O4;OOOODIOOO;4;;;	;;;r   r   )rs   rt   ru   r   r   r   r   r   r   s   @r   r   r     sg        	2 	2 	2 	2 	2 	2! ! ! < < X< < < < <r   r   c                   >     e Zd ZdZ fdZed             Zd Z xZS )StarImportationz3A binding created by a 'from x import *' statement.c                 n    t                                          d|           |dz   | _        || _        d S )N*z.*)r   r   r:   r   )rl   r:   r   r~   s      r   r   zStarImportation.__init__  s5    f%%% 4K	r   c                     d| j         z   dz   S )Nr   z	 import *r   r   s    r   r   z StarImportation.source_statement  s    &44r   c                 R    | j                             d          r| j        S | j        S r   )r   r   r   r:   r   s    r   r   zStarImportation.__str__  s+    =!!#&& 	((9r   )	rs   rt   ru   rv   r   r   r   r   r   r   s   @r   r   r     sh        ==     5 5 X5      r   r   c                   "     e Zd ZdZ fdZ xZS )FutureImportationzs
    A binding created by a from `__future__` import statement.

    `__future__` imports are implicitly used.
    c                 `    t                                          ||d           ||f| _        d S )N
__future__)r   r   r   )rl   r:   r   scoper~   s       r   r   zFutureImportation.__init__  s.    v|444FO			r   rs   rt   ru   rv   r   r   r   s   @r   r   r     sB         $ $ $ $ $ $ $ $ $r   r   c                       e Zd ZdZdS )Argumentz3
    Represents binding a name as an argument.
    Nr   r	   r   r   r   r     r   r   r   c                       e Zd ZdZdS )
Assignmenta  
    Represents binding a name with an explicit assignment.

    The checker will raise warnings for any Assignment that isn't used. Also,
    the checker does not consider assignments in tuple/list unpacking to be
    Assignments, rather it treats them as simple Bindings.
    Nr   r	   r   r   r   r     s           r   r   c                       e Zd ZdZdS )NamedExprAssignmentzB
    Represents binding a name with an assignment expression.
    Nr   r	   r   r   r   r     r   r   r   c                       e Zd ZdZd ZdS )
Annotationa  
    Represents binding a name to a type without an associated value.

    As long as this name is not assigned a value in another binding, it is considered
    undefined for most purposes. One notable exception is using the name as a type
    annotation.
    c                     dS )zAAn Annotation doesn't define any name, so it cannot redefine one.Fr	   r   s     r   r   zAnnotation.redefines  s    ur   N)rs   rt   ru   rv   r   r	   r   r   r   r     s-             r   r   c                       e Zd ZdS )FunctionDefinitionNrs   rt   ru   r	   r   r   r   r             Dr   r   c                       e Zd ZdS )ClassDefinitionNr   r	   r   r   r   r     r   r   r   c                   "     e Zd ZdZ fdZ xZS )ExportBindinga  
    A binding created by an C{__all__} assignment.  If the names in the list
    can be determined statically, they will be treated as names for export and
    additional checking applied to them.

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

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

    Names which are imported and not otherwise used but appear in the value of
    C{__all__} will not have an unused import warning reported for them.
    c                 $    d|v r:t          |t          j                  r t          |d         j                   _        ng  _         fd}t          |j        t          j        t          j        f          r ||j                   nt          |j        t          j                  r|j        }t          |j	        t          j        t          j        f          r|j
        }|j	        } ||           t          |t          j                  r|}n3t          |t          j        t          j        f          r ||           n,n+t          |j	        t          j        t          j        f          t                                          ||           d S )N__all__c                     | j         D ];}t          |t          j                  rj                            |j                   <d S r   )r,   r   r   r0   namesappendr_   )	containerr    rl   s     r   _add_to_namesz-ExportBinding.__init__.<locals>._add_to_names
  sK    ! . .dCG,, .J%%df---. .r   )r   r   	AugAssignr   r  r   Listr*   BinOprightleftr   r   )	rl   r:   r   r   r  currentValuer  r
  r~   s	   `       r   r   zExportBinding.__init__  s|    	*VS]"C"C 	eI.455DJJDJ	. 	. 	. 	. 	.
 flSXsy$9:: 	M&,''''ci00 	!<L\/#(CI1FGG #($*e$$$dCI.. 	#'LLsx&;<< !M$'''  \/#(CI1FGG  	v&&&&&r   r   r   s   @r   r   r     sB         ' ' ' ' ' ' ' ' 'r   r   c                       e Zd ZdZd ZdS )ScopeFc                 ~    | j         j        }d| dt          |           ddt                              |            dS )N<z at 0xx >)r~   rs   r7   dictr   )rl   	scope_clss     r   r   zScope.__repr__)  sB    N+	G9GGBtHHGGGt1D1DGGGGr   N)rs   rt   ru   importStarredr   r	   r   r   r  r  &  s-        MH H H H Hr   r  c                       e Zd ZdS )
ClassScopeNr   r	   r   r   r  r  .  r   r   r  c                   :     e Zd ZdZdZh dZ fdZd Zd Z x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__c                     t                                                       | j                                        | _        d | _        d S r   )r   r   
alwaysUsedcopyglobalsreturnValue)rl   r~   s    r   r   zFunctionScope.__init__<  s<    ++--r   c              #      K   |                                  D ]=\  }}|j        s1|dk    r+|| j        vr"| j        st	          |t
                    r||fV  >dS )zR
        Return a generator for the assignments which have not been used.
        _N)ry   r   r!  
usesLocalsr   r   rl   r:   bindings      r   unused_assignmentsz FunctionScope.unused_assignmentsB  s       "ZZ\\ 	$ 	$MD'L $CK$,$ $ w
33	$
 Gm###	$ 	$r   c              #      K   |                                  D ]'\  }}|j        st          |t                    r||fV  (dS )zR
        Return a generator for the annotations which have not been used.
        N)ry   r   r   r   r&  s      r   unused_annotationsz FunctionScope.unused_annotationsN  sY       "ZZ\\ 	$ 	$MD'< $Jw
$C$C $Gm###	$ 	$r   )
rs   rt   ru   rv   r%  r  r   r(  r*  r   r   s   @r   r  r  2  sx         
 J. . .J         
$ 
$ 
$$ $ $ $ $ $ $r   r  c                       e Zd ZdS )GeneratorScopeNr   r	   r   r   r,  r,  W  r   r   r,  c                       e Zd ZdZdZdZdS )ModuleScopezScope for a module.TFN)rs   rt   ru   rv   _futures_allowed_annotations_future_enabledr	   r   r   r.  r.  [  s"        "'r   r.  c                       e Zd ZdZdS )DoctestScopezScope for a doctest.Nr   r	   r   r   r2  r2  a  s        r   r2  c                   "    e Zd Z e            ZdS )DetectClassScopedMagicN)rs   rt   ru   dirr  r	   r   r   r4  r4  e  s        CEEEEEr   r4  )__file____builtins____annotations__WindowsErrorc                     t          | d          r| j        S t          | d          r| j        S t          | d          r| j        S d S )Nr7   r:   rest)r   r7   r:   r;  r   s    r   r   r   n  sY    tT wtV ytV y r   )typingtyping_extensionsc                 ,   fd}fd}t          | t          j                  o || j                  p]t          | t          j                  oCt          | j        t          j                  o$ || j        j                  o | j                  S )aX  
    Internal helper to determine whether or not something is a member of a
    typing module. This is used as part of working out whether we are within a
    type annotation context.

    Note: you probably don't want to use this function directly. Instead see the
    utils below which wrap it (`_is_typing` and `_is_any_typing_member`).
    c                     t                    D ]M}| |v rGt          ||          t                    o)||          j        t          v o ||          j                  c S NdS r   )reversedr   r   r   TYPING_MODULESr   )r:   r   is_name_match_fnscope_stacks     r   _bare_name_is_attrz-_is_typing_helper.<locals>._bare_name_is_attr  s    k** 	 	Eu} uT{O<< <$K&.8<$$U4[%:;;   ur   c                     t                    D ]7}| |v r1t          ||          t                    o||          j        t          v c S 8dS r   )r@  r   r   r   rA  )r:   r   rC  s     r   _module_scope_is_typingz2_is_typing_helper.<locals>._module_scope_is_typing  sf    k** 	 	Eu} uT{K88 ;$K(N:   ur   )r   r   r6   r7   r8   r   r9   )r    rB  rC  rD  rF  s    ``  r   _is_typing_helperrG  {  s    	 	 	 	 	 	     tSX&& (tw''	
 tS]++ (tz38,,(##DJM22( TY''
r   c                 ,    t          | fd|          S )z
    Determine whether `node` represents the member of a typing module specified
    by `typing_attr`.

    This is used as part of working out whether we are within a type annotation
    context.
    c                     | k    S r   r	   )r  typing_attrs    r   <lambda>z_is_typing.<locals>.<lambda>  s    Q+-= r   rG  )r    rJ  rC  s    ` r   
_is_typingrM    s!     T#=#=#=#={KKKr   c                 &    t          | d |          S )z
    Determine whether `node` represents any member of a typing module.

    This is used as part of working out whether we are within a type annotation
    context.
    c                     dS NTr	   )r  s    r   rK  z'_is_any_typing_member.<locals>.<lambda>  s    T r   rL  )r    rC  s     r   _is_any_typing_memberrQ    s     T>>;???r   c                     t          | j        t          j        t          j        f          o$t          fd| j        j        D                       S )Nc              3   :   K   | ]}t          |d           V  dS )overloadN)rM  )r
   decrC  s     r   r)   z%is_typing_overload.<locals>.<genexpr>  sC       
 
 sJ44
 
 
 
 
 
r   )r   r   r   FunctionDefAsyncFunctionDefanydecorator_list)r   rC  s    `r   is_typing_overloadrZ    s^    5<#/33G!HII 	
 
 
 
 
|2
 
 
 	
 	
r   c                       e Zd ZdZdZdZdS )AnnotationStater   rE      N)rs   rt   ru   NONESTRINGBAREr	   r   r   r\  r\    s        DFDDDr   r\  c                 F     t          j                    fd            }|S )Nc                 x    |                                  5   | g|R i |cd d d            S # 1 swxY w Y   d S r   )_enter_annotationrl   argskwargsfuncs      r   in_annotation_funcz)in_annotation.<locals>.in_annotation_func  s    ##%% 	/ 	/4.t...v..	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/s   /33	functoolswrapsrg  rh  s   ` r   in_annotationrm    9    _T/ / / / / r   c                 F     t          j                    fd            }|S )Nc                     |                      t          j                  5   | g|R i |cd d d            S # 1 swxY w Y   d S r   )rc  r\  r_  rd  s      r   rh  z0in_string_annotation.<locals>.in_annotation_func  s    ##O$:;; 	/ 	/4.t...v..	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/s   :>>ri  rl  s   ` r   in_string_annotationrq    rn  r   c                   j   e Zd ZdZej        eej        eej	        e
ej        e
ej        e
ej        eej        eej        eej        ei	ZdZdZej        ZdZ ee                              e          Zej                             d          Z!e!r(e"                    e!#                    d                     [!dddej        v d	fd
Z$d Z%d Z&d Z'd Z(e)d             Z*e*j+        d             Z*e)d             Z,e,j+        d             Z,e)d             Z-d Z.d Z/e
fdZ0d Z1d Z2d Z3d Z4d Z5d Z6d Z7d Z8d Z9d  Z:d! Z;d" Z<d# Z=e>j?        ej@        fd$            ZAe)d%             ZBdOd&ZCd' ZDd( ZEd) ZFd* ZG eHjI                    jJ        ZKd+ ZLeMd,             ZNeOd-             ZPd. ZQeCxZRxZSxZTxZUxZVxZWxZXxZYZZeQZ[eCxZ\xZ]xZ^xZ_xZ`xZaZbd/ Zcd0 Zdd1 Zed2 Zfd3 Zgd4 Zheird5 ZjneQxZkxZlxZmZjeCxZnxZoZpeQxZqxZrxZsxZtxZuZveQxZwxZxxZyxZzxZ{xZ|xZ}xZ~xZxZxZxZxZxZxZxZxZxZxZxZxZxZxZxZxZxZxZxZZd6 ZeCxZxZZdZd7 Zd8 Zd9 ZeZd: Zd; ZeZd< ZexZxZZd= Zd> ZeZd? Zd@ ZexZZdA ZeZdB ZdC ZdD ZdE ZdF ZdG ZeZdH ZdI ZdJ ZeZdK ZdL ZdM ZeCxZxZxZxZZeCxZZdN ZexZxZZdS )PCheckera  
    I check the cleanliness and sanity of Python code.

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

    @ivar _deferredAssignments: Similar to C{_deferredFunctions}, but for
        callables which are deferred assignment checks.
    r   NFPYFLAKES_BUILTINS,z(none)PYFLAKES_DOCTESTr	   c                    i | _         g | _        g | _        g | _        g | _        || _        |r| j                            |          | _        || _        	 t          j
        t          |                               g| _        n # t          $ r t          d|z            w xY wdg| _        || _        | j        D ]%}|                     d t%          |                     &|                     |           d| _        |                     | j                   d | _        |                     | j                   d | _        | j        dd = |                                  |                                  |rt1          j        dd           d S d S )Nz$No scope implemented for the node %rr	   TrE   z1`file_tokens` will be removed in a future versionr]  )
stacklevel)_nodeHandlers_deferredFunctions_deferredAssignments
deadScopesr   filenamebuiltInsunionwithDoctestrs  _ast_node_scoper   
scopeStackKeyErrorRuntimeErrorexceptHandlersroot
addBindingr   handleChildren_in_deferredrunDeferredpopScopecheckDeadScopeswarningswarn)rl   treer}  builtinsr  file_tokensbuiltins          r   r   zChecker.__init__   s   "$$&!  	: M//99DM&	N&6tDzzBDDEDOO 	N 	N 	NELMMM	N!d	} 	4 	4GOOD''"2"23333D!!! 0111 #'2333 %)!OABB 	MC     	 	s   ,B Bc                 d    | j                             || j        dd         | j        f           dS )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)rz  r  r  offsetrl   callables     r   deferFunctionzChecker.deferFunction'  s5     	&&$/!!!2Ddk'RSSSSSr   c                 d    | j                             || j        dd         | j        f           dS )zl
        Schedule an assignment handler to be called just after deferred
        function handlers.
        N)r{  r  r  r  r  s     r   deferAssignmentzChecker.deferAssignment2  s5    
 	!(((DOAAA4F)TUUUUUr   c                 H    |D ]\  }}}|| _         || _         |             dS )zV
        Run the callables in C{deferred} using their associated scope stack.
        N)r  r  )rl   deferredhandlerr   r  s        r   r  zChecker.runDeferred9  s?     '/ 	 	"GUF#DO DKGIIII	 	r   c                 r    t          | j                  dk    ot          | j        d         t                    S )Nr]  rE   )rF   r  r   r2  r   s    r   _in_doctestzChecker._in_doctestB  s2    DO$$) =4?1-|<<	>r   c                 Z    t          d | j        D                       sdS | j        j        S )Nc              3   @   K   | ]}t          |t                    V  d S r   )r   r.  )r
   r   s     r   r)   z)Checker.futuresAllowed.<locals>.<genexpr>H  s@       1 1 e[11 1 1 1 1 1 1r   F)r+   r  r   r/  r   s    r   futuresAllowedzChecker.futuresAllowedF  sB     1 1 $1 1 1 1 1 	5z**r   c                 b    |du sJ t          | j        t                    rd| j        _        d S d S r   )r   r   r.  r/  rl   r   s     r   r  zChecker.futuresAllowedN  s@    ~dj+.. 	0*/DJ'''	0 	0r   c                 X    | j         d         }t          |t                    sdS |j        S )Nr   F)r  r   r.  r0  )rl   r   s     r   annotationsFutureEnabledz Checker.annotationsFutureEnabledT  s.    "%-- 	500r   c                 b    |du sJ t          | j        t                    sJ d| j        _        d S rP  )r   r   r.  r0  r  s     r   r  z Checker.annotationsFutureEnabled[  s:    }$*k2222215
...r   c                     | j         d         S )Nr   )r  r   s    r   r   zChecker.scopea  s    r""r   c                 h    | j                             | j                                                   d S r   )r|  r  r  popr   s    r   r  zChecker.popScopee  s,    t224455555r   c           	         | j         D ]et          t                    r                    d          }|rt          |t                    sd}|r(t          |j                  }fd|j        D             }ng x}}|r
j        sYt          j	        
                    | j                  dk    r1|D ].}|                     t          j        d         j        |           /j        rg }                                D ]8}t          |t"                    r!||_        |                    |j                   9d                    t-          |                    }|D ]/}|                     t          j        d         j        ||           0                                D ]}t          |t0                    r|j        p|j        |v }|s5t          j        }	|                     |	|j        t7          |                     |j        D ]h}
t          |                     |
          t<                    rt          j        }	n|r:t          j         }	|                     |	|
|j        |j                   iϐgdS )z
        Look at scopes which have been fully examined and report names in them
        which were imported but unused.
        r  Nc                     g | ]}|v|	S r	   r	   )r
   r:   r   s     r   r   z+Checker.checkDeadScopes.<locals>.<listcomp>x  s4       !5(  r   __init__.py, )!r|  r   r  rx   r   setr  r  ospathbasenamer}  reportr   UndefinedExportr   valuesr   r   r  r   joinrk   ImportStarUsager   r:   UnusedImportstrr   	getParent	FOR_TYPESImportShadowedByLoopVarRedefinedWhileUnused)rl   all_binding	all_names	undefinedr:   	from_listr'  r   r   messgr    r   s              @r   r  zChecker.checkDeadScopesh  s   
 _ 5	K 5	KE%,, ))I..K #:k=#I#I #" + 122	   %0%6  		
 )+*	I N* C7##DM22mCC !* C CH$<$))$4$;TC C C C & 
N "I#(<<>> ? ?%g?? ?+6GL%,,W-=>>> $		&*;*; < <I ) N NH$<$))$4$;T9N N N N  K Ke[11 K :@y)@D E ( 5E5<UDDD % K K%dnnT&:&:IFF B$,$DEE! B$$,$AEE4U\JJJJKQ5	K 5	Kr   c                 J    | j                              |                       d S r   )r  r  )rl   
scopeClasss     r   	pushScopezChecker.pushScope  s$    zz||,,,,,r   c                 X    | j                              || j        g|R i |           d S r   )r   r  r}  )rl   messageClassre  rf  s       r   r  zChecker.report  s:    \\$-I$III&IIJJJJJr   c                 X    	 |j         }t          |d          st          |d          s|S *)NTr,   ctx)_pyflakes_parentr   rl   r    s     r   r  zChecker.getParent  s<    	(D4(( u1E1E 	r   c                 P   |||fv s t          |d          rt          |d          sd S ||u r|S |j        |j        k    r|                     |j        ||          S |j        |j        k     r|                     ||j        |          S |                     |j        |j        |          S )Nr  )r   _pyflakes_depthgetCommonAncestorr  )rl   lnodernodestops       r   r  zChecker.getCommonAncestor  s    &	 E#566	 E#566		 4E> 	L!E$99 	O))%*@%NNN!E$99 	O))%1GNNN%%""
 
 	
r   c                 D    |D ]}|                      |||          r dS dS )NTF)r  )rl   r    	ancestorsr  as        r   descendantOfzChecker.descendantOf  s<     	 	A%%dAt44 ttur   c                 n    |}	 || j         u rd S |                     |          }t          ||          r|S 3r   )r  r  r   )rl   r    ancestor_typeparents       r   _getAncestorzChecker._getAncestor  sM    	" t^^F++F&-00 	r   c                     |                      |t          t          j                                                            S r   )r  ra   rs  r  keysr  s     r   getScopeNodezChecker.getScopeNode  s/      uW-D-I-I-K-K'L'LMMMr   c                     |                      ||| j                  }t          |          }|r7|D ]4}|                     |||          |                     |||          z  r dS 5dS )zATrue, if lnode and rnode are located on different forks of IF/TRYTF)r  r  r   r  )rl   r  r  ancestorpartsry   s         r   differentForkszChecker.differentForks  s    ))%	BB)) 	     $$UE8<<$$UE8<<=  44  ur   c                    | j         ddd         D ]}|j        |v r n|                    |j                  }|rnt          |t                    sX|                     ||j                  s<|                     |j                  }t          |t                    rBt          |t                    r-| 
                    t          j        ||j        |j                   n|| j        u r~|j        sv|                    |          ra|j        dk    st          |t                    rAt!          || j                   s,| 
                    t          j        ||j        |j                   nDt          |t                    r/|                    |          r|j                            |           |j        | j        v r| j        |j                 j        |_        |j        | j        vst          |t(                    sd}t          |t*                    rZt          | j         |         t,                    r:|dz  }t          |t*                    r t          | j         |         t,                    :|| j         |         |j        <   dS dS )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$  rE   )r  r:   rx   r   r   r  r   r  r   r  r  r   r  r   r   r   rZ  r  r   r  r   r   r,  )rl   r    r   r   existingparent_stmtcur_scope_poss          r   r  zChecker.addBinding  s    _TTrT* 	 	EzU" 99UZ(( 	0Z':: 	0''ho>>	0 ..66K(K00 0ZY5W5W 0H< %*ho? ? ? ? $*$ 
0%]C/4x/H/HCs*C.8;.O.OC /xIIC
 KK = $ej(/C C C Hk22 0ux7P7P 0"))$///:# 	5EJ/4EJ :TZ' 	?z%/L/L 	?M 5"566#4?=9>JJ# " 5"566#4?=9>JJ#
 :?DOM*5:666	? 	?r   c                     t           j                            d          rt          dt	          |                     |                     |           d S )NPYFLAKES_ERROR_UNKNOWNzUnexpected type: )r  environrx   NotImplementedErrorr   r  r  s     r   _unknown_handlerzChecker._unknown_handler  sR     :>>233 	&%&F$t**&F&FGGG%%%%%r   c                     	 | j         |         S # t          $ r |j                                        }Y nw xY wt	          | || j                  x| j         |<   }|S r   )ry  r  rs   upperr   r  )rl   rm   nodeTyper  s       r   getNodeHandlerzChecker.getNodeHandler%  sw    	3%j11 	3 	3 	3!*0022HHH	33:(D14
 4
 	
:& s    #55c                    t          |          }|sd S d }d }| j        dd d         D ]}t          |t                    r|dk    r d S |du r&|                    |d           }t          |t
                    r| j        sd||         _        f|dk    rnt          |t                    rYt          |t          j
                  r?t          |j        t          j                  r |                     t          j        |           	 | j        |f||         _        ||         }t          |t"                    r?|                                r+	 | j        |f||j                 _        n# t(          $ r Y nw xY w d S # t(          $ r Y nw xY w|p|j        }|durt          |t,                    }|rg }	| j        dd d         D ]V}|                                D ]?}t          |t0                    r(| j        |f|_        |	                    |j                   @Wd                    t7          |	                    }	|                     t          j        |||	           d S |dk    r*t:          j                            | j                   dk    rd S |tB          j"        v rt          | j        t                    rd S d	| j#        d         vr#|                     t          j$        ||           d S d S )
Nr   r~   FTprintr  __path__r  	NameError)%r   r  r   r  rx   r   _in_postponed_annotationr   r   r   r	  opRShiftr  r   InvalidPrintSyntaxr   r   r   r   r  r  r,  r  r   r  r  rk   r  r  r  r  r}  r4  r  r  UndefinedName)
rl   r    r  r:   in_generatorsr  r   r'  r   r  s
             r   handleNodeLoadzChecker.handleNodeLoad/  sI   4   	F _RVV, (	B (	BE%,, ;& FF"e+  iid++G':.. t7T #'d w C:gw#?#? Cvsy11 C"69cj99CKK ;TBBB$(J#5d 
 $Ka-- !,,.. 26*d1Caj)..#   
     
 *@U-@ME) B *5. A A 	IR0 ; ;$||~~ ; ;G!'?;; ;(,
D'9!(()9:::	; 		&"3"344IKK0$iHHHF: 	"'"2"24="A"A]"R 	F)// 	Jtz:4V4V 	F d1"55 	<KK.d;;;;;	< 	<s7   AE6	E#"E6#
E0-E6/E00E66
FFc                 x   t          |          }|sd S t          | j        t                    r|| j        vr| j        d d         D ]}t          |t          t
          f          s||v o||         j        }|r]|d         | j        u rN|| j        j        vr@|                     t          j
        ||         j        d         |||         j                    n|                     |          }t          |t          j                  r|j        t!          ||          }nt          |t"          t          j        f          s ||j        k    r&|                     |          st+          ||          }n|dk    rlt          | j        t
                    rRt          |j        t          j        t          j        t          j        f          rt1          ||j        | j                  }nBt2          r+t          |t          j                  rt7          ||          }nt9          ||          }|                     ||           d S )Nr   r   rE   r  )r   r   r   r  r  r.  r   r!  r  r   UndefinedLocalr   r  r   	AnnAssignr   r   r  comprehensionr  isLiteralTupleUnpackingr   Assignr  r   	PY38_PLUS	NamedExprr   r   r  )rl   r    r:   r   r   r  r'  s          r   handleNodeStorezChecker.handleNodeStore|  s?   4   	Fdj-00 	T5K 	"-  !%-)EFF  u}9t)9 DGtz1 d$*BT6T KK 7 %d 0 3T5;;MO O OEnnT**k3=11 	-k6G 	- t,,GGi1B%CDD 	-t44	-00==	- dD))GG	!	-4:{33	- )Z> 	- $D$*?LLGG 	-:k3=AA 	-)$55GG t,,Gg&&&&&r   c                 X   fd}t                    }|sd S  |            rd S t          | j        t                    r/|| j        j        v r!| j        j                            |           d S 	 | j        |= d S # t          $ r% |                     t          j	        |           Y d S w xY w)Nc                      t          dd          } | rFt          | t          j        t          j        t          j        f          rdS t          | dd          } | FdS )zN
            Return `True` if node is part of a conditional body.
            r  NTF)r   r   r   r   WhileIfExp)currentr    s    r   on_conditional_branchz7Checker.handleNodeDelete.<locals>.on_conditional_branch  sh     d$6==G Eg	39'EFF  4!'+=tDD  E 5r   )
r   r   r   r  r!  remover  r  r   r  )rl   r    r  r:   s    `  r   handleNodeDeletezChecker.handleNodeDelete  s    		 		 		 		 		 4   	F  "" 	 Fdj-00 	@TTZ=O5O 	@J%%d+++++@Jt$$$ @ @ @H2D$??????@s   0A: :+B)(B)c              #   X   K   | j         |c}| _         	 d V  || _         d S # || _         w xY wr   )_in_annotation)rl   ann_typeorigs      r   rc  zChecker._enter_annotation  sH      $($7!d!	'EEE"&D$D&&&&s     	)c                 :    | j         t          j        k    p| j        S r   )r
  r\  r_  r  r   s    r   r  z Checker._in_postponed_annotation  s"     ?#99 *)	
r   c                 Z    t          ||          D ]}|                     ||           d S )Nr   )r   
handleNode)rl   r  r   r    s       r   r  zChecker.handleChildren  s?    $T555 	( 	(DOOD$''''	( 	(r   c                     t          |t          j                  r(|j        |j        gz   D ]}t          |d          s dS dS d S )Nr,   FT)r   r   r  targetsr   r   )rl   r    childs      r   r  zChecker.isLiteralTupleUnpacking  s]    dCJ'' 	4 ! !uf-- ! 55!4		 	r   c                     t          |t          j                  p8t          |t          j                  ot          |j        t          j                  S )z}
        Determine if the given node is a docstring, as long as it is at the
        correct place in the node tree.
        )r   r   r0   Exprr   r  s     r   isDocstringzChecker.isDocstring  sD    
 $(( NZch-G-G .M-7
CG-L-L	Nr   c                 
   t          |t          j                  r|j        }t          |t          j                  sdS t
          st          r|j        dz
  }n%|j        |j        	                    d          z
  dz
  }|j        |fS )N)NNrE   
)
r   r   r  r   r0   PYPYr  r   r_   count)rl   r    doctest_linenos      r   getDocstringzChecker.getDocstring  s    dCH%% 	:D$(( 	 < 	B9 	B![1_NN "[46<<+=+==AN''r   c                     |d S | j         rGt          |dd           6|xj        | j         d         z  c_        |xj        | j         d         z  c_        | j        r6t          |t          j                  s|                     |          sd| _        | xj	        dz  c_	        | j	        |_
        ||_        	 |                     |j                  } ||           | xj	        dz  c_	        d S # | xj	        dz  c_	        w xY w)Nr   r   rE   F)r  r   r   
col_offsetr  r   r   
ImportFromr  	nodeDepthr  r  r  r~   )rl   r    r  r  s       r   r  zChecker.handleNode  s	    	F; 	.74488 	.KK4;q>)KKOOt{1~-OO 	(
4(H(H 	((,(8(8(>(>	("'D!#~ &	 ))$.99GGDMMMNNaNNNNDNNaNNNNNNs   4%C+ +C=c                 T   	 |                      |j        d                   \  }}|o|                     |          }n# t          t          f$ r Y d S w xY w|sd S | j        }| j        d         g| _        | j        pd}|                     t                     d| j        d         vr#| 	                    d t          d                     |D ]}	 t          j        |j        d          }|d         |z   |j        z   |d         |j        z   dz   f| _        |                     |           || _        e# t"          $ rQ}	||j        z   |	j        z   |j        dz   |	j        pdz   f}
|                     t&          j        ||
           Y d }	~	d }	~	ww xY w|                                  || _        d S )Nr   )r   r   r$  z	<doctest>rE      )r  r   _getDoctestExamplesrH   rP   r  r  r  r2  r  r   r   parser   r   indentr  SyntaxErrorr  r   DoctestSyntaxErrorr  )rl   r    	docstringnode_linenoexamplessaved_stacknode_offsetexampler  epositions              r   handleDoctestszChecker.handleDoctests  s   	'+'8'81'F'F$Y HT%=%=i%H%HHHJ' 	 	 	 FF	  	F o?1-.k+V|$$$doa(( 	0OOD'#,,/// 	* 	*G
*y==  +1~;gnL*1~>BD##D))))  I I I''.818C#NQ.!(-a@BH7xHHHHHHHHI 	%s(   := AAD//
F
9AFF
c                    	 t          j        |          }n(# t          $ r |                     |||           Y d S w xY w|j        }t          |          dk    s t          |d         t           j                  s|                     |||           d S |j        d         j        }t          j	        |          D ]"}	d|	j
        v rd|	j
        v r||	_        ||	_        #|                     ||           d S )NrE   r   r   r  )r   r$  r&  r  r   rF   r   r  r   walk_attributesr   r  r  )
rl   r_   r    
ref_linenoref_col_offseterrr  r   parsed_annotation
descendants
             r   handleStringAnnotationzChecker.handleStringAnnotation)  s   	9Q<<DD 	 	 	KKT1%%%FF	 yt99> 	DGSX!>!> 	KKT1%%%F IaL.(#455 	7 	7J
 667 J$::7 %/
!(6
%)400000s    !<<c           
          t          t          j                  rL                     t	          j         j        j        j        j	        t          j                             d S  j        r6t          t          j                                        fd           d S                                 d S )Nc                                  S r   r	   )
annotationfnr    rl   s   r   rK  z*Checker.handleAnnotation.<locals>.<lambda>O  s    rr$
D'A'A r   )r   r   r0   r  rj  partialr9  r_   r   r  r   ForwardAnnotationSyntaxErrorr  rm  rs  r  )rl   r<  r    r=  s   ```@r   handleAnnotationzChecker.handleAnnotationA  s    j#'** 	.y0+!%5         * 	.w122BAAAAAAABBBBBOOJ-----r   c                     d S r   r	   r  s     r   ignorezChecker.ignoreS  s    r   c                    t          |j        d          rO|                     t          j                  5  |                     |           d d d            d S # 1 swxY w Y   d S t          |j        d          rh|                     |j        |           t          |j        t          j
                  r|j        }nRt          |j        t          j                  r1t          |j        j        t          j
                  r|j        j        }nd }|t          |j                  dk     r|                     |j        |           n|                     |j        d         |           |                     t          j                  5  |j        dd          D ]}|                     ||           	 d d d            n# 1 swxY w Y   |                     |j        |           d S t          |j        | j                  rD|                                 5  |                     |           d d d            d S # 1 swxY w Y   d S |                     |           d S )NLiteral	Annotatedr]  r   rE   )r;   r   rc  r\  r^  r  r  r   slicer   r*   IndexrF   r,   r  rQ  r  )rl   r    slice_tupleargs       r   	SUBSCRIPTzChecker.SUBSCRIPT`  s	   DJ	22 #	*''(<== * *##D)))* * * * * * * * * * * * * * * * * *dj+66  	*OODJ--- $*ci00 	#"j tz3955#tz/;;# #j."  3c+*:&;&;a&? 3
D1111  0 3T:::++O,@AA 3 3*/3 3 3T222233 3 3 3 3 3 3 3 3 3 3 3 3 3 3 OODHd+++++$TZAA *++-- . .''---. . . . . . . . . . . . . . . . . . ##D)))))s5   AAA)F;;F?F?H44H8;H8c           
          	 t          t          j        j        j                            }n9# t
          $ r,}                     t          j        |           Y d }~d S d }~ww xY wd dt                      t                       fd}|D ]\  }}}} ||          r d S |	 t          t          |                    }n:# t
          $ r-}                     t          j        |           Y d }~ d S d }~ww xY w|D ]A\  }}	}
}|
)d|
v r%                     t          j        d             d S  ||	          r  d S Bt          d j        D                       st          d j        D                       rd S t          t          t          j                                      }d j        D             }|z
  }|z
  }z  ||z  z
  }|rK                     t          j        d                    t#          d	 |D                                            |rA                     t          j        d                    t#          |                               |rM                     t          j        d                    t#          d
 |D                                            d S d S )Nr   c                    | dS |                      d          \  } }}|                      d          \  } }}	 t          |           } du r"                    t          j                   dS dn# t
          $ r Y nw xY w| dk    r/du r"                    t          j                   dS d} dz  t          | t                    r                    |            n                    |            dS )z9Returns True if there is an error which should early-exitNFr   [T rE   )	partitionintr  r   StringDotFormatMixingAutomaticrH   r   add)fmtkeyr$  auto	next_autor    placeholder_namedplaceholder_positionalrl   s     r   _add_keyz3Checker._handle_string_dot_format.<locals>._add_key  s4     u "++C00LFAq!++C00LFAq	!V 4< !KK GNNN4 DD     | 5=  KK GNNN4D"Q	&#&& .&**62222!%%f---5s   A1 1
A>=A>{zMax string recursion exceededc              3   J   K   | ]}t          |t          j                  V  d S r   r   r   Starredr
   rI  s     r   r)   z4Checker._handle_string_dot_format.<locals>.<genexpr>  s.      FFSJsCK00FFFFFFr   c              3   (   K   | ]}|j         d u V  d S r   rI  r
   kwds     r   r)   z4Checker._handle_string_dot_format.<locals>.<genexpr>  s(      ==CGtO======r   c                     h | ]	}|j         
S r	   r_  r`  s     r   	<setcomp>z4Checker._handle_string_dot_format.<locals>.<setcomp>  s    ???#cg???r   r  c              3   4   K   | ]}t          |          V  d S r   r  r
   r  s     r   r)   z4Checker._handle_string_dot_format.<locals>.<genexpr>  s(       B BAQ B B B B B Br   c              3   4   K   | ]}t          |          V  d S r   re  rf  s     r   r)   z4Checker._handle_string_dot_format.<locals>.<genexpr>  s(       C CAQ C C C C C Cr   )ra   parse_format_stringrg  r   r_   rH   r  r   StringDotFormatInvalidFormatr  rX  re  keywordsrangerF   'StringDotFormatExtraPositionalArgumentsr  rk   "StringDotFormatExtraNamedArgumentsStringDotFormatMissingArgument)rl   r    placeholdersr.  rX  r$  rS  specspec_placeholdersspec_fmtkey	spec_specsubstitution_positionalsubstitution_namedextra_positionalextra_namedmissing_argumentsrT  rU  rV  rW  s   ``              @@@@r   _handle_string_dot_formatz!Checker._handle_string_dot_format  s   	 !4TY_5F!G!GHHLL 	 	 	KK=tQGGGFFFFF	 	!$EE%	 %	 %	 %	 %	 %	 %	 %	 %	 %	N #/ 	 	AvtQx   (-.A$.G.G(H(H%%!   KK EtQOOOFFFFFF 5F 
 
0A{Iq  	1A $A ;  
 x,,  FFDIFFFFF	 ==t}=====		 F"%eC	NN&;&;"<"<?????25KK(+<< $&77$'99; 	
  	KK@		& B B1A B B BBBCC  
  	KK;		&--..  
  	KK7		& C C1B C C CCCDD    	 	s,   +4 
A*!A%%A*1C
D!D  Dc                 f   t          |j        t          j                  rIt          |j        j        t          j                  r%|j        j        dk    r|                     |           g }g }g }t          |j        d| j	                  rgt          |j                  dk    rO|                                 5  |                     |j        d         |           d d d            n# 1 swxY w Y   nqt          |j        d| j	                  rR|dgz  }|d |j        dd          D             z  }|dgz  }|d	 |j        D             z  }|d
 |j        D             z  }nt          |j        d| j	                  rt          |j                  dk    rat          |j        d         t          j                  r<|dgz  }||j        d         j        z  }|d t#          |j                  D             z  }|dgz  }|d |j        D             z  }|d |j        D             z  }n@t          |j        d| j	                  r$t          |j                  dk    rt          |j        d         t          j        t          j        f          rt)          d |j        d         j        D                       r|dgz  }|d |j        d         j        D             z  }|d |j        d         j        D             z  }|d t#          |j                  D             z  }|d |j        d         j        D             z  }|dgz  }|d |j        D             z  }|d |j        D             z  }|r|                     t,          j                  5  |D ]\  }}|                     ||           |                     ||           d d d            n# 1 swxY w Y   |                                 5  |D ]}|                     ||           	 d d d            d S # 1 swxY w Y   d S |                     |           d S )Nr   castrE   r   TypeVarre  c                     g | ]}|S r	   r	   r]  s     r   r   z Checker.CALL.<locals>.<listcomp>  s    777##777r   rj  c                 2    g | ]}|j         d k    |j        S )bound)rI  r   r
   ks     r   r   z Checker.CALL.<locals>.<listcomp>  s&    MMMaAEW<LM!'MMMr   c                 2    g | ]}||j         d k    rdgndfS )r  r   Nr_  r  s     r   r   z Checker.CALL.<locals>.<listcomp>  s?        '!1;WIIt<  r   	TypedDictc                 .    g | ]\  }}||d k    rdgndfS )rE   r  Nr	   r
   rT   rI  s      r   r   z Checker.CALL.<locals>.<listcomp>  s@     " " "3 Q88**D9" " "r   c                     g | ]	}|j         
S r	   r   r  s     r   r   z Checker.CALL.<locals>.<listcomp>&      999a!'999r   c                     g | ]}|d gfS r  r	   r  s     r   r   z Checker.CALL.<locals>.<listcomp>'      DDDq7)nDDDr   
NamedTuplec              3      K   | ]B}t          |t          j        t          j        f          ot	          |j                  d k    V  CdS )r]  N)r   r   r*   r  rF   r,   rf  s     r   r)   zChecker.CALL.<locals>.<genexpr>.  sf       A A)* q39ch"788 %KK1$A A A A A Ar   c                 (    g | ]}|j         d          S rE   r,   r'   s     r   r   z Checker.CALL.<locals>.<listcomp>2  s    GGGcchqkGGGr   c                 ,    g | ]}|j         d          dfS )r   Nr  r'   s     r   r   z Checker.CALL.<locals>.<listcomp>3  s#    !S!S!S#38A;"5!S!S!Sr   c                 .    g | ]\  }}||d k    rdgndfS )rE   r,   Nr	   r  s      r   r   z Checker.CALL.<locals>.<listcomp>4  s@     " " "3 a1f66(($7" " "r   c                     g | ]}|d fS r  r	   r'   s     r   r   z Checker.CALL.<locals>.<listcomp>8  s    !M!M!MC3-!M!M!Mr   c                     g | ]	}|j         
S r	   r  r  s     r   r   z Checker.CALL.<locals>.<listcomp><  r  r   c                     g | ]}|d gfS r  r	   r  s     r   r   z Checker.CALL.<locals>.<listcomp>=  r  r   r  )r   rg  r   r8   r   r0   r9   ry  rM  r  rF   re  rc  r  rj  Dictr  	enumerater*   r  r+   r,   r\  r^  r  )rl   r    r   	annotatednot_annotatedna_nodena_omitannotated_nodes           r   CALLzChecker.CALL  s   49cm44	149?CG44	1 	(*	1
 **4000	 ty&$/::8	E	NNa8	E '')) 4 4	!d3334 4 4 4 4 4 4 4 4 4 4 4 4 4 4 	9do>> 1	E VHD771227777I ZL DMM4=MMMMI     MM
 	;@@ #	E49~~! j1sx&H&H  TYq\00	 " ""+DI"6"6" " "  ZL D994=9999IDDdmDDDDMM	<AA 	E DI"N49Q<#)SX)>??N  A A.2il.?A A A A AN  GGTYq\5FGGGG	!S!S1AR!S!S!SS " ""+DI"6"6" " "  !M!M49Q<;L!M!M!MM ZL D994=9999IDDdmDDDDM 
	&''(<== 5 5(5 ? ?$GW''g'>>>>##Dt#4445 5 5 5 5 5 5 5 5 5 5 5 5 5 5
 '')) : :&/ : :NOOND9999:: : : : : : : : : : : : : : : : : : %%%%%s6   6"C$$C(+C(7OO
O
%PPPc           	      @   	 t          |j        j                  }n2# t          $ r% |                     t
          j        |d           Y d S w xY wt                      }d}d }|D ]\  }}||\  }}}	}
}|dk    r|t          vr!|                     t
          j	        ||           ||r|d u }|	|
fD ]0}|,d|v r(|s!|                     t
          j
        |           +|dz  }1|r%|#|                     t
          j        |            d S |s%|#|                     t
          j        |            d S |r|dz  }|                    |           t          |j        t          j        t          j        f          rt%          d |j        j        D                       sft)          |j        j                  }|r)||k    r#|                     t
          j        |||           n"|s |                     t
          j        |           t          |j        t          j                  rt1          d |j        j        D                       r|r(|dk    r"|                     t
          j        |           d S d |j        j        D             }||z
  }||z
  }|sC|rA|                     t
          j        |d	                    t;          |                               |sI|rI|                     t
          j        |d	                    t;          |                               d S d S d S d S d S )
Nzincomplete formatr   rD   r   rE   c              3   J   K   | ]}t          |t          j                  V  d S r   r[  r'   s     r   r)   z1Checker._handle_percent_format.<locals>.<genexpr>  sB         sCK00     r   c              3   J   K   | ]}t          |t          j                  V  d S r   )r   r   r0   r  s     r   r)   z1Checker._handle_percent_format.<locals>.<genexpr>  s.      DDqJq#'**DDDDDDr   c                     h | ]	}|j         
S r	   )r_   r  s     r   rc  z1Checker._handle_percent_format.<locals>.<setcomp>  s     > > > > > >r   r  )rb   r  r_   rH   r  r   PercentFormatInvalidFormatr  VALID_CONVERSIONS'PercentFormatUnsupportedFormatCharacter!PercentFormatStarRequiresSequence$PercentFormatMixedPositionalAndNamedrR  r   r
  r   r  r*   rX  r,   rF   $PercentFormatPositionalCountMismatchPercentFormatExpectedMappingr  r+   r  PercentFormatExpectedSequence PercentFormatExtraNamedArgumentsr  rk   PercentFormatMissingArgument)rl   r    ro  namedpositional_count
positionalr$  placeholderr:   rZ   r\   r]   partsubstitution_countsubstitution_keys
extra_keysmissing_keyss                    r   _handle_percent_formatzChecker._handle_percent_formatK  s   	/	<<LL 	 	 	KK3#  
 FF	 
* ,	  ,	 NA{ 4?1D!UIzS  !22 D    *j *!T\
	* . . .t .% .$F    
 )A-( d A    D A      A%  		$ 4:#)'<==	I   #z    	I "%TZ_!5!5 I.2DD IA$&	      IHA4HHH 4:sx00	DDDJODDDDD	  .2 HBDIII > >djo > > >*U2J #44L * =IIfZ0011  
  , 9IIf\2233    %	 	 	 	"   s    +A
Ac                     t          |j        t          j                  r4t          |j        t          j                  r|                     |           |                     |           d S r   )r   r  r   Modr  r0   r  r  r  s     r   BINOPzChecker.BINOP  s^    47CG,,	.49cg..	. ''---D!!!!!r   c                     | j         rat          j        | j        |j        ||j        |j        t          j                  }| j	        r |             d S | 
                    |           d S d S r   )r
  rj  r>  r9  r_   r   r  r   r?  r  r  )rl   r    r=  s      r   STRzChecker.STR  s}     	'"+5 B   '""2&&&&&	' 	'r   c                 d    t          |j        t                    r|                     |          S d S r   )r   r   r  r  r  s     r   CONSTANTzChecker.CONSTANT  s0    $*c** &xx~~%& &r   c                 D   |                      |           |j        }t          |t          j                  r8t          |j                  r"|                     t          j	        |           d S d S t          |          r"|                     t          j	        |           d S d S r   )
r  excr   r   Callr   rg  r  r   RaiseNotImplemented)rl   r    rI  s      r   RAISEzChecker.RAISE  s    D!!!hc38$$ 	<*3844 @H8$?????@ @ )-- 	<KK4d;;;;;	< 	<r   c                     | j         s>t          d |j        D                       s |                     t          j        |           d| j         c| _         }	 |                     |           || _         d S # || _         w xY w)Nc              3   J   K   | ]}t          |t          j                  V  d S r   )r   r   FormattedValuerf  s     r   r)   z$Checker.JOINEDSTR.<locals>.<genexpr>  s/      OOa
1c&899OOOOOOr   T)_in_fstringrX  r  r  r   FStringMissingPlaceholdersr  )rl   r    r  s      r   	JOINEDSTRzChecker.JOINEDSTR  s     $	C OO4;OOOOO		C KK;TBBB!%t'7$	$%%%#DtD####s   A4 4	A=c                 Z  	 d j         D             }t          |          }d |                                D             }|D ]Ҋ		fdt          |          D             }t          fd|D                       }t	          d |                                D                       ro|D ]l}j         |         }t          	t                    r'|                     t          j	        |	j
                   K|                     t          j        |	           m|                                d S )Nc                 ,    g | ]}t          |          S r	   r   )r
   rV   s     r   r   z Checker.DICT.<locals>.<listcomp>  s.     
 
 
&)S!!
 
 
r   c                 $    g | ]\  }}|d k    |S r  r	   )r
   rV   r  s      r   r   z Checker.DICT.<locals>.<listcomp>  s6     
 
 
Cqy

 
 
r   c                 &    g | ]\  }}|k    |S r	   r	   )r
   rT   i_keyrV   s      r   r   z Checker.DICT.<locals>.<listcomp>  s&    MMMEM1MMMr   c              3   L   K   | ]}t          j        |                   V  d S r   )r   r  )r
   rG   r    s     r   r)   zChecker.DICT.<locals>.<genexpr>  sF         !U!344     r   c              3   (   K   | ]\  }}|d k    V  dS )rE   Nr	   )r
   r   r  s      r   r)   zChecker.DICT.<locals>.<genexpr>  s*      AA,%5A:AAAAAAr   )r  r|   ry   r  rX  r   r   r  r   MultiValueRepeatedKeyVariabler:   MultiValueRepeatedKeyLiteralr  )
rl   r    r  
key_countsduplicate_keyskey_indicesr  	key_indexkey_noderV   s
    `       @r   DICTzChecker.DICT  s   
 
-1Y
 
 
 T]]

 
","2"2"4"4
 
 

 " 	 	CMMMMYt__MMMK    (    F AA&,,..AAAAA !,  I#y3H!#{33 	H$J$,$'H. . . . $A$   
 	D!!!!!r   c                     t          |j        t          j                  r0|j        j        g k    r |                     t          j        |           |                     |           d S r   )	r   testr   r*   r,   r  r   IfTupler  r  s     r   IFz
Checker.IF!  sY    di++ 	0	"0D 	0KK($///D!!!!!r   c                     t          |j        t          j                  r0|j        j        g k    r |                     t          j        |           |                     |           d S r   )	r   r  r   r*   r,   r  r   AssertTupler  r  s     r   ASSERTzChecker.ASSERT(  sY    di++ 	4	"0D 	4KK,d333D!!!!!r   c                 >   |                                  rdnd}| j        |         }| j        |urk|j        D ]et	          |          }fd| j        D             | _        |                    |           ||f|_        | j        |dz   d         D ]}||<   ddS dS )z5
        Keep track of globals declarations.
        rE   r   c                 j    g | ]/}t          |t          j                  r|j        d          k    -|0S )r   )r   r   r  message_args)r
   m	node_names     r   r   z"Checker.GLOBAL.<locals>.<listcomp>>  sR     !4 !4 !4q("899!4 N1%2!4!4 !4 !4r   N)r  r  r   r  r   r   
setdefaultr   )rl   r    global_scope_indexglobal_scope
node_valuer   r  s         @r   GLOBALzChecker.GLOBAL-  s     #'"2"2"4"4;QQ!'9: :\) 	2 "Z 2 2	'	488

!4 !4 !4 !4#}!4 !4 !4 ''	:>>> $0"6
!_-?!-C-D-DE 2 2E'1E)$$2'	2 	22 2r   c                     |                      t                     |                     |           |                                  d S r   )r  r,  r  r  r  s     r   GENERATOREXPzChecker.GENERATOREXPM  s9    ~&&&D!!!r   c                 H   t          |j        t          j                  r|                     ||                     |                     |j        dk    rGt          | j        t                    r/t          |j	        t          j
                  rd| j        _        dS dS dS dS t          |j        t          j                  r|                     |           dS t          |j        t          j                  r|                     |           dS t!          d|j                  )zV
        Handle occurrence of Name (which can be a load/store/delete access.)
        localsTz#Got impossible expression context: N)r   r  r   Loadr  r  r7   r   r  r  r  r%  Storer   Delr  r  r  s     r   NAMEzChecker.NAMET  s%   
 dh)) 	SdnnT&:&:;;;8# -
4:}(M(M -t4ch??- )-
%%%- - - - - - #),, 	S  &&&&&#'** 	S!!$''''' QTXQQRRRr   c                    |}t          |d          r|j        |}}t          |t          j        t          j        t          j        f          r||j        vrd S t          |t          j        t          j	        f          rnlt          |d          rLt          |t          j
                  r2||j        v r)t          s"|                     t          j        |           d S t          |d          t          |t          j
                  r"|                     t          j        |           d S |                     t          j        |           d S )Nr  	finalbody)r   r  r   r   r  ForAsyncForr   rV  ClassDefContinuer  r  r  r   ContinueInFinallyContinueOutsideLoopBreakOutsideLoop)rl   r    r   n_childs       r   CONTINUEzChecker.CONTINUEg  s5    a+,, 	+QwA!ci#,?@@ !(* F!cos|<== q+&& :dCL+I+I ak) ) KK :DAAAF a+,, 	 dCL)) 	9KK4d;;;;;KK1488888r   c                 4   t          | j        t          t          f          r"|                     t
          j        |           d S |j        r2t          | j        d          r| j        j	        s|j        | j        _	        | 
                    |j        |           d S )Nr"  )r   r   r  r.  r  r   ReturnOutsideFunctionr   r   r"  r  r  s     r   RETURNzChecker.RETURN  s    dj:{";<< 	KK6===F J	0DJ..	0 
&	0
 &*ZDJ"
D)))))r   c                     t          | j        t          t          f          r"|                     t
          j        |           d S |                     |j        |           d S r   )	r   r   r  r.  r  r   YieldOutsideFunctionr  r   r  s     r   YIELDzChecker.YIELD  sS    dj:{";<< 	KK5t<<<F
D)))))r   c                 n    j         D ]}                     |                                                                t	          j                              j        rI                                 s7t           j	        t                    s                      fd           d S d S d S d S )Nc                  .                                    S r   r0  r    rl   s   r   rK  z%Checker.FUNCTIONDEF.<locals>.<lambda>      t':':4'@'@ r   )rY  r  LAMBDAr  r   r:   r  r  r   r   r  r  )rl   r    decos   `` r   FUNCTIONDEFzChecker.FUNCTIONDEF  s    ' 	( 	(DOOD$''''D0DAABBB  	B$$&&	Btz=99	B @@@@@AAAAA	B 	B 	B 	B 	B 	Br   c                     g }g }t           rCj        j        D ]6}|                    |j                   |                    |j                   7j        j        j        j        z   D ]6}|                    |j                   |                    |j                   7j        j        j        j        z   }t          t          j                   }dD ]P}t          j        |          }|s|                    |j                   |r|                    |j                   Q|r|                    j                   t          t          |                    t          |          k     rBt!          |          D ]2\  }	}||d |	         v r!                     t$          j        |           3|D ]}
                     |
           |D ]}                     |            fd}                     |           d S )N)varargkwargc                                                                            ddg           fd} fd}                    |                                |                                            d S )NrY  returnsr  c                      j                                         D ]+\  } }                    t          j        |j        |            ,dS )zU
                Check to see if any assignments have not been used.
                N)r   r(  r  r   UnusedVariabler   r:   r'  rl   s     r   check_unused_assignmentszEChecker.LAMBDA.<locals>.runFunction.<locals>.check_unused_assignments  sR     &*Z%B%B%D%D O OMD'KK 7NNNNO Or   c                      j                                         D ]+\  } }                    t          j        |j        |            ,dS )zU
                Check to see if any annotations have not been used.
                N)r   r*  r  r   UnusedAnnotationr   r  s     r   check_unused_annotationszEChecker.LAMBDA.<locals>.runFunction.<locals>.check_unused_annotations  sR     &*Z%B%B%D%D Q QMD'KK 97>4PPPPQ Qr   )r  r  r  r  )r  r  r    rl   s     r   runFunctionz#Checker.LAMBDA.<locals>.runFunction  s    NN,<i+HIIIO O O O OQ Q Q Q Q   !9:::  !9:::MMOOOOOr   )r  re  posonlyargsr  rI  r<  
kwonlyargsdefaultskw_defaultsr   r   Lambdar   r  rF   r  r  r  r   DuplicateArgumentr@  r  r  )rl   r    re  annotationsrI  r  has_annotationsarg_namewildcardidxr<  defaultr  s   ``           r   r  zChecker.LAMBDA  s9    	3y, 3 3CG$$$""3>22229>DI$88 	/ 	/CKK   s~....9%	(==(sz:::+ 	8 	8Hty(33H KK%%% 8""8#6777 	-t|,,,s4yy>>CII% 	G'oo G G
c$tt*$ GKK :D#FFF% 	4 	4J!!*d3333 	+ 	+GOOGT****	 	 	 	 	 	2 	;'''''r   c                 4    |                      |d           d S )N)r  r  r  )r  r  s     r   	ARGUMENTSzChecker.ARGUMENTS  s"    D'BCCCCCr   c           	      ~    |                      |t          |j        |                     |                               d S r   )r  r   rI  r  r  s     r   ARGzChecker.ARG  s6    htx1B1B41H1HIIJJJJJr   c                 T    j         D ]}                     |           j        D ]}                     |           j        D ]}                     |                                t
                      j        rG                                 s3t           j	        t                    s                      fd           j        D ]}                     |                                                                  t          j                             dS )z
        Check names used in a class definition, including its decorators, base
        classes, and the body of its definition.  Additionally, add its name to
        the current scope.
        c                  .                                    S r   r  r  s   r   rK  z"Checker.CLASSDEF.<locals>.<lambda>  r  r   N)rY  r  basesrj  r  r  r  r  r   r   r  r  r   r  r  r   r:   )rl   r    r  baseNodekeywordNodestmts   ``    r   CLASSDEFzChecker.CLASSDEF  sG    ' 	( 	(DOOD$''''
 	, 	,HOOHd++++= 	/ 	/KOOK....z"""  	B$$&&	Btz=99	B @@@@@AAAI 	( 	(DOOD$''''odi>>?????r   c                     |                      |j        |           |                     |j        |           |                     |j        |           d S r   )r  targetr  r   r  s     r   	AUGASSIGNzChecker.AUGASSIGN  sL    DK...
D)))T*****r   c                    t          |j        t          j                  rd}d}t	          |j                  D ]G\  }}t          |t          j                  r(|r"|                     t          j	        |            nd}|}H|dk    st          |j                  |z
  dz
  dk    r |                     t          j        |           |                     |           d S )NFr   T   rE   i   )r   r  r   r  r  r,   r\  r  r   TwoStarredExpressionsrF   %TooManyExpressionsInStarredAssignmentr  )rl   r    has_starredstar_locrT   r   s         r   TUPLEzChecker.TUPLE  s    dh	** 	R  KH!$),, ! !1a-- !" H$BDIII "&K H6! RS^^h%>%Bg%M RHJDQQQD!!!!!r   c                     |j         D ]b}d|j        v r|j        st          |j        |          }n$|j        p|j        }t	          |||j                  }|                     ||           cd S r   )r  r:   asnamer   r   r  )rl   r    aliasimportationr:   s        r   IMPORTzChecker.IMPORT   s    Z 	/ 	/Eej  B B25:tDD|1uz)$ejAAOOD+....	/ 	/r   c                    |j         dk    r(| j        s |                     t          j        |           nd| _        d|j        z  |j         pdz   }|j        D ]0}|j        p|j        }|j         dk    rbt          ||| j
                  }|j        t          j        vr&|                     t          j        ||j                   |j        dk    rd| _        n|j        dk    rzt          | j
        t                     s"|                     t          j        ||           d| j
        _        |                     t          j        ||           t)          ||          }nt+          ||||j                  }|                     ||           2d S )Nr   Fr   rN  r  Tr   )r   r  r  r   LateFutureImportlevelr  r7  r:   r   r   r   all_feature_namesFutureFeatureNotDefinedr  r   r.  ImportStarNotPermittedr  ImportStarUsedr   r   r  )rl   r    r   r8  r:   r9  s         r   
IMPORTFROMzChecker.IMPORTFROM)  s   ;,& 	(& =H5t<<<"'D
"t{'8b9Z 	/ 	/E<-5:D{l* B/dDJGG:Z%AA 2KK @ $ej2 2 2:. 948D1s" B!$*k:: KK ? $f. . .+/
(H3T6BBB-fd;;-dD.4ejB BOOD+....+	/ 	/r   c                    g }t          |j                  D ]\  }}t          |j        t          j                  r2|j        j        D ]$}|                    t          |                     %n.|j        r'|                    t          |j                             |j        ;|t          |j                  dz
  k     r | 
                    t          j        |           | j                            |           |j        D ]}|                     ||           | j                                         |                     |d           d S )NrE   r   r  )r  r   r   r   r   r*   r,   r  r   rF   r  r   DefaultExceptNotLastr  r   r  r  r  )rl   r    handler_namesrT   r  exc_typer  s          r   TRYzChecker.TRYI  sS   #DM22 	D 	DJAw',	22 @ ' 1 @ @H!((X)>)>????@ @$$[%>%>???| DC,>,>,B(B DH97CCC""=111Y 	) 	)EOOE4((((!!!Dv.....r   c                 $   |j         |                     |           d S |j         | j        v r|                     |           	 | j                            |j                   }n# t
          $ r d }Y nw xY w|                     |           |                     |           	 | j                            |j                   }|j        s&|                     t          j	        ||j                    n# t
          $ r Y nw xY w|r|| j        |j         <   d S d S r   )
r:   r  r   r   r  r  r   r  r   r  )rl   r    prev_definitionr'  s       r   EXCEPTHANDLERzChecker.EXCEPTHANDLER_  sD   9 	%%%F 9
" 	'  &&&	#"jnnTY77OO 	# 	# 	#"OOO	# 	T"""D!!!	FjnnTY//G < FH3T49EEE	  	 	 	D	  	4$3DJty!!!	4 	4s$   A# #A21A2 C- -
C:9C:c                 $   |                      |j        |           |j        rRt          |j        d| j                  r|                      |j        |           n|                     |j        |           |                     |j        |           d S )N	TypeAlias)r@  r<  r   rM  r  r  r-  r  s     r   	ANNASSIGNzChecker.ANNASSIGN  s    dot444: 	2$/;HH 2%%dj$7777
D111T*****r   c                 J   |j         }t          |j        |j                  D ]k\  }}t	          |t
          j        t
          j        f          r>t          |          st          |          r | 	                    t          j        |           |}l|                     |           d S r   )r  zipopscomparatorsr   r   IsIsNotr4   r  r   	IsLiteralr  )rl   r    r  r  r
  s        r   COMPAREzChecker.COMPARE  s    yTXt'788 	 	IBrCFCI#6776/556 0666 H.555DDD!!!!!r   c                 Z    |                      |           |                     |           d S r   )r   r  r  s     r   _match_targetzChecker._match_target  s0    T"""D!!!!!r   r   )rs   rt   ru   rv   r   Moduler.  r  r  rV  r  rW  r  ListCompr,  SetCompGeneratorExpDictCompr  r   r  r\  r^  r
  r  r  builtin_varsr  _MAGIC_GLOBALSr~  r  r  rx   _customBuiltInsupdater   r   r  r  r  r  r   r  setterr  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  
contextlibcontextmanagerr`  rc  r  r  r  r  r  r  doctestDocTestParserget_examplesr#  r0  rq  r9  rm  r@  rB  DELETEFORASYNCFORWHILEWITHWITHITEM	ASYNCWITHEXPRASSIGNPASSBOOLOPUNARYOPSET	ATTRIBUTESTARREDNAMECONSTANT	NAMEDEXPRrJ  ry  r  r  r  r  r  r  NUMBYTESELLIPSISSLICEEXTSLICEINDEXLOADSTOREDELAUGLOADAUGSTOREPARAMANDORADDSUBMULTDIVMODPOWLSHIFTRSHIFTBITORBITXORBITANDFLOORDIVINVERTNOTUADDUSUBEQNOTEQLTLTEGTGTEISISNOTINNOTINMATMULTr  COMPREHENSIONKEYWORDFORMATTEDVALUEr  r  r  r  IFEXPr  r  NONLOCALr  LISTCOMPDICTCOMPSETCOMPr  r  BREAKr  r  AWAIT	YIELDFROMr  ASYNCFUNCTIONDEFr  r"  r$  r+  r.  r5  LISTr:  rB  rG  TRYSTARrJ  rM  rU  MATCH
MATCH_CASE
MATCHCLASSMATCHORMATCHSEQUENCEMATCHSINGLETON
MATCHVALUErW  MATCHASMATCHMAPPING	MATCHSTARr	   r   r   rs  rs    s        
 
 	
Kjm
Mn^.n
O IF$)NLs<  &&~66Hjnn%899O 4--c22333&./2:=2% % % %N	T 	T 	TV V V  > > > + + X+ 0 0 0
 1 1 X1 $6 6 %$6
 # # X#6 6 6:K :K :Kx $1 - - - -K K K  
 
 
,    N N N	 	 	/? /? /?b& & &   K< K< K<Z(' (' ('T@ @ @< )8)= ' ' ' ' 
 
 X
( ( ( (  N N N( ( (     $ 0'/11>& & &B 1 1 1. . . ]."  
 ''F 'S '8 'e 'd 'X '	 'vD ##F #W #s #Y # #<$* $* $*Lq q qfP& P& P&de e eN" " "' ' '  3	& 	& 	& 	& -322e2h  .-E-Hu 7=<D<5<3<<8e C " s S 4 #  c F V "*-369<@CG
 "%(+-058:=B< < < 0>=M=GnK$ $ $"" "" ""H" " "
 E" " "
2 2 2< H  
 %10H0x'S S S&9 9 9. E* * ** * * EI
B 
B 
B #>( >( >(@D D DK K K@ @ @0+ + +
" " ". D/ / // / /@/ / /( G+4 +4 +4Z	+ 	+ 	+" " " AONENJNNg"00NZ" " " *76G6lYYYr   rs  )Srv   r   r  r   rb  rd  rj  r  rer?   sysr  pyflakesr   version_infor  r   r  r5  r]  	Formatterr$  rh  r   r  r  r  r!   r-   r&   r4   r;   compilerI   rL   rM   rN   rO   	frozensetr  rA   rb   r  rd   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.  r2  r4  r^  r   rA  rG  rM  rQ  rZ  r\  rm  rq  rs  r	   r   r   <module>r     ss         



          				 				  



       &	ws'((s8}}&f&((. C C C Wcl#	 B
 
 
 
B B B    	
J J J J
 
 
: : :   O,,RZ
++ 2:m$$rz.//BJx  	I122   =! =! =!@    4   &   !%LLNN    ." " "4P P PI I I I I I I I@       
 
 
 
 
j 
 
 
              &%! %! %! %! %!* %! %! %!P") ") ") ") "); ") ") ")J< < < < <k < < <8    k   ,	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$    w              *          	 	 	 	 	 	 	 		 	 	 	 	j 	 	 	.' .' .' .' .'G .' .' .'bH H H H HD H H H	 	 	 	 	 	 	 	"$ "$ "$ "$ "$E "$ "$ "$J	 	 	 	 	U 	 	 	( ( ( ( (% ( ( (    ;           QPP   :;;) ) )XL L L@ @ @             P7 P7 P7 P7 P7 P7 P7 P7 P7 P7r   