Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/symtable.cpython-312.opt-1.pyc

�

6�f�0��n�dZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlZgd�Zd�ZGd�d�Ze�ZGd�d	�ZGd
�de�ZGd�d
e�ZGd�d�Zedk(r�ddlZddlZeej<d�5ZejA�Z!ddd�ee!ejDjGej<d�dd�Z$e$jK�D]9Z&e$jOe&�Z(e)e(e(jU�e(jW���;yy#1swY��xYw)z2Interface to the compiler's internal symbol tables�N)�USE�
DEF_GLOBAL�DEF_NONLOCAL�	DEF_LOCAL�	DEF_PARAM�
DEF_IMPORT�	DEF_BOUND�	DEF_ANNOT�	SCOPE_OFF�
SCOPE_MASK�FREE�LOCAL�GLOBAL_IMPLICIT�GLOBAL_EXPLICIT�CELL)�symtable�SymbolTable�Class�Function�Symbolc�H�tj|||�}t||�S)z� Return 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.
    )�	_symtabler�_newSymbolTable)�code�filename�compile_type�tops    �//opt/alt/python312/lib64/python3.12/symtable.pyrrs%���
�
�T�8�\�
:�C��3��)�)�c��eZdZd�Zd�Zd�Zy)�SymbolTableFactoryc�6�tj�|_y�N)�weakref�WeakValueDictionary�_SymbolTableFactory__memo��selfs r�__init__zSymbolTableFactory.__init__s���1�1�3��rc��|jtjk(rt||�S|jtjk(rt||�St
||�Sr#)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r(�tablers   r�newzSymbolTableFactory.newsM���:�:��0�0�0��E�8�,�,��:�:��-�-�-����)�)��5�(�+�+rc��||f}|jj|d�}|�!|j||�x}|j|<|Sr#)r&�getr/)r(r.r�key�objs     r�__call__zSymbolTableFactory.__call__ sG���X�o���k�k�o�o�c�4�(���;�%)�X�X�e�X�%>�>�C�$�+�+�c�"��
rN)�__name__�
__module__�__qualname__r)r/r4�rrr!r!s��4�,�rr!c�`�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)rc�.�||_||_i|_yr#)�_table�	_filename�_symbols)r(�	raw_tablers   rr)zSymbolTable.__init__,s�����!�����
rc�,�|jtk(rd}nd|jjz}|jjdk(rdj||j�Sdj||jj|j�S)N�z%s rz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr5r;�name�formatr<)r(�kinds  r�__repr__zSymbolTable.__repr__1s{���>�>�[�(��D��4�>�>�2�2�2�D��;�;���u�$�4�;�;�D�$�.�.�Q�Q�4�;�;�D�<@�K�K�<L�<L�<@�N�N�L�
Lrc�4�|jjtjk(ry|jjtjk(ry|jjtj
k(ry|jjtjk(ry|jjtjk(ry|jjtjk(ry|jjtjk(ryy)	z�Return the type of the symbol table.

        The values returned are 'class', 'module', 'function',
        'annotation', 'TypeVar bound', 'type alias', and 'type parameter'.
        �module�function�class�
annotationz
TypeVar boundz
type aliasztype parameterN)
r;r+r�TYPE_MODULEr,r-�TYPE_ANNOTATION�TYPE_TYPE_VAR_BOUND�TYPE_TYPE_ALIAS�TYPE_TYPE_PARAMr's r�get_typezSymbolTable.get_type>s����;�;���y�4�4�4���;�;���y�6�6�6���;�;���y�3�3�3���;�;���y�8�8�8���;�;���y�<�<�<�"��;�;���y�8�8�8���;�;���y�8�8�8�#�9rc�.�|jjS)z,Return an identifier for the table.
        )r;�idr's r�get_idzSymbolTable.get_idTs���{�{�~�~�rc�.�|jjS)z�Return 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.
        )r;rBr's r�get_namezSymbolTable.get_nameYs���{�{���rc�.�|jjS)zPReturn the number of the first line in the
        block for the table.
        )r;�linenor's r�
get_linenozSymbolTable.get_linenobs���{�{�!�!�!rc�b�t|jjtjk(�S)zJReturn *True* if the locals in the table
        are optimizable.
        )�boolr;r+rr,r's r�is_optimizedzSymbolTable.is_optimizedhs$���D�K�K�$�$�	�(?�(?�?�@�@rc�@�t|jj�S)zAReturn *True* if the block is a nested class
        or function.)rZr;�nestedr's r�	is_nestedzSymbolTable.is_nestedns���D�K�K�&�&�'�'rc�@�t|jj�S)z:Return *True* if the block has nested namespaces.
        )rZr;�childrenr's r�has_childrenzSymbolTable.has_childrenss���D�K�K�(�(�)�)rc�J�|jjj�S)zKReturn a view object containing the names of symbols in the table.
        )r;�symbols�keysr's r�get_identifierszSymbolTable.get_identifiersxs���{�{�"�"�'�'�)�)rc��|jj|�}|�a|jj|}|j	|�}|jj
dk(}t
||||��x}|j|<|S)zLLookup a *name* in the table.

        Returns a *Symbol* instance.
        r��module_scope)r=r1r;rc�_SymbolTable__check_childrenrBr)r(rB�sym�flags�
namespacesrhs      r�lookupzSymbolTable.lookup}s��
�m�m����%���;��K�K�'�'��-�E��.�.�t�4�J� �K�K�,�,��5�L�(.�t�U�J�<H�)J�
J�C�$�-�-��%��
rc�f�|j�D�cgc]}|j|���c}Scc}w)zLReturn a list of *Symbol* instances for
        names in the table.
        )rerm)r(�idents  r�get_symbolszSymbolTable.get_symbols�s*��15�0D�0D�0F�G�u����E�"�G�G��Gs�.c��|jjD�cgc]'}|j|k(rt||j���)c}Scc}wr#)r;r`rBrr<)r(rB�sts   r�__check_childrenzSymbolTable.__check_children�sB���+�+�.�.�$���7�7�d�?� ��D�N�N�3�$�	$��$s�,Ac�|�|jjD�cgc]}t||j���c}Scc}w)z3Return a list of the nested symbol tables.
        )r;r`rr<)r(rrs  r�get_childrenzSymbolTable.get_children�s9���+�+�.�.�0�� ��D�N�N�3�0�	0��0s�9N)r5r6r7r)rErPrSrUrXr[r^rarermrprirur8rrrr*sK���
L�=�,�
 �"�A�(�
*�
*�
�H�$�
0rrc�D�eZdZdZdZdZdZdZd�Zd�Z	d�Z
d�Zd�Zd�Z
y)rNc�L���t��fd��j�D��S)Nc3�`�K�|]%}��jj|�r|���'y�wr#)r;rc)�.0ror(�	test_funcs  ��r�	<genexpr>z-Function.__idents_matching.<locals>.<genexpr>�s/�����?�u�!�$�+�+�"5�"5�e�"<�=��?�s�+.)�tuplere)r(rzs``r�__idents_matchingzFunction.__idents_matching�s%����?��(<�(<�(>�?�?�	?rc�`�|j�|jd��|_|jS)z6Return a tuple of parameters to the function.
        c��|tzSr#)r��xs r�<lambda>z)Function.get_parameters.<locals>.<lambda>�s��A�	�Mr)�_Function__params�_Function__idents_matchingr's r�get_parameterszFunction.get_parameters�s+���=�=� � �2�2�3I�J�D�M��}�}�rc���|j�'ttf��fd�}|j|�|_|jS)z2Return a tuple of locals in the function.
        c�(��|tz	tz�vSr#�rr)r��locss �rr�z%Function.get_locals.<locals>.<lambda>�s���q�I�~��;��Dr)�_Function__localsrrr�)r(�testr�s  @r�
get_localszFunction.get_locals�s9����=�=� ��4�=�D�D�D� �2�2�4�8�D�M��}�}�rc���|j�'ttf��fd�}|j|�|_|jS)z3Return a tuple of globals in the function.
        c�(��|tz	tz�vSr#r�)r��globs �rr�z&Function.get_globals.<locals>.<lambda>�s���a�9�n�
�:�t�Cr)�_Function__globalsrrr�)r(r�r�s  @r�get_globalszFunction.get_globals�s:����>�>�!�#�_�5�D�C�D�!�3�3�D�9�D�N��~�~�rc�`�|j�|jd��|_|jS)z5Return a tuple of nonlocals in the function.
        c��|tzSr#)rr�s rr�z(Function.get_nonlocals.<locals>.<lambda>�s	��q�<�?Or)�_Function__nonlocalsr�r's r�
get_nonlocalszFunction.get_nonlocals�s0�����#�#�5�5�6O�P�D�����rc�d�|j�d�}|j|�|_|jS)z:Return a tuple of free variables in the function.
        c�0�|tz	tztk(Sr#)rrr
r�s rr�z$Function.get_frees.<locals>.<lambda>�s���i��:� =�$�Fr)�_Function__freesr�)r(�is_frees  r�	get_freeszFunction.get_frees�s/���<�<��F�G��1�1�'�:�D�L��|�|�r)r5r6r7r�r�r�r�r�r�r�r�r�r�r�r8rrrr�s;���H��H��G��I��K�?���� �rrc��eZdZdZd�Zy)rNc� ���j��i}�fd�}�jjD]�}||j�s�|jxt
jk(r/|jdk(rd|jvr�Sd||j<�ct
jk(s�v|j}|jD]6}|j|k(s�|jt
jk(s�1d||<����t|��_�jS)z9Return a tuple of methods declared in the class.
        c�~���jjj|d�}|tz	tzt
k(S)Nr)r;rcr1rrr)rorkr(s  �r�is_local_symbolz*Class.get_methods.<locals>.is_local_symbol�s4������+�+�/�/��q�9���)�+�z�9�e�C�Cr�genexprz.0�)
�_Class__methodsr;r`rBr+rr,�varnamesrOr|)r(�dr�rr�
scope_name�cs`     r�get_methodszClass.get_methods�s�����>�>�!��A�
D��k�k�*�*��"�2�7�7�+��'�'�4�Y�4�4� "�w�w�)�3�����8K� (�)*�A�b�g�g�J�&�6�6�*,���J�%'�[�[��#$�6�6�Z�#7�A�F�F�i�F]�F]�<]�56�A�j�M�$)�&1�+�4#�1�X�D�N��~�~�r)r5r6r7r�r�r8rrrr�s���I�%rrc�t�eZdZddd�d�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�Zy)rNFrgc�n�||_||_|tz	tz|_|xsd|_||_y)Nr8)�
_Symbol__name�_Symbol__flagsrr�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r(rBrkrlrhs     rr)zSymbol.__init__s6����������*�j�8���&�,�"���*��rc�8�dj|j�S)Nz<symbol {0!r}>)rCr�r's rrEzSymbol.__repr__s���&�&�t�{�{�3�3rc��|jS)z#Return a name of a symbol.
        )r�r's rrUzSymbol.get_names���{�{�rc�N�t|jtjz�S)zBReturn *True* if the symbol is used in
        its block.
        )rZr�rrr's r�
is_referencedzSymbol.is_referenceds���D�L�L�9�=�=�0�1�1rc�:�t|jtz�S)z4Return *True* if the symbol is a parameter.
        )rZr�rr's r�is_parameterzSymbol.is_parameter����D�L�L�9�,�-�-rc��t|jttfvxs!|jxr|j
tz�S)z/Return *True* if the symbol is global.
        )rZr�rrr�r�r	r's r�	is_globalzSymbol.is_globals@���D�L�L�_�o�$F�F�J��+�+�H����y�0H�K�	Krc�:�t|jtz�S)z(Return *True* if the symbol is nonlocal.)rZr�rr's r�is_nonlocalzSymbol.is_nonlocal!s���D�L�L�<�/�0�0rc�:�t|jtk(�S)zOReturn *True* if the symbol is declared global
        with a global statement.)rZr�rr's r�is_declared_globalzSymbol.is_declared_global%s���D�L�L�O�3�4�4rc��t|jttfvxs!|jxr|j
tz�S)z.Return *True* if the symbol is local.
        )rZr�rrr�r�r	r's r�is_localzSymbol.is_local*s?���D�L�L�U�D�M�1�J��+�+�H����y�0H�K�	Krc�:�t|jtz�S)z2Return *True* if the symbol is annotated.
        )rZr�r
