1
0
forked from VimPlug/jedi

Separate some Generator stuff.

This commit is contained in:
Dave Halter
2014-11-12 13:42:24 +01:00
parent 65f182ff0d
commit 65c18f143c
2 changed files with 15 additions and 13 deletions

View File

@@ -155,9 +155,9 @@ def _check_for_exception_catch(evaluator, jedi_obj, exception, payload=None):
return True
return False
def check_hasattr(stmt):
expression_list = stmt.expression_list()
def check_hasattr(node):
try:
assert False
assert len(expression_list) == 1
call = expression_list[0]
assert isinstance(call, pr.Call) and str(call.name) == 'hasattr'
@@ -183,8 +183,8 @@ def _check_for_exception_catch(evaluator, jedi_obj, exception, payload=None):
if obj.isinstance(pr.TryStmt) and check_try_for_except(obj):
return True
# hasattr check
if exception == AttributeError and obj.command in ('if', 'while'):
if obj.inputs and check_hasattr(obj.inputs[0]):
if exception == AttributeError and obj.isinstance(pr.IfStmt, pr.WhileStmt):
if check_hasattr(obj.children[1]):
return True
obj = obj.parent