+
    i;  c                   s   R t ^ RIt^ RIHtHtHtHtHtHtHtH	t	H
t
HtHtHtHtHtHtHtHtHtHt ^ RIt^ RIHt . ROtR	 t ! R
 R4      t]! 4       t ! R R]4      t ! R R4      tR t ! R R]4      t ! R R]4      t  ! R R4      t!R]3.t"]"PG                  R ]$! 4       PK                  4        4       4       Rt&]& U u/ uF  p ]$! 4       V ,          V bK  	  up t'R t(])R8X  d    ^ RI*t*](! ]*PV                  R,          4       R# R# u up i )z2Interface to the compiler's internal symbol tablesN)USE
DEF_GLOBALDEF_NONLOCAL	DEF_LOCAL	DEF_PARAMDEF_TYPE_PARAMDEF_FREE_CLASS
DEF_IMPORT	DEF_BOUND	DEF_ANNOTDEF_COMP_ITERDEF_COMP_CELL	SCOPE_OFF
SCOPE_MASKFREELOCALGLOBAL_IMPLICITGLOBAL_EXPLICITCELL)StrEnumSymbolTableTypeSymbolTableClassFunctionSymbolc                sF    \         P                  ! WV4      p\        W14      # )zReturn the toplevel *SymbolTable* for the source code.

*filename* is the name of the file with the code
and *compile_type* is the *compile()* mode argument.
)	_symtablesymtable_newSymbolTable)ZcodefilenameZcompile_typetops   &&& !/usr/lib64/python3.14/symtable.pyr   r      s!     

T\
:C3))    c                   s2   a  ] tR t^t o R tR tR tRtV tR# )SymbolTableFactoryc                s:    \         P                  ! 4       V n        R # N)weakrefZWeakValueDictionary_SymbolTableFactory__memoself   &r   __init__ZSymbolTableFactory.__init__   s    113r   c                s    VP                   \        P                  8X  d   \        W4      # VP                   \        P                  8X  d   \        W4      # \        W4      # r!   )typer   TYPE_FUNCTIONr   
TYPE_CLASSr   r   )r%   tabler      &&&r   newZSymbolTableFactory.new!   sG    ::000E,,::---))5++r   c                s    W3pV P                   P                  VR 4      pVf    V P                  W4      ;q@P                   V&   V# r!   )r#   getr-   )r%   r+   r   ZkeyZobjs   &&&  r   __call__ZSymbolTableFactory.__call__(   sA    okkooc4(;%)XXe%>>C++c"
r   )Z__memoN)	__name__
__module____qualname____firstlineno__r'   r-   r/   __static_attributes____classdictcell__Z__classdict__   @r   r    r       s     4, r   r    c                   s2    ] tR t^2tRtRtRtRtRtRt	Rt
RtR	# )
r   moduleZfunctionZclassZ
annotationz
type aliasztype parametersztype variable N)r0   r1   r2   r3   MODULEFUNCTIONCLASS
ANNOTATION
TYPE_ALIASTYPE_PARAMETERSTYPE_VARIABLEr4   r9   r   r   r   r   2   s%    FHEJJ'O#Mr   c                   st   a  ] tR t^<t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tRtV tR# )r   c                s,    Wn         W n        / V n        R # r!   )_table	_filename_symbols)r%   Z	raw_tabler   r,   r   r'   ZSymbolTable.__init__>   s    !r   c                s:   V P                   \        8X  d   R pMRV P                   P                  ,          pV P                  P                  R8X  d   RP                  WP                  4      # RP                  VV P                  P                  V P                  4      # ) z%s r   z<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)	__class__r   r0   rA   nameZformatrB   )r%   Zkind   & r   __repr__ZSymbolTable.__repr__C   sy    >>[(D4>>222D;;u$4;;D..QQ4;;D<@KK<L<L<@NNL Lr   c                s$   V P                   P                  \        P                  8X  d   \        P
                  # V P                   P                  \        P                  8X  d   \        P                  # V P                   P                  \        P                  8X  d   \        P                  # V P                   P                  \        P                  8X  d   \        P                  # V P                   P                  \        P                  8X  d   \        P                  # V P                   P                  \        P                  8X  d   \        P                  # V P                   P                  \        P                   8X  d   \        P"                  # R# )zvReturn the type of the symbol table.

