[Python-checkins] r80572 - sandbox/trunk/2to3/lib2to3/fixes/fix_import.py

benjamin.peterson python-checkins at python.org
Wed Apr 28 03:33:54 CEST 2010


Author: benjamin.peterson
Date: Wed Apr 28 03:33:54 2010
New Revision: 80572

Log:
use unicode literals

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

Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_import.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_import.py	(original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_import.py	Wed Apr 28 03:33:54 2010
@@ -77,19 +77,19 @@
                     self.warning(node, "absolute and local imports together")
                 return
 
-            new = FromImport('.', [imp])
+            new = FromImport(u".", [imp])
             new.prefix = node.prefix
             return new
 
     def probably_a_local_import(self, imp_name):
-        imp_name = imp_name.split('.', 1)[0]
+        imp_name = imp_name.split(u".", 1)[0]
         base_path = dirname(self.filename)
         base_path = join(base_path, imp_name)
         # If there is no __init__.py next to the file its not in a package
         # so can't be a relative import.
-        if not exists(join(dirname(base_path), '__init__.py')):
+        if not exists(join(dirname(base_path), "__init__.py")):
             return False
-        for ext in ['.py', sep, '.pyc', '.so', '.sl', '.pyd']:
+        for ext in [".py", sep, ".pyc", ".so", ".sl", ".pyd"]:
             if exists(base_path + ext):
                 return True
         return False


More information about the Python-checkins mailing list