/usr/lib/python2.7/dist-packages/dogtail/dump.py is in python-dogtail 0.9.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | """Utility functions for 'dumping' trees of Node objects.
Author: Zack Cerza <zcerza@redhat.com>"""
__author__ = "Zack Cerza <zcerza@redhat.com>"
from __builtin__ import file
spacer = ' '
def plain(node, fileName=None):
"""
Plain-text dump. The hierarchy is represented through indentation.
"""
def crawl(node, depth):
dump(node, depth)
for action in node.actions.values():
dump(action, depth + 1)
for child in node.children:
crawl(child, depth + 1)
def dumpFile(item, depth):
_file.write(spacer * depth + str(item) + '\n')
def dumpStdOut(item, depth):
print(spacer * depth + str(item))
if fileName:
dump = dumpFile
_file = file(fileName, 'w')
else:
dump = dumpStdOut
crawl(node, 0)
|