forked from VimPlug/jedi
corrected indent of some extract functions
This commit is contained in:
@@ -1865,6 +1865,7 @@ class PyFuzzyParser(object):
|
|||||||
self.start_pos[0])
|
self.start_pos[0])
|
||||||
# returns
|
# returns
|
||||||
elif tok in ['return', 'yield']:
|
elif tok in ['return', 'yield']:
|
||||||
|
s = self.start_pos
|
||||||
self.freshscope = False
|
self.freshscope = False
|
||||||
# add returns to the scope
|
# add returns to the scope
|
||||||
func = self.scope.get_parent_until(Function)
|
func = self.scope.get_parent_until(Function)
|
||||||
@@ -1876,6 +1877,8 @@ class PyFuzzyParser(object):
|
|||||||
stmt.parent = set_parent_scope
|
stmt.parent = set_parent_scope
|
||||||
try:
|
try:
|
||||||
func.returns.append(stmt)
|
func.returns.append(stmt)
|
||||||
|
# start_pos is the one of the return statement
|
||||||
|
stmt.start_pos = s
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
debug.warning('return in non-function')
|
debug.warning('return in non-function')
|
||||||
# globals
|
# globals
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ def extract(script, new_name):
|
|||||||
# TODO care for multiline extracts
|
# TODO care for multiline extracts
|
||||||
dct = {}
|
dct = {}
|
||||||
if user_stmt:
|
if user_stmt:
|
||||||
indent = user_stmt.start_pos[0]
|
|
||||||
pos = script.pos
|
pos = script.pos
|
||||||
line_index = pos[0] - 1
|
line_index = pos[0] - 1
|
||||||
import parsing
|
import parsing
|
||||||
@@ -141,6 +140,7 @@ def extract(script, new_name):
|
|||||||
text = '(%s)' % text
|
text = '(%s)' % text
|
||||||
|
|
||||||
# add new line before statement
|
# add new line before statement
|
||||||
|
indent = user_stmt.start_pos[1]
|
||||||
new = "%s%s = %s" % (' ' * indent, new_name, text)
|
new = "%s%s = %s" % (' ' * indent, new_name, text)
|
||||||
new_lines.insert(line_index, new)
|
new_lines.insert(line_index, new)
|
||||||
dct[script.source_path] = script.source_path, old_lines, new_lines
|
dct[script.source_path] = script.source_path, old_lines, new_lines
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def test():
|
|||||||
+ 1)
|
+ 1)
|
||||||
# +++
|
# +++
|
||||||
def test():
|
def test():
|
||||||
x = ((30 + b, c) + 1
|
x = ((30 + b, c)
|
||||||
+ 1)
|
+ 1)
|
||||||
return test(x
|
return test(1, x
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user