Your IP : 18.225.72.181


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

�

�Q�f�0��l�	ddlZddlmZmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZgd�Zd�ZGd�d�Ze�ZGd�d�ZGd	�d
e�ZGd�de�ZGd
�d�Zedk(r�ddlZddlZeej:d�5Zej?�Z ddd�ee ejBjEej:d�dd�Z#e#jI�D]9Z%e#jMe%�Z'e(e'e'jS�e'jU���;yy#1swY��xYw)�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�J�	tj|||�}t||�S�N)�	_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�|_yr)�weakref�WeakValueDictionary�_SymbolTableFactory__memo��selfs r�__init__zSymbolTableFactory.__init__s���1�1�3��r c��|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�(�+�+r c��||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�"��
r N)�__name__�
__module__�__qualname__r)r/r4�r rr"r"s��4�,�r r"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�����!�����
r c�,�|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�
Lr c�6�	|jjtjk(ry|jjtjk(ry|jjtj
k(ry|jjtjk(ry|jjtjk(ry|jjtjk(ry|jjtjk(ryy)N�module�function�class�
annotationz
TypeVar boundz
type aliasztype parameter)
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�#�9r c�0�	|jjSr)r;�idr's r�get_idzSymbolTable.get_idTs��	��{�{�~�~�r c�0�	|jjSr)r;rBr's r�get_namezSymbolTable.get_nameYs��	��{�{���r c�0�	|jjSr)r;�linenor's r�
get_linenozSymbolTable.get_linenobs��	��{�{�!�!�!r c�d�	t|jjtjk(�Sr)�boolr;r+rr,r's r�is_optimizedzSymbolTable.is_optimizedhs)��	��D�K�K�$�$�	�(?�(?�?�@�@r c�B�	t|jj�Sr)rZr;�nestedr's r�	is_nestedzSymbolTable.is_nestedns��	��D�K�K�&�&�'�'r c�B�	t|jj�Sr)rZr;�childrenr's r�has_childrenzSymbolTable.has_childrenss��	��D�K�K�(�(�)�)r c�L�	|jjj�Sr)r;�symbols�keysr's r�get_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(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�$�-�-��%��
r c�h�	|j�D�cgc]}|j|���c}Scc}wr)rerm)r(�idents  r�get_symbolszSymbolTable.get_symbols�s5��	�15�0D�0D�0F�G�0F�u����E�"�0F�G�G��Gs�/c��|jjD�cgc]'}|j|k(rt||j���)c}Scc}wr)r;r`rBrr<)r(rB�sts   r�__check_childrenzSymbolTable.__check_children�sG���+�+�.�.�$�.�B��7�7�d�?� ��D�N�N�3�.�$�	$��$s�,Ac�~�	|jjD�cgc]}t||j���c}Scc}wr)r;r`rr<)r(rrs  r�get_childrenzSymbolTable.get_children�sC��	��+�+�.�.�0�.�B� ��D�N�N�3�.�0�	0��0s�:N)r5r6r7r)rErPrSrUrXr[r^rarermrprirur8r rrr*sK���
L�=�,�
 �"�A�(�
*�
*�
�H�$�
0r rc�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>�s0�����?�(>�u�!�$�+�+�"5�"5�e�"<�=��(>�s�+.)�tuplere)r(rzs``r�__idents_matchingzFunction.__idents_matching�s%����?��(<�(<�(>�?�?�	?r c�b�	|j�|jd��|_|jS)Nc��|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��}�}�r c���	|j�'ttf��fd�}|j|�|_|jS)Nc�(��|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�s<���	��=�=� ��4�=�D�D�D� �2�2�4�8�D�M��}�}�r c���	|j�'ttf��fd�}|j|�|_|jS)Nc�(��|tz	tz�vSrr�)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��~�~�r c�b�	|j�|jd��|_|jS)Nc��|tzSr)rr�s rr�z(Function.get_nonlocals.<locals>.<lambda>�s	��q�<�?Or )�_Function__nonlocalsr�r's r�
get_nonlocalszFunction.get_nonlocals�s3��	����#�#�5�5�6O�P�D�����r c�f�	|j�d�}|j|�|_|jS)Nc�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�s2��	��<�<��F�G��1�1�'�:�D�L��|�|�r )r5r6r7r�r�r�r�r�r�r�r�r�r�r�r8r rrr�s;���H��H��G��I��K�?���� �r rc��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)Nc�~���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�r8r rrr�s���I�%r rc�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���&�,�"���*��r c�8�dj|j�S)Nz<symbol {0!r}>)rCr�r's rrEzSymbol.__repr__s���&�&�t�{�{�3�3r c��	|jSr)r�r's rrUzSymbol.get_names��	��{�{�r c�P�	t|jtjz�Sr)rZr�rrr's r�
is_referencedzSymbol.is_referenceds!��	��D�L�L�9�=�=�0�1�1r c�<�	t|jtz�Sr)rZr�rr's r�is_parameterzSymbol.is_parameter���	��D�L�L�9�,�-�-r c��	t|jttfvxs!|jxr|j
tz�Sr)rZr�rrr�r�r	r's r�	is_globalzSymbol.is_globalsC��	��D�L�L�_�o�$F�F�J��+�+�H����y�0H�K�	Kr c�<�	t|jtz�Sr)rZr�rr's r�is_nonlocalzSymbol.is_nonlocal!s��6��D�L�L�<�/�0�0r c�<�	t|jtk(�Sr)rZr�rr's r�is_declared_globalzSymbol.is_declared_global%s��	$��D�L�L�O�3�4�4r c��	t|jttfvxs!|jxr|j
tz�Sr)rZr�rrr�r�r	r's r�is_localzSymbol.is_local*sB��	��D�L�L�U�D�M�1�J��+�+�H����y�0H�K�	Kr c�<�	t|jtz�Sr)rZr�r
r's r�is_annotatedzSymbol.is_annotated0r�r c�<�	t|jtk(�Sr)rZr�r
r's rr�zSymbol.is_free5s��	��D�L�L�D�(�)�)r c�<�	t|jtz�Sr)rZr�rr's r�is_importedzSymbol.is_imported;s��	��D�L�L�:�-�.�.r c�<�	t|jtz�Sr)rZr�rr's r�is_assignedzSymbol.is_assignedAs��7��D�L�L�9�,�-�-r c�.�	t|j�Sr)rZr�r's r�is_namespacezSymbol.is_namespaceEs��		��D�%�%�&�&r c��	|jSr)r�r's r�get_namespaceszSymbol.get_namespacesRs��<�� � � r c��	t|j�dk(rtd��t|j�dkDrtd��|jdS)Nrz#name is not bound to any namespacesr�z$name is bound to multiple namespaces)�lenr��
ValueErrorr's r�
get_namespacezSymbol.get_namespaceVsX��	�
�t� � �!�Q�&��B�C�C�
��"�"�
#�a�
'��C�D�D��$�$�Q�'�'r r)r5r6r7r)rErUr�r�r�r�r�r�r�r�r�r�r�r�r�r8r rrr�s[��+�U�+�4��
2�.�
K�1�5�
K�.�
*�/�.�'�!�(r r�__main__r��exec)+rrrrrrrr	r
rrr
rrrrr$�__all__rr"rrrrrr5�os�sys�open�argv�f�read�src�path�split�modrerorm�info�printr�r�r8r r�<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*�*D3

?>