forked from VimPlug/jedi
New "with ignored(*exceptions)" context manager
This commit is contained in:
@@ -12,11 +12,11 @@ following functions (sometimes bug-prone):
|
||||
- extract variable
|
||||
- inline variable
|
||||
"""
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
import difflib
|
||||
|
||||
from jedi import common
|
||||
from jedi import modules
|
||||
from jedi import helpers
|
||||
from jedi import parsing_representation as pr
|
||||
@@ -168,7 +168,7 @@ def inline(script):
|
||||
dct = {}
|
||||
|
||||
definitions = script.goto()
|
||||
try:
|
||||
with common.ignored(AssertionError):
|
||||
assert len(definitions) == 1
|
||||
stmt = definitions[0].definition
|
||||
related_names = script.related_names()
|
||||
@@ -202,7 +202,4 @@ def inline(script):
|
||||
else:
|
||||
new_lines.pop(index)
|
||||
|
||||
except AssertionError:
|
||||
pass
|
||||
|
||||
return Refactoring(dct)
|
||||
|
||||
Reference in New Issue
Block a user