[issue4423] 2to3 replaces "arbitrary" variables

2008-11-26 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Ok. The building of the pattern in fix_imports is changed to compile_pattern in r67404. ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-26 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > I wonder if a better way would be to configure the imports fixer > through the options dict passed to RefactoringTool. i.e. > > RefactoringTool(..., {"fix_imports:dont_transform" : ["commands", > "other_module"]}) That's very obscure, IM

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-26 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: On Wed, Nov 26, 2008 at 12:45 AM, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > > Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > >> This is true of many fixers. What is the use case? > > In this case, I wanted to work around the fi

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-25 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > This is true of many fixers. What is the use case? In this case, I wanted to work around the fixer working incorrectly for commands, but still have it continue to work for all the other modules it fixes. The context is the setup.py script

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-25 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: On Tue, Nov 25, 2008 at 5:10 PM, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > > Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > >> I'm not sure what you mean about MAPPING being compiled in. It is >> regenerated every time 2to3 is

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-25 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > I'm not sure what you mean about MAPPING being compiled in. It is > regenerated every time 2to3 is run. This code does not work: from lib2to3.fixes import fix_imports del fix_imports.MAPPING['commands'] when followed by an attemp

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-25 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: I'm not sure what you mean about MAPPING being compiled in. It is regenerated every time 2to3 is run. Anyway, I fixed the replacement problem in r67386. -- resolution: -> fixed status: open -> closed

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-24 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: This bug certainly has been reported before, so I'll see if I can find time for it. ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-24 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: Are there any plans to improve that? In the specific case, it would help if commands gets only replaced if an import of commands appears "in scope" (or, if that is too difficult, anywhere in the file). I think 2to3 should create a list of all

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-24 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Yes, this a known issue. You can currently circumvent it by disabling the imports fixer. -- nosy: +benjamin.peterson priority: -> normal ___ Python tracker <[EMAIL PROTECTED]>

[issue4423] 2to3 replaces "arbitrary" variables

2008-11-24 Thread Martin v. Löwis
New submission from Martin v. Löwis <[EMAIL PROTECTED]>: In 2to3 (from the py3k branch, as of r67372) translates the fragment def f(): commands = foo() commands.sort() to def f(): commands = foo() subprocess.sort() -- components: 2to3 (2.x to 3.0 conversion tool) messa