Extract now properly validates line/column and those two params are required

This commit is contained in:
Dave Halter
2020-04-13 23:15:42 +02:00
parent 25db8de0da
commit 9ccb596f93
2 changed files with 5 additions and 4 deletions

View File

@@ -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

View File

@@ -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