o
    tThs
                     @   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)numberszimport_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   a/home/air/segue/gemini/back/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
    *