+
    lh;                        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                F    \         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)codefilenamecompile_typetops   &&& lib/python3.14/symtable.pyr   r      s!     

T\
:C3))    c                   2   a  ] tR t^t o R tR tR tRtV tR# )SymbolTableFactoryc                :    \         P                  ! 4       V n        R # N)weakrefWeakValueDictionary_SymbolTableFactory__memoselfs   &r#   __init__SymbolTableFactory.__init__   s    113r$   c                    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    s   &&&r#   newSymbolTableFactory.new!   sG    ::000E,,::---))5++r$   c                    W3pV P                   P                  VR 4      pVf    V P                  W4      ;q@P                   V&   V# r(   )r+   getr5   )r-   r4   r    keyobjs   &&&  r#   __call__SymbolTableFactory.__call__(   sA    okkooc4(;%)XXe%>>C++c"
r$   )__memoN)	__name__
__module____qualname____firstlineno__r.   r5   r;   __static_attributes____classdictcell____classdict__s   @r#   r&   r&      s     4, r$   r&   c                   2    ] tR t^2tRtRtRtRtRtRt	Rt
RtR	# )
r   modulefunctionclass
annotationz
type aliasztype parametersztype variable N)r>   r?   r@   rA   MODULEFUNCTIONCLASS
ANNOTATION
TYPE_ALIASTYPE_PARAMETERSTYPE_VARIABLErB   rK   r$   r#   r   r   2   s%    FHEJJ'O#Mr$   c                   t   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                ,    Wn         W n        / V n        R # r(   )_table	_filename_symbols)r-   	raw_tabler    s   &&&r#   r.   SymbolTable.__init__>   s    !r$   c                :   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   r>   rU   nameformatrV   )r-   kinds   & r#   __repr__SymbolTable.__repr__C   sy    >>[(D4>>222D;;u$4;;D..QQ4;;D<@KK<L<L<@NNL Lr$   c                \   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"                  # Q RT P                   P                   24       h)zvReturn the type of the symbol table.

The value returned is one of the values in
the ``SymbolTableType`` enumeration.
zunexpected type: )rU   r1   r   TYPE_MODULEr   rL   r2   rM   r3   rN   TYPE_ANNOTATIONrO   TYPE_TYPE_ALIASrP   TYPE_TYPE_PARAMETERSrQ   TYPE_TYPE_VARIABLErR   r,   s   &r#   get_type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<)$++*:*:);<<ur$   c                .    V P                   P                  # )z,Return an identifier for the table.
        )rU   idr,   s   &r#   get_idSymbolTable.get_idf   s     {{~~r$   c                .    V P                   P                  # )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.
)rU   r]   r,   s   &r#   get_nameSymbolTable.get_namek   s     {{r$   c                .    V P                   P                  # )z@Return the number of the first line in the
block for the table.
)rU   linenor,   s   &r#   
get_linenoSymbolTable.get_linenot   s     {{!!!r$   c                b    \        V P                  P                  \        P                  8H  4      # )z:Return *True* if the locals in the table
are optimizable.
)boolrU   r1   r   r2   r,   s   &r#   is_optimizedSymbolTable.is_optimizedz   s$     DKK$$	(?(??@@r$   c                @    \        V P                  P                  4      # )z9Return *True* if the block is a nested class
or function.)rv   rU   nestedr,   s   &r#   	is_nestedSymbolTable.is_nested   s     DKK&&''r$   c                @    \        V P                  P                  4      # )z:Return *True* if the block has nested namespaces.
        )rv   rU   childrenr,   s   &r#   has_childrenSymbolTable.has_children   s     DKK(())r$   c                J    V P                   P                  P                  4       # )zKReturn a view object containing the names of symbols in the table.
        )rU   symbolskeysr,   s   &r#   get_identifiersSymbolTable.get_identifiers   s     {{""''))r$   c                
   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)rW   r8   rU   r   _SymbolTable__check_childrenr]   r   )r-   r]   symflags
namespacesr   s   &&    r#   lookupSymbolTable.lookup   s{    
 mm%;KK''-E..t4J KK,,5L(.tJ<H)J JC--%
r$   c                h    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.
)r   r   )r-   idents   & r#   get_symbolsSymbolTable.get_symbols   s.     150D0D0FG0FuE"0FGGGs   /c                    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(   )rU   r~   r]   r   rV   )r-   r]   sts   && r#   __check_childrenSymbolTable.__check_children   sG    ++..$.B77d? 4NN3.$ 	$ $s
   AAc                ~    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.
        )rU   r~   r   rV   )r-   r   s   & r#   get_childrenSymbolTable.get_children   s<     ++..0.B  NN3.0 	0 0s   :)rV   rW   rU   N)r>   r?   r@   rA   r.   r`   rh   rl   ro   rs   rw   r{   r   r   r   r   r   r   rB   rC   rD   s   @r#   r   r   <   sS     
L=,
 "A(