The value returned is one of the values in
the ``SymbolTableType`` enumeration.
N)rA   r(   r   ZTYPE_MODULEr   r:   r)   r;   r*   r<   ZTYPE_ANNOTATIONr=   ZTYPE_TYPE_ALIASr>   TYPE_TYPE_PARAMETERSr?   ZTYPE_TYPE_VARIABLEr@   r$   r&   r   get_typeZSymbolTable.get_typeP   s    ;;y444")));;y666"+++;;y333"(((;;y888"---;;y888"---;;y==="222;;y;;;"000 <r   c                .    V P                   P                  # )z,Return an identifier for the table.
        )rA   Zidr$   r&   r   get_idZSymbolTable.get_idf   s     {{~~r   c                rK   )zReturn the table's name.

This corresponds to the name of the class, function
or 'top' if the table is for a class, function or
global respectively.
)rA   rF   r$   r&   r   get_nameZSymbolTable.get_namek   s     {{r   c                rK   )z@Return the number of the first line in the
block for the table.
)rA   Zlinenor$   r&   r   
get_linenoZSymbolTable.get_linenot   s     {{!!!r   c                sb    \        V P                  P                  \        P                  8H  4      # )z:Return *True* if the locals in the table
are optimizable.
)boolrA   r(   r   r)   r$   r&   r   is_optimizedZSymbolTable.is_optimizedz   s$     DKK$$	(?(??@@r   c                @    \        V P                  P                  4      # )z9Return *True* if the block is a nested class
or function.)rO   rA   nestedr$   r&   r   	is_nestedZSymbolTable.is_nested   s     DKK&&''r   c                rQ   )z:Return *True* if the block has nested namespaces.
        )rO   rA   childrenr$   r&   r   has_childrenZSymbolTable.has_children   s     DKK(())r   c                sJ    V P                   P                  P                  4       # )zKReturn a view object containing the names of symbols in the table.
        )rA   symbolsZkeysr$   r&   r   get_identifiersZSymbolTable.get_identifiers   s     {{""''))r   c                s
   V P                   P                  V4      pVfd   V P                  P                  V,          pV P	                  V4      pV P                  P
                  R8H  p\        WVVR7      ;q P                   V&   V# )z<Lookup a *name* in the table.

Returns a *Symbol* instance.
r   )module_scope)rC   r.   rA   rV   _SymbolTable__check_childrenrF   r   )r%   rF   Zsymflags
namespacesrX   s   &&    r   lookupZSymbolTable.lookup   s{    
 mm%;KK''-E..t4J KK,,5L(.tJ<H)J JC--%
r   c                sh    V P                  4        Uu. uF  qP                  V4      NK  	  up# u upi )z<Return a list of *Symbol* instances for
names in the table.
)rW   r\   )r%   identrG   r   get_symbolsZSymbolTable.get_symbols   s.     150D0D0FG0FuE"0FGGGs   /c                s    V P                   P                   Uu. uF+  pVP                  V8X  g   K  \        W P                  4      NK-  	  up# u upi r!   )rA   rT   rF   r   rB   )r%   rF   sts   && r   Z__check_childrenZSymbolTable.__check_children   sG    ++..$.B77d? 4NN3.$ 	$ $s
   AAc                s~    V P                   P                   Uu. uF  p\        WP                  4      NK  	  up# u upi )z3Return a list of the nested symbol tables.
        )rA   rT   r   rB   )r%   r_   rG   r   get_childrenZSymbolTable.get_children   s<     ++..0.B  NN3.0 	0 0s   :)rB   rC   rA   N)r0   r1   r2   r3   r'   rH   rJ   rL   rM   rN   rP   rS   rU   rW   r\   r^   rY   r`   r4   r5   r6   r7   r   r   r   <   sS     
L=,
 "A(
