
    *e                      U d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZ dd	lmZ ddlZ dd
l!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z(m)Z) erddl*m+Z+  G d d          Z,erddl-Z  ed          Z.ee/ef         Z0de1d<   dZ2de1d<   dZ3de1d<   dZ4de1d<   dZ5de1d<   dZ6de1d<   dZ7de1d<   dZ8de1d<   dZ9de1d<   dZ:de1d<   e2d e3d!e4d"e5d#iZ;de1d$<   d% e;<                                D             Z=de1d&<   d'ddd'd'dd(Z>de1d)<   d*d+d,d-d.d/d0d1d2d3d4
Z?de1d5<   d6d7iZ@de1d8<   d2d3d9ZAde1d:<   d;d<d=d>d?ZBde1d@<   dAdBdCZCde1dD<   eCD                    dE e?<                                D                        eCd2= eCd3= dIdJZEdKZFde1dL<    G dM dNe,          ZGe G dO dPeG                      ZHe G dQ dReG                      ZI G dS dTeI          ZJeIZKde1dU<   e G dV dWeG                      ZLee/dXedY         f         ZMde1dZ<    G d[ d\eL          ZN G d] d^eH          ZO G d_ d`eO          ZP G da dbeO          ZQ G dc ddeO          ZRg deZSde1df<    G dg dheG          ZTedi         ZUde1dj<    G dk dleTeLeH          ZV G dm dneG          ZWeSg doz   ZXde1dp<    G dq dreT          ZYeXg dsz   ZZde1dt<   dZ[de1du<   dZ\de1dv<   dZ]de1dw<    G dx dyeYeLeH          Z^eVe^fZ_ G dz d{eLeH          Z`g d|Zade1d}<    G d~ deL          Zb G d deH          Zc G d deH          Zd G d deH          Ze G d deH          Zf G d deH          Zg G d deH          Zh G d deH          Zi G d deH          Zj G d deH          Zk G d deH          Zl G d deH          Zm G d deH          Zn G d deH          Zo G d deH          Zp G d deH          Zq G d deH          Zr G d deH          Zs G d deH          Zt G d deH          Zu G d deH          Zv G d deI          Zw G d deI          ZxdJdZy G d deI          Zz G d deI          Z{ G d deI          Z| G d deI          Z} G d deI          Z~ G d deI          Z G d de          Z G d de          Ze
 G d de	                      Zej        Zde1d<   ej        Zde1d<   ej        Zde1d<   ej        Zde1d<   ej        Zde1d<   ej        Zde1d<    G dȄ deI          Z G dʄ deI          Z G d̄ deI          Z G d΄ deI          Z G dЄ deI          Z G d҄ deI          Z G dԄ deI          Z G dք deI          Z G d؄ deI          Z G dڄ deI          Z G d܄ deI          Z G dބ deI          Z G d deI          Z G d deYeI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          ZdZde1d<   dZde1d<   dZde1d<    G d deLeI          Z G d de          Z G d d e          Z G d de          Z G d deI          Z G d deI          Z G d deI          Z G d	 d
eI          Z G d deI          Z G d deI          Z G d deI          Z G d deI          Z eh d          Zde1d<    G d dYeL          Z G d de          Z ed          Zde1d<    ed          Zde1d<    ed          Zde1d<    G d d eL          Z G d! d"eL          Z G d# dX          Z G d$ d%ee/ef                   Z G d& d'          ZdKd+ZdLd.ZdMd1Zd2  e            <                                D             Zde1d3<   dNd:Z	 dOdPd?ZdQdAZdRdCZ	 dSdTdHZdS (U  z4Abstract syntax tree node classes (i.e. parse tree).    )annotationsN)abstractmethod)defaultdict)Enumunique)TYPE_CHECKINGAnyCallableDictFinalIteratorListOptionalSequenceTupleTypeVarUnioncast)	TypeAlias	TypeGuard)trait)Options)is_typeshed_file
short_type)ExpressionVisitorNodeVisitorStatementVisitor)Patternc                  0    e Zd ZdZdZddd	Z	 	 	 dddZd
S )Contextz@Base type for objects that are valid as error message locations.linecolumnend_line
end_columnr"   intr#   returnNonec                >    || _         || _        d | _        d | _        d S Nr!   )selfr"   r#   s      *lib/python3.11/site-packages/mypy/nodes.py__init__zContext.__init__*   s"    	$(&*    NtargetContext | int
int | Noner$   r%   c                    t          |t                    r|| _        n0|j        | _        |j        | _        |j        | _        |j        | _        ||| _        ||| _        |	|| _        dS dS )zIf target is a node, pull line (and column) information
        into this node. If column is specified, this will override any column
        information coming from a node.
        N)
isinstancer'   r"   r#   r$   r%   )r,   r0   r#   r$   r%   s        r-   set_linezContext.set_line0   sw     fc"" 	0DIIDI -DK"ODM$/DO DK$DM!(DOOO "!r/   )r&   r&   )r"   r'   r#   r'   r(   r)   NNN
r0   r1   r#   r2   r$   r2   r%   r2   r(   r)   )__name__
__module____qualname____doc__	__slots__r.   r5    r/   r-   r    r    %   s\        JJ<I+ + + + + "#!%) ) ) ) ) ) )r/   r    T
_TypeAliasJsonDictr   LDEF   GDEF   MDEF   UNBOUND_IMPORTEDREVEAL_TYPEREVEAL_LOCALSLITERAL_YESLITERAL_TYPE
LITERAL_NOLdefGdefMdefUnboundImported
node_kindsc                    i | ]\  }}||	S r=   r=   ).0_name_kinds      r-   
<dictcomp>rV   n   s    QQQleUUEQQQr/   inverse_node_kindsz__builtins__.str)r8   r;   __path____file____package____annotations__implicit_module_attrsbuiltins.listbuiltins.dictbuiltins.setbuiltins.frozensetzcollections.ChainMapzcollections.Counterzcollections.defaultdictzcollections.dequezcollections.OrderedDictzbuiltins.str)
typing.Listtyping.Dict
typing.Settyping.FrozenSetztyping.ChainMapztyping.Counterztyping.DefaultDictztyping.Dequeztyping.OrderedDicttyping.LiteralStringtype_aliasesre   )rF      type_aliases_source_versions)ztyping_extensions.OrderedDictztyping_extensions.LiteralStringtyping_extensions_aliasesra   rb   rc   rd   )r]   r^   r_   r`   reverse_builtin_aliasesztyping.Tuple )zbuiltins.tuplezbuiltins.enumerate_nongen_builtinsc              #  $   K   | ]\  }}||fV  d S r+   r=   )rS   aliasnames      r-   	<genexpr>rp      s*      NN+%uNNNNNNr/   python_versiontuple[int, int]r(   dict[str, str]c                     | dk     rt           ni S )N)rF   	   )rl   )rq   s    r-   get_nongen_builtinsrv      s    -66B>r/   )ztyping.runtime_checkableztyping_extensions.runtimez#typing_extensions.runtime_checkableRUNTIME_PROTOCOL_DECOSc                  .    e Zd ZdZdZddZddZddZdS )Nodez4Common base class for all non-type parse tree nodes.r=   r(   strc                    |                      t          j                            t	                                          }|t          |           S |S Noptions)acceptmypystrconvStrConvr   repr)r,   anss     r-   __str__zNode.__str__   s@    kk$,..wyy.AABB;::
r/   r~   r   c                t    |                      t          j                            |                    }|sJ |S r|   )r   r   r   r   )r,   r~   r   s      r-   str_with_optionszNode.str_with_options   s4    kk$,..w.??@@



r/   visitorNodeVisitor[T]r>   c                <    t          dt          |                     NzNot implementedRuntimeErrortyper,   r   s     r-   r   zNode.accept       ,d4jj999r/   Nr(   rz   )r~   r   r(   rz   r   r   r(   r>   )r8   r9   r:   r;   r<   r   r   r   r=   r/   r-   ry   ry      s[        >>I      
: : : : : :r/   ry   c                      e Zd ZdZdZd	dZdS )
	StatementzA statement node.r=   r   StatementVisitor[T]r(   r>   c                <    t          dt          |                     r   r   r   s     r-   r   zStatement.accept   r   r/   Nr   r   r(   r>   r8   r9   r:   r;   r<   r   r=   r/   r-   r   r      s3        I: : : : : :r/   r   c                      e Zd ZdZdZd	dZdS )

ExpressionzAn expression node.r=   r   ExpressionVisitor[T]r(   r>   c                <    t          dt          |                     r   r   r   s     r-   r   zExpression.accept   r   r/   Nr   r   r(   r>   r   r=   r/   r-   r   r      s3        I: : : : : :r/   r   c                      e Zd ZdZdZdS )FakeExpressionzA dummy expression.

    We need a dummy expression in one place, and can't instantiate Expression
    because it is a trait and mypyc barfs.
    r=   N)r8   r9   r:   r;   r<   r=   r/   r-   r   r      s          IIIr/   r   Lvaluec                      e Zd ZdZdZeedd                        Zeedd                        Zedd            Z	e
dd
            ZdS )
SymbolNodez+Nodes that can be stored in a symbol table.r=   r(   rz   c                    d S r+   r=   r,   s    r-   ro   zSymbolNode.name   	     	r/   c                    d S r+   r=   r   s    r-   fullnamezSymbolNode.fullname   r   r/   r@   c                    d S r+   r=   r   s    r-   	serializezSymbolNode.serialize   s    r/   datac                    |d         }t                               |          }| ||          S t          d|           )N.classzunexpected .class )deserialize_mapgetNotImplementedError)clsr   	classnamemethods       r-   deserializezSymbolNode.deserialize   sI    N	 $$Y//6$<<!"By"B"BCCCr/   Nr   r(   r@   )r   r@   r(   r   )r8   r9   r:   r;   r<   propertyr   ro   r   r   classmethodr   r=   r/   r-   r   r      s        55I   ^ X    ^ X    ^ D D D [D D Dr/   r   SymbolTableNodeTypeInfo
Definitionc                  B    e Zd ZU dZdZdZded<   ded<   ded<   d	ed
<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   	 	 d6d7 fd#Zd8d%Ze	d9d&            Z
e	d9d'            Zd:d+Zd;d,Zd<d.Zd=d1Zd>d3Zed?d5            Z xZS )@MypyFilez1The abstract syntax tree of a single source file.)	_fullnamepathdefs
alias_depsis_bomnamesimportsignored_linesskipped_linesis_stubis_cache_skeletonis_partial_stub_packageplugin_depsfuture_import_flags_is_typeshed_file)ro   r   r   rz   r   r   list[Statement]r   zdefaultdict[str, set[str]]r   boolr   SymbolTabler   list[ImportBase]r   zdict[int, list[str]]r   zset[int]r   r   r   r   zdict[str, set[str]]r   zset[str]r   bool | Noner   FNdict[int, list[str]] | Noner(   r)   c                   t                                                       || _        d| _        d| _        || _        || _        t          t                    | _	        i | _
        |r|| _        ni | _        t                      | _        d| _        d| _        d| _        d| _        t                      | _        d | _        d S )NrB   r   rk   F)superr.   r   r"   r#   r   r   r   setr   r   r   r   r   r   r   r   r   r   )r,   r   r   r   r   	__class__s        r-   r.   zMypyFile.__init__E  s     			%c** 	$!.D!#D UU	!&',$#&55 !%r/   Iterator[Definition]c                6    t          | j        | j                  S )zyReturn all definitions within the module (including nested).

        This doesn't include imported definitions.
        )local_definitionsr   r   r   s    r-   r   zMypyFile.local_definitionsa  s    
 !T];;;r/   c                T    | j         sdn| j                             d          d         S )Nrk   .r&   r   splitr   s    r-   ro   zMypyFile.nameh  s(    JrrT^-A-A#-F-Fr-JJr/   c                    | j         S r+   r   r   s    r-   r   zMypyFile.fullnamel  
    ~r/   r   r   r>   c                ,    |                     |           S r+   )visit_mypy_filer   s     r-   r   zMypyFile.acceptp      &&t,,,r/   c                    t          | j                  dk    o6t          j                            | j                                      d          S )Nr   z	__init__.)lenr   osbasename
startswithr   s    r-   is_package_init_filezMypyFile.is_package_init_files  s:    49~~"Zrw'7'7	'B'B'M'Mk'Z'ZZr/   flagc                    || j         v S r+   )r   )r,   r   s     r-   is_future_flag_setzMypyFile.is_future_flag_setv  s    t///r/   r~   r   c                \    | j         t          |j        | j                  | _         | j         S r+   )r   r   abs_custom_typeshed_dirr   r,   r~   s     r-   r   zMypyFile.is_typeshed_filey  s-    !)%5g6UW[W`%a%aD"%%r/   r@   c           	         d| j         | j                            | j                   | j        | j        | j        t          | j                  dS )Nr   )r   r   r   r   r   r   r   )r   r   r   r   r   r   listr   r   s    r-   r   zMypyFile.serialize  sL     Z))$.99|I'+'C#'(@#A#A
 
 	
r/   r   c                F   |d         dk    s
J |            t          g g           }|d         |_        t                              |d                   |_        |d         |_        |d         |_        |d         |_        d|_        t          |d	                   |_
        |S )
Nr   r   r   r   r   r   r   Tr   )r   r   r   r   r   r   r   r   r   r   r   )r   r   trees      r-   r   zMypyFile.deserialize  s    H~+++T+++Bk* ,,T'];;
IL	'+,E'F$!%#&t,A'B#C#C r/   )FN)
r   r   r   r   r   r   r   r   r(   r)   )r(   r   r   r   r(   r   )r   rz   r(   r   )r~   r   r(   r   r   )r   r@   r(   r   )r8   r9   r:   r;   r<   __match_args__r[   r.   r   r   ro   r   r   r   r   r   r   r   r   __classcell__r   s   @r-   r   r     s        ;;I$ .N NNNIII****LLL (''' MMM "!!!$$$$!!!!"""" 59& & & & & & &8< < < < K K K XK    X- - - -[ [ [ [0 0 0 0& & & &	
 	
 	
 	
 
 
 
 [
 
 
 
 
r/   r   c                  R     e Zd ZU dZdZded<   ded<   ded<   ded<   d fdZ xZS )
ImportBasez%Base class for all import statements.)is_unreachableis_top_levelis_mypy_onlyassignmentsr   r   r   r   zlist[AssignmentStmt]r   r(   r)   c                    t                                                       g | _        d| _        d| _        d| _        d S NF)r   r.   r   r   r   r   r,   r   s    r-   r.   zImportBase.__init__  s?    #!!r/   r(   r)   )r8   r9   r:   r;   r<   r[   r.   r   r   s   @r-   r   r     s|         //QI &%%%" " " " " " " " " "r/   r   c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )Importzimport m [as n])idslist[tuple[str, str | None]]r  r(   r)   c                V    t                                                       || _        d S r+   )r   r.   r  )r,   r  r   s     r-   r.   zImport.__init__  s$    r/   r   r   r>   c                ,    |                     |           S r+   )visit_importr   s     r-   r   zImport.accept  s    ##D)))r/   )r  r  r(   r)   r   
r8   r9   r:   r;   r<   r   r[   r.   r   r   r   s   @r-   r  r    so         IN%%%%     * * * * * * * *r/   r  c                  T     e Zd ZU dZdZdZded<   ded<   ded<   d fdZddZ xZ	S )
ImportFromzfrom m import x [as y], ...)idr   relativerz   r
  r'   r  r  r   r(   r)   c                r    t                                                       || _        || _        || _        d S r+   )r   r.   r
  r   r  )r,   r
  r  r   r   s       r-   r.   zImportFrom.__init__  s2    
 r/   r   r   r>   c                ,    |                     |           S r+   )visit_import_fromr   s     r-   r   zImportFrom.accept      ((...r/   )r
  rz   r  r'   r   r  r(   r)   r   r  r   s   @r-   r	  r	    s         %%+I0NGGGMMM''''! ! ! ! ! !/ / / / / / / /r/   r	  c                  J     e Zd ZU dZdZdZded<   ded<   d fd	ZddZ xZ	S )	ImportAllzfrom m import *)r
  r  rz   r
  r'   r  r(   r)   c                d    t                                                       || _        || _        d S r+   )r   r.   r
  r  )r,   r
  r  r   s      r-   r.   zImportAll.__init__  s+     r/   r   r   r>   c                ,    |                     |           S r+   )visit_import_allr   s     r-   r   zImportAll.accept      ''---r/   )r
  rz   r  r'   r(   r)   r   r  r   s   @r-   r  r    su         "I'NGGGMMM! ! ! ! ! !