*
*
H$
0 0r$   c                 2    V \         ,	          \        ,          # r(   )r   r   )r   s   &r#   
_get_scoper      s    Y*,,r$   c                   X   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                   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   ~   <"   T F2  pS! SP                   P                  V,          4      '       g   K.  Vx  K4  	  R # 5ir(   )rU   r   ).0r   r-   	test_funcs   & r#   	<genexpr>-Function.__idents_matching.<locals>.<genexpr>   s1      ?(>u!$++"5"5e"<= U(>s   +=
=)tupler   )r-   r   s   ffr#   __idents_matching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   xs   &r#   <lambda>)Function.get_parameters.<locals>.<lambda>   s    A	Mr$   )_Function__params_Function__idents_matchingr,   s   &r#   get_parameters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(   r   )r   locss   &r#   r   %Function.get_locals.<locals>.<lambda>       Z]d2r$   )_Function__localsr   r   r   )r-   testr   s   & @r#   
get_localsFunction.get_locals   s9     == 4=D2D 2248DM}}r$   c                   a V P                   f)   \        \        3oV3R lpV P                  V4      V n         V P                   # )z3Return a tuple of globals in the function.
        c                     < \        V 4      S9   # r(   r   )r   globs   &r#   r   &Function.get_globals.<locals>.<lambda>   r   r$   )_Function__globalsr   r   r   )r-   r   r   s   & @r#   get_globalsFunction.get_globals   s:     >>!#_5D2D!33D9DN~~r$   c                d    V P                   f   V P                  R 4      V n         V P                   # )z5Return a tuple of nonlocals in the function.
        c                     V \         ,          # r(   )r   r   s   &r#   r   (Function.get_nonlocals.<locals>.<lambda>   s	    q<?Or$   )_Function__nonlocalsr   r,   s   &r#   get_nonlocalsFunction.get_nonlocals   s0     ##556OPDr$   c                h    V P                   f   R pV P                  V4      V n         V P                   # )z:Return a tuple of free variables in the function.
        c                 &    \        V 4      \        8H  # r(   )r   r   r   s   &r#   r   $Function.get_frees.<locals>.<lambda>   s    
1 5r$   )_Function__freesr   )r-   is_frees   & r#   	get_freesFunction.get_frees   s/     <<5G11':DL||r$   )__frees	__globals__locals__nonlocals__params)r>   r?   r@   rA   r   r   r   r   r   r   r   r   r   r   r   rB   rC   rD   s   @r#   r   r      sC      HHGIK?  r$   c                   *   a  ] tR t^t o RtR tRtV tR# )r   Nc                .  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                   FV  pVP                  V8X  g   K  VP                  \        P                  8X  g   K7  VR8w  g   RVP                  9  g   Q h^W6&    K  	  K  	  \        V4      S n        S P                  # )z9Return a tuple of methods declared in the class.
        N.z@.get_methods() is deprecated and will be removed in Python 3.16.)
stacklevelc                    < SP                   P                  P                  V ^ 4      pV\        ,	          \        ,          \
        8H  #     )rU   r   r8   r   r   r   )r   r   r-   s   & r#   is_local_symbol*Class.get_methods.<locals>.is_local_symbol   s4    ++//q9)+z9eCCr$   genexprz.0)warningsr\   r?   r>   warnDeprecationWarning_Class__methodsrU   r~   r]   r1   r   r2   varnamesrf   r   )r-   r   typenamedr   r   
scope_namecs   f       r#   get_methodsClass.get_methods   sH    	nn//0$..2I2I1JK
 #< =(Q 	 	8 >>!AD kk**"277++''4Y44  "ww)38K ()*AggJ&;;; *,J%'[[#$66Z#7AFFiF]F]<] ,6+BdRSR\R\F\$\+\45AM$) &1 +4 #1XDN~~r$   )	__methods)r>   r?   r@   rA   r   r   rB   rC   rD   s   @r#   r   r      s     I+ +r$   c                      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  Nr   Fc               l    Wn         W n        \        V4      V n        T;'       g    RV n        W@n        R # )NrK   )_Symbol__name_Symbol__flagsr   _Symbol__scope_Symbol__namespaces_Symbol__module_scope)r-   r]   r   r   r   s   &&&&$r#   r.   Symbol.__init__  s.    !%(&,,"*r$   c                    R P                  V P                  4       4      pRV P                  : RV P                  4        RV R2# )|z<symbol : , >)join
_flags_strr   
_scope_str)r-   	flags_strs   & r#   r`   Symbol.__repr__$  s>    HHT__./	$++4??+<*=R	{!LLr$   c                z    \         P                  V P                  4      ;'       g    \        V P                  4      # r(   )_scopes_value_to_namer8   r   strr,   s   &r#   r   Symbol._scope_str(  s(    $((6KK#dll:KKr$   c              #  h   "   \          F#  w  rV P                  V,          V8X  g   K  Vx  K%  	  R # 5ir(   )_flagsr   )r-   flagname	flagvalues   &  r#   r   Symbol._flags_str+  s(     #)H||i'94 $*s   !2
2c                    V P                   # )z#Return a name of a symbol.
        )r   r,   s   &r#   ro   Symbol.get_name0  s     {{r$   c                B    \        V P                  \        ,          4      # )z2Return *True* if the symbol is used in
