rope icon indicating copy to clipboard operation
rope copied to clipboard

Update `__all__` when renaming an imported variable/function/class

Open lieryan opened this issue 4 years ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Code before refactoring:
# mod1.py
__all__ = ['old_name']

old_name = 1
# mod2.py
from mod1 import *
print(old_name) 
  1. Describe the refactoring you want to do

Rename old_name to new_name

  1. Expected code after refactoring:
# mod1.py
__all__ = ['new_name']

new_name = 1
# mod2.py
from mod1 import *
print(new_name) 
  1. Describe the error or unexpected result that you are getting

The __all__ dictionary was left still using the old_name:

__all__ = ['old_name']

Editor information (please complete the following information):

  • Rope version: 0.20.1

lieryan avatar Sep 22 '21 18:09 lieryan