Qf0l ddlZddlmZmZmZmZmZmZmZmZm Z m Z m Z m Z m Z mZmZddlZgdZdZGddZeZGddZGd d eZGd d eZGd dZedk(rddlZddlZeej:d5Zej?Z dddee ejBjEej:dddZ#e#jID]9Z%e#jMe%Z'e(e'e'jSe'jU;yy#1swYxYw)N)USE DEF_GLOBAL DEF_NONLOCAL DEF_LOCAL DEF_PARAM DEF_IMPORT DEF_BOUND DEF_ANNOT SCOPE_OFF SCOPE_MASKFREELOCALGLOBAL_IMPLICITGLOBAL_EXPLICITCELL)symtable SymbolTableClassFunctionSymbolcJ tj|||}t||SN) _symtabler_newSymbolTable)codefilename compile_typetops //opt/alt/python312/lib64/python3.12/symtable.pyrr s*   T8\ :C 3 ))ceZdZdZdZdZy)SymbolTableFactoryc6tj|_yr)weakrefWeakValueDictionary_SymbolTableFactory__memoselfs r__init__zSymbolTableFactory.__init__s113 r c|jtjk(r t||S|jtjk(r t ||St ||Sr)typer TYPE_FUNCTIONr TYPE_CLASSrr)r(tablers rnewzSymbolTableFactory.newsM ::00 0E8, , ::-- -) )5(++r c||f}|jj|d}|!|j||x}|j|<|Sr)r&getr/)r(r.rkeyobjs r__call__zSymbolTableFactory.__call__ sGXokkooc4( ;%)XXeX%> >C$++c" r N)__name__ __module__ __qualname__r)r/r4r rr"r"s4,r r"c`eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)rc.||_||_i|_yr)_table _filename_symbols)r( raw_tablers rr)zSymbolTable.__init__,s ! r c,|jtk(rd}nd|jjz}|jjdk(rdj ||j Sdj ||jj|j S)Nz%s rz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>) __class__rr5r;nameformatr<)r(kinds r__repr__zSymbolTable.__repr__1s{ >>[ (D4>>222D ;;  u $4;;D$..Q Q4;;D<@KKs ;;  y44 4 ;;  y66 6 ;;  y33 3 ;;  y88 8 ;;  y<< <" ;;  y88 8 ;;  y88 8# 9r c0 |jjSr)r;idr's rget_idzSymbolTable.get_idTs {{~~r c0 |jjSr)r;rBr's rget_namezSymbolTable.get_nameYs {{r c0 |jjSr)r;linenor's r get_linenozSymbolTable.get_linenobs {{!!!r cd t|jjtjk(Sr)boolr;r+rr,r's r is_optimizedzSymbolTable.is_optimizedhs) DKK$$ (?(??@@r cB t|jjSr)rZr;nestedr's r is_nestedzSymbolTable.is_nestedns DKK&&''r cB t|jjSr)rZr;childrenr's r has_childrenzSymbolTable.has_childrenss DKK(())r cL |jjjSr)r;symbolskeysr's rget_identifierszSymbolTable.get_identifiersxs  {{""''))r c |jj|}|a|jj|}|j |}|jj dk(}t ||||x}|j|<|S)Nr module_scope)r=r1r;rc_SymbolTable__check_childrenrBr)r(rBsymflags namespacesrhs rlookupzSymbolTable.lookup}s mm% ;KK''-E..t4J KK,,5L(.tUJz-Function.__idents_matching..s0?(>u!$++"5"5e"<=(>s+.)tuplere)r(rzs``r__idents_matchingzFunction.__idents_matchings%?(<(<(>?? ?r cb |j|jd|_|jS)Nc|tzSr)rxs rz)Function.get_parameters..sA Mr )_Function__params_Function__idents_matchingr's rget_parameterszFunction.get_parameterss. ==  223IJDM}}r c |j'ttffd}|j||_|jS)Nc(|tz tzvSrr r )rlocss rrz%Function.get_locals..sqI~;Dr )_Function__localsrrr)r(testrs @r get_localszFunction.get_localss< == 4=DDD 2248DM}}r c |j'ttffd}|j||_|jS)Nc(|tz tzvSrr)rglobs rrz&Function.get_globals..sa9n :tCr )_Function__globalsrrr)r(rrs @r get_globalszFunction.get_globalss= >> !#_5DCD!33D9DN~~r cb |j|jd|_|jS)Nc|tzSr)rrs rrz(Function.get_nonlocals..s q.si: =$Fr )_Function__freesr)r(is_frees r get_freeszFunction.get_freess2 << FG11':DL||r )r5r6r7rrrrrrrrrrrr8r rrrs;HHGIK? r rceZdZdZdZy)rNc" ji}fd}jjD]}||js|jxt j k(r/|jdk(rd|jvrSd||j<ct jk(sv|j}|jD]6}|j|k(s|jt j k(s1d||<t|_jS)Nc~jjj|d}|tz tzt k(S)Nr)r;rcr1r r r)rorkr(s ris_local_symbolz*Class.get_methods..is_local_symbols4 ++//q9)+z9eCCr genexprz.0) _Class__methodsr;r`rBr+rr,varnamesrOr|)r(drrr scope_namecs` r get_methodszClass.get_methodss >> !A Dkk**"277+''4Y44 "ww)3 8K ()*AbggJ&66*,J%'[[#$66Z#7AFFiF]F]<]56AjM$)&1+4#1XDN~~r )r5r6r7rrr8r rrrs I%r rcteZdZddddZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZdZy)rNFrgcn||_||_|tz tz|_|xsd|_||_y)Nr8) _Symbol__name_Symbol__flagsr r _Symbol__scope_Symbol__namespaces_Symbol__module_scope)r(rBrkrlrhs rr)zSymbol.__init__s6  *j8 &,"*r c8dj|jS)Nz)rCrr's rrEzSymbol.__repr__s&&t{{33r c |jSr)rr's rrUzSymbol.get_name s {{r cP t|jtjzSr)rZrrrr's r is_referencedzSymbol.is_referenceds! DLL9==011r c< t|jtzSr)rZrrr's r is_parameterzSymbol.is_parameter DLL9,--r c t|jttfvxs!|jxr|j t zSr)rZrrrrrr r's r is_globalzSymbol.is_globalsC DLL_o$FFJ++H y0HK Kr c< t|jtzSr)rZrrr's r is_nonlocalzSymbol.is_nonlocal!s6DLL</00r c< t|jtk(Sr)rZrrr's ris_declared_globalzSymbol.is_declared_global%s $DLLO344r c t|jttfvxs!|jxr|j t zSr)rZrrrrrr r's ris_localzSymbol.is_local*sB DLLUDM1J++H y0HK Kr c< t|jtzSr)rZrr r's r is_annotatedzSymbol.is_annotated0rr c< t|jtk(Sr)rZrr r's rrzSymbol.is_free5s DLLD())r c< t|jtzSr)rZrrr's r is_importedzSymbol.is_imported;s DLL:-..r c< t|jtzSr)rZrrr's r is_assignedzSymbol.is_assignedAs7DLL9,--r c. t|jSr)rZrr's r is_namespacezSymbol.is_namespaceEs D%%&&r c |jSr)rr's rget_namespaceszSymbol.get_namespacesRs<   r c t|jdk(r tdt|jdkDr td|jdS)Nrz#name is not bound to any namespacesrz$name is bound to multiple namespaces)lenr ValueErrorr's r get_namespacezSymbol.get_namespaceVsX t  !Q &BC C "" #a 'CD D$$Q' 'r r)r5r6r7r)rErUrrrrrrrrrrrrrr8r rrrs[+U+4 2 . K 15 K . * / . '! (r r__main__rexec)+rrrrrrrr r r r r rrrrr$__all__rr"rrrrrr5ossysopenargvfreadsrcpathsplitmodrerorminfoprintrrr8r rrs844444 D*$%&p0p0f3{3l)K)Xb(b(H z chhqk affh  3 chhqk215v >C$$&zz%  dDMMOT%6%6%89'   s D**D3