its block.
)rv   r   r   r,   s   &r#   is_referencedSymbol.is_referenced5  s     DLL3&''r$   c                B    \        V P                  \        ,          4      # )z4Return *True* if the symbol is a parameter.
        )rv   r   r   r,   s   &r#   is_parameterSymbol.is_parameter;       DLL9,--r$   c                B    \        V P                  \        ,          4      # )z9Return *True* if the symbol is a type parameter.
        )rv   r   r   r,   s   &r#   is_type_parameter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.
        )rv   r   r   r   r   r   r
   r,   s   &r#   	is_globalSymbol.is_globalE  sI     DLL_o$FF J J++HHy0HK 	Kr$   c                B    \        V P                  \        ,          4      # )z(Return *True* if the symbol is nonlocal.)rv   r   r   r,   s   &r#   is_nonlocalSymbol.is_nonlocalK  s    DLL</00r$   c                :    \        V P                  \        8H  4      # )zGReturn *True* if the symbol is declared global
with a global statement.)rv   r   r   r,   s   &r#   is_declared_globalSymbol.is_declared_globalO  s     DLLO344r$   c                    \        V P                  \        \        39   ;'       g,    V P                  ;'       d    V P
                  \        ,          4      # )z.Return *True* if the symbol is local.
        )rv   r   r   r   r   r   r
   r,   s   &r#   is_localSymbol.is_localT  sH     DLLUDM1 J J++HHy0HK 	Kr$   c                B    \        V P                  \        ,          4      # )z2Return *True* if the symbol is annotated.
        )rv   r   r   r,   s   &r#   is_annotatedSymbol.is_annotatedZ  r  r$   c                :    \        V P                  \        8H  4      # )z9Return *True* if a referenced symbol is
not assigned to.
)rv   r   r   r,   s   &r#   r   Symbol.is_free_  s     DLLD())r$   c                B    \        V P                  \        ,          4      # )zPReturn *True* if a class-scoped symbol is free from
the perspective of a method.)rv   r   r   r,   s   &r#   is_free_classSymbol.is_free_classe  r  r$   c                B    \        V P                  \        ,          4      # )zAReturn *True* if the symbol is created from
an import statement.
)rv   r   r	   r,   s   &r#   is_importedSymbol.is_importedj  s     DLL:-..r$   c                B    \        V P                  \        ,          4      # )z)Return *True* if a symbol is assigned to.)rv   r   r   r,   s   &r#   is_assignedSymbol.is_assignedp  s    DLL9,--r$   c                B    \        V P                  \        ,          4      # )zKReturn *True* if the symbol is a comprehension iteration variable.
        )rv   r   r   r,   s   &r#   is_comp_iterSymbol.is_comp_itert       DLL=011r$   c                B    \        V P                  \        ,          4      # )zKReturn *True* if the symbol is a cell in an inlined comprehension.
        )rv   r   r   r,   s   &r#   is_comp_cellSymbol.is_comp_celly  r-  r$   c                ,    \        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.
)rv   r   r,   s   &r#   is_namespaceSymbol.is_namespace~  s     D%%&&r$   c                    V P                   # )z.Return a list of namespaces bound to this name)r   r,   s   &r#   get_namespacesSymbol.get_namespaces  s       r$   c                    \        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)lenr   
ValueErrorr,   s   &r#   get_namespaceSymbol.get_namespace  sS     t  !Q&BCC""#a'CDD$$Q''r$   )__flags__module_scope__name__namespaces__scoper(   )r>   r?   r@   rA   r.   r`   r   r   ro   r  r	  r  r  r  r  r  r  r   r"  r%  r(  r+  r/  r2  r5  r:  rB   rC   rD   s   @r#   r   r     s     +U +ML

(.
3
K15
K.
*3
/.2
2
'!( (r$   r   c              #   d   "   T F&  q^ ,          P                  R4      '       g   K"  Vx  K(  	  R# 5i)r   DEF_N)
startswith)r   kvs   & r#   r   r     s#     I,R10@0@0Hbb,s   0
0c                 :  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           
        < 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 r[   rG   z
from file zsymbol table for  :r   z symbol r   N)r{   rh   rV   ro   printr   r   r   r   lowerr   r   )
r4   levelindentrz   whatr   symbolr   table2print_symbolss
   &&       r#   rP  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<stdin>rbexecr   )sysstdinreadopenr   )argsrU  r    srcfmodrP  s   &     @r#   mainr]    s{    -" MMSEMs?)).."C Hh%%ffh &sHf-c "
 &%s   B

B__main__:   NN)r   r   r   r   r   r   )r   r   r   r   r   ),__doc__r   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r)   enumr   __all__r   r&   r   r   r   r   r   r   r   r   extendglobalsitems_scopes_namesr   r]  r>   rU  argv)ns   0r#   <module>ri     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