. . . . . . . .r/   r  )is_propertyis_class	is_staticis_finalFUNCBASE_FLAGSc                  h     e Zd ZdZdZd	 fdZeed
d                        Zed
d            Z	 xZ
S )FuncBasea  Abstract base class for function-like nodes.

    N.B: Although this has SymbolNode subclasses (FuncDef,
    OverloadedFuncDef), avoid calling isinstance(..., FuncBase) on
    something that is typed as SymbolNode.  This is to work around
    mypy bug #3603, in which mypy doesn't understand multiple
    inheritance very well, and will assume that a SymbolNode
    cannot be a FuncBase.

    Instead, test against SYMBOL_FUNCBASE_TYPES, which enumerates
    SymbolNode subclasses that are also FuncBase subclasses.
    )
r   unanalyzed_typeinfor  r  r  r  is_explicit_overrideis_type_check_onlyr   r(   r)   c                    t                                                       d | _        d | _        t          | _        d| _        d| _        d| _        d| _	        d| _
        d| _        d| _        d S )NFrk   )r   r.   r   r  FUNC_NO_INFOr  r  r  r  r  r  r   r   r   s    r-   r.   zFuncBase.__init__  si     37	=A 	 $)!"'r/   rz   c                    d S r+   r=   r   s    r-   ro   zFuncBase.name  r   r/   c                    | j         S r+   r   r   s    r-   r   zFuncBase.fullname  r   r/   r   r   )r8   r9   r:   r;   r<   r.   r   r   ro   r   r   r   s   @r-   r  r    s         I     $    ^ X    X    r/   r  )FuncDef	DecoratorOverloadPartc                       e Zd ZU dZdZded<   ded<   ded<   d fd
Zedd            ZddZ	ddZ
edd            Z xZS )OverloadedFuncDefaR  A logical node representing all the variants of a multi-declaration function.

    A multi-declaration function is often an @overload, but can also be a
    @property with a setter and a/or a deleter.

    This node has no explicit representation in the source program.
    Overloaded variants must be consecutive in the source file.
    )itemsunanalyzed_itemsimpllist[OverloadPart]r*  r+  zOverloadPart | Noner,  r(   r)   c                    t                                                       || _        |                                | _        d | _        |r.|                     |d         j        |d         j                   d S d S Nr   )	r   r.   r*  copyr+  r,  r5   r"   r#   r,   r*  r   s     r-   r.   zOverloadedFuncDef.__init__7  so    
 %

	 	:MM%(-q99999	: 	:r/   rz   c                ^    | j         r| j         d         j        S | j        J | j        j        S r/  )r*  ro   r,  r   s    r-   ro   zOverloadedFuncDef.name@  s5    : 	":a=%% 9(((9>!r/   r   r   r>   c                ,    |                     |           S r+   )visit_overloaded_func_defr   s     r-   r   zOverloadedFuncDef.acceptI      00666r/   r@   c           	         dd | j         D             | j        d n| j                                        | j        | j        d n| j                                        t          | t                    dS )Nr)  c                6    g | ]}|                                 S r=   r   )rS   is     r-   
<listcomp>z/OverloadedFuncDef.serialize.<locals>.<listcomp>O       888akkmm888r/   )r   r*  r   r   r,  flags)r*  r   r   r   r,  	get_flagsr  r   s    r-   r   zOverloadedFuncDef.serializeL  sq    )88TZ888 I-DD493F3F3H3H I-DD493F3F3H3Ht^44
 
 	
r/   r   c                r   |d         dk    sJ t          d |d         D                       }|                    d          ot          t          t                              |d                             |_        t          |j                  dk    r|	                    |j        j
                   |                    d          Mt          j                            |d                   }t          |t          j        j                  sJ ||_        |d         |_        t%          ||d	                    |S )
Nr   r)  c                h    g | ]/}t          t          t                              |                    0S r=   )r   r'  r   r   )rS   ds     r-   r:  z1OverloadedFuncDef.deserialize.<locals>.<listcomp>Z  s0    RRRqT,
 6 6q 9 9::RRRr/   r*  r,  r   r   r   r<  )r)  r   r   r'  r   r   r,  r   r*  r5   r"   r   typesdeserialize_typer4   
ProperTyper   r   	set_flags)r   r   restyps       r-   r   zOverloadedFuncDef.deserializeV  s   H~!44444RRDMRRR
 
 88F'L**@*@f*N*NOOCH39~~!!SX]+++88F'*--d6l;;Cc4:#899999CHZ(#tG}%%%
r/   )r*  r-  r(   r)   r   r   r   )r   r@   r(   r)  )r8   r9   r:   r;   r<   r[   r.   r   ro   r   r   r   r   r   r   s   @r-   r)  r)  '  s           6I((((: : : : : : " " " X"7 7 7 7
 
 
 
    [    r/   r)  c                  D     e Zd ZdZdZdZ	 dd fdZ	 	 	 dd fdZ xZS )Argumentz A single argument in a FuncItem.)variabletype_annotationinitializerkindpos_onlyFrI  VarrJ  mypy.types.Type | NonerK  Expression | NonerL  ArgKindrM  r   r(   r)   c                    t                                                       || _        || _        || _        || _        || _        d S r+   )r   r.   rI  rJ  rK  rL  rM  )r,   rI  rJ  rK  rL  rM  r   s         r-   r.   zArgument.__init__r  sD     	 .&	 r/   Nr0   r1   r#   r2   r$   r%   c                B   t                                          ||||           | j        rA| j        j        dk     r1| j                            | j        | j        | j        | j                   | j                            | j        | j        | j        | j                   d S r/  )r   r5   rK  r"   r#   r$   r%   rI  )r,   r0   r#   r$   r%   r   s        r-   r5   zArgument.set_line  s     	:>>> 	^ 0 5 9 9%%didmT_]]]ty$+t}doVVVVVr/   F)rI  rN  rJ  rO  rK  rP  rL  rQ  rM  r   r(   r)   r6   r7   )	r8   r9   r:   r;   r<   r   r.   r5   r   r   s   @r-   rH  rH  k  s        **RIWN ! ! ! ! ! ! !$ "#!%W W W W W W W W W W Wr/   rH  )is_overloadis_generatoris_coroutineis_async_generatoris_awaitable_coroutineFUNCITEM_FLAGSc                  D     e Zd ZdZdZdZ	 	 	 dd fdZddZddZ xZ	S )FuncItemz9Base class for nodes usable as overloaded function items.)	arguments	arg_names	arg_kindsmin_argsmax_posbodyrU  rV  rW  rX  rY  expanded)r]  ra  r`  Nr]  list[Argument] | Nonerb  Block | NonerF  mypy.types.FunctionLike | Noner(   r)   c                   t                                                       |pg | _        d | j        D             | _        d | j        D             | _        | j                            t                    | j                            t                    z   | _        |pt          g           | _
        || _        || _        d| _        d| _        d| _        d| _        d| _        g | _        d| _        t)          t+          | j                            D ]1}| j        |         "||                                 k     r
|dz   | _        2d S )Nc                8    g | ]}|j         rd n|j        j        S r+   )rM  rI  ro   rS   args     r-   r:  z%FuncItem.__init__.<locals>.<listcomp>  s(    ```##,E$$CL4E```r/   c                    g | ]	}|j         
S r=   )rL  ri  s     r-   r:  z%FuncItem.__init__.<locals>.<listcomp>  s    (L(L(Lc(L(L(Lr/   Fr   rB   )r   r.   r]  r^  r_  countARG_POSARG_OPTra  Blockrb  r   r  rU  rV  rW  rX  rY  rc  r`  ranger   max_fixed_argc)r,   r]  rb  rF  r9  r   s        r-   r.   zFuncItem.__init__  s4    	"b``QUQ_```(L(LT^(L(L(L N0099DN<P<PQX<Y<YY,599		"!&"'"'(-,1#(*s4>**++ 	& 	&A~a (Q1D1D1F1F-F-F !A	& 	&r/   r'   c                    | j         S r+   )ra  r   s    r-   rq  zFuncItem.max_fixed_argc  s
    |r/   r   c                    | j         d u S r+   r   r   s    r-   
is_dynamiczFuncItem.is_dynamic  s    yD  r/   r6   )r]  rd  rb  re  rF  rf  r(   r)   )r(   r'   r   )
r8   r9   r:   r;   r<   __deletable__r.   rq  ru  r   r   s   @r-   r\  r\    s        CCI" 9M ,0!.2	& & & & & & &4   ! ! ! ! ! ! ! !r/   r\  )is_decoratedis_conditionalis_trivial_bodyr   FUNCDEF_FLAGSNOT_ABSTRACTIS_ABSTRACTIMPLICITLY_ABSTRACTc                  v     e Zd ZdZdZdZ	 	 	 	 dd fdZedd            ZddZ	ddZ
edd            Z xZS ) r%  zQFunction definition.

    This is a non-lambda function defined using 'def'.
    )
rT   rw  rx  abstract_statusoriginal_def	deco_linery  r   dataclass_transform_spec	docstring)ro   r]  r   rb  rk   Nro   rz   r]  rd  rb  re  rF  rf  r(   r)   c                    t                                          |||           || _        d| _        d| _        t
          | _        d| _        d | _        d | _	        d| _
        d | _        d | _        d S r   )r   r.   rT   rw  rx  r{  r  ry  r  r  r   r  r  )r,   ro   r]  rb  rF  r   s        r-   r.   zFuncDef.__init__  st     	D#...
!#+  %>B%)!GK%%)r/   c                    | j         S r+   rT   r   s    r-   ro   zFuncDef.name  
    zr/   r   r   r>   c                ,    |                     |           S r+   )visit_func_defr   s     r-   r   zFuncDef.accept      %%d+++r/   r@   c           
        d| j         | j        | j        d | j        D             | j        d n| j                                        t          | t                    | j        | j	        d n| j	                                        d	S )Nr%  c                6    g | ]}t          |j                  S r=   )r'   valuerS   xs     r-   r:  z%FuncDef.serialize.<locals>.<listcomp>!  s     ???1#ag,,???r/   )	r   ro   r   r^  r_  r   r<  r  r  )
rT   r   r^  r_  r   r   r=  rz  r  r  r   s    r-   r   zFuncDef.serialize  s      J????? I-DD493F3F3H3Ht]33#3 08 2<<>>
 
 	
r/   r   c                   |d         dk    sJ t          g           }t          |d         g ||d         d nAt          t          j        j        t          j                            |d                                       }|d         |_        t          ||d                    |d         |_	        d |d	         D             |_
        |d
         |_        |d          t                              |d                   nd |_        |`|`|`|S )Nr   r%  ro   r   r   r<  r^  c                ,    g | ]}t          |          S r=   )rQ  r  s     r-   r:  z'FuncDef.deserialize.<locals>.<listcomp>?  s    ??????r/   r_  r  r  )ro  r%  r   r   rA  FunctionLikerB  r   rD  r^  r_  r  DataclassTransformSpecr   r  r]  ra  r`  )r   r   rb  rets       r-   r   zFuncDef.deserialize-  s   H~****RyyL <' $*14:3N3NtTZ|3\3\]]	
 	
 Z(#tG}%%%[)??T+->???"#45 ./; #..t4N/OPPP 	$ MKL
r/   )rk   NNN)
ro   rz   r]  rd  rb  re  rF  rf  r(   r)   r   r   r   )r   r@   r(   r%  )r8   r9   r:   r;   r<   r   r.   r   ro   r   r   r   r   r   r   s   @r-   r%  r%    s         
I ;N
 +/!.2* * * * * * *0    X, , , ,
 
 
 
0    [    r/   r%  c                       e Zd ZU dZdZdZded<   ded<   ded<   d	ed
<   ded<   d  fdZed!d            Z	ed!d            Z
ed"d            Zed#d            Zed$d            Zd%dZd&dZed'd            Z xZS )(r&  zhA decorated function.

    A single Decorator object can include any number of function decorators.
    )func
decoratorsoriginal_decoratorsvarrU  )r  r  r  r%  r  list[Expression]r  r  rN  r  r   rU  r(   r)   c                    t                                                       || _        || _        |                                | _        || _        d| _        d S r   )r   r.   r  r  r0  r  r  rU  )r,   r  r  r  r   s       r-   r.   zDecorator.__init__d  sN    	$#-??#4#4  r/   rz   c                    | j         j        S r+   )r  ro   r   s    r-   ro   zDecorator.namel      y~r/   c                    | j         j        S r+   )r  r   r   s    r-   r   zDecorator.fullnamep      y!!r/   c                    | j         j        S r+   )r  r  r   s    r-   r  zDecorator.is_finalt  r  r/   r   c                    | j         j        S r+   )r  r  r   s    r-   r  zDecorator.infox  r  r/   rO  c                    | j         j        S r+   )r  r   r   s    r-   r   zDecorator.type|  s    x}r/   r   r   r>   c                ,    |                     |           S r+   )visit_decoratorr   s     r-   r   zDecorator.accept  r   r/   r@   c                v    d| j                                         | j                                        | j        dS )Nr&  )r   r  r  rU  )r  r   r  rU  r   s    r-   r   zDecorator.serialize  s<    !I''))8%%''+	
 
 	
r/   r   c                    |d         dk    sJ t          t                              |d                   g t                              |d                             }|d         |_        |S )Nr   r&  r  r  rU  )r&  r%  r   rN  rU  )r   r   decs      r-   r   zDecorator.deserialize  s\    H~,,,,++DL992stTY{?[?[\\}-
r/   )r  r%  r  r  r  rN  r(   r)   r   r   )r(   r   r(   rO  r   r   )r   r@   r(   r&  )r8   r9   r:   r;   r<   r   r[   r.   r   ro   r   r  r  r   r   r   r   r   r   r   s   @r-   r&  r&  R  st         
 TI2NMMM    ))))HHH! ! ! ! ! !    X " " " X" " " " X"    X    X- - - -
 
 
 
    [    r/   r&  )is_selfis_clsis_initialized_in_classis_staticmethodis_classmethodr  is_settable_propertyis_suppressed_importis_classvaris_abstract_varr  final_unset_in_classfinal_set_in_initexplicit_self_typeis_readyis_inferredinvalid_partial_typefrom_module_getattrhas_explicit_valueallow_incompatible_override	VAR_FLAGSc                       e Zd ZdZdZdZdd fdZedd            Zedd            Z	ddZ
ddZedd            Z xZS )rN  zPA variable.

    It can refer to global/local variable or a data attribute.
    )rT   r   r  r   final_valuer  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )ro   r   r  Nro   rz   r   rO  r(   r)   c                   t                                                       || _        d| _        t          | _        || _        d| _        d| _        d| _	        | j        d u | _
        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d | _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d S )Nrk   FT)r   r.   rT   r   VAR_NO_INFOr  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )r,   ro   r   r   s      r-   r.   zVar.__init__  s    
	,0	9,',$$# $)! $ %*! GK$)!!& #(#(  #(+0( %*!!!r/   c                    | j         S r+   r  r   s    r-   ro   zVar.name  r  r/   c                    | j         S r+   r   r   s    r-   r   zVar.fullname  r   r/   r   r   r>   c                ,    |                     |           S r+   )	visit_varr   s     r-   r   z
Var.accept  s      &&&r/   r@   c                    d| j         | j        | j        d n| j                                        t	          | t
                    d}| j        
| j        |d<   |S )NrN  )r   ro   r   r   r<  r  )rT   r   r   r   r=  r  r  r,   r   s     r-   r   zVar.serialize  sc     J I-DD493F3F3H3HtY//
 
 '"&"2Dr/   r   c                8   |d         dk    sJ |d         }|d         d n$t           j                            |d                   }t          ||          }d|_        |d         |_        t          ||d                    |                    d          |_        |S )	Nr   rN  ro   r   Fr   r<  r  )	r   rA  rB  rN  r  r   rD  r   r  )r   r   ro   r   vs        r-   r   zVar.deserialize  s    H~&&&&F|F|+tt1L1LTRX\1Z1ZdOO
