From 9ccb596f93e80cc74ab38cda8a19e5e68689d044 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 13 Apr 2020 23:15:42 +0200 Subject: [PATCH] Extract now properly validates line/column and those two params are required --- jedi/api/__init__.py | 5 +++-- test/refactor/extract_function.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 8da34551..0a385eff 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -687,8 +687,7 @@ class Script(object): return refactoring.rename(self._inference_state, definitions, new_name) @_no_python2_support - @validate_line_column - def extract_variable(self, line=None, column=None, **kwargs): + def extract_variable(self, line, column, **kwargs): """ Moves an expression to a new statemenet. @@ -715,6 +714,7 @@ class Script(object): """ return self._extract_variable(line, column, **kwargs) # Python 2... + @validate_line_column def _extract_variable(self, line, column, new_name, until_line=None, until_column=None): if until_line is None and until_column is None: until_pos = None @@ -764,6 +764,7 @@ class Script(object): """ return self._extract_function(line, column, **kwargs) # Python 2... + @validate_line_column def _extract_function(self, line, column, new_name, until_line=None, until_column=None): if until_line is None and until_column is None: until_pos = None diff --git a/test/refactor/extract_function.py b/test/refactor/extract_function.py index 04bdbded..36d09474 100644 --- a/test/refactor/extract_function.py +++ b/test/refactor/extract_function.py @@ -300,7 +300,7 @@ def x(v1): x # -------------------------------------------------- in-class-range-1 class X1: - #? 11 text {'new_name': 'f', 'until_line': 4} + #? 9 text {'new_name': 'f', 'until_line': 4} a = 3 c = a + 2 # ++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -311,7 +311,7 @@ def f(): class X1: - #? 11 text {'new_name': 'f', 'until_line': 4} + #? 9 text {'new_name': 'f', 'until_line': 4} c = f() # -------------------------------------------------- in-method-range-1 glob1 = 1