o
    ,º]s
  ã                   @   s>   d Z ddlmZmZ ddlmZ g d¢ZG dd„ dejƒZdS )	zŸ
Warn about features that are not present in Python 2.5, giving a message that
points to the earliest version of Python 2.x (or 3.x, if none) that supports it
é   )ÚFeatureÚFeaturesé    )Ú
fixer_base))Ú
memoryviewz4power < 'memoryview' trailer < '(' any* ')' > any* >z2.7)Únumbersz…import_from< 'from' 'numbers' 'import' any* > |
           import_name< 'import' ('numbers' dotted_as_names< any* 'numbers' any* >) >ú2.6)Úabczyimport_name< 'import' ('abc' dotted_as_names< any* 'abc' any* >) > |
           import_from< 'from' 'abc' 'import' any* >r   )Úiozvimport_name< 'import' ('io' dotted_as_names< any* 'io' any* >) > |
           import_from< 'from' 'io' 'import' any* >r   )Úbinz+power< 'bin' trailer< '(' any* ')' > any* >r   )Ú
formattingz<power< any trailer< '.' 'format' > trailer< '(' any* ')' > >r   )Únonlocalzglobal_stmt< 'nonlocal' any* >ú3.0)Úwith_tracebackztrailer< '.' 'with_traceback' >r   c                       sF   e Zd ZdZeƒ Zedd„ eD ƒƒZej	Z	‡ fdd„Z
dd„ Z‡  ZS )ÚFixFeaturesé	   c                 C   s   g | ]\}}}t |||ƒ‘qS © )r   )Ú.0ÚnameÚpatternÚversionr   r   ú]/var/www/html/myproject/venv/lib/python3.10/site-packages/libpasteurize/fixes/fix_features.pyÚ
<listcomp>;   s    ÿzFixFeatures.<listcomp>c                    s2   t t| ƒ |¡}z|d= W |S  ty   Y |S w )NÚnode)Úsuperr   ÚmatchÚ	Exception)Úselfr   Úto_ret©Ú	__class__r   r   r   @   s   üüzFixFeatures.matchc                 C   sX   |D ]'}|| j v r
q| j| }|jdkr| j}n| j}||| ¡ d� | j  |¡ qd S )NÚ3)Úreason)Úfeatures_warnedÚfeaturesr   Úcannot_convertÚwarningÚmessage_textÚadd)r   r   ÚresultsÚfeature_nameÚcurr_featureÚfailr   r   r   Ú	transformK   s   


özFixFeatures.transform)Ú__name__Ú
__module__Ú__qualname__Ú	run_orderÚsetr#   r   ÚFEATURESr$   ÚPATTERNr   r-   Ú__classcell__r   r   r   r   r   3   s    ÿr   N)	Ú__doc__Úfeature_baser   r   Úlib2to3r   r3   ÚBaseFixr   r   r   r   r   Ú<module>   s
    *