Changed is_node so it can actually deal with InstanceElements.

This commit is contained in:
Dave Halter
2014-11-13 01:15:44 +01:00
parent 1ab67ebbba
commit 541b8872d0
2 changed files with 9 additions and 4 deletions

View File

@@ -57,9 +57,13 @@ SCOPE_CONTENTS = 'asserts', 'subscopes', 'imports', 'statements', 'returns'
def is_node(node, *symbol_names):
if isinstance(node, Node):
try:
type = node.type
except AttributeError:
pass
else:
for symbol_name in symbol_names:
if getattr(python_symbols, symbol_name) == node.type:
if getattr(python_symbols, symbol_name) == type:
return True
return False

View File

@@ -327,9 +327,10 @@ except ImportError as i_a:
try:
import math
except ImportError, i_b:
#? ['i_b']
# TODO check this only in Python2
##? ['i_b']
i_b
#? ImportError()
##? ImportError()
i_b