*
*
H$
0 0r   c                 s2    V \         ,	          \        ,          # r!   )r   r   )rZ   r&   r   
_get_scopera      s    Y*,,r   c                   sX   a  ] tR t^t o RtRtRtRtRtR t	R t
R tR tR tR tRtV tR# )	r   Nc                s   a a \         ;QJ d&    . V V3R  lS P                  4        4       F  NK  	  5# ! V V3R  lS P                  4        4       4      # )c              3   s~   <"   T F2  pS! SP                   P                  V,          4      '       g   K.  Vx  K4  	  R # 5ir!   )rA   rV   ).0r]   r%   	test_funcs   & r   	<genexpr>Z-Function.__idents_matching.<locals>.<genexpr>   s1      ?(>u!$++"5"5e"<= U(>s   +=
=)tuplerW   )r%   rc   s   ffr   Z__idents_matchingZFunction.__idents_matching   sE    u ?(<(<(> ?u 	?u ?(<(<(> ? ? 	?r   c                d    V P                   f   V P                  R 4      V n         V P                   # )z6Return a tuple of parameters to the function.
        c                     V \         ,          # r!   )r   xr&   r   <lambda>Z)Function.get_parameters.<locals>.<lambda>   s    A	Mr   )_Function__params_Function__idents_matchingr$   r&   r   get_parametersZFunction.get_parameters   s+     ==  223IJDM}}r   c                   a V P                   f)   \        \        3oV3R lpV P                  V4      V n         V P                   # )z2Return a tuple of locals in the function.
        c                     < \        V 4      S9   # r!   ra   )ri   locs   &r   rj   Z%Function.get_locals.<locals>.<lambda>       Z]d2r   )_Function__localsr   r   rl   )r%   testrq      & @r   
get_localsZFunction.get_locals   s9     == 4=D2D 2248DM}}r   c                rn   )z3Return a tuple of globals in the function.
        c                 ro   r!   rp   )ri   globrr   r   rj   Z&Function.get_globals.<locals>.<lambda>   rs   r   )_Function__globalsr   r   rl   )r%   ru   rx   rv   r   get_globalsZFunction.get_globals   s:     >>!#_5D2D!33D9DN~~r   c                rf   )z5Return a tuple of nonlocals in the function.
        c                 rg   r!   )r   rh   r&   r   rj   Z(Function.get_nonlocals.<locals>.<lambda>   s	    q<?Or   )_Function__nonlocalsrl   r$   r&   r   get_nonlocalsZFunction.get_nonlocals   s0     ##556OPDr   c                sh    V P                   f   R pV P                  V4      V n         V P                   # )z:Return a tuple of free variables in the function.
        c                 s&    \        V 4      \        8H  # r!   )ra   r   rh   r&   r   rj   Z$Function.get_frees.<locals>.<lambda>   s    
1 5r   )_Function__freesrl   )r%   is_freerG   r   	get_freesZFunction.get_frees   s/     <<5G11':DL||r   )Z__freesZ	__globalsZ__localsZ__nonlocalsZ__params)r0   r1   r2   r3   rk   rt   r}   ry   r{   rl   rm   rw   rz   r|   r   r4   r5   r6   r7   r   r   r      sC      HHGIK?  r   c                   s*   a  ] tR t^t o RtR tRtV tR# )r   Nc                s  a  ^ RI pS P                  P                   RS P                  P                   2pVP	                  V R2\
        ^R7       S P                  Ef   / pV 3R lpS P                  P                   F  pV! VP                  4      '       g   K  VP                  ;\        P                  8X  d6    VP                  R8X  d   RVP                  9   d   Kb  ^W5P                  &   Kr  \        P                  8X  g   K  VP                  pVP                   F<  pVP                  V8X  g   K  VP                  \        P                  8X  g   K7  ^W6&    K  	  K  	  \        V4      S n        S P                  # )z9Return a tuple of methods declared in the class.
        NZ.z@.get_methods() is deprecated and will be removed in Python 3.16.)Z
stacklevelc                 s   < SP                   P                  P                  V ^ 4      pV\        ,	          \        ,          \
        8H  #     )rA   rV   r.   r   r   r   )r]   rZ   r%   s   & r   is_local_symbolZ*Class.get_methods.<locals>.is_local_symbol   s4    ++//q9)+z9eCCr   Zgenexprz.0)warningsrE   r1   r0   ZwarnZDeprecationWarning_Class__methodsrA   rT   rF   r(   r   r)   ZvarnamesrI   re   )r%   r   ZtypenameZdr   r_   Z
