ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/symtable.cpython-311.opt-2.pyc

�

�f�(����	ddlZddlmZmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZgd�Zd�ZGd�d��Ze��ZGd�d��ZGd	�d
e��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)�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�P�	tj|||��}t||��S�N)�	_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��|_dSr)�weakref�WeakValueDictionary�_SymbolTableFactory__memo��selfs r�__init__zSymbolTableFactory.__init__s���1�3�3����r c��|jtjkrt||��S|jtjkrt||��St
||��Sr)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r(�tablers   r�newzSymbolTableFactory.newsR���:��0�0�0��E�8�,�,�,��:��-�-�-����)�)�)��5�(�+�+�+r c��||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�"��
r N)�__name__�
__module__�__qualname__r)r/r4�r rr"r"sA������4�4�4�,�,�,�����r r"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�����!�����
�
�
r c���|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�
Lr c��	|jjtjkrdS|jjtjkrdS|jjtjkrdSdS)N�module�function�class)r;r+r�TYPE_MODULEr,r-r's r�get_typezSymbolTable.get_type>sY��	�
�;��y�4�4�4��8��;��y�6�6�6��:��;��y�3�3�3��7�4�3r c��	|jjSr)r;�idr's r�get_idzSymbolTable.get_idMs��	��{�~�r c��	|jjSr)r;rBr's r�get_namezSymbolTable.get_nameRs��	��{��r c��	|jjSr)r;�linenor's r�
get_linenozSymbolTable.get_lineno[s��	��{�!�!r c�R�	t|jjtjk��Sr)�boolr;r+rr,r's r�is_optimizedzSymbolTable.is_optimizedas$��	��D�K�$�	�(?�?�@�@�@r c�6�	t|jj��Sr)rUr;�nestedr's r�	is_nestedzSymbolTable.is_nestedgs��	��D�K�&�'�'�'r c�6�	t|jj��Sr)rUr;�childrenr's r�has_childrenzSymbolTable.has_childrenls��	��D�K�(�)�)�)r c�@�	|jj���Sr)r;�symbols�keysr's r�get_identifierszSymbolTable.get_identifiersqs��	��{�"�'�'�)�)�)r c���	|j�|��}|�T|jj|}|�|��}|jjdk}t
||||���x}|j|<|S)Nr��module_scope)r=r1r;r^�_SymbolTable__check_childrenrBr)r(rB�sym�flags�
namespacesrcs      r�lookupzSymbolTable.lookupvs���	��m����%�%���;��K�'��-�E��.�.�t�4�4�J� �K�,��5�L�(.�t�U�J�<H�)J�)J�)J�
J�C�$�-��%��
r c�F��	�fd�����D��S)Nc�:��g|]}��|����Sr8)rh)�.0�identr(s  �r�
<listcomp>z+SymbolTable.get_symbols.<locals>.<listcomp>�s%���G�G�G�u����E�"�"�G�G�Gr )r`r's`r�get_symbolszSymbolTable.get_symbols�s1���	�H�G�G�G��0D�0D�0F�0F�G�G�G�Gr c�8�����fd��jjD��S)Nc�P��g|]"}|j�k�
t|�j����#Sr8)rBrr<)rk�strBr(s  ��rrmz0SymbolTable.__check_children.<locals>.<listcomp>�s8���$�$�$���7�d�?�?� ��D�N�3�3�"�?�?r �r;r[)r(rBs``r�__check_childrenzSymbolTable.__check_children�s9����$�$�$�$�$��+�.�$�$�$�	$r c�6��	�fd��jjD��S)Nc�:��g|]}t|�j����Sr8)rr<)rkrqr(s  �rrmz,SymbolTable.get_children.<locals>.<listcomp>�s5���0�0�0�� ��D�N�3�3�0�0�0r rrr's`r�get_childrenzSymbolTable.get_children�s8���	�0�0�0�0��+�.�0�0�0�	0r N)r5r6r7r)rErKrNrPrSrVrYr\r`rhrnrdrvr8r rrr*s����������
L�L�L�
?�
?�
?����
 � � �"�"�"�A�A�A�(�(�(�
*�*�*�
*�*�*�
���H�H�H�$�$�$�
0�0�0�0�0r rc�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;r^)rkrlr(�	test_funcs  ��r�	<genexpr>z-Function.__idents_matching.<locals>.<genexpr>�sO�����?�?�u�!�	�$�+�"5�e�"<�=�=�?�U�?�?�?�?�?�?r )�tupler`)r(rzs``r�__idents_matchingzFunction.__idents_matching�sL�����?�?�?�?�?��(<�(<�(>�(>�?�?�?�?�?�	?r c�V�	|j�|�d���|_|jS)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�s0��	��=� � �2�2�3I�3I�J�J�D�M��}�r c�|��	|j�-ttf��fd�}|�|��|_|jS)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�sD���	��=� ��4�=�D�D�D�D�D�D� �2�2�4�8�8�D�M��}�r c�|��	|j�-ttf��fd�}|�|��|_|jS)Nc�,��|tz	tz�vSrr�)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�sE���	��>�!�#�_�5�D�C�C�C�C�D�!�3�3�D�9�9�D�N��~�r c�V�	|j�|�d���|_|jS)Nc��|tzSr)rr�s rr�z(Function.get_nonlocals.<locals>.<lambda>�s��q�<�?O�r )�_Function__nonlocalsr�r's r�
get_nonlocalszFunction.get_nonlocals�s3��	���#�#�5�5�6O�6O�P�P�D����r c�Z�	|j�d�}|�|��|_|jS)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�s4��	��<��F�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�ZdS)rNc�~�	|j�/i}|jjD]}d||j<�
t	|��|_|jS)N�)�_Class__methodsr;r[rBr|)r(�drqs   r�get_methodszClass.get_methods�sJ��	��>�!��A��k�*�
�
����"�'�
�
�"�1�X�X�D�N��~�r )r5r6r7r�r�r8r rrr�s(�������I�����r rc�v�eZdZddd�d�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�ZdS)rNFrbc�p�||_||_|tz	tz|_|pd|_||_dS)Nr8)�
_Symbol__name�_Symbol__flagsrr�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r(rBrfrgrcs     rr)zSymbol.__init__�s<����������*�j�8���&�,�"���*����r c�6�d�|j��S)Nz<symbol {0!r}>)rCr�r's rrEzSymbol.__repr__�s���&�&�t�{�3�3�3r c��	|jSr)r�r's rrPzSymbol.get_name�s��	��{�r c�F�	t|jtjz��Sr)rUr�rrr's r�
is_referencedzSymbol.is_referenced�s ��	��D�L�9�=�0�1�1�1r c�<�	t|jtz��Sr)rUr�rr's r�is_parameterzSymbol.is_parameter����	��D�L�9�,�-�-�-r c�t�	t|jttfvp|jo|jtz��Sr)rUr�rrr�r�r	r's r�	is_globalzSymbol.is_global�sB��	��D�L�_�o�$F�F�J��+�H���y�0H�K�K�	Kr c�<�	t|jtz��Sr)rUr�rr's r�is_nonlocalzSymbol.is_nonlocal�s��6��D�L�<�/�0�0�0r c�>�	t|jtk��Sr)rUr�rr's r�is_declared_globalzSymbol.is_declared_globals��	$��D�L�O�3�4�4�4r c�t�	t|jttfvp|jo|jtz��Sr)rUr�rrr�r�r	r's r�is_localzSymbol.is_localsA��	��D�L�U�D�M�1�J��+�H���y�0H�K�K�	Kr c�<�	t|jtz��Sr)rUr�r
r's r�is_annotatedzSymbol.is_annotatedr�r c�>�	t|jtk��Sr)rUr�r
r's rr�zSymbol.is_frees��	��D�L�D�(�)�)�)r c�<�	t|jtz��Sr)rUr�rr's r�is_importedzSymbol.is_importeds��	��D�L�:�-�.�.�.r c�<�	t|jtz��Sr)rUr�rr's r�is_assignedzSymbol.is_assigneds��7��D�L�9�,�-�-�-r c�,�	t|j��Sr)rUr�r's r�is_namespacezSymbol.is_namespace!s��		��D�%�&�&�&r c��	|jSr)r�r's r�get_namespaceszSymbol.get_namespaces.s��<�� � r c��	t|j��dkrtd���t|j��dkrtd���|jdS)Nrz#name is not bound to any namespacesr�z$name is bound to multiple namespaces)�lenr��
ValueErrorr's r�
get_namespacezSymbol.get_namespace2sa��	�
�t� �!�!�Q�&�&��B�C�C�C�
��"�
#�
#�a�
'�
'��C�D�D�D��$�Q�'�'r r)r5r6r7r)rErPr�r�r�r�r�r�r�r�r�r�r�r�r�r8r rrr�s������+�U�+�+�+�+�+�4�4�4����
2�2�2�.�.�.�
K�K�K�1�1�1�5�5�5�
K�K�K�.�.�.�
*�*�*�/�/�/�.�.�.�'�'�'�!�!�!�(�(�(�(�(r r�__main__r��exec)+rrrrrrrr	r
rrr
rrrrr$�__all__rr"rrrrrr5�os�sys�open�argv�f�read�src�path�split�modr`rlrh�info�printr�r�r8r r�<module>r�s���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	

Zerion Mini Shell 1.0