:&!T']###//r/   r+   )ro   rz   r   rO  r(   r)   r   r   r   )r   r@   r(   rN  )r8   r9   r:   r;   r<   r   r.   r   ro   r   r   r   r   r   r   r   s   @r-   rN  rN    s         
I8 5N3* 3* 3* 3* 3* 3* 3*j    X    X' ' ' '    	 	 	 [	 	 	 	 	r/   rN  c                  $    e Zd ZU dZdZdZded<   ded<   ded<   d	ed
<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   	 	 	 	 d-d. fd Zed/d!            Z	e	j
        d0d#            Z	d1d'Zd2d(Zd3d*Zed4d,            Z xZS )5ClassDefzClass definition)ro   r   r   	type_varsbase_type_exprsremoved_base_type_exprsr  	metaclassr  keywordsanalyzedhas_incompatible_baseclassr  r  removed_statements)ro   r   rz   ro   r   ro  r   z list[mypy.types.TypeVarLikeType]r  r  r  r  r   r  rP  r  r  zdict[str, Expression]r  r  r   r  r   r  N'list[mypy.types.TypeVarLikeType] | Nonelist[Expression] | None#list[tuple[str, Expression]] | Noner(   r)   c                N   t                                                       || _        d| _        || _        |pg | _        |pg | _        g | _        t          | _	        || _
        g | _        |rt          |          ni | _        d | _        d| _        d | _        d | _        g | _        d S Nrk   F)r   r.   ro   r   r   r  r  r  CLASSDEF_NO_INFOr  r  r  dictr  r  r  r  r  r  )r,   ro   r   r  r  r  r  r   s          r-   r.   zClassDef.__init__R  s     			"b.4"')$$	"*2:X*/'%)%)"$r/   c                    | j         S r+   r   r   s    r-   r   zClassDef.fullnamem  r   r/   r  c                    || _         d S r+   r   r,   r  s     r-   r   zClassDef.fullnameq      r/   r   r   r>   c                ,    |                     |           S r+   )visit_class_defr   s     r-   r   zClassDef.acceptu  r   r/   c                4    | j                                         S r+   )r  
is_genericr   s    r-   r  zClassDef.is_genericx  s    y##%%%r/   r@   c                B    d| j         | j        d | j        D             dS )Nr  c                6    g | ]}|                                 S r=   r8  rS   r  s     r-   r:  z&ClassDef.serialize.<locals>.<listcomp>  s     @@@A!++--@@@r/   )r   ro   r   r  )ro   r   r  r   s    r-   r   zClassDef.serialize{  s3     !I@@@@@	
 
 	
r/   r   c                    |d         dk    sJ t          |d         t          g           d |d         D                       }|d         |_        |S )Nr   r  ro   c                    g | ]>}t          t          j        j        t          j                            |                    ?S r=   )r   r   rA  TypeVarLikeTyperB  r  s     r-   r:  z(ClassDef.deserialize.<locals>.<listcomp>  sG        TZ/1L1LQ1O1OPP  r/   r  r   )r  ro  r   )r,   r   rE  s      r-   r   zClassDef.deserialize  sj    H~++++L"II k*  	
 
 J'
r/   )NNNN)ro   rz   r   ro  r  r  r  r  r  rP  r  r  r(   r)   r   r  rz   r(   r)   r   r   r   )r   r@   r(   r  )r8   r9   r:   r;   r<   r   r[   r.   r   r   setterr   r  r   r   r   r   r   s   @r-   r  r  *  s        I$ &NIIINNNKKK////%%%%----NNN        ####$$$$'''' >B37'+8<% % % % % % %6    X _   _- - - -& & & &
 
 
 
    [    r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )
GlobalDeclzDeclaration global x, y, ...r   	list[str]r   r(   r)   c                V    t                                                       || _        d S r+   r   r.   r   r,   r   r   s     r-   r.   zGlobalDecl.__init__  $    


r/   r   r   r>   c                ,    |                     |           S r+   )visit_global_declr   s     r-   r   zGlobalDecl.accept  r  r/   r   r  r(   r)   r   r  r   s   @r-   r  r    so         &&IN     / / / / / / / /r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )NonlocalDeclzDeclaration nonlocal x, y, ...r  r  r   r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zNonlocalDecl.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_nonlocal_declr   s     r-   r   zNonlocalDecl.accept      **4000r/   r  r   r  r   s   @r-   r  r    so         ((IN     1 1 1 1 1 1 1 1r/   r  c                  0     e Zd ZdZdZd fdZdd
Z xZS )ro  )rb  r   rb  r   r(   r)   c                d    t                                                       || _        d| _        d S r   )r   r.   rb  r   )r,   rb  r   s     r-   r.   zBlock.__init__  s0    	 $r/   r   r   r>   c                ,    |                     |           S r+   )visit_blockr   s     r-   r   zBlock.accept  s    ""4(((r/   )rb  r   r(   r)   r   )r8   r9   r:   r<   r   r.   r   r   r   s   @r-   ro  ro    s[        *I/N$ $ $ $ $ $) ) ) ) ) ) ) )r/   ro  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )ExpressionStmtz/An expression as a statement, such as print(s).exprr   r  r(   r)   c                V    t                                                       || _        d S r+   r   r.   r  r,   r  r   s     r-   r.   zExpressionStmt.__init__  $    			r/   r   r   r>   c                ,    |                     |           S r+   )visit_expression_stmtr   s     r-   r   zExpressionStmt.accept      ,,T222r/   r  r   r(   r)   r   r  r   s   @r-   r  r    so         99IN     3 3 3 3 3 3 3 3r/   r  c                       e Zd ZU dZdZdZded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<   	 	 dd fdZddZ xZ	S )AssignmentStmtab  Assignment statement.

    The same node class is used for single assignment, multiple assignment
    (e.g. x, y = z) and chained assignment (e.g. x = y = z), assignments
    that define new names, and assignments with explicit types ("# type: t"
    or "x: t [= ...]").

    An lvalue can be NameExpr, TupleExpr, ListExpr, MemberExpr, or IndexExpr.
    )lvaluesrvaluer   r  
new_syntaxis_alias_defis_final_definvalid_recursive_alias)r  rvaluesr   list[Lvalue]r  r   r  rO  r   r  r   r  r  r  r  NFr(   r)   c                    t                                                       || _        || _        || _        || _        || _        d| _        d| _        d| _	        d S r   )
r   r.   r  r  r   r  r  r  r  r  )r,   r  r  r   r  r   s        r-   r.   zAssignmentStmt.__init__  s]     		#$!!',$$$r/   r   r   r>   c                ,    |                     |           S r+   )visit_assignment_stmtr   s     r-   r   zAssignmentStmt.accept  r  r/   r   )
r  r  r  r   r   rO  r  r   r(   r)   r   r  r   s   @r-   r  r    s          	I 4N    ++++  "!!! (, - - - - - - -"3 3 3 3 3 3 3 3r/   r  c                  T     e Zd ZU dZdZdZded<   ded<   ded	<   d fdZddZ xZ	S )OperatorAssignmentStmtz,Operator assignment statement such as x += 1)oplvaluer  )r  r  r  rz   r  r   r  r   r  r(   r)   c                r    t                                                       || _        || _        || _        d S r+   )r   r.   r  r  r  )r,   r  r  r  r   s       r-   r.   zOperatorAssignmentStmt.__init__,  s2    r/   r   r   r>   c                ,    |                     |           S r+   )visit_operator_assignment_stmtr   s     r-   r   zOperatorAssignmentStmt.accept2      55d;;;r/   )r  rz   r  r   r  r   r(   r)   r   r  r   s   @r-   r  r  !  s         66*I/NGGGNNN     < < < < < < < <r/   r  c                  P     e Zd ZU dZdZded<   ded<   ded<   d fd
ZddZ xZS )	WhileStmtr  rb  	else_bodyr   r  ro  rb  re  r"  r(   r)   c                r    t                                                       || _        || _        || _        d S r+   r   r.   r  rb  r"  r,   r  rb  r"  r   s       r-   r.   zWhileStmt.__init__?  2    		"r/   r   r   r>   c                ,    |                     |           S r+   )visit_while_stmtr   s     r-   r   zWhileStmt.acceptE  r  r/   )r  r   rb  ro  r"  re  r(   r)   r   	r8   r9   r:   r<   r   r[   r.   r   r   r   s   @r-   r   r   6  s~         -I2NKKK# # # # # #. . . . . . . .r/   r   c                       e Zd ZU dZdZded<   ded<   ded<   ded<   ded	<   d
ed<   ded<   ded<   ded<   	 dd fdZddZ xZS )ForStmt)	index
index_typeunanalyzed_index_typeinferred_item_typeinferred_iterator_typer  rb  r"  is_async)r,  r-  r  rb  r"  r   r,  rO  r-  r.  r/  r0  r   r  ro  rb  re  r"  r   r1  Nr(   r)   c                    t                                                       || _        || _        || _        d | _        d | _        || _        || _        || _	        d| _
        d S r   )r   r.   r,  r-  r.  r/  r0  r  rb  r"  r1  )r,   r,  r  rb  r"  r-  r   s         r-   r.   zForStmt.__init__h  sa     	
