[Python-checkins] r72524 - in python/branches/py3k/Lib/lib2to3/fixes: fix_imports.py fix_methodattrs.py fix_renames.py fix_types.py

benjamin.peterson python-checkins at python.org
Sat May 9 21:44:56 CEST 2009


Author: benjamin.peterson
Date: Sat May  9 21:44:56 2009
New Revision: 72524

Log:
remove unneeded uses of str()

Modified:
   python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py
   python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py
   python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py
   python/branches/py3k/Lib/lib2to3/fixes/fix_types.py

Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py
==============================================================================
--- python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py	(original)
+++ python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py	Sat May  9 21:44:56 2009
@@ -123,7 +123,7 @@
         import_mod = results.get("module_name")
         if import_mod:
             mod_name = import_mod.value
-            new_name = str(self.mapping[mod_name])
+            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,

Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py
==============================================================================
--- python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py	(original)
+++ python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py	Sat May  9 21:44:56 2009
@@ -19,5 +19,5 @@
 
     def transform(self, node, results):
         attr = results["attr"][0]
-        new = str(MAP[attr.value])
+        new = MAP[attr.value]
         attr.replace(Name(new, prefix=attr.get_prefix()))

Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py
==============================================================================
--- python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py	(original)
+++ python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py	Sat May  9 21:44:56 2009
@@ -65,5 +65,5 @@
         #import_mod = results.get("module")
 
         if mod_name and attr_name:
-            new_attr = str(LOOKUP[(mod_name.value, attr_name.value)])
+            new_attr = LOOKUP[(mod_name.value, attr_name.value)]
             attr_name.replace(Name(new_attr, prefix=attr_name.get_prefix()))

Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_types.py
==============================================================================
--- python/branches/py3k/Lib/lib2to3/fixes/fix_types.py	(original)
+++ python/branches/py3k/Lib/lib2to3/fixes/fix_types.py	Sat May  9 21:44:56 2009
@@ -56,7 +56,7 @@
     PATTERN = '|'.join(_pats)
 
     def transform(self, node, results):
-        new_value = str(_TYPE_MAPPING.get(results["name"].value))
+        new_value = _TYPE_MAPPING.get(results["name"].value)
         if new_value:
             return Name(new_value, prefix=node.get_prefix())
         return None


More information about the Python-checkins mailing list