[Python-Dev] 2to3 question about fix_imports. (original) (raw)
Alexandre Vassalotti alexandre at peadrop.com
Sun Dec 14 19:19:17 CET 2008
- Previous message: [Python-Dev] 2to3 question about fix_imports.
- Next message: [Python-Dev] 2to3 question about fix_imports.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Dec 12, 2008 at 11:39 AM, Lennart Regebro <regebro at gmail.com> wrote:
The fiximports fix seems to fix only the first import per line that you have. So if you do for example import urllib2, cStringIO it will not fix cStringIO.
Is this a bug or a feature? :-) If it's a feature it should warn at least, right?
Which revision of python are you using? I tried the test-case you gave and 2to3 translated it perfectly.
-- Alexandre
alex at helios:~$ cat test.py import urllib2, cStringIO
s = cStringIO.StringIO(urllib2.randombytes(100)) alex at helios:~$ 2to3 test.py RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms RefactoringTool: Skipping implicit fixer: set_literal RefactoringTool: Skipping implicit fixer: ws_comma --- test.py (original) +++ test.py (refactored) @@ -1,3 +1,3 @@ -import urllib2, cStringIO +import urllib.request, urllib.error, io
-s = cStringIO.StringIO(urllib2.randombytes(100)) +s = io.StringIO(urllib2.randombytes(100)) RefactoringTool: Files that need to be modified: RefactoringTool: test.py
- Previous message: [Python-Dev] 2to3 question about fix_imports.
- Next message: [Python-Dev] 2to3 question about fix_imports.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]