$%/""&&*#		"r/   r   r   r>   c                ,    |                     |           S r+   )visit_for_stmtr   s     r-   r   zForStmt.accept{  r  r/   r+   )r,  r   r  r   rb  ro  r"  re  r-  rO  r(   r)   r   r)  r   s   @r-   r+  r+  I  s         
I JN MMM&&&&1111....2222KKKNNN .2      &, , , , , , , ,r/   r+  c                  <     e Zd ZU dZdZded<   d fdZdd
Z xZS )
ReturnStmtr   rP  r  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zReturnStmt.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_return_stmtr   s     r-   r   zReturnStmt.accept  r  r/   r  rP  r(   r)   r   r)  r   s   @r-   r6  r6    si         IN     / / / / / / / /r/   r6  c                  H     e Zd ZU dZdZded<   ded<   dd fd	ZddZ xZS )
AssertStmt)r  msgr   r  rP  r=  Nr(   r)   c                d    t                                                       || _        || _        d S r+   )r   r.   r  r=  )r,   r  r=  r   s      r-   r.   zAssertStmt.__init__  s+    	r/   r   r   r>   c                ,    |                     |           S r+   )visit_assert_stmtr   s     r-   r   zAssertStmt.accept  r  r/   r+   )r  r   r=  rP  r(   r)   r   r)  r   s   @r-   r<  r<    sz         I$N      
/ / / / / / / /r/   r<  c                  <     e Zd ZU dZdZded<   d fdZdd
Z xZS )DelStmtr   r   r  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zDelStmt.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_del_stmtr   s     r-   r   zDelStmt.accept  r  r/   )r  r   r(   r)   r   r)  r   s   @r-   rB  rB    sf         INLLL     , , , , , , , ,r/   rB  c                      e Zd ZdZddZdS )		BreakStmtr=   r   r   r(   r>   c                ,    |                     |           S r+   )visit_break_stmtr   s     r-   r   zBreakStmt.accept  r  r/   Nr   r8   r9   r:   r<   r   r=   r/   r-   rG  rG    s-        I. . . . . .r/   rG  c                      e Zd ZdZddZdS )	ContinueStmtr=   r   r   r(   r>   c                ,    |                     |           S r+   )visit_continue_stmtr   s     r-   r   zContinueStmt.accept  r  r/   Nr   rJ  r=   r/   r-   rL  rL    s-        I1 1 1 1 1 1r/   rL  c                      e Zd ZdZddZdS )	PassStmtr=   r   r   r(   r>   c                ,    |                     |           S r+   )visit_pass_stmtr   s     r-   r   zPassStmt.accept  r   r/   Nr   rJ  r=   r/   r-   rP  rP    s-        I- - - - - -r/   rP  c                  P     e Zd ZU dZdZded<   ded<   ded<   d fd
ZddZ xZS )IfStmtr!  r  r  list[Block]rb  re  r"  r(   r)   c                r    t                                                       || _        || _        || _        d S r+   r$  r%  s       r-   r.   zIfStmt.__init__  r&  r/   r   r   r>   c                ,    |                     |           S r+   )visit_if_stmtr   s     r-   r   zIfStmt.accept      $$T***r/   )r  r  rb  rU  r"  re  r(   r)   r   r)  r   s   @r-   rT  rT    s         -I2N# # # # # #+ + + + + + + +r/   rT  c                  F     e Zd ZU dZdZded<   ded<   d fdZddZ xZS )	RaiseStmt)r  	from_exprrP  r  r\  r(   r)   c                d    t                                                       || _        || _        d S r+   )r   r.   r  r\  )r,   r  r\  r   s      r-   r.   zRaiseStmt.__init__  s+    	"r/   r   r   r>   c                ,    |                     |           S r+   )visit_raise_stmtr   s     r-   r   zRaiseStmt.accept  r  r/   )r  rP  r\  rP  r(   r)   r   r)  r   s   @r-   r[  r[    sw         %I*N     # # # # # #
. . . . . . . .r/   r[  c                  x     e Zd ZU dZdZded<   ded<   ded<   ded	<   d
ed<   d
ed<   ded<   d fdZddZ xZS )TryStmt)rb  rA  varshandlersr"  finally_bodyis_starro  rb  list[Expression | None]rA  list[NameExpr | None]rb  rU  rc  re  r"  rd  r   re  r(   r)   c                    t                                                       || _        || _        || _        || _        || _        || _        d| _        d S r   )	r   r.   rb  rb  rA  rc  r"  rd  re  )r,   rb  rb  rA  rc  r"  rd  r   s          r-   r.   zTryStmt.__init__  sQ     			
 "(r/   r   r   r>   c                ,    |                     |           S r+   )visit_try_stmtr   s     r-   r   zTryStmt.accept	  r  r/   )rb  ro  rb  rg  rA  rf  rc  rU  r"  re  rd  re  r(   r)   r   r)  r   s   @r-   ra  ra    s         ]IbNKKK""""MMM     $, , , , , , , ,r/   ra  c                  r     e Zd ZU dZdZded<   ded<   ded<   d	ed
<   ded<   ded<   	 dd fdZddZ xZS )WithStmt)r  r0   r  analyzed_typesrb  r1  )r  r0   rb  r  r  list[Lvalue | None]r0   rO  r  list[mypy.types.Type]rm  ro  rb  r   r1  Ntarget_typer(   r)   c                    t                                                       || _        || _        || _        g | _        || _        d| _        d S r   )r   r.   r  r0   r  rm  rb  r1  )r,   r  r0   rb  rp  r   s        r-   r.   zWithStmt.__init__  sK     		* 	r/   r   r   r>   c                ,    |                     |           S r+   )visit_with_stmtr   s     r-   r   zWithStmt.accept*  r   r/   r+   )
r  r  r0   rn  rb  ro  rp  rO  r(   r)   r   r)  r   s   @r-   rl  rl    s         [I/N++++))))KKKNNN /3      - - - - - - - -r/   rl  c                  Z     e Zd ZU dZdZded<   ded<   ded<   ded	<   d fdZddZ xZS )	MatchStmt)subjectpatternsguardsbodiesr   rv  list[Pattern]rw  rf  rx  rU  ry  r(   r)   c                    t                                                       t          |          t          |          cxk    rt          |          k    sn J || _        || _        || _        || _        d S r+   )r   r.   r   rv  rw  rx  ry  )r,   rv  rw  rx  ry  r   s        r-   r.   zMatchStmt.__init__8  sr     	8}}F::::s6{{:::::: r/   r   r   r>   c                ,    |                     |           S r+   )visit_match_stmtr   s     r-   r   zMatchStmt.acceptF  r  r/   )
rv  r   rw  rz  rx  rf  ry  rU  r(   r)   r   r)  r   s   @r-   ru  ru  .  s         ;I@N####     . . . . . . . .r/   ru  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )IntExprzInteger literalr  r'   r  r(   r)   c                V    t                                                       || _        d S r+   r   r.   r  r,   r  r   s     r-   r.   zIntExpr.__init__V  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_int_exprr   s     r-   r   zIntExpr.acceptZ  r  r/   )r  r'   r(   r)   r   r  r   s   @r-   r  r  M  sl         INJJJ     , , , , , , , ,r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )StrExprzString literalr  rz   r  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zStrExpr.__init__m  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_str_exprr   s     r-   r   zStrExpr.acceptq  r  r/   r  rz   r(   r)   r   r  r   s   @r-   r  r  d  sl         INJJJ     , , , , , , , ,r/   r  seqr  TypeGuard[list[StrExpr]]c                4    t          d | D                       S )Nc              3  @   K   | ]}t          |t                    V  d S r+   )r4   r  )rS   items     r-   rp   z"is_StrExpr_list.<locals>.<genexpr>v  s,      99Tz$((999999r/   )all)r  s    r-   is_StrExpr_listr  u  s    99S999999r/   c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )	BytesExprzBytes literalr  rz   r  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zBytesExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_bytes_exprr   s     r-   r   zBytesExpr.accept  r  r/   r  r   r  r   s   @r-   r  r  y  sn         IN JJJ     . . . . . . . .r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )	FloatExprzFloat literalr  floatr  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zFloatExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_float_exprr   s     r-   r   zFloatExpr.accept  r  r/   )r  r  r(   r)   r   r  r   s   @r-   r  r    sl         INLLL     . . . . . . . .r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )ComplexExprzComplex literalr  complexr  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zComplexExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_complex_exprr   s     r-   r   zComplexExpr.accept      ))$///r/   )r  r  r(   r)   r   r  r   s   @r-   r  r    sl         INNNN     0 0 0 0 0 0 0 0r/   r  c                      e Zd ZdZdZd	dZdS )
EllipsisExprzEllipsis (...)r=   r   r   r(   r>   c                ,    |                     |           S r+   )visit_ellipsisr   s     r-   r   zEllipsisExpr.accept  r  r/   Nr   r   r=   r/   r-   r  r    s3        I, , , , , ,r/   r  c                  J     e Zd ZU dZdZdZded<   ded<   d fd	ZddZ xZ	S )StarExprzStar expression)r  validr   r  r   r  r(   r)   c                d    t                                                       || _        d| _        d S r   )r   r.   r  r  r  s     r-   r.   zStarExpr.__init__  s-    	 


r/   r   r   r>   c                ,    |                     |           S r+   )visit_star_exprr   s     r-   r   zStarExpr.accept  r   r/   r	  r   r  r   s   @r-   r  r    sx         !I&NKKK     - - - - - - - -r/   r  c                  b     e Zd ZdZdZd
 fdZedd            Zej        dd	            Z xZ	S )RefExprz,Abstract base class for name-like constructs)rL  noder   
is_new_defis_inferred_defis_alias_rvalue
type_guardr(   r)   c                    t                                                       d | _        d | _        d| _        d| _        d| _        d| _        d | _        d S r  )	r   r.   rL  r  r   r  r  r  r  r   s    r-   r.   zRefExpr.__init__  sR     $	'+	
  %$26r/   rz   c                    | j         S r+   r   r   s    r-   r   zRefExpr.fullname  r   r/   r  c                    || _         d S r+   r   r  s     r-   r   zRefExpr.fullname  r  r/   r   r   r  )
r8   r9   r:   r;   r<   r.   r   r   r  r   r   s   @r-   r  r    s        66I7 7 7 7 7 7(    X _   _    r/   r  c                  <     e Zd ZdZdZdZd fdZddZddZ xZ	S )NameExprzOName expression

    This refers to a local name, global name or a module.
    )ro   is_special_form)ro   r  ro   rz   r(   r)   c                d    t                                                       || _        d| _        d S r   )r   r.   ro   r  )r,   ro   r   s     r-   r.   zNameExpr.__init__  s.    	$r/   r   r   r>   c                ,    |                     |           S r+   )visit_name_exprr   s     r-   r   zNameExpr.accept  r   r/   r@   c                    J d|              )NFzSerializing NameExpr: r=   r   s    r-   r   zNameExpr.serialize  s    55t55555r/   )ro   rz   r(   r)   r   r   )
r8   r9   r:   r;   r<   r   r.   r   r   r   r   s   @r-   r  r    s{         
 ,I%N% % % % % %- - - -6 6 6 6 6 6 6 6r/   r  c                  4     e Zd ZdZdZdZd fd
ZddZ xZS )
MemberExprzMember access expression x.y)r  ro   def_var)r  ro   r  r  r   ro   rz   r(   r)   c                r    t                                                       || _        || _        d | _        d S r+   )r   r.   r  ro   r  )r,   r  ro   r   s      r-   r.   zMemberExpr.__init__  s4    		 $(r/   r   r   r>   c                ,    |                     |           S r+   )visit_member_exprr   s     r-   r   zMemberExpr.accept#  r  r/   )r  r   ro   rz   r(   r)   r   	r8   r9   r:   r;   r<   r   r.   r   r   r   s   @r-   r  r    sa        &&+I-N( ( ( ( ( (/ / / / / / / /r/   r  c                  R    e Zd ZdZdZdZdZdZdZdddZ	dddZ
ddZddZddZdS )rQ  r   rB   rD   rF         Fstarr   r(   c                H    | t           k    p| t          k    p|o
| t          k    S r+   )rm  rn  ARG_STARr,   r  s     r-   is_positionalzArgKind.is_positional7  s$    wP$'/Pd6Otx?OPr/   c                H    | t           k    p| t          k    p|o
| t          k    S r+   )	ARG_NAMEDARG_NAMED_OPT	ARG_STAR2r  s     r-   is_namedzArgKind.is_named:  s&    y YDM$9Yd>XtyGXYr/   c                .    | t           k    p
| t          k    S r+   )rm  r  r   s    r-   is_requiredzArgKind.is_required=  s    w3$)"33r/   c                .    | t           k    p
| t          k    S r+   )rn  r  r   s    r-   is_optionalzArgKind.is_optional@  s    w7$-"77r/   c                .    | t           k    p
| t          k    S r+   )r  r  r   s    r-   re  zArgKind.is_starC  s    x449#44r/   NrT  )r  r   r(   r   r   )r8   r9   r:   rm  rn  r  r  r  r  r  r  r  r  re  r=   r/   r-   rQ  rQ  (  s         GGHIIMQ Q Q Q QZ Z Z Z Z4 4 4 48 8 8 85 5 5 5 5 5r/   rQ  rm  rn  r  r  r  r  c                  8     e Zd ZdZdZdZ	 dd fdZddZ xZS )CallExprzCall expression.

    This can also represent several special forms that are syntactically calls
    such as cast(...) and None  # type: ....
    )calleeargsr_  r^  r  )r  r  r_  r^  Nr  r   r  r  r_  list[ArgKind]r^  list[str | None]r  rP  r(   r)   c                    t                                                       |sd gt          |          z  }|| _        || _        || _        || _        || _        d S r+   )r   r.   r   r  r  r_  r^  r  )r,   r  r  r_  r^  r  r   s         r-   r.   zCallExpr.__init__Z  s^     	 	+T*I	"+4 !r/   r   r   r>   c                ,    |                     |           S r+   )visit_call_exprr   s     r-   r   zCallExpr.accepto  r   r/   r+   )r  r   r  r  r_  r  r^  r  r  rP  r(   r)   r   r  r   s   @r-   r  r  O  sr          IIAN '+! ! ! ! ! ! !*- - - - - - - -r/   r  c                  <     e Zd ZU dZdZded<   d fdZdd
Z xZS )YieldFromExprr   r   r  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zYieldFromExpr.__init__z  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_yield_from_exprr   s     r-   r   zYieldFromExpr.accept~  r  r/   r	  r   r)  r   s   @r-   r  r  s  si         IN     3 3 3 3 3 3 3 3r/   r  c                  <     e Zd ZU dZdZded<   d fdZdd
Z xZS )	YieldExprr   rP  r  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zYieldExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_yield_exprr   s     r-   r   zYieldExpr.accept  r  r/   r:  r   r)  r   s   @r-   r  r    si         IN     . . . . . . . .r/   r  c                  ^     e Zd ZU dZdZdZded<   ded<   ded<   d	ed
<   d fdZddZ xZ	S )	IndexExprzaIndex expression x[y].

    Also wraps type application such as List[int] as a special form.
    )baser,  method_typer  )r  r,  r   r  r,  rO  r  z&TypeApplication | TypeAliasExpr | Noner  r(   r)   c                    t                                                       || _        || _        d | _        d | _        d S r+   )r   r.   r  r,  r  r  )r,   r  r,  r   s      r-   r.   zIndexExpr.__init__  s:    	
r/   r   r   r>   c                ,    |                     |           S r+   )visit_index_exprr   s     r-   r   zIndexExpr.accept  r  r/   )r  r   r,  r   r(   r)   r   r  r   s   @r-   r  r    s          
 =I&N'''' 5444     . . . . . . . .r/   r  c                  T     e Zd ZU dZdZdZded<   ded<   ded	<   d fdZddZ xZ	S )	UnaryExprzUnary operation)r  r  r  )r  r  rz   r  r   r  rO  r  r(   r)   c                r    t                                                       || _        || _        d | _        d S r+   )r   r.   r  r  r  )r,   r  r  r   s      r-   r.   zUnaryExpr.__init__  s5    	r/   r   r   r>   c                ,    |                     |           S r+   )visit_unary_exprr   s     r-   r   zUnaryExpr.accept  r  r/   )r  rz   r  r   r(   r)   r   r  r   s   @r-   r  r    s         -I#NGGG''''           . . . . . . . .r/   r  c                  4     e Zd ZdZdZdZd fdZddZ xZS )AssignmentExprz5Assignment expressions in Python 3.8+, like "a := 2".)r0   r  r0   r   r  r(   r)   c                d    t                                                       || _        || _        d S r+   )r   r.   r0   r  )r,   r0   r  r   s      r-   r.   zAssignmentExpr.__init__  s+    


r/   r   r   r>   c                ,    |                     |           S r+   )visit_assignment_exprr   s     r-   r   zAssignmentExpr.accept  r  r/   )r0   r   r  r   r(   r)   r   r  r   s   @r-   r  r    sa        ??#I(N     
3 3 3 3 3 3 3 3r/   r  c                       e Zd ZU dZdZdZded<   ded<   ded<   d	ed
<   ded<   ded<   ded<   	 dd fdZddZ xZ	S )OpExprz^Binary operation.

    The dot (.), [] and comparison operators have more specific nodes.
    )r  leftrightr  right_alwaysright_unreachabler  )r  r  r   rz   r  r   r  r   rO  r  r   r  r  TypeAliasExpr | Noner  Nr(   r)   c                    t                                                       || _        || _        || _        d | _        d| _        d| _        || _        d S r   )	r   r.   r  r  r   r  r  r  r  )r,   r  r  r   r  r   s        r-   r.   zOpExpr.__init__  sS     		
!!& r/   r   r   r>   c                ,    |                     |           S r+   )visit_op_exprr   s     r-   r   zOpExpr.accept  rY  r/   r+   )
r  rz   r  r   r   r   r  r  r(   r)   r   r  r   s   @r-   r  r    s          
I -NGGG''''"""" ^b
! 
! 
! 
! 
! 
! 
!+ + + + + + + +r/   r  c                  \     e Zd ZU dZdZdZded<   ded<   ded	<   d fdZddZddZ	 xZ
S )ComparisonExprz+Comparison expression (e.g. a < b > c < d).)	operatorsoperandsmethod_types)r
  r	  r  r	  r  r
  zlist[mypy.types.Type | None]r  r(   r)   c                r    t                                                       || _        || _        g | _        d S r+   )r   r.   r	  r
  r  )r,   r	  r
  r   s      r-   r.   zComparisonExpr.__init__  s5    " r/   ,Iterator[tuple[str, Expression, Expression]]c              #  ~   K   t          | j                  D ]%\  }}|| j        |         | j        |dz            fV  &dS )zzIf this comparison expr is "a < b is c == d", yields the sequence
        ("<", a, b), ("is", b, c), ("==", c, d)
        rB   N)	enumerater	  r
  )r,   r9  operators      r-   pairwisezComparisonExpr.pairwise  s[       %T^44 	C 	CKAxDM!,dmAE.BBBBBB	C 	Cr/   r   r   r>   c                ,    |                     |           S r+   )visit_comparison_exprr   s     r-   r   zComparisonExpr.accept  r  r/   )r	  r  r
  r  r(   r)   )r(   r  r   )r8   r9   r:   r;   r<   r   r[   r.   r  r   r   r   s   @r-   r  r    s         559I.N....     C C C C3 3 3 3 3 3 3 3r/   r  c                  T     e Zd ZU dZdZdZded<   ded<   ded<   d fd	ZddZ xZ	S )	SliceExprznSlice expression (e.g. 'x:y', 'x:', '::2' or ':').

    This is only valid as index in index expressions.
    )begin_index	end_indexstriderP  r  r  r  r(   r)   c                r    t                                                       || _        || _        || _        d S r+   )r   r.   r  r  r  )r,   r  r  r  r   s       r-   r.   zSliceExpr.__init__-  s5     	&"r/   r   r   r>   c                ,    |                     |           S r+   )visit_slice_exprr   s     r-   r   zSliceExpr.accept8  r  r/   )r  rP  r  rP  r  rP  r(   r)   r   r  r   s   @r-   r  r    s          
 7I;N""""    	 	 	 	 	 	. . . . . . . .r/   r  c                  J     e Zd ZU dZdZdZded<   ded<   d fd
ZddZ xZ	S )CastExprz!Cast expression cast(type, expr).r  r   r   r  mypy.types.Typer   rF  r(   r)   c                d    t                                                       || _        || _        d S r+   r   r.   r  r   r,   r  rF  r   s      r-   r.   zCastExpr.__init__F  +    				r/   r   r   r>   c                ,    |                     |           S r+   )visit_cast_exprr   s     r-   r   zCastExpr.acceptK  r   r/   r  r   rF  r  r(   r)   r   r  r   s   @r-   r  r  <  s{         ++ I%N     
- - - - - - - -r/   r  c                  J     e Zd ZU dZdZdZded<   ded<   d fd
ZddZ xZ	S )AssertTypeExprz1Represents a typing.assert_type(expr, type) call.r  r   r  r  r   rF  r(   r)   c                d    t                                                       || _        || _        d S r+   r!  r"  s      r-   r.   zAssertTypeExpr.__init__Y  r#  r/   r   r   r>   c                ,    |                     |           S r+   )visit_assert_type_exprr   s     r-   r   zAssertTypeExpr.accept^      --d333r/   r&  r   r  r   s   @r-   r(  r(  O  s{         ;; I%N     
4 4 4 4 4 4 4 4r/   r(  c                  \     e Zd ZU dZdZdZded<   ded<   ded<   	 	 	 dd fdZddZ xZ	S )
RevealExprzGReveal type expression reveal_type(expr) or reveal_locals() expression.)r  rL  local_nodesis_importedrP  r  r'   rL  list[Var] | Noner/  NFr0  r   r(   r)   c                    t                                                       || _        || _        || _        || _        d S r+   )r   r.   r  rL  r/  r0  )r,   rL  r  r/  r0  r   s        r-   r.   zRevealExpr.__init__m  s?     			&&r/   r   r   r>   c                ,    |                     |           S r+   )visit_reveal_exprr   s     r-   r   zRevealExpr.acceptz  r  r/   )NNF)
rL  r'   r  rP  r/  r1  r0  r   r(   r)   r   r  r   s   @r-   r.  r.  b  s         QQ>ICNIII!!!!
 #'(,!' ' ' ' ' ' '/ / / / / / / /r/   r.  c                  T     e Zd ZU dZdZdZded<   ded<   ded	<   d fdZddZ xZ	S )	SuperExprzExpression super().name)ro   r  call)ro   r7  r  rz   ro   TypeInfo | Noner  r  r7  r(   r)   c                r    t                                                       || _        || _        d | _        d S r+   )r   r.   ro   r7  r  )r,   ro   r7  r   s      r-   r.   zSuperExpr.__init__  s2    					r/   r   r   r>   c                ,    |                     |           S r+   )visit_super_exprr   s     r-   r   zSuperExpr.accept  r  r/   )ro   rz   r7  r  r(   r)   r   r  r   s   @r-   r6  r6  ~  s         !!(I-NIIINNN     . . . . . . . .r/   r6  c                  F    e Zd ZdZdZedd            ZddZddZddZ	dS )
LambdaExprzLambda expression)r]  r^  r_  rb  r(   rz   c                    dS )Nz<lambda>r=   r   s    r-   ro   zLambdaExpr.name  s    zr/   r   c                n    | j         j         d         }t          |t                    sJ |j        }|J |S )z/Return the expression (the body) of the lambda.r&   )rb  r4   r6  r  )r,   r  r  s      r-   r  zLambdaExpr.expr  s>    inR #z*****xr/   r   r   r>   c                ,    |                     |           S r+   )visit_lambda_exprr   s     r-   r   zLambdaExpr.accept  r  r/   r   c                    dS r   r=   r   s    r-   ru  zLambdaExpr.is_dynamic  s    ur/   Nr   )r(   r   r   r   )
r8   r9   r:   r;   r   r   ro   r  r   ru  r=   r/   r-   r=  r=    sy        DN   X   / / / /     r/   r=  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )ListExprzList literal expression [...].r*  r  r*  r(   r)   c                V    t                                                       || _        d S r+   r   r.   r*  r1  s     r-   r.   zListExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_list_exprr   s     r-   r   zListExpr.accept  r   r/   r*  r  r(   r)   r   r  r   s   @r-   rD  rD    so         ((IN     - - - - - - - -r/   rD  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )DictExprz0Dictionary literal expression {key: value, ...}.rE  *list[tuple[Expression | None, Expression]]r*  r(   r)   c                V    t                                                       || _        d S r+   rG  r1  s     r-   r.   zDictExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_dict_exprr   s     r-   r   zDictExpr.accept  r   r/   )r*  rM  r(   r)   r   r  r   s   @r-   rL  rL    so         ::IN5555     - - - - - - - -r/   rL  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )	TupleExprzXTuple literal expression (..., ...)

    Also lvalue sequences (..., ...) and [..., ...]rE  r  r*  r(   r)   c                V    t                                                       || _        d S r+   rG  r1  s     r-   r.   zTupleExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_tuple_exprr   s     r-   r   zTupleExpr.accept  r  r/   rJ  r   r  r   s   @r-   rR  rR    su         7 7 IN     . . . . . . . .r/   rR  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )SetExprz$Set literal expression {value, ...}.rE  r  r*  r(   r)   c                V    t                                                       || _        d S r+   rG  r1  s     r-   r.   zSetExpr.__init__  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_set_exprr   s     r-   r   zSetExpr.accept  r  r/   rJ  r   r  r   s   @r-   rW  rW    so         ..IN     , , , , , , , ,r/   rW  c                  h     e Zd ZU dZdZdZded<   ded<   ded	<   d
ed<   ded<   d fdZddZ xZ	S )GeneratorExprzGGenerator expression ... for ... in ... [ for ...  in ... ] [ if ... ].)	left_expr	sequences	condlistsr1  indices)r]  r`  r^  r_  r   r]  r  r^  list[list[Expression]]r_  
list[bool]r1  r  r`  r(   r)   c                    t                                                       || _        || _        || _        || _        || _        d S r+   )r   r.   r]  r^  r_  r`  r1  )r,   r]  r`  r^  r_  r1  r   s         r-   r.   zGeneratorExpr.__init__  sB     	""" r/   r   r   r>   c                ,    |                     |           S r+   )visit_generator_exprr   s     r-   r   zGeneratorExpr.accept	      ++D111r/   )r]  r   r`  r  r^  r  r_  ra  r1  rb  r(   r)   r   r  r   s   @r-   r\  r\    s         QQNIGN%%%%! ! ! ! ! !2 2 2 2 2 2 2 2r/   r\  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )ListComprehensionz,List comprehension (e.g. [x + 1 for x in a])	generatorr\  rj  r(   r)   c                V    t                                                       || _        d S r+   r   r.   rj  r,   rj  r   s     r-   r.   zListComprehension.__init__	  $    "r/   r   r   r>   c                ,    |                     |           S r+   )visit_list_comprehensionr   s     r-   r   zListComprehension.accept	  s    //555r/   rj  r\  r(   r)   r   r  r   s   @r-   rh  rh  	  so         66I#N# # # # # #6 6 6 6 6 6 6 6r/   rh  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )SetComprehensionz+Set comprehension (e.g. {x + 1 for x in a})ri  r\  rj  r(   r)   c                V    t                                                       || _        d S r+   rl  rm  s     r-   r.   zSetComprehension.__init__+	  rn  r/   r   r   r>   c                ,    |                     |           S r+   )visit_set_comprehensionr   s     r-   r   zSetComprehension.accept/	  s    ..t444r/   rq  r   r  r   s   @r-   rs  rs  "	  so         55I#N# # # # # #5 5 5 5 5 5 5 5r/   rs  c                  r     e Zd ZU dZdZdZded<   ded<   ded<   d	ed
<   ded<   ded<   d fdZddZ xZ	S )DictionaryComprehensionz3Dictionary comprehension (e.g. {k: v for k, v in a})keyr  r^  r_  r1  r`  )ry  r  r`  r^  r_  r   ry  r  r  r^  ra  r_  rb  r1  r  r`  r(   r)   c                    t                                                       || _        || _        || _        || _        || _        || _        d S r+   )r   r.   ry  r  r^  r_  r`  r1  )r,   ry  r  r`  r^  r_  r1  r   s          r-   r.   z DictionaryComprehension.__init__A	  sI     	
"" r/   r   r   r>   c                ,    |                     |           S r+   )visit_dictionary_comprehensionr   s     r-   r   zDictionaryComprehension.acceptR	  r  r/   )ry  r   r  r   r`  r  r^  r  r_  ra  r1  rb  r(   r)   r   r  r   s   @r-   rx  rx  3	  s         ==QIJNOOO%%%%! ! ! ! ! !"< < < < < < < <r/   rx  c                  T     e Zd ZU dZdZdZded<   ded<   ded<   d fd
ZddZ xZ	S )ConditionalExprz+Conditional expression (e.g. x if y else z))condif_expr	else_expr)r  r  r  r   r  r  r  r(   r)   c                r    t                                                       || _        || _        || _        d S r+   )r   r.   r  r  r  )r,   r  r  r  r   s       r-   r.   zConditionalExpr.__init__a	  s2    	"r/   r   r   r>   c                ,    |                     |           S r+   )visit_conditional_exprr   s     r-   r   zConditionalExpr.acceptg	  r,  r/   )r  r   r  r   r  r   r(   r)   r   r  r   s   @r-   r~  r~  V	  s         550I5N# # # # # #4 4 4 4 4 4 4 4r/   r~  c                  J     e Zd ZU dZdZdZded<   ded<   d fd	ZddZ xZ	S )TypeApplicationz Type application expr[type, ...])r  rA  r   r  ro  rA  r(   r)   c                d    t                                                       || _        || _        d S r+   )r   r.   r  rA  )r,   r  rA  r   s      r-   r.   zTypeApplication.__init__u	  s+    	


r/   r   r   r>   c                ,    |                     |           S r+   )visit_type_applicationr   s     r-   r   zTypeApplication.acceptz	  r,  r/   )r  r   rA  ro  r(   r)   r   r  r   s   @r-   r  r  k	  s{         **!I&N         
4 4 4 4 4 4 4 4r/   r  	INVARIANT	COVARIANTCONTRAVARIANTc                       e Zd ZU dZdZded<   ded<   ded<   ded<   d	ed
<   efd fdZedd            Z	edd            Z
 xZS )TypeVarLikeExprzBase class for TypeVarExpr, ParamSpecExpr and TypeVarTupleExpr.

    Note that they are constructed by the semantic analyzer.
    )rT   r   upper_bounddefaultvariancerz   rT   r   r  r  r  r'   r  ro   r   r(   r)   c                    t                                                       || _        || _        || _        || _        || _        d S r+   )r   r.   rT   r   r  r  r  )r,   ro   r   r  r  r  r   s         r-   r.   zTypeVarLikeExpr.__init__	  sC     	
!& r/   c                    | j         S r+   r  r   s    r-   ro   zTypeVarLikeExpr.name	  r  r/   c                    | j         S r+   r   r   s    r-   r   zTypeVarLikeExpr.fullname	  r   r/   )ro   rz   r   rz   r  r  r  r  r  r'   r(   r)   r   )r8   r9   r:   r;   r<   r[   r  r.   r   ro   r   r   r   s   @r-   r  r  	  s          
 MIJJJNNN !    
 MMM "! ! ! ! ! ! !    X    X    r/   r  c                  d     e Zd ZU dZdZdZded<   efd fdZddZ	ddZ
edd            Z xZS )TypeVarExprar  Type variable expression TypeVar(...).

    This is also used to represent type variables in symbol tables.

    A type variable is not valid as a type unless bound in a TypeVarLikeScope.
    That happens within:

     1. a generic class that uses the type variable as a type argument or
     2. a generic function that refers to the type variable in its signature.
    )values)ro   r  r  r  ro  r  ro   rz   r   r  r  r  r  r'   r(   r)   c                `    t                                          |||||           || _        d S r+   )r   r.   r  )r,   ro   r   r  r  r  r  r   s          r-   r.   zTypeVarExpr.__init__	  s0     	xgxHHHr/   r   r   r>   c                ,    |                     |           S r+   )visit_type_var_exprr   s     r-   r   zTypeVarExpr.accept	  r  r/   r@   c                    d| j         | j        d | j        D             | j                                        | j                                        | j        dS )Nr  c                6    g | ]}|                                 S r=   r8  rS   ts     r-   r:  z)TypeVarExpr.serialize.<locals>.<listcomp>	  s     :::q{{}}:::r/   )r   ro   r   r  r  r  r  )rT   r   r  r  r   r  r  r   s    r-   r   zTypeVarExpr.serialize	  sY    #J::dk:::+5577|--//
 
 	
r/   r   c           
        |d         dk    sJ t          |d         |d         d |d         D             t          j                            |d                   t          j                            |d                   |d	                   S )
Nr   r  ro   r   c                L    g | ]!}t           j                            |          "S r=   r   rA  rB  r  s     r-   r:  z+TypeVarExpr.deserialize.<locals>.<listcomp>	  s(    DDDTZ((++DDDr/   r  r  r  r  )r  r   rA  rB  r   r   s     r-   r   zTypeVarExpr.deserialize	  s    H~....LDDT(^DDDJ''](;<<J''Y88
 
 	
r/   )ro   rz   r   rz   r  ro  r  r  r  r  r  r'   r(   r)   r   r   )r   r@   r(   r  )r8   r9   r:   r;   r<   r   r[   r  r.   r   r   r   r   r   r   s   @r-   r  r  	  s         	 	 IAN "!!! "
 
 
 
 
 
 
1 1 1 1	
 	
 	
 	
 	
 	
 	
 [	
 	
 	
 	
 	
r/   r  c                  >    e Zd ZdZdZddZdd	Zedd            ZdS )ParamSpecExprr=   ro   r  r  r   r   r(   r>   c                ,    |                     |           S r+   )visit_paramspec_exprr   s     r-   r   zParamSpecExpr.accept	  rf  r/   r@   c                    d| j         | j        | j                                        | j                                        | j        dS )Nr  )r   ro   r   r  r  r  )rT   r   r  r   r  r  r   s    r-   r   zParamSpecExpr.serialize	  sF    %J+5577|--//
 
 	
r/   r   c           	         |d         dk    sJ t          |d         |d         t          j                            |d                   t          j                            |d                   |d                   S )Nr   r  ro   r   r  r  r  )r  r   rA  rB  r  s     r-   r   zParamSpecExpr.deserialize
  so    H~0000LJ''](;<<J''Y88
 
 	
r/   Nr   r   )r   r@   r(   r  )	r8   r9   r:   r<   r   r   r   r   r   r=   r/   r-   r  r  	  sf        I7N2 2 2 2
 
 
 
 
 
 
 [
 
 
r/   r  c                  d     e Zd ZU dZdZded<   dZefd fdZddZ	ddZ
edd            Z xZS )TypeVarTupleExprz1Type variable tuple expression TypeVarTuple(...).tuple_fallbackmypy.types.Instancer  ro   rz   r   r  r  r  r  r'   r(   r)   c                `    t                                          |||||           || _        d S r+   )r   r.   r  )r,   ro   r   r  r  r  r  r   s          r-   r.   zTypeVarTupleExpr.__init__
  s3     	xgxHHH,r/   r   r   r>   c                ,    |                     |           S r+   )visit_type_var_tuple_exprr   s     r-   r   zTypeVarTupleExpr.accept(
  r5  r/   r@   c                    d| j         | j        | j                                        | j                                        | j                                        | j        dS )Nr  )r   ro   r   r  r  r  r  )rT   r   r  r   r  r  r  r   s    r-   r   zTypeVarTupleExpr.serialize+
  sX    (J+5577"1;;==|--//
 
 	
r/   r   c           
     F   |d         dk    sJ t          |d         |d         t          j                            |d                   t          j        j                            |d                   t          j                            |d                   |d                   S )	Nr   r  ro   r   r  r  r  r  )r  r   rA  rB  Instancer   r  s     r-   r   zTypeVarTupleExpr.deserialize6
  s    H~!33333LJ''](;<<J++D1A,BCCJ''Y88
 
 	
r/   )ro   rz   r   rz   r  r  r  r  r  r  r  r'   r(   r)   r   r   )r   r@   r(   r  )r8   r9   r:   r;   r<   r[   r   r  r.   r   r   r   r   r   r   s   @r-   r  r  
  s         ;; I''''7N "
- 
- 
- 
- 
- 
- 
-7 7 7 7	
 	
 	
 	
 	
 	
 	
 [	
 	
 	
 	
 	
r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )TypeAliasExprzType alias expression (rvalue).r  r   r  r(   r)   c                V    t                                                       || _        d S r+   )r   r.   r  )r,   r  r   s     r-   r.   zTypeAliasExpr.__init__L
  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_type_alias_exprr   s     r-   r   zTypeAliasExpr.acceptP
  r  r/   )r  r   r(   r)   r   r  r   s   @r-   r  r  C
  sl         ))INOOO     3 3 3 3 3 3 3 3r/   r  c                  L     e Zd ZU dZdZdZded<   ded<   dd fdZddZ xZ	S )NamedTupleExprz:Named tuple expression namedtuple(...) or NamedTuple(...).)r  is_typedr  r   r  r   r  Fr(   r)   c                d    t                                                       || _        || _        d S r+   )r   r.   r  r  )r,   r  r  r   s      r-   r.   zNamedTupleExpr.__init__`
  s+    	 r/   r   r   r>   c                ,    |                     |           S r+   )visit_namedtuple_exprr   s     r-   r   zNamedTupleExpr.accepte
  r  r/   rT  )r  r   r  r   r(   r)   r   r  r   s   @r-   r  r  T
  s|         DD$IN NNNNNN! ! ! ! ! ! !
3 3 3 3 3 3 3 3r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )TypedDictExprz%Typed dict expression TypedDict(...).r  r   r  r(   r)   c                V    t                                                       || _        d S r+   )r   r.   r  )r,   r  r   s     r-   r.   zTypedDictExpr.__init__s
  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_typeddict_exprr   s     r-   r   zTypedDictExpr.acceptw
  rf  r/   )r  r   r(   r)   r   r  r   s   @r-   r  r  i
  sn         //IN NNN     2 2 2 2 2 2 2 2r/   r  c                  T     e Zd ZU dZdZdZded<   ded<   ded<   d fdZddZ xZ	S )EnumCallExprz5Named tuple expression Enum('name', 'val1 val2 ...').)r  r*  r  r   r  r  r*  rf  r  r(   r)   c                r    t                                                       || _        || _        || _        d S r+   )r   r.   r  r*  r  )r,   r  r*  r  r   s       r-   r.   zEnumCallExpr.__init__
  s2    	
r/   r   r   r>   c                ,    |                     |           S r+   )visit_enum_call_exprr   s     r-   r   zEnumCallExpr.accept
  rf  r/   )r  r   r*  r  r  rf  r(   r)   r   r  r   s   @r-   r  r  {
  s         ??+I0N NNN####     2 2 2 2 2 2 2 2r/   r  c                  <     e Zd ZU dZdZded<   d fdZddZ xZS )PromoteExprz2Ducktype class decorator expression _promote(...).rt  mypy.types.ProperTyper   r(   r)   c                V    t                                                       || _        d S r+   )r   r.   r   )r,   r   r   s     r-   r.   zPromoteExpr.__init__
  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit__promote_exprr   s     r-   r   zPromoteExpr.accept
  r  r/   )r   r  r(   r)   r   )	r8   r9   r:   r;   r<   r[   r.   r   r   r   s   @r-   r  r  
  sj         <<I     1 1 1 1 1 1 1 1r/   r  c                  T     e Zd ZU dZdZdZded<   ded<   ded<   d fdZddZ xZ	S )NewTypeExprz NewType expression NewType(...).)ro   old_typer  rz   ro   rO  r  r8  r  r"   r'   r#   r(   r)   c                x    t                                          ||           || _        || _        d | _        d S )N)r"   r#   )r   r.   ro   r  r  )r,   ro   r  r"   r#   r   s        r-   r.   zNewTypeExpr.__init__
  s;     	d6222	 			r/   r   r   r>   c                ,    |                     |           S r+   )visit_newtype_exprr   s     r-   r   zNewTypeExpr.accept
  r  r/   )
ro   rz   r  rO  r"   r'   r#   r'   r(   r)   r   r  r   s   @r-   r  r  
  s         **,I1NIII$$$$     0 0 0 0 0 0 0 0r/   r  c                  @     e Zd ZU dZdZdZded<   d fdZddZ xZ	S )	AwaitExprzAwait expression (await ...).r   r   r  r(   r)   c                V    t                                                       || _        d S r+   r  r  s     r-   r.   zAwaitExpr.__init__
  r  r/   r   r   r>   c                ,    |                     |           S r+   )visit_await_exprr   s     r-   r   zAwaitExpr.accept
  r  r/   r	  r   r  r   s   @r-   r  r  
  so         ''IN     . . . . . . . .r/   r  c                  X     e Zd ZU dZdZded<   ded<   	 ddd	d fdZddZddZ xZ	S )TempNodezTemporary dummy node used during type checking.

    This node is not present in the original program; it is just an artifact
    of the type checker implementation. It only represents an opaque node with
    some fixed type.
    )r   no_rhsr  r   r   r  FN)contextrF  r  Context | Noner(   r)   c                   t                                                       || _        || _        ||j        | _        |j        | _        dS dS )zJConstruct a dummy node; optionally borrow line/column from context object.N)r   r.   r   r  r"   r#   )r,   rF  r  r  r   s       r-   r.   zTempNode.__init__
  sM     		DI!.DKKK r/   rz   c                >    d| j         t          | j                  fz  S )NzTempNode:%d(%s))r"   rz   r   r   s    r-   __repr__zTempNode.__repr__
  s     DIs49~~#>>>r/   r   r   r>   c                ,    |                     |           S r+   )visit_temp_noder   s     r-   r   zTempNode.accept
  r   r/   rT  )rF  r  r  r   r  r  r(   r)   r   r   )
r8   r9   r:   r;   r<   r[   r.   r  r   r   r   s   @r-   r  r  
  s           #I LLL 49	)W[	) 	) 	) 	) 	) 	) 	) 	)? ? ? ?- - - - - - - -r/   r  >   r;   __new____dict__r.   r<   r9   __weakref__r[   __subclasshook____class_getitem____abstractmethods__EXCLUDED_PROTOCOL_ATTRIBUTESc                      e Zd ZU dZdZded<   ded<   ded<   ded	<   d
ed<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   d ed!<   ded"<   ded#<   ded$<   ded%<   ded&<   d ed'<   d(ed)<   ded*<   d+ed,<   ded-<   d.ed/<   ded0<   ded1<   d2ed3<   d4ed5<   d6ed7<   d8ed9<   ded:<   g d;Zd<ed=<   df fd@ZdgdAZe	dhdB            Z
e	dhdC            ZdidDZdjdGZdkdIZe	dldJ            ZdmdLZdhdMZdidNZdndOZdodQZdpdRZdidSZdqdUZdrdVZdsdYZdtd[Zdhd\ZdudaZdvdcZedwde            Z xZ S )xr   a  The type structure of a single class.

    Each TypeInfo corresponds one-to-one to a ClassDef, which
    represents the AST of the class.

    In type-theory terms, this is a "type constructor", and if the
    class is generic then it will be a type constructor of higher kind.
    Where the class is used in an actual type, it's in the form of an
    Instance, which amounts to a type application of the tycon to
    the appropriate number of arguments.
    )(r   module_namedefnmro	_mro_refsbad_mror  declared_metaclassmetaclass_typer   is_abstractis_protocolruntime_protocolabstract_attributesdeletable_attributesslotsassumingassuming_proper	inferringis_enumfallback_to_anymeta_fallback_to_anyr  has_param_spec_typebases_promote
tuple_typespecial_aliasis_named_tupletypeddict_type
is_newtypeis_intersectionmetadataalt_promotehas_type_var_tuple_typetype_var_tuple_prefixtype_var_tuple_suffix	self_typer  r   rz   r   r  r  r  list[TypeInfo]r  zlist[str] | Noner  r   r  r  mypy.types.Instance | Noner  r  r   r   r  r  r  zlist[tuple[str, int]]r  r  r  zset[str] | Noner  z5list[tuple[mypy.types.Instance, mypy.types.Instance]]r  r  zlist[mypy.types.Instance]r  r  r  r   r  r  r  zlist[mypy.types.ProperType]r  r  zmypy.types.TupleType | Noner  r  zmypy.types.TypedDictType | Noner  r  r	  zdict[str, JsonDict]r
  zTypeAlias | Noner  zmypy.types.TypeVarType | Noner  zDataclassTransformSpec | Noner  r   )
r  r  r  r   r  r  r  r  r  r	  r   FLAGSr(   r)   c                   t                                                       |j        | _        || _        || _        || _        g | _        d| _        d| _	        g | _
        g | _        d| _        d| _        d| _        d| _        d| _        g | _        g | _        d| _        g | _        g | _        g | _        d| _        d| _        d| _        d| _        |                                  d| _        d| _        d| _        d| _        g | _         d| _!        d| _"        d| _#        d| _$        d| _%        d| _&        d| _'        i | _(        d| _)        d| _*        d| _+        dS )zInitialize a TypeInfo.FN),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  r  add_type_varsr  r  r  r   r  r  r  r  r  r  r  r	  r
  r  r  r   )r,   r   r  r  r   s       r-   r.   zTypeInfo.__init__  sa   
	&#( ',$
"&" #% $&!
!  %15"15"$$)!!#"$(,%"'r/   c                   d| _         | j        j        rt          | j        j                  D ]\  }}t	          |t
          j        j                  rd| _        t	          |t
          j        j	                  r;| j         rJ d| _         || _
        t          | j        j                  |z
  dz
  | _        | j                            |j                   | j        r| j         rJ d            d S d S )NFTrB   z8Mixing type var tuples and param specs not supported yet)r  r  r  r  r4   r   rA  ParamSpecTyper  TypeVarTupleTyper  r   r  appendro   )r,   r9  vds      r-   r  zTypeInfo.add_type_vars  s   ',$9 		/"49#677 / /2b$*":;; 4/3D,b$*"=>> R#;;;;37D012D.14TY5H1I1IA1MPQ1QD.%%bg....$	F)-)E	F 	FE	F 	F 	F 	F 	F 	F 	Fr/   c                    | j         j        S )zShort name.)r  ro   r   s    r-   ro   zTypeInfo.name  s     y~r/   c                    | j         S r+   r   r   s    r-   r   zTypeInfo.fullname   r   r/   c                2    t          | j                  dk    S )z7Is the type generic (i.e. does it have type variables)?r   )r   r  r   s    r-   r  zTypeInfo.is_generic$  s    4>""Q&&r/   ro   SymbolTableNode | Nonec                Z    | j         D ]"}|j                            |          }|r|c S #d S r+   )r  r   r   )r,   ro   r   ns       r-   r   zTypeInfo.get(  sA    8 	 	C	d##A tr/   r8  c                4    | j         D ]}||j        v r|c S d S r+   )r  r   )r,   ro   r   s      r-   get_containing_type_infoz!TypeInfo.get_containing_type_info/  s3    8 	 	Csy  


 !tr/   c                v   t                      }| j        s
J d            | j        d d         D ]o}|j        rf|j                                        D ]L\  }}t          |j        t          t          t          f          r-|t          v r7|                    |           Mpt          t          |                    S )Nz?This property can be only accessed after MRO is (re-)calculatedr&   )r   r  r  r   r*  r4   r  r   r  r   r  addsortedr   )r,   membersr  ro   r  s        r-   protocol_memberszTypeInfo.protocol_members5  s      EExZZZZZZHSbSM 	& 	&D &"&*"2"2"4"4 & &JD$!$)ih-OPP ! ;;; KK%%%%d7mm$$$r/   r   c                R    |                      |          }|r|S t          |          r+   )r   KeyError)r,   ro   r  s      r-   __getitem__zTypeInfo.__getitem__F  s*    HHTNN 	!H4.. r/   c                    d| j          dS )Nz
<TypeInfo >r   r   s    r-   r  zTypeInfo.__repr__M  s    ,DM,,,,r/   c                .    t          | t                     S r+   )r4   FakeInfor   s    r-   __bool__zTypeInfo.__bool__P  s     dH----r/   c                0    |                      |          d uS r+   )r   )r,   ro   s     r-   has_readable_memberzTypeInfo.has_readable_memberV  s    xx~~T))r/   FuncBase | Decorator | Nonec                    | j         D ]R}||j        v rG|j        |         j        }t          |t                    r|c S t          |t
                    r|c S  d S Sd S r+   )r  r   r  r4   r  r&  )r,   ro   r   r  s       r-   
get_methodzTypeInfo.get_methodY  sw    8 	  	 Csy  y+dH--  KKKi00  KKK44 ! tr/   c                   | j         }||j                            d          s|S | j        dk    r t          j                            | g           S d | j        D             }|D ]!t          fd|D                       rc S "d S )Nbuiltins.typec                B    g | ]}|j         	|j         j        |j         S r+   )r  r   )rS   ss     r-   r:  z5TypeInfo.calculate_metaclass_type.<locals>.<listcomp>k  s9     
 
 
#/A4H4M4Y  4Y4Y4Yr/   c              3  >   K   | ]}|j         j         j        v V  d S r+   )r   r  )rS   othercs     r-   rp   z4TypeInfo.calculate_metaclass_type.<locals>.<genexpr>q  s.      DD5:+DDDDDDr/   )	r  r   has_baser   r   rA  r  r  r  )r,   declared
candidatesr;  s      @r-   calculate_metaclass_typez!TypeInfo.calculate_metaclass_typee  s    *(>(>(O(OO>_,,:&&tR000
 
X
 
 


  	 	ADDDDDDDDD tr/   c                P    |                      d          p| j        dk    p| j        S )Nr6  zabc.ABCMeta)r<  r   r  r   s    r-   is_metaclasszTypeInfo.is_metaclassu  s0    MM/** $}-$#	
r/   r   c                6    | j         D ]}|j        |k    r dS dS )zReturn True if type has a base type with the specified name.

        This can be either via extension or via implementation.
        TF)r  r   )r,   r   r   s      r-   r<  zTypeInfo.has_base|  s3    
 8 	 	C|x''tt (ur/   c                $    d | j         D             S )zXReturn a direct base classes.

        Omit base classes of other base classes.
        c                    g | ]	}|j         
S r=   rt  )rS   r  s     r-   r:  z0TypeInfo.direct_base_classes.<locals>.<listcomp>  s    111d	111r/   )r  r   s    r-   direct_base_classeszTypeInfo.direct_base_classes  s    
 21dj1111r/   rF  mypy.types.TupleTypec                    || _         t                              |           }| j        s	|| _        dS |j        | j        _        dS )z.Update tuple_type and special_alias as needed.N)r  r   from_tuple_typer  r0   r,   rF  rn   s      r-   update_tuple_typezTypeInfo.update_tuple_type  sH    ))$//! 	5!&D(-D%%%r/   mypy.types.TypedDictTypec                    || _         t                              |           }| j        s	|| _        dS |j        | j        _        dS )z2Update typeddict_type and special_alias as needed.N)r  r   from_typeddict_typer  r0   rI  s      r-   update_typeddict_typezTypeInfo.update_typeddict_type  sI    !--d33! 	5!&D(-D%%%r/   c                    t                      }|                     t          j                            |          t          j                            |                    S )zzReturn a string representation of the type.

        This includes the most important information about the type.
        r}   )str_convtype_str_conv)r   dumpr   r   r   rA  TypeStrVisitorr   s     r-   r   zTypeInfo.__str__  sT    
 ))yy\))')::*33G3DD  
 
 	
r/   rP  mypy.strconv.StrConvrQ  mypy.types.TypeStrVisitorc                p   d}dfdd                     |           z   }| j        r*dd	                    fd
| j        D                        d}d                    d	                    fd| j        D                                 }g }t          | j                  D ]}|                     | j        |         j                  z   }| j        |         j        }	t          |	t                    r|	j
        r|d |	j
                   dz  }|                    |           d| j         d||d|fg}
| j        r'|
                    d | j                   d           | j        r'|
                    d | j                   d           t          j                            |
|          S )z5Return a string dump of the contents of the TypeInfo.rk   rF  r  r(   rz   c                .    |                                S r+   )r   )rF  rQ  s    r-   type_strzTypeInfo.dump.<locals>.type_str  s    ::m,,,r/   r   zBases(z, c              3  .   K   | ]} |          V  d S r+   r=   )rS   r  rX  s     r-   rp   z TypeInfo.dump.<locals>.<genexpr>  s+      %L%Lhhtnn%L%L%L%L%L%Lr/   )zMro({})c              3  R   K   | ]!}|j                             |          z   V  "d S r+   )r   	format_id)rS   r  rP  s     r-   rp   z TypeInfo.dump.<locals>.<genexpr>  s8      TT4dmh&8&8&>&>>TTTTTTr/    (zName(NameszDeclaredMetaclass(zMetaclassType()rP  )rF  r  r(   rz   )r\  r  joinformatr  r$  r   r  r4   rN  r   r  r   r  r  r   r   dump_tagged)r,   rP  rQ  r  headr  r   ro   descriptionr  r*  rX  s    ``        @r-   rR  zTypeInfo.dump  s   
 	- 	- 	- 	- 	- 	- H..t444: 	PODII%L%L%L%L%L%L%LLLOOODIITTTT48TTTTT
 
 4:&& 	& 	&D!3!3DJt4D4I!J!JJK:d#(D$$$ ; ;:HHTY$7$7::::LL%%%%))))4w6FG" 	TLLRhht7N.O.ORRRSSS 	LLLJ((43F*G*GJJJKKK|''th'GGGr/   r@   c                   i ddd| j         d| j        d| j                            | j                  d| j                                        d| j        d| j        d	| j        d
d | j        D             dd | j	        D             dd | j
        D             d| j        d n| j                                        d| j        d n| j                                        d| j        d n| j                                        d| j        d n| j                                        d| j        d n| j                                        dt!          | t"          j                  | j        | j        !t+          t-          | j                            nd | j        | j        | j                                        nd | j        | j                                        nd d}|S )Nr   r   r  r   r   r  r  r  r  r  c                6    g | ]}|                                 S r=   r8  rS   bs     r-   r:  z&TypeInfo.serialize.<locals>.<listcomp>  r;  r/   r  c                    g | ]	}|j         
S r=   r,  )rS   r;  s     r-   r:  z&TypeInfo.serialize.<locals>.<listcomp>  s    1111AJ111r/   r  c                6    g | ]}|                                 S r=   r8  )rS   ps     r-   r:  z&TypeInfo.serialize.<locals>.<listcomp>  s     >>>1>>>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  r  r  r=  r   r  r
  r  r   r$  r  r  r  r  s     r-   r   zTypeInfo.serialize  sU   !
j!
4+!
 !
 TZ))$-88	!

 DI''))!
 "4#;!
 !
 "4#;!
 88TZ888!
 11111!
 >>>>>!
 4#3#;44AQA[A[A]A]!
 !/7T=T=^=^=`=`!
  "* #d$..00%!
& $/"9$$t?X?X?Z?Z'!
( "* #d$..00-!
. YtX^44/!
0 151GT&,,---T$($=7;~7Q11333W[ 0< -77999?!
 !
 !
D r/   r   c                   t                               |d                   }t                              |d                   }|d         }t          |||          }|d         |_        d |d         D             |_        |d         |_        |d         |_        d	 |d
         D             |_        g }|d         D ]W}t          j
                            |          }t          |t          j
        j                  sJ |                    |           X||_        |d         d n)t          j
        j                            |d                   |_        |d         d n)t          j
        j                            |d                   |_        |d         d n)t          j
        j                            |d                   |_        |d         |_        |d         d n)t          j
        j                            |d                   |_        |d         d n)t          j
        j                            |d                   |_        |d         |_        |d         t5          |d                   nd |_        |d         |_        t;          ||d                    |d         }	|	$t          j
        j                            |	          nd |_        |                     d          %tB                              |d                   |_"        |S )Nr   r  r  r   c                .    g | ]}|d          |d         fS )r   rB   r=   )rS   attrs     r-   r:  z(TypeInfo.deserialize.<locals>.<listcomp>  s%    !]!]!]47DG"4!]!]!]r/   r  r  r  c                V    g | ]&}t           j        j                            |          'S r=   )r   rA  r  r   rf  s     r-   r:  z(TypeInfo.deserialize.<locals>.<listcomp>  s+    NNN1DJ'33A66NNNr/   r  r  r  r  r  r  r  r  r
  r  r  r<  r  r  )#r   r   r  r   r   r  r  r  r  r   rA  rB  r4   rC  r  r  r  r  r  r  r  	TupleTyper  TypedDictTyper  r
  r   r  r  rD  TypeVarTyper  r   r  r  )
r   r   r   r  r  tir  rj  r  sts
             r-   r   zTypeInfo.deserialize  s   ''W66##DL11=)eT;//J'!]!]F[A\!]!]!]K(!%&;!<NNWNNNj! 	 	A
++A..Aa!677777OOA M"* D$00m1DEE 	 ()1 D$006J1KLL 	 $%- D$006F1GHH 	 E{ L!) D%11$|2DEE 	 $%- D)55d;K6LMM 	
 :&)-g)B3tG}%%%"&'=">"d7m$$$+ACtz-99"===UY88.//;*@*L*L/0+ +B' 	r/   )r   r   r  r  r  rz   r(   r)   r   r   r   )ro   rz   r(   r  )ro   rz   r(   r8  )r(   r  )ro   rz   r(   r   )ro   rz   r(   r   )ro   rz   r(   r2  )r(   r  )r   rz   r(   r   )r(   r  )rF  rF  r(   r)   )rF  rK  r(   r)   )rP  rT  rQ  rU  r(   rz   r   )r   r@   r(   r   )!r8   r9   r:   r;   r<   r[   r  r.   r  r   ro   r   r  r   r!  r&  r)  r  r/  r1  r4  r?  rA  r<  rE  rJ  rN  r   rR  r   r   r   r   r   s   @r-   r   r     sJ        
 
)IV NNN NNN   MMMNNN2222.... /...#### , DCCCJJJJ )((( MMM  
   %$$$ *))) ,+++ ,+++  4333   "!!! $### -,,, <;;;   E    +( +( +( +( +( +(ZF F F F     X    X' ' ' '       % % % X% ! ! ! !- - - -. . . .* * * *
 
 
 
    
 
 
 
   2 2 2 25 5 5 55 5 5 5	
 	
 	
 	
H H H H<$ $ $ $L ? ? ? [? ? ? ? ?r/   c                  "    e Zd ZdZddZdd	Zd
S )r.  r=  r=  rz   r(   r)   c                    || _         d S r+   ru  )r,   r=  s     r-   r.   zFakeInfo.__init__H  s    r/   rm  r   c                    |dk    rt                               | |          S t          t                               | d                    )Nr   r=  )object__getattribute__AssertionError)r,   rm  s     r-   ry  zFakeInfo.__getattribute__K  sA    ;**4666V44T5AABBBr/   N)r=  rz   r(   r)   )rm  rz   r(   r   )r8   r9   r:   r<   r.   ry  r=   r/   r-   r.  r.  1  sG        I,   C C C C C Cr/   r.  zVar is lacking infozFinal[TypeInfo]r  zClassDef is lacking infor  z"FuncBase for non-methods lack infor"  c                       e Zd ZdZdZdZdddddd& fdZed'd            Zed'd            Z	e
d(d            Ze
d(d            Ze
d)d            Zd*dZd+d#Zed,d%            Z xZS )-r   a  
    A symbol node representing a type alias.

    Type alias is a static concept, in contrast to variables with types
    like Type[...]. Namely:
        * type aliases
            - can be used in type context (annotations)
            - cannot be re-assigned
        * variables with type Type[...]
            - cannot be used in type context
            - but can be re-assigned

    An alias can be defined only by an assignment to a name (not any other lvalues).

    Such assignment defines an alias by default. To define a variable,
    an explicit Type[...] annotation is required. As an exception,
    at non-global scope non-subscripted rvalue creates a variable even without
    an annotation. This exception exists to accommodate the common use case of
    class-valued attributes. See SemanticAnalyzerPass2.check_and_set_up_type_alias
    for details.

    Aliases can be generic. We use bound type variables for generic aliases, similar
    to classes. Essentially, type aliases work as macros that expand textually.
    The definition and expansion rules are following:

        1. An alias targeting a generic class without explicit variables act as
        the given class (this doesn't apply to TypedDict, Tuple and Callable, which
        are not proper classes but special type constructors):

            A = List
            AA = List[Any]

            x: A  # same as List[Any]
            x: A[int]  # same as List[int]

            x: AA  # same as List[Any]
            x: AA[int]  # Error!

            C = Callable  # Same as Callable[..., Any]
            T = Tuple  # Same as Tuple[Any, ...]

        2. An alias using explicit type variables in its rvalue expects
        replacements (type arguments) for these variables. If missing, they
        are treated as Any, like for other generics:

            B = List[Tuple[T, T]]

            x: B  # same as List[Tuple[Any, Any]]
            x: B[int]  # same as List[Tuple[int, int]]

            def f(x: B[T]) -> T: ...  # without T, Any would be used here

        3. An alias can be defined using another aliases. In the definition
        rvalue the Any substitution doesn't happen for top level unsubscripted
        generic classes:

            A = List
            B = A  # here A is expanded to List, _not_ List[Any],
                   # to match the Python runtime behaviour
            x: B[int]  # same as List[int]
            C = List[A]  # this expands to List[List[Any]]

            AA = List[T]
            D = AA  # here AA expands to List[Any]
            x: D[int]  # Error!

    Note: the fact that we support aliases like `A = List` means that the target
    type will be initially an instance type with wrong number of type arguments.
    Such instances are all fixed either during or after main semantic analysis passes.
    We therefore store the difference between `List` and `List[Any]` rvalues (targets)
    using the `no_args` flag. See also TypeAliasExpr.no_args.

    Meaning of other fields:

    target: The target type. For generic aliases contains bound type variables
        as nested types (currently TypeVar and ParamSpec are supported).
    _fullname: Qualified name of this type alias. This is used in particular
        to track fine grained dependencies from aliases.
    alias_tvars: Type variables used to define this alias.
    normalized: Used to distinguish between `A = List`, and `A = list`. Both
        are internally stored using `builtins.list` (because `typing.List` is
        itself an alias), while the second cannot be subscripted because of
        Python runtime limitation.
    line and column: Line and column on the original alias definition.
    eager: If True, immediately expand alias when referred to (useful for aliases
        within functions that can't be looked up from the symbol table)
    )r0   r   alias_tvarsno_args
normalized_is_recursiveeagertvar_tuple_index)ro   r0   r|  r}  NF)r|  r}  r~  r  r0   r  r   rz   r"   r'   r#   r|  r  r}  r   r~  r  r(   r)   c               :   || _         || _        |g }|| _        || _        || _        d | _        || _        d | _        t          |          D ]+\  }	}
t          |
t          j        j                  r|	| _        ,t                                          ||           d S r+   )r   r0   r|  r}  r~  r  r  r  r  r4   r   rA  r  r   r.   )r,   r0   r   r"   r#   r|  r}  r~  r  r9  r  r   s              r-   r.   zTypeAlias.__init__  s     "K&$ +/
 $k** 	* 	*DAq!TZ899 *()%v&&&&&r/   r  r   c           
        |j         sJ t          |j                             t          j                            |t          j                            |j        j                                      |j	        |j
        |j                  S )zGenerate an alias to the tuple type described by a given TypeInfo.

        NOTE: this doesn't set type alias type variables (for generic tuple types),
        they must be set by the caller (when fully analyzed).
        fallback)r  r   copy_modifiedr   rA  r  type_vars_as_argsr  r  r   r"   r#   r   r  s     r-   rH  zTypeAlias.from_tuple_type  s~     O)),,$*66ty7JKK  *   MIK

 

 
	
r/   c           
        |j         sJ t          |j                             t          j                            |t          j                            |j        j                                      |j	        |j
        |j                  S )zGenerate an alias to the TypedDict type described by a given TypeInfo.

        NOTE: this doesn't set type alias type variables (for generic TypedDicts),
        they must be set by the caller (when fully analyzed).
        r  )r  r   r  r   rA  r  r  r  r  r   r"   r#   r  s     r-   rM  zTypeAlias.from_typeddict_type  s     """"--,,$*66ty7JKK  .   MIK

 

 
	
r/   c                B    | j                             d          d         S Nr   r&   r   r   s    r-   ro   zTypeAlias.name      ~##C((,,r/   c                    | j         S r+   r   r   s    r-   r   zTypeAlias.fullname  r   r/   c                >    t          d | j        D                       S )Nc              3  T   K   | ]#}t          |t          j        j                  V  $d S r+   )r4   r   rA  r  r  s     r-   rp   z0TypeAlias.has_param_spec_type.<locals>.<genexpr>  s1      UUq:a!9::UUUUUUr/   )anyr|  r   s    r-   r  zTypeAlias.has_param_spec_type  s"    UUDDTUUUUUUr/   r@   c           	         d| j         | j                                        d | j        D             | j        | j        | j        | j        d}|S )Nr   c                6    g | ]}|                                 S r=   r8  r  s     r-   r:  z'TypeAlias.serialize.<locals>.<listcomp>  s     DDDaAKKMMDDDr/   )r   r   r0   r|  r}  r~  r"   r#   )r   r0   r   r|  r}  r~  r"   r#   r  s     r-   r   zTypeAlias.serialize  sV    !k++--DD43CDDD|/Ik	
 	
 r/   r   r   r>   c                ,    |                     |           S r+   )visit_type_aliasr   s     r-   r   zTypeAlias.accept  r  r/   r   c           
        |d         dk    sJ |d         }d |d         D             }t          d |D                       sJ t          j                            |d                   }|d         }|d	         }|d
         }|d         } | ||||t	          t
          t          j        j                 |          ||          S )Nr   r   r   c                L    g | ]!}t           j                            |          "S r=   r  r  s     r-   r:  z)TypeAlias.deserialize.<locals>.<listcomp>$  s(    SSS!tz22155SSSr/   r|  c              3  T   K   | ]#}t          |t          j        j                  V  $d S r+   )r4   r   rA  r  r  s     r-   rp   z(TypeAlias.deserialize.<locals>.<genexpr>%  s1      RR:a!;<<RRRRRRr/   r0   r}  r~  r"   r#   )r|  r}  r~  )r  r   rA  rB  r   r   r  )	r   r   r   r|  r0   r}  r~  r"   r#   s	            r-   r   zTypeAlias.deserialize   s    H~,,,,
#SStM?RSSSRRkRRRRRRRR,,T(^<<y/,'
F|hsT$*"<={KK!
 
 
 	
r/   )r0   r  r   rz   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   )r8   r9   r:   r;   r<   r   r.   r   rH  rM  r   ro   r   r  r   r   r   r   r   s   @r-   r   r   W  s_       V Vp	I BN @D ' ' ' ' ' ' ' ': 
 
 
 [
( 
 
 
 [
( - - - X-    X V V V XV   . . . . 
 
 
 [
 
 
 
 
r/   r   c                  d    e Zd ZdZdZddddZedd            Zedd            ZddZ	ddZ
dS )PlaceholderNodea  Temporary symbol node that will later become a real SymbolNode.

    These are only present during semantic analysis when using the new
    semantic analyzer. These are created if some essential dependencies
    of a definition are not yet complete.

    A typical use is for names imported from a module which is still
    incomplete (within an import cycle):

      from m import f  # Initially may create PlaceholderNode

    This is particularly important if the imported shadows a name from
    an enclosing scope or builtins:

      from m import int  # Placeholder avoids mixups with builtins.int

    Another case where this is useful is when there is another definition
    or assignment:

      from m import f
      def f() -> None: ...

    In the above example, the presence of PlaceholderNode allows us to
    handle the second definition as a redefinition.

    They are also used to create PlaceholderType instances for types
    that refer to incomplete types. Example:

      class C(Sequence[C]): ...

    We create a PlaceholderNode (with becomes_typeinfo=True) for C so
    that the type C in Sequence[C] can be bound.

    Attributes:

      fullname: Full name of the PlaceholderNode.
      node: AST node that contains the definition that caused this to
          be created. This is useful for tracking order of incomplete definitions
          and for debugging.
      becomes_typeinfo: If True, this refers something that could later
          become a TypeInfo. It can't be used with type variables, in
          particular, as this would cause issues with class type variable
          detection.

    The long-term purpose of placeholder nodes/types is to evolve into
    something that can support general recursive types.
    )r   r  becomes_typeinfoF)r  r   rz   r  ry   r"   r'   r  r   r(   r)   c               >    || _         || _        || _        || _        d S r+   )r   r  r  r"   )r,   r   r  r"   r  s        r-   r.   zPlaceholderNode.__init__i  s%     "	 0			r/   c                B    | j                             d          d         S r  r   r   s    r-   ro   zPlaceholderNode.nameq  r  r/   c                    | j         S r+   r   r   s    r-   r   zPlaceholderNode.fullnameu  r   r/   r@   c                    J d            )NFz#PlaceholderNode can't be serializedr=   r   s    r-   r   zPlaceholderNode.serializey  s    ;;;;;r/   r   r   r>   c                ,    |                     |           S r+   )visit_placeholder_noder   s     r-   r   zPlaceholderNode.accept|  r,  r/   N)
r   rz   r  ry   r"   r'   r  r   r(   r)   r   r   r   )r8   r9   r:   r;   r<   r.   r   ro   r   r   r   r=   r/   r-   r  r  6  s        . .` :I QV      - - - X-    X< < < <4 4 4 4 4 4r/   r  c                      e Zd ZdZdZ	 	 	 d!dddd"dZed#d            Zed$d            Zd%dZ	d&dZ
d'dZed(d            Zd S ))r   a  Description of a name binding in a symbol table.

    These are only used as values in module (global), function (local)
    and class symbol tables (see SymbolTable). The name that is bound is
    the key in SymbolTable.

    Symbol tables don't contain direct references to AST nodes primarily
    because there can be multiple symbol table references to a single
    AST node (due to imports and aliases), and different references can
    behave differently. This class describes the unique properties of
    each reference.

    The most fundamental attribute is 'node', which is the AST node that
    the name refers to.

    The kind is usually one of LDEF, GDEF or MDEF, depending on the scope
    of the definition. These three kinds can usually be used
    interchangeably and the difference between local, global and class
    scopes is mostly descriptive, with no semantic significance.
    However, some tools that consume mypy ASTs may care about these so
    they should be correct.

    Attributes:
        node: AST node of definition. Among others, this can be one of
            FuncDef, Var, TypeInfo, TypeVarExpr or MypyFile -- or None
            for cross_ref that hasn't been fixed up yet.
        kind: Kind of node. Possible values:
               - LDEF: local definition
               - GDEF: global (module-level) definition
               - MDEF: class member definition
               - UNBOUND_IMPORTED: temporary kind for imported names (we
                 don't know the final kind yet)
        module_public: If False, this name won't be imported via
            'from <module> import *'. This has no effect on names within
            classes.
        module_hidden: If True, the name will be never exported (needed for
            stub files)
        cross_ref: For deserialized MypyFile nodes, the referenced module
            name; for other nodes, optionally the name of the referenced object.
        implicit: Was this defined by assignment to self attribute?
        plugin_generated: Was this symbol generated by a plugin?
            (And therefore needs to be removed in aststrip.)
        no_serialize: Do not serialize this node if True. This is used to prevent
            keys in the cache that refer to modules on which this file does not
            depend. Currently this can happen if there is a module not in build
            used e.g. like this:
                import a.b.c # type: ignore
            This will add a submodule symbol to parent module `a` symbol table,
            but `a.b` is _not_ added as its dependency. Therefore, we should
            not serialize these symbols as they may not be found during fixup
            phase, instead they will be re-added during subsequent patch parents
            phase.
            TODO: Refactor build.py to make dependency tracking more transparent
            and/or refactor look-up functions to not require parent patching.

    NOTE: No other attributes should be added to this class unless they
    are shared by all node kinds.
    )rL  r  module_publicmodule_hidden	cross_refimplicitplugin_generatedno_serializeTF)r  r  rL  r'   r  SymbolNode | Noner  r   r  r  r  r  r(   r)   c               v    || _         || _        || _        || _        || _        d | _        || _        || _        d S r+   )rL  r  r  r  r  r  r  r  )r,   rL  r  r  r  r  r  r  s           r-   r.   zSymbolTableNode.__init__  sF     		* *%) 0(r/   
str | Nonec                ,    | j         | j         j        S d S r+   )r  r   r   s    r-   r   zSymbolTableNode.fullname  s    9 9%%4r/   rO  c                    | j         }t          |t          t          f          r|j        |j        S t          |t
                    r|j        j        S d S r+   )r  r4   rN  SYMBOL_FUNCBASE_TYPESr   r&  r  )r,   r  s     r-   r   zSymbolTableNode.type  sQ    ydS"7899 	di>S9i(( 	8= 4r/   c                v    t          | j        | j        | j        | j        | j                  }| j        |_        |S r+   )r   rL  r  r  r  r  r  )r,   news     r-   r0  zSymbolTableNode.copy  s8    Ity$"4dmTEW
 
 
r/   rz   c                   t           | j                  dt          | j                   }t	          | j        t
                    r|d| j        j         dz  }| j        |d| j         z  }| j        r|d| j         z  }|S )N/r]  rZ   : z cross_ref:)	rQ   rL  r   r  r4   r   r   r   r  )r,   r8  s     r-   r   zSymbolTableNode.__str__  s    $)$>>z$)'<'<>>di,, 	,+di(++++A9 "ty"""A> 	0/t~///Ar/   prefixro   r@   c                .   dt           | j                 d}| j        rd|d<   | j        sd|d<   | j        rd|d<   | j        rd|d<   t          | j        t                    r| j        j	        |d	<   n| j        J | d|             |q| j        j	        }d|v ra||dz   |z   k    rUt          | j        t                    r| j        j        s/t          | j        t                    rJ d| d            ||d	<   |S | j                                        |d<   |S )zSerialize a SymbolTableNode.

        Args:
          prefix: full name of the containing module or class; or None
          name: name of this object relative to the containing object
        r   )r   rL  Tr  Fr  r  r  r  N:r   zDefinition of z is unexpectedly incompleter  )rQ   rL  r  r  r  r  r4   r  r   r   rN  r  r  r   )r,   r  ro   r   r   s        r-   r   zSymbolTableNode.serialize  ss    %6z$)?TUU 	)$(D!! 	*$)D!= 	$#D  	,'+D#$di** 	1 $	 2D9((V*<*<d*<*<(((!9-8OO FSL4$777'	377 8<@I<Y 8  *	?    N NMMMMN N N )1D%K9..00DLr/   r   c                   |d         dk    sJ t           |d                  }d|v rt          |d           }|d         |_        n>d|v s
J |            t                              |d                   }t          ||          }d|v r|d         |_        d|v r|d         |_        d|v r|d         |_        d	|v r|d	         |_        |S )
Nr   r   rL  r  r  r  r  r  r  )	rW   r   r  r   r   r  r  r  r  )r   r   rL  stnoder  s        r-   r   zSymbolTableNode.deserialize!  s    H~!22222!$v,/$$T400F#K0FT>>>4>>>))$v,77D$T400Fd""#'#8F d""#'#8F ":.FO%%&*+=&>F#r/   N)TFF)rL  r'   r  r  r  r   r  r   r  r   r  r   r  r   r(   r)   )r(   r  r  )r(   r   r   )r  rz   ro   rz   r(   r@   )r   r@   r(   r   )r8   r9   r:   r;   r<   r.   r   r   r   r0  r   r   r   r   r=   r/   r-   r   r     s        9 9v	I ##) "'") ) ) ) ) )(    X    X   	 	 	 	! ! ! !F    [  r/   c                  F    e Zd ZdZdZddZddZdd	Zedd            Z	dS )r   zrStatic representation of a namespace dictionary.

    This is used for module, class and function namespaces.
    r=   r(   rz   c                   g }|                                  D ]\  }}t          |t                    rm|j        dk    ra|j        pd                    d          d         t
          vr8|                    dt          |          z   dz   t          |          z              |                    d           t          |          }|	                    dd	           |dxx         d
z  cc<   d
                    |          S )Nbuiltinsrk   r   r&   z  r  z  <invalid item>r   zSymbolTable(rZ  
)r*  r4   r   r   r   r\   r  rz   r$  insertr_  )r,   ary  r  s       r-   r   zSymbolTable.__str__@  s    **,, 		- 		-JC%11 -Nj00-244S99"=EZZZHHTCHH_u4s5zzABBB+,,,,1II	N###	"yy||r/   c                X    t          d |                                 D                       S )Nc                @    g | ]\  }}||                                 fS r=   )r0  )rS   ry  r  s      r-   r:  z$SymbolTable.copy.<locals>.<listcomp>R  s)    MMM93S$))++.MMMr/   )r   r*  r   s    r-   r0  zSymbolTable.copyQ  s'    MM

MMMNNNr/   r   r@   c                    ddi}|                                  D ],\  }}|dk    s|j        r|                    ||          ||<   -|S )Nr   r   __builtins__)r*  r  r   )r,   r   r   ry  r  s        r-   r   zSymbolTable.serializeT  s]    "M2**,, 	7 	7JC
 n$$(:$#66DIIr/   r   c                    |d         dk    sJ t                      }|                                D ](\  }}|dk    rt                              |          ||<   )|S )Nr   r   )r   r*  r   r   )r   r   rs  ry  r  s        r-   r   zSymbolTable.deserialize`  sa    H~....]]**,, 	= 	=JCh)55e<<3	r/   Nr   )r(   r   )r   rz   r(   r@   )r   r@   r(   r   )
r8   r9   r:   r;   r<   r   r0  r   r   r   r=   r/   r-   r   r   8  s         
 I   "O O O O
 
 
 
    [  r/   r   c                  L    e Zd ZdZdZddddddddZddZedd            ZdS )r  zSpecifies how a dataclass-like transform should be applied. The fields here are based on the
    parameters accepted by `typing.dataclass_transform`.
eq_defaultorder_defaultkw_only_defaultfrozen_defaultfield_specifiersN)r  r  r  r  r  r  r   r  r  r  tuple[str, ...] | Noner  c               t    ||nd| _         ||nd| _        ||nd| _        ||nd| _        ||nd| _        d S )NTFr=   r  )r,   r  r  r  r  r  s         r-   r.   zDataclassTransformSpec.__init__v  sc     )3(>**D.;.G]]U2A2MSX0>0JnnPU4D4P 0 0VXr/   r(   r@   c                ^    | j         | j        | j        | j        t	          | j                  dS )Nr  )r  r  r  r  r   r  r   s    r-   r   z DataclassTransformSpec.serialize  s6    /!/#3"1 $T%: ; ;
 
 	
r/   r   c                   t          |                    d          |                    d          |                    d          |                    d          t          |                    dg                               S )Nr  r  r  r  r  r  )r  r   tupler  s     r-   r   z"DataclassTransformSpec.deserialize  sq    %xx--((?33 HH%67788$455"488,>#C#CDD
 
 
 	
r/   )
r  r   r  r   r  r   r  r  r  r   r   )r   r@   r(   r  )	r8   r9   r:   r;   r<   r.   r   r   r   r=   r/   r-   r  r  j  s        < <I #'%)'+37 '+Y Y Y Y Y Y$
 
 
 
 
 
 
 [
 
 
r/   r  r  r   r  c                       fd|D             S )Nc                4    g | ]}t          |          |S r=   )getattr)rS   ro   r  s     r-   r:  zget_flags.<locals>.<listcomp>  s(    :::TgdD&9&9:D:::r/   r=   )r  r   s   ` r-   r=  r=    s    ::::U::::r/   r<  r)   c                2    |D ]}t          | |d           d S )NT)setattr)r  r<  ro   s      r-   rD  rD    s0     " "dD!!!!" "r/   r  r  c                    d}t          | j        t                    r| j        j        }n1t          | j        t                    rt          | j                  }ndS | d| j         S )zReturn the qualified name representation of a member expression.

    Return a string of form foo.bar, foo.bar.baz, or similar, or None if the
    argument cannot be represented in this form.
    Nr   )r4   r  r  ro   r  get_member_expr_fullname)r  initials     r-   r  r    sh     G$)X&& ).	DIz	*	* *4955t##	###r/   c                    i | ]V\  }}t          |          t          ur;t          |t                     r&t          |t                    r|t          uN||j        WS r=   )r   r.  r4   
issubclassr   r   )rS   ry  objs      r-   rV   rV     sn       SCyy  3 !3
## ! 	: 
 	r/   r   r_  r  nodeslist[T]failCallable[[str, T], None]c                   d}d}d}d}t          | |          D ]\  }}|t          k    r|s|s|s|r |d|            d S (|t          k    r|s|s|r |d|            d S d}K|t          k    r|s|s|r |d|            d S d}n|t          k    s|t
          k    rd}|r |d|            d S |t          k    r|r |d|            d S d}d S )NFzHRequired positional args may not appear after default, named or var argsz>Positional default args may not appear after named or var argsTz/Var args may not appear after named or var argsz-A **kwargs argument must be the last argumentz'You may only have one **kwargs argument)ziprm  rn  r  r  r  r  )	r_  r  r  
is_var_arg	is_kw_arg
seen_namedseen_optrL  r  s	            r-   check_arg_kindsr    s    JIJH)U++  
d7?? Y *  ^    W__ Y * UW[\\\HHX Y * FMMMJJY$-"7"7J DdKKK Y >EEEI7 r/   function definitionSequence[str | None]rc  rz   c                    t                      }t          | |          D ]5\  }}|||v r |d| d| |            d S |                    |           6d S )NzDuplicate argument "z" in )r   r  r#  )r   r  r  rc  
seen_namesro   r  s          r-   check_arg_namesr    s     #&%%J%''  
d
 2 2D@@@;@@$GGGEEt	 r/   r   c                R    t          | j        t                    r| j        j        S dS )z.Return whether the expression is ClassVar[...]F)r4   r  rN  r  r   s    r-   is_class_varr    s&    $)S!! %y$$5r/   r  c                `    t          | t          t          t          t          f          o| j        S )z6Check whether `node` corresponds to a final attribute.)r4   rN  r%  r)  r&  r  r  s    r-   is_final_noder    s#    dS'+<iHII[dm[r/   name_prefixr  r8  r   c              #  (  K   |                                  D ]z\  }}|}d|v r|                    d          d         }|dz   |z   }|j        }|rC|j        |k    r8|||fV  t	          |t
                    rt          |j        ||          E d{V  {dS )zIterate over local definitions (not imported) in a symbol table.

    Recursively iterate over class members and nested classes.
    z-redefr   r   N)r*  r   r  r   r4   r   r   r   )r   r  r  ro   symnode	shortnamer   r  s           r-   r   r     s        
I 
Ig	t

8,,Q/I$y0| 	IDMX--GT))))$)) I,TZ4HHHHHHHHH
I 
Ir/   )rq   rr   r(   rs   )r  r  r(   r  )r  ry   r   r  r(   r  )r  ry   r<  r  r(   r)   )r  r  r(   r  )r_  r  r  r  r  r  r(   r)   )r  )
r   r  r  r  r  r  rc  rz   r(   r)   )r  r  r(   r   )r  r  r(   r   r+   )r   r   r  rz   r  r8  r(   r   )r;   
__future__r   r   abcr   collectionsr   enumr   r   typingr   r	   r
   r   r   r   r   r   r   r   r   r   r   typing_extensionsr   r?   r   mypy_extensionsr   mypy.strconvr   mypy.optionsr   	mypy.utilr   r   mypy.visitorr   r   r   mypy.patternsr   r    
mypy.typesr>   rz   r@   r[   rA   rC   rE   rG   rH   rI   rJ   rK   rL   rQ   r*  rW   r\   rf   rh   ri   rj   rl   updaterv   rw   ry   r   r   r   r   r   r   r   r   r  r	  r  r  r  r'  r)  rH  rZ  r\  rz  r{  r|  r}  r%  r  r&  r  rN  r  r  r  ro  r  r  r  r   r+  r6  r<  rB  rG  rL  rP  rT  r[  ra  rl  ru  r  r  r  r  r  r  r  r  r  r  r  rQ  rm  rn  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r(  r.  r6  r=  rD  rL  rR  rW  r\  rh  rs  rx  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  	frozensetr  r   r.  r  r  r"  r  r   r   r  r=  rD  r  globalsr   r  r  r  r  r   r=   r/   r-   <module>r     s   : : : " " " " " " 				       # # # # # #                                      A @ @ @ @ @ @ @ ! ! ! ! ! !                 2 2 2 2 2 2 2 2 I I I I I I I I I I &%%%%%%%) %) %) %) %) %) %) %)P   GCLLCH~ % % % %                        
    64v?OQbc
 c c c cQQj>N>N>P>PQQQ  Q Q Q Q #"%         #" ,-+3'3*       (>w&G  G G G G
 &?'5	$ $      #" ,	" "      .<SUVV  V V V V   NN9K9K9M9MNNN N N N./^$? ? ? ?
!     : : : : :7 : : :( : : : : : : : : : : : : : : : :    Z          D D D D D D D D< s$5x
7KKL
 L L L LI I I I Iz I I IX" " " " " " " "2* * * * *Z * * *"/ / / / / / / /*. . . . .
 . . .& MLL L L L L4 4 4 4 4t 4 4 4n !!78 8 8 8 8A A A A A*i A A AH"W "W "W "W "Wt "W "W "WJ ' * * *     4! 4! 4! 4! 4!x 4! 4! 4!n & ) ) )                   k k k k kh
I k k k` +G4 > > > > >
I > > >B  	    0| | | | |* | | |~h h h h hy h h hV/ / / / / / / /"1 1 1 1 19 1 1 1") ) ) ) )I ) ) ),3 3 3 3 3Y 3 3 3"@3 @3 @3 @3 @3Y @3 @3 @3F< < < < <Y < < <*. . . . .	 . . .&3, 3, 3, 3, 3,i 3, 3, 3,l/ / / / / / / // / / / / / / /", , , , ,i , , ,. . . . .	 . . .1 1 1 1 19 1 1 1- - - - -y - - -+ + + + +Y + + +&. . . . .	 . . .$", ", ", ", ",i ", ", ",J- - - - -y - - -B. . . . .	 . . .>, , , , ,j , , ,., , , , ,j , , ,": : : :. . . . .
 . . .4. . . . .
 . . ."0 0 0 0 0* 0 0 0", , , , ,: , , ,- - - - -z - - -*' ' ' ' 'j ' ' 'T6 6 6 6 6w 6 6 6./ / / / / / / /( 5 5 5 5 5d 5 5 5<                 " " " " "$	 $ $ $ $$	 $ $ $ $, , , , ,!- !- !- !- !-z !- !- !-H3 3 3 3 3J 3 3 3. . . . .
 . . .. . . . .
 . . .:. . . . .
 . . .,3 3 3 3 3Z 3 3 3 ++ ++ ++ ++ ++Z ++ ++ ++\3 3 3 3 3Z 3 3 3:. . . . .
 . . .:- - - - -z - - -&4 4 4 4 4Z 4 4 4&/ / / / / / / /8. . . . .
 . . .*    :   0- - - - -z - - -"- - - - -z - - -". . . . .
 . . .&, , , , ,j , , ,"2 2 2 2 2J 2 2 2@6 6 6 6 6
 6 6 6"5 5 5 5 5z 5 5 5" <  <  <  <  <j  <  <  <F4 4 4 4 4j 4 4 4*4 4 4 4 4j 4 4 48 	    	        + + + + +j* + + +\8
 8
 8
 8
 8
/ 8
 8
 8
v
 
 
 
 
O 
 
 
<-
 -
 -
 -
 -
 -
 -
 -
`3 3 3 3 3J 3 3 3"3 3 3 3 3Z 3 3 3*2 2 2 2 2J 2 2 2$2 2 2 2 2: 2 2 2.1 1 1 1 1* 1 1 10 0 0 0 0* 0 0 02. . . . .
 . . .(- - - - -z - - -F '0i  ' '     "l l l l lz l l l^C C C C Cx C C CB  (x(=>> > > > >$,H-G$H$H  H H H H ()M N N N N N N\
 \
 \
 \
 \

 \
 \
 \
~G4 G4 G4 G4 G4j G4 G4 G4Tu u u u u u u up/ / / / /$sO+, / / /d/
 /
 /
 /
 /
 /
 /
 /
d; ; ; ;" " " "
$ $ $ $  GIIOO%%      " " " "R -	       \ \ \ \ CGI I I I I I Ir/   