Your IP : 18.224.54.118


Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/fix_import.cpython-310.opt-2.pyc

o

6��f��@sX	ddlmZddlmZmZmZmZddlmZm	Z	m
Z
dd�ZGdd�dej�Z
d	S)
�)�
fixer_base�)�dirname�join�exists�sep)�
FromImport�syms�tokenccs��	|g}|rR|��}|jtjkr|jVn8|jtjkr)d�dd�|jD��Vn%|jtj	kr8|�
|jd�n|jtjkrJ|�|jddd��nt
d��|sdSdS)N�cSsg|]}|j�qS�)�value)�.0Zchrr�?/opt/alt/python310/lib64/python3.10/lib2to3/fixes/fix_import.py�
<listcomp>sz$traverse_imports.<locals>.<listcomp>r���zunknown node type)�pop�typer
�NAMEr
r	Zdotted_namer�childrenZdotted_as_name�appendZdotted_as_names�extend�AssertionError)�namesZpending�noderrr�traverse_importss�
�rcs4eZdZdZdZ�fdd�Zdd�Zdd�Z�ZS)	�	FixImportTzj
    import_from< 'from' imp=any 'import' ['('] any [')'] >
    |
    import_name< 'import' imp=any >
    cs"tt|��||�d|jv|_dS)NZabsolute_import)�superr�
start_treeZfuture_features�skip)�selfZtree�name��	__class__rrr/szFixImport.start_treecCs�|jrdS|d}|jtjkr2t|d�s|jd}t|d�r|�|j�r0d|j|_|��dSdSd}d}t	|�D]}|�|�rDd}q:d}q:|rS|rQ|�
|d�dStd|g�}|j|_|S)N�impr
r�.FTz#absolute and local imports together)
rrr	Zimport_from�hasattrr�probably_a_local_importr
ZchangedrZwarningr�prefix)r rZresultsr$Z
have_localZ
have_absoluteZmod_name�newrrr�	transform3s0


��
zFixImport.transformcCst|�d�rdS|�dd�d}t|j�}t||�}ttt|�d��s$dSdtddd	d
fD]}t||�r7dSq,dS)Nr%F�rz__init__.pyz.pyz.pycz.soz.slz.pydT)�
startswith�splitr�filenamerrr)r Zimp_name�	base_pathZextrrrr'Us


�z!FixImport.probably_a_local_import)	�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNrr*r'�
__classcell__rrr"rr&s"rN)rrZos.pathrrrrZ
fixer_utilrr	r
rZBaseFixrrrrr�<module>s


?>