Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(11)  |  Call(5)  |  Derive(0)  |  Import(6)
Display a directed graph of the Component structure of x

:param x: A Component or Manager to graph
:type  x: Component or Manager

:param name: A name for the graph (defaults to x's name)
:type  name: str

@return: A directed graph representing x's Component structure.
@rtype:  str

        def graph(x, name=None):
    """Display a directed graph of the Component structure of x

    :param x: A Component or Manager to graph
    :type  x: Component or Manager

    :param name: A name for the graph (defaults to x's name)
    :type  name: str

    @return: A directed graph representing x's Component structure.
    @rtype:  str
    """

    networkx = tryimport("networkx")
    pygraphviz = tryimport("pygraphviz")
    plt = tryimport("matplotlib.pyplot", "pyplot")

    if networkx is not None and pygraphviz is not None and plt is not None:
        graph_edges = []
        for (u, v, d) in edges(x):
            graph_edges.append((u.name, v.name, float(d)))

        g = networkx.DiGraph()
        g.add_weighted_edges_from(graph_edges)

        elarge = [(u, v) for (u, v, d) in g.edges(data=True)
                  if d["weight"] > 3.0]
        esmall = [(u, v) for (u, v, d) in g.edges(data=True)
                  if d["weight"] <= 3.0]

        pos = networkx.spring_layout(g)  # positions for all nodes

        # nodes
        networkx.draw_networkx_nodes(g, pos, node_size=700)

        # edges
        networkx.draw_networkx_edges(g, pos, edgelist=elarge, width=1)
        networkx.draw_networkx_edges(
            g, pos, edgelist=esmall, width=1,
            alpha=0.5, edge_color="b", style="dashed"
        )

        # labels
        networkx.draw_networkx_labels(
            g, pos, font_size=10, font_family="sans-serif"
        )

        plt.axis("off")

        plt.savefig("{0:s}.png".format(name or x.name))
        networkx.write_dot(g, "{0:s}.dot".format(name or x.name))

        plt.clf()

    def printer(d, x):
        return "%s* %s" % (" " * d, x)

    return "\n".join(walk(x, printer))
        


src/c/o/cocy-0.1.12/sampleapps/media_renderer/server.py   cocy(Download)
    media_renderer = DummyPlayer().register(application)
 
    from circuits.tools import graph
    print graph(application)
    application.run()

src/c/o/cocy-0.1.12/sampleapps/binary_light/server.py   cocy(Download)
    BinaryLightPortlet(binary_light).register(portal)
 
    from circuits.tools import graph
    print graph(application)
    application.run()

src/c/i/circuits-3.0.0.dev/circuits/web/main.py   circuits(Download)
 
from circuits.core.pollers import Select
from circuits.tools import inspect, graph
from circuits import Component, Manager, Debugger
from circuits import __version__ as systemVersion
 
    if opts.debug:
        print(graph(manager, name="circuits.web"))
        print()
        print(inspect(manager))

src/c/i/circuits-3.0.0.dev/docs/source/tutorial/005.py   circuits(Download)
#!/usr/bin/env python
 
from circuits import Component
from circuits.tools import graph
 
    def started(self, *args):
        print(graph(self.root))
 
class Bob(Component):
 

src/k/d/kdb-1.0.2/kdb/plugins/stats.py   kdb(Download)
 
from circuits import handler, Component
from circuits.tools import graph, inspect
 
from pymills.utils import MemoryStats

src/c/i/circuits-minpor-0.3/tests/TestPortal.py   circuits-minpor(Download)
    ServerTimePortlet().register(application)
 
    from circuits.tools import graph
    print graph(application)
    application.run()