summaryrefslogtreecommitdiff
path: root/checkers/utils.py
diff options
context:
space:
mode:
authorsylvain thenault <sylvain.thenault@logilab.fr>2009-03-06 15:19:26 +0100
committersylvain thenault <sylvain.thenault@logilab.fr>2009-03-06 15:19:26 +0100
commit2c2c07af74b64ddaf6ce4100369ac1b0b9d11708 (patch)
tree454370a41a115f58e760f73dd1ae3129aa3ae3e6 /checkers/utils.py
parenteeef77af9988f0c5eb9d684890c66a0e877f53f6 (diff)
downloadpylint-2c2c07af74b64ddaf6ce4100369ac1b0b9d11708.tar.gz
astng2 support
Diffstat (limited to 'checkers/utils.py')
-rw-r--r--checkers/utils.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/checkers/utils.py b/checkers/utils.py
index 860999d..6a20b71 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -25,10 +25,10 @@ from logilab.astng.utils import are_exclusive
try:
# python >= 2.4
COMP_NODE_TYPES = (astng.ListComp, astng.GenExpr)
- FOR_NODE_TYPES = (astng.For, astng.ListCompFor, astng.GenExprFor)
+ FOR_NODE_TYPES = (astng.For, astng.Comprehension, astng.Comprehension)
except AttributeError:
COMP_NODE_TYPES = astng.ListComp
- FOR_NODE_TYPES = (astng.For, astng.ListCompFor)
+ FOR_NODE_TYPES = (astng.For, astng.Comprehension)
def safe_infer(node):
"""return the infered value for the given node.
@@ -56,23 +56,21 @@ def is_super(node):
def is_error(node):
"""return true if the function does nothing but raising an exception"""
- for child_node in node.code.getChildNodes():
+ for child_node in node.code.get_children():
if isinstance(child_node, astng.Raise):
return True
return False
-def is_raising(stmt):
- """return true if the given statement node raise an exception
- """
- for node in stmt.nodes:
+def is_raising(body):
+ """return true if the given statement node raise an exception"""
+ for node in body:
if isinstance(node, astng.Raise):
return True
return False
-def is_empty(node):
+def is_empty(body):
"""return true if the given node does nothing but 'pass'"""
- children = node.getChildNodes()
- return len(children) == 1 and isinstance(children[0], astng.Pass)
+ return len(body) == 1 and isinstance(body[0], astng.Pass)
builtins = __builtins__.copy()
SPECIAL_BUILTINS = ('__builtins__',) # '__path__', '__file__')