rope
rope copied to clipboard
Rename Field changes the import and adds a nonexistent name.
Rename Field changes the import and adds a nonexistent name.
Steps to reproduce the behavior:
- Code before refactoring:
-- app.py
from __future__ import print_function
from compat import izip
def pairs(seq1, seq2):
return list(izip(seq1, seq2))
if __name__ == "__main__":
print(pairs([1, 2, 3], [4, 5, 6]))
-- compat.py
from __future__ import print_function
import sys
PY2 = (sys.version_info[0] == 2)
if PY2:
from itertools import imap, izip
else:
imap = map
izip = zip
__all__ = ["imap", "izip"]
-
Apply the rename field to app.py.
izip -
Code after refactoring:
-- app.py
from __future__ import print_function
from compat import implements_to_string
def pairs(seq1, seq2):
return list(implements_to_string(seq1, seq2))
if __name__ == "__main__":
print(pairs([1, 2, 3], [4, 5, 6]))
-- compat.py
from __future__ import print_function
import sys
PY2 = (sys.version_info[0] == 2)
if PY2:
from itertools import imap, implements_to_string
else:
imap = map
implements_to_string = zip
__all__ = ["imap", "implements_to_string"]