#!/usr/bin/python
#
-# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2010-2012 W. Trevor King <wking@drexel.edu>
#
# This file is part of Hooke.
#
-# Hooke is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation, either
-# version 3 of the License, or (at your option) any later version.
+# Hooke is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
-# Hooke is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
+# Hooke is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with Hooke. If not, see
Serialize the tree with depth marking branches.
>>> for depth,node in a.thread():
- ... print "%*s" % (2*depth+1, node.n)
+ ... print('{}{}'.format(' '*2*depth, node.n))
a
b
d
branch splits.
>>> for depth,node in a.thread(flatten=True):
- ... print "%*s" % (2*depth+1, node.n)
+ ... print('{}{}'.format(' '*2*depth, node.n))
a
b
d
if __name__ == '__main__':
pt = python_tree(root_path='../hooke', root_modname='hooke')
for node in pt.traverse():
- print node.modname
+ print(node.modname)
make_module_txt(node.modname, [c.modname for c in node])