[Python-checkins] r68503 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py

benjamin.peterson python-checkins at python.org
Sat Jan 10 21:14:50 CET 2009


Author: benjamin.peterson
Date: Sat Jan 10 21:14:49 2009
New Revision: 68503

Log:
use variable

Modified:
   sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py

Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py	(original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py	Sat Jan 10 21:14:49 2009
@@ -121,12 +121,13 @@
     def transform(self, node, results):
         import_mod = results.get("module_name")
         if import_mod:
-            new_name = self.mapping[import_mod.value]
+            mod_name = import_mod.value
+            new_name = self.mapping[mod_name]
             import_mod.replace(Name(new_name, prefix=import_mod.get_prefix()))
             if "name_import" in results:
                 # If it's not a "from x import x, y" or "import x as y" import,
                 # marked its usage to be replaced.
-                self.replace[import_mod.value] = new_name
+                self.replace[mod_name] = new_name
             if "multiple_imports" in results:
                 # This is a nasty hack to fix multiple imports on a
                 # line (e.g., "import StringIO, urlparse"). The problem is that I


More information about the Python-checkins mailing list