AlkantarClanX12

Your IP : 3.135.193.193


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/symtable.cpython-311.pyc

�

c��f�(����dZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlZgd�Zd�ZGd�d��Ze��ZGd�d	��ZGd
�de��ZGd�d
e��ZGd�d��Zedkr�ddlZddlZeejd��5Ze� ��Z!ddd��n#1swxYwYee!ej"�#ejd��dd��Z$e$�%��D]JZ&e$�'e&��Z(e)e(e(�*��e(�+�����IdSdS)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�N�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/python311/lib64/python3.11/symtable.pyrrs(���
�T�8�\�
:�
:�C��3��)�)�)�c� �eZdZd�Zd�Zd�ZdS)�SymbolTableFactoryc�6�tj��|_dS�N)�weakref�WeakValueDictionary�_SymbolTableFactory__memo��selfs r�__init__zSymbolTableFactory.__init__s���1�3�3����rc��|jtjkrt||��S|jtjkrt||��St
||��Sr#)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r(�tablers   r�newzSymbolTableFactory.newsR���:��0�0�0��E�8�,�,�,��:��-�-�-����)�)�)��5�(�+�+�+rc��||f}|j�|d��}|� |�||��x}|j|<|Sr#)r&�getr/)r(r.r�key�objs     r�__call__zSymbolTableFactory.__call__ sI���X�o���k�o�o�c�4�(�(���;�%)�X�X�e�X�%>�%>�>�C�$�+�c�"��
rN)�__name__�
__module__�__qualname__r)r/r4�rrr!r!sA������4�4�4�,�,�,�����rr!c�b�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZdS)rc�0�||_||_i|_dSr#)�_table�	_filename�_symbols)r(�	raw_tablers   rr)zSymbolTable.__init__,s�����!�����
�
�
rc���|jtkrd}nd|jjz}|jjdkrd�||j��Sd�||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__1sw���>�[�(�(��D�D��4�>�2�2�D��;��u�$�$�4�;�;�D�$�.�Q�Q�Q�4�;�;�D�<@�K�<L�<@�N�L�L�
Lrc��|jjtjkrdS|jjtjkrdS|jjtjkrdS|jjdvs'Jd�|jj�����dS)zxReturn the type of the symbol table.

        The values returned are 'class', 'module' and
        'function'.
        �module�function�class)���zunexpected type: {0}N)r;r+r�TYPE_MODULEr,r-rCr's r�get_typezSymbolTable.get_type>s����;��y�4�4�4��8��;��y�6�6�6��:��;��y�3�3�3��7��{��9�,�,�,�%�,�,�T�[�-=�>�>�-�,�,�,�,rc��|jjS)z,Return an identifier for the table.
        )r;�idr's r�get_idzSymbolTable.get_idMs���{�~�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_nameRs���{��rc��|jjS)zPReturn the number of the first line in the
        block for the table.
        )r;�linenor's r�
get_linenozSymbolTable.get_lineno[s���{�!�!rc�P�t|jjtjk��S)zJReturn *True* if the locals in the table
        are optimizable.
        )�boolr;r+rr,r's r�is_optimizedzSymbolTable.is_optimizedas���D�K�$�	�(?�?�@�@�@rc�4�t|jj��S)zAReturn *True* if the block is a nested class
        or function.)rXr;�nestedr's r�	is_nestedzSymbolTable.is_nestedgs���D�K�&�'�'�'rc�4�t|jj��S)z:Return *True* if the block has nested namespaces.
        )rXr;�childrenr's r�has_childrenzSymbolTable.has_childrenls���D�K�(�)�)�)rc�>�|jj���S)zKReturn a view object containing the names of symbols in the table.
        )r;�symbols�keysr's r�get_identifierszSymbolTable.get_identifiersqs���{�"�'�'�)�)�)rc���|j�|��}|�T|jj|}|�|��}|jjdk}t
