gak / pycallgraph

pycallgraph is a Python module that creates call graphs for Python programs.
GNU General Public License v2.0
1.83k stars 335 forks source link

(suggestion) add output filename as the same as inputfile #151

Closed techbliss closed 7 years ago

techbliss commented 8 years ago

i made some small changes so output file have same name as the input one.

file graphviz.py

from __future__ import division
import tempfile
import os
import sys
import textwrap
import subprocess as sub

from ..metadata import __version__
from ..exceptions import PyCallGraphException
from ..color import Color
from .output import Output
file_minus_extension = os.path.splitext(os.path.basename(os.path.realpath(sys.argv[3]))) #split filename + extension in two

class GraphvizOutput(Output):

    def __init__(self, **kwargs):
        g = globals()
        self.png = '.png' # png extension
        self.tool = 'dot'
        self.output_file = str(file_minus_extension [0] +self.png) # filename + adding png to the end

test case

C:\Python27\Lib\site-packages\PyQt4\examples\richtext>pycallgraph graphviz -- ./syntaxhighlighter.pyw

output

emmikhr - imgur

techbliss commented 7 years ago

closing to no respond