예제 #1
0
파일: tree.py 프로젝트: alkorzt/pypy
 def view(self):
     from dotviewer import graphclient
     content = ["digraph G{"]
     content.extend(self.dot())
     content.append("}")
     p = py.test.ensuretemp("automaton").join("temp.dot")
     p.write("\n".join(content))
     graphclient.display_dot_file(str(p))
예제 #2
0
 def view(self):
     from dotviewer import graphclient
     content = ["digraph G{"]
     content.extend(self.dot())
     content.append("}")
     p = py.test.ensuretemp("automaton").join("temp.dot")
     p.write("\n".join(content))
     graphclient.display_dot_file(str(p))
예제 #3
0
def test_display_dot_file():
    from dotviewer.graphclient import display_dot_file
    print "=== display_dot_file(%s) with GRAPHSERVER=%s" % (
        FILENAME,
        os.environ.get('GRAPHSERVER', ''),
    )
    display_dot_file(udir.join(FILENAME))
    print "=== display_dot_file finished"
예제 #4
0
파일: parser.py 프로젝트: lvyitian/pypy
 def view(self):
     from dotviewer import graphclient
     import pytest
     r = ["digraph G {"]
     self._dot(r)
     r.append("}")
     p = pytest.ensuretemp("pyparser").join("temp.dot")
     p.write("\n".join(r))
     graphclient.display_dot_file(str(p))
예제 #5
0
파일: tree.py 프로젝트: bivab/eqsat
 def view(self):
     import py
     from dotviewer import graphclient
     content = ["digraph G{"]
     seen = set()
     content.extend(self._dot(seen))
     content.append("}")
     p = py.path.local.make_numbered_dir("eqsat-").join("temp.dot")
     p.write("\n".join(content))
     graphclient.display_dot_file(str(p))
예제 #6
0
 def view(self):
     from dotviewer import graphclient
     p = py.test.ensuretemp("automaton").join("temp.dot")
     dot = self.dot()
     p.write(dot)
     plainpath = p.new(ext="plain")
     try:
         py.process.cmdexec("neato -Tplain %s > %s" % (p, plainpath))
     except py.error.Error:
         py.process.cmdexec("fdp -Tplain %s > %s" % (p, plainpath))
     graphclient.display_dot_file(str(plainpath))
예제 #7
0
 def view(self):
     from dotviewer import graphclient
     p = py.test.ensuretemp("automaton").join("temp.dot")
     dot = self.dot()
     p.write(dot)
     plainpath = p.new(ext="plain")
     try:
         py.process.cmdexec("neato -Tplain %s > %s" % (p, plainpath))
     except py.error.Error:
         py.process.cmdexec("fdp -Tplain %s > %s" % (p, plainpath))
     graphclient.display_dot_file(str(plainpath))
예제 #8
0
def view(*objects, **names):
    from dotviewer import graphclient
    content = ["digraph G{"]
    seen = set()
    for obj in list(objects) + names.values():
        content.extend(obj._dot(seen))
    for key, value in names.items():
        content.append("%s -> %s" % (key, id(value)))
    content.append("}")
    p = py.test.ensuretemp("prolog").join("temp.dot")
    p.write("\n".join(content))
    graphclient.display_dot_file(str(p))
예제 #9
0
def view(states, final):
    from dotviewer import graphclient
    import tempfile
    r = ["digraph G {"]
    _dot(states, final, r)
    r.append("}")
    with tempfile.NamedTemporaryFile() as f:
        fn = f.name
        print fn
        with open(fn, "w") as f:
            f.write("\n".join(r))
        graphclient.display_dot_file(fn)
예제 #10
0
def view(*objects, **names):
    from dotviewer import graphclient
    content = ["digraph G{"]
    seen = set()
    for obj in list(objects) + names.values():
        content.extend(obj._dot(seen))
    for key, value in names.items():
        content.append("%s -> %s" % (key, id(value)))
    content.append("}")
    p = py.test.ensuretemp("prolog").join("temp.dot")
    p.write("\n".join(content))
    graphclient.display_dot_file(str(p))
예제 #11
0
파일: simpleast.py 프로젝트: stepahn/slf
 def view(self):
     """ Calling this method gives a graphical representation of the ast
     graph.  Needs a checkout of
     http://codespeak.net/svn/pypy/trunk/dotviewer in the current directory
     as well as graphviz (http://graphviz.org) installed. """
     from dotviewer import graphclient
     content = ["digraph G{"]
     content.extend(self.dot())
     content.append("}")
     p = py.test.ensuretemp("simpleparser").join("temp.dot")
     p.write("\n".join(content))
     graphclient.display_dot_file(str(p))