scope_nameZcs   f       r   get_methodsZClass.get_methods   s,    	nn//0$..2I2I1JK
 #< =(Q 	 	8 >>!AD kk**"277++''4Y44  "ww)38K ()*AggJ&;;; *,J%'[[#$66Z#7AFFiF]F]<] 56AM$) &1 +4 #1XDN~~r   )Z	__methods)r0   r1   r2   r3   r   r   r4   r5   r6   r7   r   r   r      s     I+ +r   c                   s   a  ] tR tRt o RRR/R lltR tR tR tR	 tR
 t	R t
R tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )r   i  NrX   Fc               sl    Wn         W n        \        V4      V n        T;'       g    RV n        W@n        R # )Nr9   )_Symbol__name_Symbol__flagsra   _Symbol__scope_Symbol__namespaces_Symbol__module_scope)r%   rF   rZ   r[   rX   s   &&&&$r   r'   ZSymbol.__init__  s.    !%(&,,"*r   c                s    R P                  V P                  4       4      pRV P                  : RV P                  4        RV R2# )Z|z<symbol : , Z>)join
_flags_strr   
_scope_str)r%   Z	flags_strrG   r   rH   ZSymbol.__repr__$  s>    HHT__./	$++4??+<*=R	{!LLr   c                sz    \         P                  V P                  4      ;'       g    \        V P                  4      # r!   )_scopes_value_to_namer.   r   Zstrr$   r&   r   r   ZSymbol._scope_str(  s(    $((6KK#dll:KKr   c              #  sh   "   \          F#  w  rV P                  V,          V8X  g   K  Vx  K%  	  R # 5ir!   )_flagsr   )r%   ZflagnameZ	flagvalues   &  r   r   ZSymbol._flags_str+  s(     #)H||i'94 $*s   !2
2c                    V P                   # )z#Return a name of a symbol.
        )r   r$   r&   r   rM   ZSymbol.get_name0  s     {{r   c                B    \        V P                  \        ,          4      # )z2Return *True* if the symbol is used in
its block.
)rO   r   r    r$   r&   r   is_referencedZSymbol.is_referenced5  s     DLL3&''r   c                r   )z4Return *True* if the symbol is a parameter.
        )rO   r   r   r$   r&   r   is_parameterZSymbol.is_parameter;       DLL9,--r   c                r   )z9Return *True* if the symbol is a type parameter.
        )rO   r   r   r$   r&   r   is_type_parameterZSymbol.is_type_parameter@       DLL>122r   c                    \        V P                  \        \        39   ;'       g,    V P                  ;'       d    V P
                  \        ,          4      # )z/Return *True* if the symbol is global.
        )rO   r   r   r   r   r   r   r$   r&   r   	is_globalZSymbol.is_globalE  sI     DLL_o$FF J J++HHy0HK 	Kr   c                r   )z(Return *True* if the symbol is nonlocal.)rO   r   r   r$   r&   r   is_nonlocalZSymbol.is_nonlocalK  s    DLL</00r   c                :    \        V P                  \        8H  4      # )zGReturn *True* if the symbol is declared global
with a global statement.)rO   r   r   r$   r&   r   is_declared_globalZSymbol.is_declared_globalO  s     DLLO344r   c                r   )z.Return *True* if the symbol is local.
        )rO   r   r   r   r   r   r   r$   r&   r   is_localZSymbol.is_localT  sH     DLLUDM1 J J++HHy0HK 	Kr   c                r   )z2Return *True* if the symbol is annotated.
        )rO   r   r	   r$   r&   r   is_annotatedZSymbol.is_annotatedZ  r   r   c                r   )z9Return *True* if a referenced symbol is
not assigned to.
)rO   r   r   r$   r&   r   r~   ZSymbol.is_free_  s     DLLD())r   c                r   )zPReturn *True* if a class-scoped symbol is free from
the perspective of a method.)rO   r   r   r$   r&   r   is_free_classZSymbol.is_free_classe  r   r   c                r   )zAReturn *True* if the symbol is created from
an import statement.
)rO   r   r   r$   r&   r   is_importedZSymbol.is_importedj  s     DLL:-..r   c                r   )z)Return *True* if a symbol is assigned to.)rO   r   r   r$   r&   r   is_assignedZSymbol.is_assignedp  s    DLL9,--r   c                r   )zKReturn *True* if the symbol is a comprehension iteration variable.
        )rO   r   r
   r$   r&   r   is_comp_iterZSymbol.is_comp_itert       DLL=011r   c                r   )zKReturn *True* if the symbol is a cell in an inlined comprehension.
        )rO   r   r   r$   r&   r   is_comp_cellZSymbol.is_comp_celly  r   r   c                s,    \        V P                  4      # )aS  Returns *True* if name binding introduces new namespace.

