Skip to content

Commit 9190132

Browse files
author
Dimitrios Semitsoglou-Tsiapos
committed
rope: correct refactoring function calls
* (Temporarily) drops passing of `task_handle`.
1 parent 9c8468e commit 9190132

File tree

1 file changed

+28
-40
lines changed

1 file changed

+28
-40
lines changed

pymode/rope.py

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,7 @@ def get_input_str(refactor, ctx):
505505

506506
@staticmethod
507507
def get_changes(refactor, input_str, in_hierarchy=False):
508-
""" Get changes.
509-
510-
:return Changes:
511-
512-
"""
513-
progress = ProgressHandler('Calculate changes ...')
514-
return refactor.get_changes(
515-
input_str, task_handle=progress.handle, in_hierarchy = in_hierarchy)
508+
raise NotImplementedError
516509

517510

518511
class RenameRefactoring(Refactoring):
@@ -550,8 +543,26 @@ def get_input_str(self, refactor, ctx):
550543

551544
return newname
552545

546+
@staticmethod
547+
def get_changes(refactor, input_str, in_hierarchy):
548+
""" Get changes.
549+
550+
:return Changes:
551+
552+
"""
553+
return refactor.get_changes(input_str, in_hierarchy=in_hierarchy)
554+
555+
class ExtractRefactoring(Refactoring):
556+
@staticmethod
557+
def get_changes(refactor, input_str, in_hierarchy):
558+
""" Get changes.
559+
560+
:return Changes:
561+
562+
"""
563+
return refactor.get_changes(input_str) #, global_=not in_hierarchy)
553564

554-
class ExtractMethodRefactoring(Refactoring):
565+
class ExtractMethodRefactoring(ExtractRefactoring):
555566

556567
""" Extract method. """
557568

@@ -574,18 +585,8 @@ def get_refactor(ctx):
574585
return extract.ExtractMethod(
575586
ctx.project, ctx.resource, offset1, offset2)
576587

577-
@staticmethod
578-
def get_changes(refactor, input_str):
579-
""" Get changes.
580588

581-
:return Changes:
582-
583-
"""
584-
585-
return refactor.get_changes(input_str)
586-
587-
588-
class ExtractVariableRefactoring(Refactoring):
589+
class ExtractVariableRefactoring(ExtractRefactoring):
589590

590591
""" Extract variable. """
591592

@@ -608,16 +609,6 @@ def get_refactor(ctx):
608609
return extract.ExtractVariable(
609610
ctx.project, ctx.resource, offset1, offset2)
610611

611-
@staticmethod
612-
def get_changes(refactor, input_str):
613-
""" Get changes.
614-
615-
:return Changes:
616-
617-
"""
618-
619-
return refactor.get_changes(input_str)
620-
621612

622613
class InlineRefactoring(Refactoring):
623614

@@ -634,14 +625,13 @@ def get_refactor(ctx):
634625
return inline.create_inline(ctx.project, ctx.resource, offset)
635626

636627
@staticmethod
637-
def get_changes(refactor, input_str):
628+
def get_changes(refactor, input_str, in_hierarchy):
638629
""" Get changes.
639630
640631
:return Changes:
641632
642633
"""
643-
progress = ProgressHandler('Calculate changes ...')
644-
return refactor.get_changes(task_handle=progress.handle)
634+
return refactor.get_changes()
645635

646636

647637
class UseFunctionRefactoring(Refactoring):
@@ -659,15 +649,13 @@ def get_refactor(ctx):
659649
return usefunction.UseFunction(ctx.project, ctx.resource, offset)
660650

661651
@staticmethod
662-
def get_changes(refactor, input_str):
652+
def get_changes(refactor, input_str, in_hierarchy):
663653
""" Get changes.
664654
665655
:return Changes:
666656
667657
"""
668-
progress = ProgressHandler('Calculate changes ...')
669-
return refactor.get_changes(
670-
resources=[refactor.resource], task_handle=progress.handle)
658+
return refactor.get_changes()
671659

672660

673661
class ModuleToPackageRefactoring(Refactoring):
@@ -684,7 +672,7 @@ def get_refactor(ctx):
684672
return ModuleToPackage(ctx.project, ctx.resource)
685673

686674
@staticmethod
687-
def get_changes(refactor, input_str):
675+
def get_changes(refactor, input_str, in_hierarchy):
688676
""" Get changes.
689677
690678
:return Changes:
@@ -746,7 +734,7 @@ def get_refactor(ctx):
746734
return change_signature.ChangeSignature(
747735
ctx.project, ctx.resource, offset)
748736

749-
def get_changes(self, refactor, input_string):
737+
def get_changes(self, refactor, input_string, in_hierarchy):
750738
""" Function description.
751739
752740
:return Rope.changes:
@@ -771,7 +759,7 @@ def get_changes(self, refactor, input_string):
771759
changers.append(change_signature.ArgumentReorderer(
772760
order, autodef='None'))
773761

774-
return refactor.get_changes(changers)
762+
return refactor.get_changes(changers, in_hierarchy=in_hierarchy)
775763

776764

777765
class GenerateElementRefactoring(Refactoring):

0 commit comments

Comments
 (0)