Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python27
/
lib
/
python2.7
/
site-packages
/
libpasteurize
/
fixes
/
File Content:
fix_features.py
u""" 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 """ from .feature_base import Feature, Features from lib2to3 import fixer_base FEATURES = [ #(FeatureName, # FeaturePattern, # FeatureMinVersion, #), (u"memoryview", u"power < 'memoryview' trailer < '(' any* ')' > any* >", u"2.7", ), (u"numbers", u"""import_from< 'from' 'numbers' 'import' any* > | import_name< 'import' ('numbers' dotted_as_names< any* 'numbers' any* >) >""", u"2.6", ), (u"abc", u"""import_name< 'import' ('abc' dotted_as_names< any* 'abc' any* >) > | import_from< 'from' 'abc' 'import' any* >""", u"2.6", ), (u"io", u"""import_name< 'import' ('io' dotted_as_names< any* 'io' any* >) > | import_from< 'from' 'io' 'import' any* >""", u"2.6", ), (u"bin", u"power< 'bin' trailer< '(' any* ')' > any* >", u"2.6", ), (u"formatting", u"power< any trailer< '.' 'format' > trailer< '(' any* ')' > >", u"2.6", ), (u"nonlocal", u"global_stmt< 'nonlocal' any* >", u"3.0", ), (u"with_traceback", u"trailer< '.' 'with_traceback' >", u"3.0", ), ] class FixFeatures(fixer_base.BaseFix): run_order = 9 # Wait until all other fixers have run to check for these # To avoid spamming, we only want to warn for each feature once. features_warned = set() # Build features from the list above features = Features([Feature(name, pattern, version) for \ name, pattern, version in FEATURES]) PATTERN = features.PATTERN def match(self, node): to_ret = super(FixFeatures, self).match(node) # We want the mapping only to tell us the node's specific information. try: del to_ret[u'node'] except Exception: # We want it to delete the 'node' from the results # if it's there, so we don't care if it fails for normal reasons. pass return to_ret def transform(self, node, results): for feature_name in results: if feature_name in self.features_warned: continue else: curr_feature = self.features[feature_name] if curr_feature.version >= u"3": fail = self.cannot_convert else: fail = self.warning fail(node, reason=curr_feature.message_text()) self.features_warned.add(feature_name)
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
__init__.py
3719 bytes
0644
__init__.pyc
974 bytes
0644
__init__.pyo
974 bytes
0644
feature_base.py
1723 bytes
0644
feature_base.pyc
2985 bytes
0644
feature_base.pyo
2985 bytes
0644
fix_add_all__future__imports.py
676 bytes
0644
fix_add_all__future__imports.pyc
1309 bytes
0644
fix_add_all__future__imports.pyo
1309 bytes
0644
fix_add_all_future_builtins.py
1269 bytes
0644
fix_add_all_future_builtins.pyc
1430 bytes
0644
fix_add_all_future_builtins.pyo
1430 bytes
0644
fix_add_future_standard_library_import.py
663 bytes
0644
fix_add_future_standard_library_import.pyc
1233 bytes
0644
fix_add_future_standard_library_import.pyo
1233 bytes
0644
fix_annotations.py
1581 bytes
0644
fix_annotations.pyc
2253 bytes
0644
fix_annotations.pyo
2153 bytes
0644
fix_division.py
904 bytes
0644
fix_division.pyc
1724 bytes
0644
fix_division.pyo
1724 bytes
0644
fix_features.py
2675 bytes
0644
fix_features.pyc
3399 bytes
0644
fix_features.pyo
3399 bytes
0644
fix_fullargspec.py
438 bytes
0644
fix_fullargspec.pyc
1063 bytes
0644
fix_fullargspec.pyo
1063 bytes
0644
fix_future_builtins.py
1450 bytes
0644
fix_future_builtins.pyc
1758 bytes
0644
fix_future_builtins.pyo
1758 bytes
0644
fix_getcwd.py
873 bytes
0644
fix_getcwd.pyc
1352 bytes
0644
fix_getcwd.pyo
1352 bytes
0644
fix_imports.py
4944 bytes
0644
fix_imports.pyc
4403 bytes
0644
fix_imports.pyo
4403 bytes
0644
fix_imports2.py
8580 bytes
0644
fix_imports2.pyc
10321 bytes
0644
fix_imports2.pyo
10321 bytes
0644
fix_kwargs.py
5991 bytes
0644
fix_kwargs.pyc
4791 bytes
0644
fix_kwargs.pyo
4674 bytes
0644
fix_memoryview.py
551 bytes
0644
fix_memoryview.pyc
1144 bytes
0644
fix_memoryview.pyo
1144 bytes
0644
fix_metaclass.py
3260 bytes
0644
fix_metaclass.pyc
2668 bytes
0644
fix_metaclass.pyo
2668 bytes
0644
fix_newstyle.py
888 bytes
0644
fix_newstyle.pyc
1582 bytes
0644
fix_newstyle.pyo
1582 bytes
0644
fix_next.py
1233 bytes
0644
fix_next.pyc
1891 bytes
0644
fix_next.pyo
1858 bytes
0644
fix_printfunction.py
401 bytes
0644
fix_printfunction.pyc
991 bytes
0644
fix_printfunction.pyo
991 bytes
0644
fix_raise.py
1099 bytes
0644
fix_raise.pyc
1697 bytes
0644
fix_raise.pyo
1697 bytes
0644
fix_raise_.py
1225 bytes
0644
fix_raise_.pyc
1828 bytes
0644
fix_raise_.pyo
1828 bytes
0644
fix_throw.py
835 bytes
0644
fix_throw.pyc
1497 bytes
0644
fix_throw.pyo
1497 bytes
0644
fix_unpacking.py
5946 bytes
0644
fix_unpacking.pyc
6339 bytes
0644
fix_unpacking.pyo
6339 bytes
0644
N4ST4R_ID | Naxtarrr