New "with ignored(*exceptions)" context manager
This commit is contained in:
1 parent
24573c5ef2
commit
f98b0d7b6f
13 files changed
+51
-73
No files matched your search
+2
-5
@@ -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