예제 #12
0
def display1(filename, lock, errors):
    try:
        try:
            from dotviewer.graphclient import display_dot_file
            print "=== display_dot_file(%s) with GRAPHSERVER=%s" % (
                filename, os.environ.get('GRAPHSERVER', ''),)
            display_dot_file(udir.join(filename))
            print "=== display_dot_file finished"
        except:
            errors.append(sys.exc_info())
    finally:
        lock.release()
예제 #13
0
파일: rope.py 프로젝트: griels/pypy-sc
def view(objs):
    from dotviewer import graphclient
    content = ["digraph G{"]
    seen = {}
    for i, obj in enumerate(objs):
        if obj is None:
            content.append(str(i) + ";")
        else:
            content.extend(obj.dot(seen, toplevel=True))
    content.append("}")
    p = py.test.ensuretemp("automaton").join("temp.dot")
    p.write("\n".join(content))
    graphclient.display_dot_file(str(p))
예제 #14
0
파일: rope.py 프로젝트: Darriall/pypy
def view(objs):
    from dotviewer import graphclient
    content = ["digraph G{"]
    seen = {}
    for i, obj in enumerate(objs):
        if obj is None:
            content.append(str(i) + ";")
        else:
            content.extend(obj.dot(seen, toplevel=True))
    content.append("}")
    p = py.test.ensuretemp("automaton").join("temp.dot")
    p.write("\n".join(content))
    graphclient.display_dot_file(str(p))
예제 #15
0
def display1(filename, lock, errors):
    try:
        try:
            from dotviewer.graphclient import display_dot_file
            print "=== display_dot_file(%s) with GRAPHSERVER=%s" % (
                filename,
                os.environ.get('GRAPHSERVER', ''),
            )
            display_dot_file(udir.join(filename))
            print "=== display_dot_file finished"
        except:
            errors.append(sys.exc_info())
    finally:
        lock.release()
예제 #16
0
 def view(self):
     from dotviewer import graphclient
     content = ["digraph G{"]
     content.extend(self.dot())
     content.append("}")
     try:
         p = py.test.ensuretemp("automaton").join("temp.dot")
         remove = False
     except AttributeError:  # pytest lacks ensuretemp, make a normal one
         p = py.path.local.mkdtemp().join('automaton.dot')
         remove = True
     p.write("\n".join(content))
     graphclient.display_dot_file(str(p))
     if remove:
         p.dirpath().remove()
예제 #17
0
파일: tree.py 프로젝트: Debug-Orz/Sypy
 def view(self):
     from dotviewer import graphclient
     content = ["digraph G{"]
     content.extend(self.dot())
     content.append("}")
     try:
         p = py.test.ensuretemp("automaton").join("temp.dot")
         remove = False
     except AttributeError: # pytest lacks ensuretemp, make a normal one
         p = py.path.local.mkdtemp().join('automaton.dot')
         remove = True
     p.write("\n".join(content))
     graphclient.display_dot_file(str(p))
     if remove:
         p.dirpath().remove()
예제 #18
0
def main(args=sys.argv[1:]):
    # make the dotviewer *package* importable
    sys.path.insert(0, PARENTDIR)

    options, args = getopt.getopt(args, 's:h', ['server=', 'help'])
    server_addr = None
    for option, value in options:
        if option in ('-h', '--help'):
            print(__doc__, file=sys.stderr)
            sys.exit(2)
        if option in ('-s', '--server'):  # deprecated
            server_addr = value
    if not args and server_addr is None:
        print(__doc__, file=sys.stderr)
        sys.exit(2)
    for filename in args:
        from dotviewer import graphclient
        graphclient.display_dot_file(filename)
    if server_addr is not None:
        from dotviewer import graphserver
        graphserver.listen_server(server_addr)
예제 #19
0
파일: __main__.py 프로젝트: Mu-L/pypy
# alternative entry point when packaged
from __future__ import absolute_import

import argparse

from dotviewer import graphclient

parser = argparse.ArgumentParser(description='Show a graphviz file')
parser.add_argument('filename',
                    metavar='FILE',
                    help='a .dot file or a .plain file to show')

if __name__ == '__main__':
    args = parser.parse_args()
    graphclient.display_dot_file(args.filename)
예제 #20
0
def view(*objects, **names):
    from dotviewer import graphclient
    import py
    p = py.path.local().mkdtemp().join("lamb").join("temp.dot")
    p.write(u"\n".join(graph(objects, names)).encode('utf-8'), 'wb')
    graphclient.display_dot_file(p, save_tmp_file='/tmp/foo/out.dot')
예제 #21
0
def test_display_dot_file():
    from dotviewer.graphclient import display_dot_file
    print "=== display_dot_file(%s) with GRAPHSERVER=%s" % (
        FILENAME, os.environ.get('GRAPHSERVER', ''),)
    display_dot_file(udir.join(FILENAME))
    print "=== display_dot_file finished"