forked from VimPlug/jedi
Make extract yield error message better
This commit is contained in:
@@ -297,11 +297,11 @@ def _check_for_non_extractables(nodes):
|
|||||||
try:
|
try:
|
||||||
children = n.children
|
children = n.children
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
if n.value in ('return', 'yield'):
|
if n.value == 'return':
|
||||||
raise RefactoringError(
|
raise RefactoringError(
|
||||||
'Can only extract %s statements if they are at the end.'
|
'Can only extract return statements if they are at the end.')
|
||||||
% n.value
|
if n.value == 'yield':
|
||||||
)
|
raise RefactoringError('Cannot extract yield statements.')
|
||||||
else:
|
else:
|
||||||
_check_for_non_extractables(children)
|
_check_for_non_extractables(children)
|
||||||
|
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ def x():
|
|||||||
return
|
return
|
||||||
pass
|
pass
|
||||||
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
Can only extract yield statements if they are at the end.
|
Cannot extract yield statements.
|
||||||
# -------------------------------------------------- random-yield-2
|
# -------------------------------------------------- random-yield-2
|
||||||
def x():
|
def x():
|
||||||
#? 0 error {'new_name': 'ab', 'until_line': 4, 'until_column': 10}
|
#? 0 error {'new_name': 'ab', 'until_line': 4, 'until_column': 10}
|
||||||
@@ -429,4 +429,4 @@ def x():
|
|||||||
finally:
|
finally:
|
||||||
pass
|
pass
|
||||||
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
Can only extract yield statements if they are at the end.
|
Cannot extract yield statements.
|
||||||
|
|||||||
Reference in New Issue
Block a user