Skip to content

Fix renaming kwargs when refactoring from imports#646

Merged
lieryan merged 2 commits intopython-rope:masterfrom
apmorton:am/froms-to-normal-kwargs
Jan 11, 2023
Merged

Fix renaming kwargs when refactoring from imports#646
lieryan merged 2 commits intopython-rope:masterfrom
apmorton:am/froms-to-normal-kwargs

Conversation

@apmorton
Copy link
Contributor

When converting from imports on a large codebase I encountered many files that failed with errors of the form:

Syntax error in file <foo.py> line <123>: expression cannot contain assignment, perhaps you meant "=="?

This was traced back to erroneously renaming keyword arguments that conflicted with renamed imports, resulting in code that looked something like the following:

Before

from os import path
foo(path=path.join('a', 'b'))

After

import os
foo(os.path=os.path.join('a', 'b'))

@apmorton apmorton force-pushed the am/froms-to-normal-kwargs branch from 2aabd21 to ff4f5db Compare January 10, 2023 15:09
@lieryan lieryan enabled auto-merge January 11, 2023 12:32
@lieryan lieryan merged commit 1ed5594 into python-rope:master Jan 11, 2023
@lieryan
Copy link
Member

lieryan commented Jan 11, 2023

The fix looks reasonable, thanks @apmorton!

@all-contributors add @apmorton for code contribution

@allcontributors
Copy link
Contributor

@lieryan

I've put up a pull request to add @apmorton! 🎉

@lieryan lieryan added this to the 1.7.0 milestone Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants