o ,]s @s>dZddlmZmZddlmZgdZGdddejZdS) 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 )FeatureFeatures) fixer_base)) memoryviewz4power < 'memoryview' trailer < '(' any* ')' > any* >z2.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 trailer< '(' any* ')' > >r)nonlocalzglobal_stmt< 'nonlocal' any* >3.0)with_tracebackztrailer< '.' 'with_traceback' >rcsFeZdZdZeZeddeDZej Z fddZ ddZ Z S) FixFeatures cCsg|] \}}}t|||qS)r).0namepatternversionrrB/usr/lib/python3/dist-packages/libpasteurize/fixes/fix_features.py ;szFixFeatures.cs2tt||}z|d=W|StyY|Sw)Nnode)superrmatch Exception)selfrto_ret __class__rrr@s zFixFeatures.matchcCsX|D]'}||jvr q|j|}|jdkr|j}n|j}|||d|j|qdS)N3)reason)features_warnedfeaturesrcannot_convertwarning message_textadd)rrresults feature_name curr_featurefailrrr transformKs   zFixFeatures.transform) __name__ __module__ __qualname__ run_ordersetr#rFEATURESr$PATTERNrr- __classcell__rrrrr3s  rN) __doc__ feature_baserrlib2to3rr3BaseFixrrrrrs  *