If the name is used as the target of a function or class
statement, this will be true.

Note that a single name can be bound to multiple objects.  If
is_namespace() is true, the name may also be bound to other
objects, like an int or list, that does not introduce a new
namespace.
)rO   r   r$   r&   r   is_namespaceZSymbol.is_namespace~  s     D%%&&r   c                r   )z.Return a list of namespaces bound to this name)r   r$   r&   r   get_namespacesZSymbol.get_namespaces  s       r   c                s    \        V P                  4      ^ 8X  d   \        R4      h\        V P                  4      ^8  d   \        R4      hV P                  ^ ,          # )zReturn the single namespace bound to this name.

Raises ValueError if the name is bound to multiple namespaces
or no namespace.
z#name is not bound to any namespacesz$name is bound to multiple namespaces)Zlenr   Z
ValueErrorr$   r&   r   get_namespaceZSymbol.get_namespace  sS     t  !Q&BCC""#a'CDD$$Q''r   )Z__flagsZ__module_scopeZ__nameZ__namespacesZ__scoper!   )r0   r1   r2   r3   r'   rH   r   r   rM   r   r   r   r   r   r   r   r   r~   r   r   r   r   r   r   r   r   r4   r5   r6   r7   r   r   r     s     +U +ML

(.
3
K15
K.
*3
/.2
2
'!( (r   r    c              #   sd   "   T F&  q^ ,          P                  R4      '       g   K"  Vx  K(  	  R# 5i)r   ZDEF_N)Z
startswith)rb   ZkvrG   r   rd   rd     s#     I,R10@0@0Hbb,s   0
0c                 s:  a ^ RI pRV3R lloT ;'       g    R. Fi  pVR8X  d   VP                  P                  4       pRpM-\        VR4      ;_uu_ 4       pVP                  4       pRRR4       \	        XVR4      pS! V4       Kk  	  R#   + '       g   i     L+; i)r   Nc           
      s  < R V,          pV P                  4       '       d   RMRpV P                  4       R8X  d   RV P                  : 2pMV P                  4       : p\	        V RV V P                  4        RV R24       V P                  4        F  pV P                  V4      pRP                  VP                  4       4      P                  4       p\	        R V VP                  4       P                  4        R	VP                  4       : R
V 24       K  	  \	        4        V P                  4        F  pS	! W^,           4       K  	  R# )z    znested rD   r8   z
from file zsymbol table for Z Z:r   z symbol r   N)rS   rJ   rB   rM   ZprintrW   r\   r   r   Zlowerr   r`   )
r+   ZlevelZindentrR   Zwhatr]   ZsymbolrZ   Ztable2print_symbolss
   &&       r   r   Zmain.<locals>.print_symbols  s   %#oo//R>>x'23Dnn&)D)&%..2B1C1TF!LM**,E\\%(FIIf//1288:ED!2!2!4!:!:!< =XfooFWEZZ\]b\cde - 	((*F&!), +r   Z-z<stdin>ZrbZexecr   )sysZstdinZreadZopenr   )Zargsr   r   ZsrcZfZmodr   s   &     @r   mainr     s{    -" MMSEMs?)).."C Hh%%ffh &sHf-c "
 &%s   B

BZ__main__:i   NN)r   r   r   r   r   r   )r   r   r   r   r   ),Z__doc__r   r    r   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r"   Zenumr   Z__all__r   r    r   r   r   ra   r   r   r   r   ZextendZglobalsZitemsZ_scopes_namesr   r   r0   r   Zargv)Zns   0r   <module>r      s   8 	 	 	 	 	 	  
W* $ %&$g $p0 p0f-3{ 3l/K /d( (D #, I79??,I IO2?@-Q1q-@ < z" C As   D