Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix renaming kwargs when refactoring from imports #646

Merged
merged 2 commits into from Jan 11, 2023

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'))

@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.

None yet

2 participants