diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index be42a863..4ae3b17d 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -545,21 +545,22 @@ class Script(object): string. :rtype: :class:`refactoring.Refactoring` """ - return self._extract_variable(line, column, **kwargs) + return self._extract_variable(line, column, **kwargs) # Python 2... - def _extract_variable(self, line, column, new_name): # Python 2... + def _extract_variable(self, line, column, new_name, until_line=None, until_column=None): raise NotImplementedError def extract_function(self, line=None, column=None, **kwargs): """ """ - return self._extract_method(line, column, **kwargs) + return self._extract_method(line, column, **kwargs) # Python 2... - def _extract_function(self, line, column, new_name): # Python 2... + def _extract_function(self, line, column, new_name, until_line=None, until_column=None): raise NotImplementedError - def inline_variable(self, line=None, column=None, until_line=None, until_column=None): + def inline(self, line=None, column=None): """ + Inlines a variable under the cursor. """ raise NotImplementedError diff --git a/test/refactor/extract.py b/test/refactor/extract_variable.py similarity index 91% rename from test/refactor/extract.py rename to test/refactor/extract_variable.py index 1317a354..1ddcf3f3 100644 --- a/test/refactor/extract.py +++ b/test/refactor/extract_variable.py @@ -5,6 +5,7 @@ def test(): # ++++++++++++++++++++++++++++++++++++++++++++++++++ def test(): + #? 35 {'new_name': 'a'} a = (30 + b, c) + 1 return test(100, a) @@ -16,6 +17,7 @@ def test(): # ++++++++++++++++++++++++++++++++++++++++++++++++++ def test(): + #? 25 {'new_name': 'a'} a = 30 + b return test(100, (a, c) + 1) @@ -27,6 +29,7 @@ def test(): + 1) # ++++++++++++++++++++++++++++++++++++++++++++++++++ def test(): + #? 30 {'new_name': 'a'} x = ((30 + b, c) + 1) return test(1, x @@ -40,6 +43,7 @@ def test(): + 1) # ++++++++++++++++++++++++++++++++++++++++++++++++++ def test(): + #? 25 {'new_name': 'a'} x = 30 + b return test(1, (x, c) + 1) diff --git a/test/refactor/inline.py b/test/refactor/inline.py index 2679b998..b4054644 100644 --- a/test/refactor/inline.py +++ b/test/refactor/inline.py @@ -1,18 +1,20 @@ -# -------------------------------------------------- simple +# -------------------------------------------------- simple-1 def test(): #? 4 a = (30 + b, c) + 1 return test(100, a) # ++++++++++++++++++++++++++++++++++++++++++++++++++ def test(): + #? 4 return test(100, (30 + b, c) + 1) -# -------------------------------------------------- simple +# -------------------------------------------------- simple-2 if 1: #? 4 a = 1, 2 return test(100, a) # ++++++++++++++++++++++++++++++++++++++++++++++++++ if 1: + #? 4 return test(100, (1, 2))