r's r�is_annotatedzSymbol.is_annotated0r�rc�:�t|jtk(�S)zIReturn *True* if a referenced symbol is
        not assigned to.
        )rZr�r
r's rr�zSymbol.is_free5s���D�L�L�D�(�)�)rc�:�t|jtz�S)zQReturn *True* if the symbol is created from
        an import statement.
        )rZr�rr's r�is_importedzSymbol.is_imported;s���D�L�L�:�-�.�.rc�:�t|jtz�S)z)Return *True* if a symbol is assigned to.)rZr�rr's r�is_assignedzSymbol.is_assignedAs���D�L�L�9�,�-�-rc�,�t|j�S)a�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.
        )rZr�r's r�is_namespacezSymbol.is_namespaceEs���D�%�%�&�&rc��|jS)z.Return a list of namespaces bound to this name)r�r's r�get_namespaceszSymbol.get_namespacesRs��� � � rc��t|j�dk(rtd��t|j�dkDrtd��|jdS)z�Return the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces
        or no namespace.
        rz#name is not bound to any namespacesr�z$name is bound to multiple namespaces)�lenr��
ValueErrorr's r�
get_namespacezSymbol.get_namespaceVsS���t� � �!�Q�&��B�C�C�
��"�"�
#�a�
'��C�D�D��$�$�Q�'�'rr#)r5r6r7r)rErUr�r�r�r�r�r�r�r�r�r�r�r�r�r8rrrr�s[��+�U�+�4��
2�.�
K�1�5�
K�.�
*�/�.�'�!�(rr�__main__r��exec),�__doc__rrrrrrrr	r
rrr
rrrrr$�__all__rr!rrrrrr5�os�sys�open�argv�f�read�src�path�split�modrerorm�info�printr�r�r8rr�<module>r�s#��8��4�4�4�4�4��
D��*���$%�&��p0�p0�f3�{�3�l)�K�)�Xb(�b(�H�z���	
�c�h�h�q�k�	��a��f�f�h���
�3����
�
�c�h�h�q�k�2�1�5�v�
>�C��$�$�&���z�z�%� ��
�d�D�M�M�O�T�%6�%6�%8�9�'����s�D+�+D4

Hacked By AnonymousFox1.0, Coded By AnonymousFox