Your IP : 18.219.107.243


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

�

�Q�f���p�dZddlmZddlmZmZmZmZddlm	Z	m
Z
mZd�ZGd�dej�Zy	)
z�Fixer for import statements.
If spam is being imported from the local directory, this import:
    from spam import eggs
Becomes:
    from .spam import eggs

And this import:
    import spam
Becomes:
    from . import spam
�)�
fixer_base�)�dirname�join�exists�sep)�
FromImport�syms�tokenc#�VK�|g}|�r|j�}|jtjk(r|j��n�|jt
jk(r6dj|jD�cgc]}|j��c}���n�|jt
jk(r|j|jd�nJ|jt
jk(r"|j|jddd��ntd��|r��yycc}w�w)zF
    Walks over all the names imported in a dotted_as_names node.
    �rN���zunknown node type)�pop�typer�NAME�valuer
�dotted_namer�children�dotted_as_name�append�dotted_as_names�extend�AssertionError)�names�pending�node�chs    �?/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_import.py�traverse_importsrs������g�G�
��{�{�}���9�9��
�
�"��*�*��
�Y�Y�$�*�*�
*��'�'�d�m�m�<�m��2�8�8�m�<�=�=�
�Y�Y�$�-�-�
-��N�N�4�=�=��+�,�
�Y�Y�$�.�.�
.��N�N�4�=�=��2��.�/� �!4�5�5���
=�s�A9D)�;D$�BD)�"D)c�2��eZdZdZdZ�fd�Zd�Zd�Z�xZS)�	FixImportTzj
    import_from< 'from' imp=any 'import' ['('] any [')'] >
    |
    import_name< 'import' imp=any >
    c�T��tt|�||�d|jv|_y)N�absolute_import)�superr!�
start_tree�future_features�skip)�self�tree�name�	__class__s   �rr%zFixImport.start_tree/s&���
�i��)�$��5�%��)=�)=�=��	�c���|jry|d}|jtjk(rit	|d�s|j
d}t	|d�s�|j
|j�r%d|jz|_|j�yyd}d}t|�D]}|j
|�rd}�d}�|r|r|j|d�ytd|g�}|j|_|S)N�imprr�.FTz#absolute and local imports together)
r'rr
�import_from�hasattrr�probably_a_local_importr�changedr�warningr	�prefix)r(r�resultsr.�
have_local�
have_absolute�mod_name�news        r�	transformzFixImport.transform3s����9�9���e�n���9�9��(�(�(�
�c�7�+��l�l�1�o���c�7�+��+�+�C�I�I�6��#�)�)�O��	����
�7��J�!�M�,�S�1���/�/��9�!%�J�$(�M�	2�
���L�L��'L�M���S�3�%�(�C����C�J��Jr,c��|jd�ry|jdd�d}t|j�}t	||�}tt	t|�d��sydtddd	d
fD]}t||z�s�yy)Nr/F�rz__init__.pyz.pyz.pycz.soz.slz.pydT)�
startswith�splitr�filenamerrr)r(�imp_name�	base_path�exts    rr2z!FixImport.probably_a_local_importUs������s�#���>�>�#�q�)�!�,���D�M�M�*�	���H�-�	��d�7�9�-�}�=�>���3���u�f�=�C��i�#�o�&��>�r,)	�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr%r;r2�
__classcell__)r+s@rr!r!&s����M��G�>� �Dr,r!N)�__doc__r
r�os.pathrrrr�
fixer_utilr	r
rr�BaseFixr!�r,r�<module>rOs2��
��.�.�0�0�6�&=�
�"�"�=r,

?>