[Python-checkins] r57336 - in sandbox/trunk/2to3: fixes/basefix.py

collin.winter python-checkins at python.org
Thu Aug 23 20:29:54 CEST 2007


Author: collin.winter
Date: Thu Aug 23 20:29:54 2007
New Revision: 57336

Modified:
   sandbox/trunk/2to3/   (props changed)
   sandbox/trunk/2to3/fixes/basefix.py
Log:
 r663 at Silves:  collinwinter | 2007-08-23 11:29:36 -0700
 Fix the signature of basefix.BaseFix.transform(); update the docs.


Modified: sandbox/trunk/2to3/fixes/basefix.py
==============================================================================
--- sandbox/trunk/2to3/fixes/basefix.py	(original)
+++ sandbox/trunk/2to3/fixes/basefix.py	Thu Aug 23 20:29:54 2007
@@ -77,15 +77,21 @@
         results = {"node": node}
         return self.pattern.match(node, results) and results
 
-    def transform(self, node):
+    def transform(self, node, results):
         """Returns the transformation for a given parse tree node.
 
-        Should return None, or a node that is a modified copy of the
-        argument node.  The argument should not be modified in place.
+        Args:
+          node: the root of the parse tree that matched the fixer.
+          results: a dict mapping symbolic names to part of the match.
+          
+        Returns:
+          None, or a node that is a modified copy of the
+          argument node.  The node argument may also be modified in-place to
+          effect the same change.
 
         Subclass *must* override.
         """
-        return None
+        raise NotImplementedError()
 
     def parenthesize(self, node):
         """Wrapper around pygram.parenthesize()."""


More information about the Python-checkins mailing list