add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
a

Z��^�c@sZdZddlmZddlmZmZmZmZddlm	Z	m
Z
mZdd�ZGdd	�d	ej
�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
i)�
fixer_base�)�dirname�join�exists�sep)�
FromImport�syms�tokenccs�|g}|r�|��}|jtjkr(|jVq|jtjkrNd�dd�|jD��Vq|jtj	krl|�
|jd�q|jtjkr�|�|jddd��qt
d��qdS)zF
    Walks over all the names imported in a dotted_as_names node.
    �cSsg|]
}|j�qS�)�value)Z.0Zchr
r
�0/usr/lib64/python3.9/lib2to3/fixes/fix_import.pyZ
<listcomp>sz$traverse_imports.<locals>.<listcomp>rNi����zunknown node type)Zpop�typerZNAMErrZdotted_namer�childrenZdotted_as_nameZappendZdotted_as_namesZextendZAssertionError)ZnamesZpending�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)Zsuperr�
start_treeZfuture_features�skip)�selfZtreeZname�Z	__class__r
rr/szFixImport.start_treecCs�|jr
dS|d}|jtjkrVt|d�s4|jd}q|�|j�r�d|j|_|��nZd}d}t	|�D]}|�|�rzd}qfd}qf|r�|r�|�
|d�dStd|g�}|j|_|SdS)N�imprr�.FTz#absolute and local imports together)
rr
rZimport_fromZhasattrr�probably_a_local_importrZchangedrZwarningrZprefix)rrZresultsrZ
have_localZ
have_absoluteZmod_nameZnewr
r
r�	transform3s,


zFixImport.transformcCst|�d�rdS|�dd�d}t|j�}t||�}ttt|�d��sHdSdtddd	d
fD]}t||�rXdSqXdS)NrFirz__init__.pyz.pyz.pycz.soz.slz.pydT)Z
startswithZsplitrZfilenamerrr)rZimp_nameZ	base_pathZextr
r
rrUs


z!FixImport.probably_a_local_import)	Z__name__Z
__module__Z__qualname__Z
BM_compatibleZPATTERNrrrZ
__classcell__r
r
rrr&s
"rN)Z__doc__r	rZos.pathrrrrZ
fixer_utilrrrrZBaseFixrr
r
r
rZ<module>s