|
1 | 1 | """ Rope support in pymode. """
|
2 | 2 | from __future__ import absolute_import, print_function
|
3 | 3 |
|
4 |
| -import multiprocessing |
5 | 4 | import os.path
|
6 | 5 | import re
|
7 | 6 | import site
|
|
13 | 12 | from rope.contrib import autoimport as rope_autoimport, codeassist, findit, generate # noqa
|
14 | 13 | from rope.refactor import ModuleToPackage, ImportOrganizer, rename, extract, inline, usefunction, move, change_signature, importutils # noqa
|
15 | 14 |
|
16 |
| -from ._compat import StringIO |
17 | 15 | from .environment import env
|
18 | 16 |
|
19 | 17 |
|
@@ -352,8 +350,7 @@ def __init__(self, path, project_path):
|
352 | 350 | """ Init Rope context. """
|
353 | 351 | self.path = path
|
354 | 352 |
|
355 |
| - self.project = project.Project( |
356 |
| - project_path, fscommands=FileSystemCommands()) |
| 353 | + self.project = project.Project(project_path, fscommands=FileSystemCommands()) |
357 | 354 |
|
358 | 355 | self.importer = rope_autoimport.AutoImport(
|
359 | 356 | project=self.project, observe=False)
|
@@ -462,8 +459,8 @@ def run(self):
|
462 | 459 |
|
463 | 460 | action = env.user_input_choices(
|
464 | 461 | 'Choose what to do:', 'perform', 'preview',
|
465 |
| - 'perform in class hierarchy', |
466 |
| - 'preview in class hierarchy') |
| 462 | + 'perform in class hierarchy', |
| 463 | + 'preview in class hierarchy') |
467 | 464 |
|
468 | 465 | in_hierarchy = action.endswith("in class hierarchy")
|
469 | 466 |
|
@@ -512,7 +509,7 @@ def get_changes(refactor, input_str, in_hierarchy=False):
|
512 | 509 | """
|
513 | 510 | progress = ProgressHandler('Calculate changes ...')
|
514 | 511 | return refactor.get_changes(
|
515 |
| - input_str, task_handle=progress.handle, in_hierarchy = in_hierarchy) |
| 512 | + input_str, task_handle=progress.handle, in_hierarchy=in_hierarchy) |
516 | 513 |
|
517 | 514 |
|
518 | 515 | class RenameRefactoring(Refactoring):
|
@@ -746,13 +743,12 @@ def get_refactor(ctx):
|
746 | 743 | return change_signature.ChangeSignature(
|
747 | 744 | ctx.project, ctx.resource, offset)
|
748 | 745 |
|
749 |
| - def get_changes(self, refactor, input_string): |
| 746 | + def get_changes(self, refactor, input_string, in_hierarchy=False): |
750 | 747 | """ Function description.
|
751 | 748 |
|
752 | 749 | :return Rope.changes:
|
753 | 750 |
|
754 | 751 | """
|
755 |
| - |
756 | 752 | args = re.sub(r'[\s\(\)]+', '', input_string).split(',')
|
757 | 753 | olds = [arg[0] for arg in refactor.get_args()]
|
758 | 754 |
|
@@ -793,7 +789,7 @@ def get_refactor(self, ctx):
|
793 | 789 | return generate.create_generate(
|
794 | 790 | self.kind, ctx.project, ctx.resource, offset)
|
795 | 791 |
|
796 |
| - def get_changes(self, refactor, input_str): |
| 792 | + def get_changes(self, refactor, input_str, in_hierarchy=False): |
797 | 793 | """ Function description.
|
798 | 794 |
|
799 | 795 | :return Rope.changes:
|
@@ -938,5 +934,3 @@ def _insert_import(name, module, ctx):
|
938 | 934 | progress = ProgressHandler('Apply changes ...')
|
939 | 935 | ctx.project.do(changes, task_handle=progress.handle)
|
940 | 936 | reload_changes(changes)
|
941 |
| - |
942 |
| -# pylama:ignore=W1401,E1120,D |
0 commit comments