[Python-checkins] r54304 - sandbox/trunk/2to3/fixes/basefix.py

collin.winter python-checkins at python.org
Mon Mar 12 21:14:04 CET 2007


Author: collin.winter
Date: Mon Mar 12 21:14:03 2007
New Revision: 54304

Modified:
   sandbox/trunk/2to3/fixes/basefix.py
Log:
Add a BaseFix.warning() method to go with cannot_convert().

Modified: sandbox/trunk/2to3/fixes/basefix.py
==============================================================================
--- sandbox/trunk/2to3/fixes/basefix.py	(original)
+++ sandbox/trunk/2to3/fixes/basefix.py	Mon Mar 12 21:14:03 2007
@@ -110,6 +110,16 @@
         self.logger.warning(msg % (lineno, for_output))
         if reason:
             self.logger.warning(reason)
+            
+    def warning(self, node, reason):
+        """Used for warning the user about possible uncertainty in the
+        translation.
+
+        First argument is the top-level node for the code in question.
+        Optional second argument is why it can't be converted.
+        """
+        lineno = node.get_lineno()
+        self.logger.warning("At line %d: %s" % (lineno, reason))
 
     def start_tree(self, tree, filename):
         """Some fixers need to maintain tree-wide state.


More information about the Python-checkins mailing list