AlkantarClanX12

Your IP : 3.147.71.175


Current Path : /opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/fix_import.cpython-311.pyc

�

c��f���n�dZddlmZddlmZmZmZmZddlm	Z	m
Z
mZd�ZGd�dej
��Zd	S)
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#�K�|g}|r�|���}|jtjkr
|jV�n�|jt
jkr'd�d�|jD����V�n~|jt
j	kr!|�
|jd��nH|jt
jkr$|�|jddd���ntd���|��dSdS)zF
    Walks over all the names imported in a dotted_as_names node.
    �c��g|]	}|j��
S�)�value)�.0�chs  �?/opt/alt/python311/lib64/python3.11/lib2to3/fixes/fix_import.py�
<listcomp>z$traverse_imports.<locals>.<listcomp>s��<�<�<��2�8�<�<�<�rN���zunknown node type)�pop�typer�NAMErr
�dotted_namer�children�dotted_as_name�append�dotted_as_names�extend�AssertionError)�names�pending�nodes   r�traverse_importsr$s�����g�G�
�6��{�{�}�}���9��
�"�"��*�����
�Y�$�*�
*�
*��'�'�<�<�d�m�<�<�<�=�=�=�=�=�=�
�Y�$�-�
-�
-��N�N�4�=��+�,�,�,�,�
�Y�$�.�
.�
.��N�N�4�=���2��.�/�/�/�/� �!4�5�5�5��6�6�6�6�6rc�2��eZdZdZdZ�fd�Zd�Zd�Z�xZS)�	FixImportTzj
    import_from< 'from' imp=any 'import' ['('] any [')'] >
    |
    import_name< 'import' imp=any >
    c�v��tt|���||��d|jv|_dS)N�absolute_import)�superr&�
start_tree�future_features�skip)�self�tree�name�	__class__s   �rr*zFixImport.start_tree/s6���
�i����)�)�$��5�5�5�%��)=�=��	�	�	rc��|jrdS|d}|jtjkrnt	|d��s|jd}t	|d���|�|j��r%d|jz|_|���dSdSd}d}t|��D]}|�|��rd}�d}�|r|r|�
|d��dStd|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#�resultsr2�
have_local�
have_absolute�mod_name�news        r�	transformzFixImport.transform3s0���9�	��F��e�n���9��(�(�(�
�c�7�+�+�
&��l�1�o���c�7�+�+�
&��+�+�C�I�6�6�
��#�)�O��	����
�
�
�
�
�
�
��J�!�M�,�S�1�1�
)�
)���/�/��9�9�)�!%�J�J�$(�M�M��
��N��L�L��'L�M�M�M����S�3�%�(�(�C���C�J��Jrc�V�|�d��rdS|�dd��d}t|j��}t	||��}tt	t|��d����sdSdtddd	d
fD]}t||z��rdS�dS)Nr3F�rz__init__.pyz.pyz.pycz.soz.slz.pydT)�
startswith�splitr�filenamerrr)r-�imp_name�	base_path�exts    rr6z!FixImport.probably_a_local_importUs������s�#�#�	��5��>�>�#�q�)�)�!�,���D�M�*�*�	���H�-�-�	��d�7�9�-�-�}�=�=�>�>�	��5��3���u�f�=�	�	�C��i�#�o�&�&�
��t�t�
��ur)	�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr*r?r6�
__classcell__)r0s@rr&r&&sc��������M��G�>�>�>�>�>� � � �D������rr&N)�__doc__r
r�os.pathrrrr�
fixer_utilr	r
rr$�BaseFixr&rrr�<module>rRs���
�
�������.�.�.�.�.�.�.�.�.�.�.�.�0�0�0�0�0�0�0�0�0�0�6�6�6�&=�=�=�=�=�
�"�=�=�=�=�=r