||||���x}|j|<|S)zLLookup a *name* in the table.

        Returns a *Symbol* instance.
        Nr��module_scope)r=r1r;ra�_SymbolTable__check_childrenrBr)r(rB�sym�flags�
namespacesrfs      r�lookupzSymbolTable.lookupvs���
�m����%�%���;��K�'��-�E��.�.�t�4�4�J� �K�,��5�L�(.�t�U�J�<H�)J�)J�)J�
J�C�$�-��%��
rc�D���fd�����D��S)zLReturn a list of *Symbol* instances for
        names in the table.
        c�:��g|]}��|����Sr8)rk)�.0�identr(s  �r�
<listcomp>z+SymbolTable.get_symbols.<locals>.<listcomp>�s%���G�G�G�u����E�"�"�G�G�Gr)rcr's`r�get_symbolszSymbolTable.get_symbols�s,���H�G�G�G��0D�0D�0F�0F�G�G�G�Grc�8�����fd��jjD��S)Nc�P��g|]"}|j�k�
t|�j����#Sr8)rBrr<)rn�strBr(s  ��rrpz0SymbolTable.__check_children.<locals>.<listcomp>�s8���$�$�$���7�d�?�?� ��D�N�3�3�"�?�?r�r;r^)r(rBs``r�__check_childrenzSymbolTable.__check_children�s9����$�$�$�$�$��+�.�$�$�$�	$rc�4���fd��jjD��S)z3Return a list of the nested symbol tables.
        c�:��g|]}t|�j����Sr8)rr<)rnrtr(s  �rrpz,SymbolTable.get_children.<locals>.<listcomp>�s5���0�0�0�� ��D�N�3�3�0�0�0rrur's`r�get_childrenzSymbolTable.get_children�s3���0�0�0�0��+�.�0�0�0�	0rN)r5r6r7r)rErNrQrSrVrYr\r_rcrkrqrgryr8rrrr*s����������
L�L�L�
?�
?�
?����
 � � �"�"�"�A�A�A�(�(�(�
*�*�*�
*�*�*�
���H�H�H�$�$�$�
0�0�0�0�0rrc�F�eZdZdZdZdZdZdZd�Zd�Z	d�Z
d�Zd�Zd�Z
dS)rNc�b���t��fd�����D����S)Nc3�R�K�|]!}��jj|���|V��"dSr#)r;ra)rnror(�	test_funcs  ��r�	<genexpr>z-Function.__idents_matching.<locals>.<genexpr>�sO�����?�?�u�!�	�$�+�"5�e�"<�=�=�?�U�?�?�?�?�?�?r)�tuplerc)r(r}s``r�__idents_matchingzFunction.__idents_matching�sL�����?�?�?�?�?��(<�(<�(>�(>�?�?�?�?�?�	?rc�T�|j�|�d���|_|jS)z6Return a tuple of parameters to the function.
        Nc��|tzSr#)r��xs r�<lambda>z)Function.get_parameters.<locals>.<lambda>�s
��A�	�M�r)�_Function__params�_Function__idents_matchingr's r�get_parameterszFunction.get_parameters�s-���=� � �2�2�3I�3I�J�J�D�M��}�rc�z��|j�-ttf��fd�}|�|��|_|jS)z2Return a tuple of locals in the function.
        Nc�,��|tz	tz�vSr#�rr)r��locss �rr�z%Function.get_locals.<locals>.<lambda>�s���q�I�~��;��D�r)�_Function__localsrrr�)r(�testr�s  @r�
get_localszFunction.get_locals�sA����=� ��4�=�D�D�D�D�D�D� �2�2�4�8�8�D�M��}�rc�z��|j�-ttf��fd�}|�|��|_|jS)z3Return a tuple of globals in the function.
        Nc�,��|tz	tz�vSr#r�)r��globs �rr�z&Function.get_globals.<locals>.<lambda>�s���a�9�n�
�:�t�C�r)�_Function__globalsrrr�)r(r�r�s  @r�get_globalszFunction.get_globals�sB����>�!�#�_�5�D�C�C�C�C�D�!�3�3�D�9�9�D�N��~�rc�T�|j�|�d���|_|jS)z5Return a tuple of nonlocals in the function.
        Nc��|tzSr#)rr�s rr�z(Function.get_nonlocals.<locals>.<lambda>�s��q�<�?O�r)�_Function__nonlocalsr�r's r�
get_nonlocalszFunction.get_nonlocals�s0����#�#�5�5�6O�6O�P�P�D����rc�X�|j�d�}|�|��|_|jS)z:Return a tuple of free variables in the function.
        Nc�8�|tz	tztkSr#)rrr
r�s rr�z$Function.get_frees.<locals>.<lambda>�s���i��:� =�$�F�r)�_Function__freesr�)r(�is_frees  r�	get_freeszFunction.get_frees�s1���<��F�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�ZdS)rNc�|�|j�/i}|jjD]}d||j<�
t	|��|_|jS)z9Return a tuple of methods declared in the class.
        NrJ)�_Class__methodsr;r^rBr)r(�drts   r�get_methodszClass.get_methods�sG���>�!��A��k�*�
�
����"�'�
�
�"�1�X�X�D�N��~�r)r5r6r7r�r�r8rrrr�s(�������I�����rrc�v�eZdZddd�d�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�ZdS)rNFrec�p�||_||_|tz	tz|_|pd|_||_dS)Nr8)�
_Symbol__name�_Symbol__flagsrr�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r(rBrirjrfs     rr)zSymbol.__init__�s<����������*�j�8���&�,�"���*����rc�6�d�|j��S)Nz<symbol {0!r}>)rCr�r's rrEzSymbol.__repr__�s���&�&�t�{�3�3�3rc��|jS)z#Return a name of a symbol.
        )r�r's rrSzSymbol.get_name�s���{�rc�D�t|jtjz��S)zBReturn *True* if the symbol is used in
        its block.
        )rXr�rrr's r�
