summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2014-10-27 00:35:18 +0200
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2014-10-27 00:35:18 +0200
commit09cd8b7eefb021f2d8327e42614bca7cbb8915f2 (patch)
treee54d46837b31f00197106ad6f104f3444c65b521 /utils.py
parent1c5cab5ce9c6bf5c2a161748d03a5fa44a69e15e (diff)
downloadastroid-git-09cd8b7eefb021f2d8327e42614bca7cbb8915f2.tar.gz
Make the source compatible with Python 2.7 and 3.3+.
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/utils.py b/utils.py
index 936c8b5a..ae72a92c 100644
--- a/utils.py
+++ b/utils.py
@@ -18,6 +18,7 @@
"""this module contains some utilities to navigate in the tree or to
extract information from it
"""
+from __future__ import print_function
__docformat__ = "restructuredtext en"
@@ -109,22 +110,22 @@ def _check_children(node):
for child in node.get_children():
ok = False
if child is None:
- print "Hm, child of %s is None" % node
+ print("Hm, child of %s is None" % node)
continue
if not hasattr(child, 'parent'):
- print " ERROR: %s has child %s %x with no parent" % (
- node, child, id(child))
+ print(" ERROR: %s has child %s %x with no parent" % (
+ node, child, id(child)))
elif not child.parent:
- print " ERROR: %s has child %s %x with parent %r" % (
- node, child, id(child), child.parent)
+ print(" ERROR: %s has child %s %x with parent %r" % (
+ node, child, id(child), child.parent))
elif child.parent is not node:
- print " ERROR: %s %x has child %s %x with wrong parent %s" % (
- node, id(node), child, id(child), child.parent)
+ print(" ERROR: %s %x has child %s %x with wrong parent %s" % (
+ node, id(node), child, id(child), child.parent))
else:
ok = True
if not ok:
- print "lines;", node.lineno, child.lineno
- print "of module", node.root(), node.root().name
+ print("lines;", node.lineno, child.lineno)
+ print("of module", node.root(), node.root().name)
raise AstroidBuildingException
_check_children(child)