Skip to content

Commit

Permalink
Add type annotation to get_changes() in move.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Apr 4, 2024
1 parent 780bcd9 commit 84c71bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions rope/refactor/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def __init__(self, project, resource, offset):

def get_changes(
self,
dest_attr,
new_name=None,
resources=None,
dest_attr: str,
new_name: Optional[str] = None,
resources: Optional[List[resources.File]] = None,
task_handle=taskhandle.DEFAULT_TASK_HANDLE, # FIXME: this is unused
):
"""Return the changes needed for this refactoring
Expand Down Expand Up @@ -519,7 +519,10 @@ def __init__(self, project, resource):
self.import_tools = self.tools.import_tools

def get_changes(
self, dest, resources=None, task_handle=taskhandle.DEFAULT_TASK_HANDLE
self,
dest: resources.Resource,
resources: Optional[List[resources.File]] = None,
task_handle=taskhandle.DEFAULT_TASK_HANDLE,
):
if resources is None:
resources = self.project.get_python_files()
Expand Down
3 changes: 2 additions & 1 deletion ropetest/refactor/movetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ def _move_to_attr(
self,
resource: Union[resources.File, resources.Folder],
offset: Union[int, None],
dest_attr: Union[str, resources.File, resources.Folder],
dest_attr: str,
*,
new_name: str,
):
mover = move.create_move(self.project, resource, offset)
assert isinstance(mover, move.MoveMethod)
changes = mover.get_changes(dest_attr, new_name=new_name)
self.project.do(changes)

Expand Down

0 comments on commit 84c71bf

Please sign in to comment.