is_referencedzSymbol.is_referenced�s���D�L�9�=�0�1�1�1rc�:�t|jtz��S)z4Return *True* if the symbol is a parameter.
        )rXr�rr's r�is_parameterzSymbol.is_parameter�����D�L�9�,�-�-�-rc�r�t|jttfvp|jo|jtz��S)z/Return *True* if the symbol is global.
        )rXr�rrr�r�r	r's r�	is_globalzSymbol.is_global�s?���D�L�_�o�$F�F�J��+�H���y�0H�K�K�	Krc�:�t|jtz��S)z(Return *True* if the symbol is nonlocal.)rXr�rr's r�is_nonlocalzSymbol.is_nonlocal�s���D�L�<�/�0�0�0rc�<�t|jtk��S)zOReturn *True* if the symbol is declared global
        with a global statement.)rXr�rr's r�is_declared_globalzSymbol.is_declared_globals���D�L�O�3�4�4�4rc�r�t|jttfvp|jo|jtz��S)z.Return *True* if the symbol is local.
        )rXr�rrr�r�r	r's r�is_localzSymbol.is_locals>���D�L�U�D�M�1�J��+�H���y�0H�K�K�	Krc�:�t|jtz��S)z2Return *True* if the symbol is annotated.
        )rXr�r
r's r�is_annotatedzSymbol.is_annotatedr�rc�<�t|jtk��S)zIReturn *True* if a referenced symbol is
        not assigned to.
        )rXr�r
r's rr�zSymbol.is_frees���D�L�D�(�)�)�)rc�:�t|jtz��S)zQReturn *True* if the symbol is created from
        an import statement.
        )rXr�rr's r�is_importedzSymbol.is_importeds���D�L�:�-�.�.�.rc�:�t|jtz��S)z)Return *True* if a symbol is assigned to.)rXr�rr's r�is_assignedzSymbol.is_assigneds���D�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.
        )rXr�r's r�is_namespacezSymbol.is_namespace!s���D�%�&�&�&rc��|jS)z.Return a list of namespaces bound to this name)r�r's r�get_namespaceszSymbol.get_namespaces.s��� � rc��t|j��dkrtd���t|j��dkrtd���|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 namespacesrJz$name is bound to multiple namespaces)�lenr��
ValueErrorr's r�
get_namespacezSymbol.get_namespace2s\���t� �!�!�Q�&�&��B�C�C�C�
��"�
#�
#�a�
'�
'��C�D�D�D��$�Q�'�'rr#)r5r6r7r)rErSr�r�r�r�r�r�r�r�r�r�r�r�r�r8rrrr�s������+�U�+�+�+�+�+�4�4�4����
2�2�2�.�.�.�
K�K�K�1�1�1�5�5�5�
K�K�K�.�.�.�
*�*�*�/�/�/�.�.�.�'�'�'�!�!�!�(�(�(�(�(rr�__main__rJ�exec),�__doc__rrrrrrrr	r
rrr
rrrrr$�__all__rr!rrrrrr5�os�sys�open�argv�f�read�src�path�split�modrcrork�info�printr�r�r8rr�<module>r�s���8�8�����4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�����
D�
D�
D��*�*�*���������$%�$�&�&��i0�i0�i0�i0�i0�i0�i0�i0�X3�3�3�3�3�{�3�3�3�l�����K����b(�b(�b(�b(�b(�b(�b(�b(�H�z����N�N�N�N�N�N�N�	
��c�h�q�k�	�	��a��f�f�h�h��������������������
�(�3���
�
�c�h�q�k�2�2�1�5�v�
>�
>�C��$�$�&�&�:�:���z�z�%� � ��
��d�D�M�M�O�O�T�%6�%6�%8�%8�9�9�9�9���
:�:s�%C�C
�
C