/usr/share/pyshared/pycallgraph/output/pickle.py is in python-pycallgraph 1.0.1-1.
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 34 35 | try:
import cPickle as pickle
except ImportError:
import pickle
from .output import Output
class PickleOutput(Output):
def __init__(self, **kwargs):
self.fp = None
self.output_file = 'pycallgraph.dot'
Output.__init__(self, **kwargs)
@classmethod
def add_arguments(cls, subparsers, parent_parser, usage):
defaults = cls()
subparser = subparsers.add_parser(
'pickle',
help='Dump to a cPickle file for generation later',
parents=[parent_parser], usage=usage,
)
subparser.add_argument(
'-o', '--output-file', type=str, default=defaults.output_file,
help='The generated cPickle file',
)
return subparser
def done(self):
self.prepare_output_file()
pickle.dump(self.tracer, self.fp, pickle.HIGHEST_PROTOCOL)
|