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

Refactor: Move Function or Class #19148

Open
dciborow opened this issue May 14, 2022 · 0 comments
Open

Refactor: Move Function or Class #19148

dciborow opened this issue May 14, 2022 · 0 comments
Labels
feature-request triage-needed

Comments

@dciborow
Copy link

@dciborow dciborow commented May 14, 2022

I would like to be able to easily move a function or class from one file to another. When moving the class, all the imports in my project should be properly updated with the new location. If other functions or classes depend on the object being moved, I should be prompted to include them in the move.

Before Move

File1.py

def func1(): 
  pass


def func2(): # We will select this function to move to File2.py
  func1()


def func3():
  func2()

When selecting to Refactor: Move funct2, to File2.py, it should be noted that func1() must also be moved, to prevent creating a circular dependency.

After Move

File1.py

from File2 import func2  # This line was inserted for me after func2() was moved

def func3():
  func2()

File2.py

def func1():  # Dependent functions where also moved 
  pass


def func2():  # This function was selected for refactoring
  func1()
@github-actions github-actions bot added the triage-needed label May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request triage-needed
Projects
None yet
Development

No branches or pull requests

1 participant