521 lines
15 KiB
Python
Raw Normal View History

"""Graphviz's dot language parser.
The dotparser parses graphviz files in dot and dot files and transforms them
into a class representation defined by pydot.
The module needs pyparsing (tested with version 1.2.2) and pydot
Author: Michael Krause <michael@krause-software.de>
Fixes by: Ero Carrera <ero@dkbza.org>
"""
2013-07-26 03:06:12 -07:00
from __future__ import division, print_function
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
__author__ = ['Michael Krause', 'Ero Carrera']
__license__ = 'MIT'
import sys
2015-02-25 19:58:39 +01:00
import pydot_ng as pydot
import codecs
from pyparsing import __version__ as pyparsing_version
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
from pyparsing import (
nestedExpr, Literal, CaselessLiteral, Word, OneOrMore,
Forward, Group, Optional, Combine, nums, restOfLine,
cStyleComment, alphanums, printables, ParseException,
ParseResults, CharsNotIn, QuotedString
)
2013-07-26 03:06:12 -07:00
PY3 = not sys.version_info < (3, 0, 0)
if PY3:
basestring = str
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
class P_AttrList:
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def __init__(self, toks):
self.attrs = {}
i = 0
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
while i < len(toks):
attrname = toks[i]
if i + 2 < len(toks) and toks[i + 1] == '=':
attrvalue = toks[i + 2]
i += 3
else:
attrvalue = None
i += 1
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
self.attrs[attrname] = attrvalue
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.attrs)
class DefaultStatement(P_AttrList):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def __init__(self, default_type, attrs):
self.default_type = default_type
self.attrs = attrs
def __repr__(self):
return "%s(%s, %r)" % (
self.__class__.__name__,
self.default_type, self.attrs
)
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
top_graphs = list()
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def push_top_graph_stmt(str, loc, toks):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
attrs = {}
g = None
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
for element in toks:
if (isinstance(element, (ParseResults, tuple, list)) and
len(element) == 1 and isinstance(element[0], basestring)):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
element = element[0]
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if element == 'strict':
attrs['strict'] = True
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif element in ['graph', 'digraph']:
attrs = {}
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
g = pydot.Dot(graph_type=element, **attrs)
attrs['type'] = element
2013-07-26 00:15:57 -07:00
top_graphs.append(g)
2013-07-26 00:15:57 -07:00
elif isinstance(element, basestring):
g.set_name(element)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(element, pydot.Subgraph):
g.obj_dict['attributes'].update(element.obj_dict['attributes'])
g.obj_dict['edges'].update(element.obj_dict['edges'])
g.obj_dict['nodes'].update(element.obj_dict['nodes'])
g.obj_dict['subgraphs'].update(element.obj_dict['subgraphs'])
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
g.set_parent_graph(g)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(element, P_AttrList):
attrs.update(element.attrs)
elif isinstance(element, (ParseResults, list)):
add_elements(g, element)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
else:
2013-07-26 03:06:12 -07:00
raise ValueError("Unknown element statement: %r " % element)
2013-07-26 00:15:57 -07:00
for g in top_graphs:
update_parent_graph_hierarchy(g)
2013-07-26 00:15:57 -07:00
if len(top_graphs) == 1:
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return top_graphs[0]
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return top_graphs
def update_parent_graph_hierarchy(g, parent_graph=None, level=0):
if parent_graph is None:
parent_graph = g
2013-07-26 00:15:57 -07:00
for key_name in ('edges',):
if isinstance(g, pydot.frozendict):
item_dict = g
else:
item_dict = g.obj_dict
2013-07-26 00:15:57 -07:00
2013-07-26 03:06:12 -07:00
if key_name not in item_dict:
continue
for key, objs in item_dict[key_name].items():
for obj in objs:
if 'parent_graph' in obj and obj['parent_graph'].get_parent_graph() == g:
if obj['parent_graph'] is g:
pass
else:
obj['parent_graph'].set_parent_graph(parent_graph)
if key_name == 'edges' and len(key) == 2:
for idx, vertex in enumerate(obj['points']):
if isinstance(vertex, (pydot.Graph, pydot.Subgraph, pydot.Cluster)):
vertex.set_parent_graph(parent_graph)
if isinstance(vertex, pydot.frozendict):
if vertex['parent_graph'] is g:
pass
else:
vertex['parent_graph'].set_parent_graph(parent_graph)
def add_defaults(element, defaults):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
d = element.__dict__
for key, value in defaults.items():
if not d.get(key):
d[key] = value
def add_elements(g, toks, defaults_graph=None, defaults_node=None, defaults_edge=None):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if defaults_graph is None:
defaults_graph = {}
if defaults_node is None:
defaults_node = {}
if defaults_edge is None:
defaults_edge = {}
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
for elm_idx, element in enumerate(toks):
if isinstance(element, (pydot.Subgraph, pydot.Cluster)):
add_defaults(element, defaults_graph)
g.add_subgraph(element)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(element, pydot.Node):
add_defaults(element, defaults_node)
g.add_node(element)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(element, pydot.Edge):
add_defaults(element, defaults_edge)
g.add_edge(element)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(element, ParseResults):
for e in element:
add_elements(g, [e], defaults_graph, defaults_node, defaults_edge)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(element, DefaultStatement):
if element.default_type == 'graph':
default_graph_attrs = pydot.Node('graph', **element.attrs)
g.add_node(default_graph_attrs)
elif element.default_type == 'node':
default_node_attrs = pydot.Node('node', **element.attrs)
g.add_node(default_node_attrs)
elif element.default_type == 'edge':
default_edge_attrs = pydot.Node('edge', **element.attrs)
g.add_node(default_edge_attrs)
defaults_edge.update(element.attrs)
else:
2013-07-26 03:06:12 -07:00
raise ValueError("Unknown DefaultStatement: %s " % element.default_type)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(element, P_AttrList):
g.obj_dict['attributes'].update(element.attrs)
else:
2013-07-26 03:06:12 -07:00
raise ValueError("Unknown element statement: %r" % element)
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
2013-07-26 00:15:57 -07:00
def push_graph_stmt(str, loc, toks):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
g = pydot.Subgraph('')
add_elements(g, toks)
return g
def push_subgraph_stmt(str, loc, toks):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
g = pydot.Subgraph('')
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
for e in toks:
if len(e) == 3:
e[2].set_name(e[1])
if e[0] == 'subgraph':
e[2].obj_dict['show_keyword'] = True
return e[2]
else:
if e[0] == 'subgraph':
e[1].obj_dict['show_keyword'] = True
return e[1]
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return g
def push_default_stmt(str, loc, toks):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
# The pydot class instances should be marked as
# default statements to be inherited by actual
# graphs, nodes and edges.
default_type = toks[0][0]
if len(toks) > 1:
attrs = toks[1].attrs
else:
attrs = {}
if default_type in ['graph', 'node', 'edge']:
return DefaultStatement(default_type, attrs)
else:
2013-07-26 03:06:12 -07:00
raise ValueError("Unknown default statement: %r " % toks)
def push_attr_list(str, loc, toks):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
p = P_AttrList(toks)
return p
def get_port(node):
if len(node) > 1:
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if isinstance(node[1], ParseResults):
if len(node[1][0]) == 2:
if node[1][0][0] == ':':
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return node[1][0][1]
return None
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def do_node_ports(node):
node_port = ''
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if len(node) > 1:
node_port = ''.join([str(a) + str(b) for a, b in node[1]])
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return node_port
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def push_edge_stmt(str, loc, toks):
tok_attrs = [a for a in toks if isinstance(a, P_AttrList)]
attrs = {}
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
for a in tok_attrs:
attrs.update(a.attrs)
e = []
if isinstance(toks[0][0], pydot.Graph):
n_prev = pydot.frozendict(toks[0][0].obj_dict)
2013-07-26 00:15:57 -07:00
else:
n_prev = toks[0][0] + do_node_ports(toks[0])
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if isinstance(toks[2][0], ParseResults):
n_next_list = [[n.get_name()] for n in toks[2][0]]
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
for n_next in [n for n in n_next_list]:
n_next_port = do_node_ports(n_next)
e.append(pydot.Edge(n_prev, n_next[0] + n_next_port, **attrs))
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
elif isinstance(toks[2][0], pydot.Graph):
e.append(pydot.Edge(n_prev, pydot.frozendict(toks[2][0].obj_dict), **attrs))
elif isinstance(toks[2][0], pydot.Node):
node = toks[2][0]
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if node.get_port() is not None:
name_port = node.get_name() + ":" + node.get_port()
else:
name_port = node.get_name()
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
e.append(pydot.Edge(n_prev, name_port, **attrs))
elif isinstance(toks[2][0], type('')):
for n_next in [n for n in tuple(toks)[2::2]]:
if isinstance(n_next, P_AttrList) or not isinstance(n_next[0], type('')):
continue
n_next_port = do_node_ports(n_next)
e.append(pydot.Edge(n_prev, n_next[0] + n_next_port, **attrs))
2013-07-26 00:15:57 -07:00
n_prev = n_next[0] + n_next_port
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
else:
# UNEXPECTED EDGE TYPE
pass
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return e
def push_node_stmt(s, loc, toks):
if len(toks) == 2:
attrs = toks[1].attrs
else:
attrs = {}
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
node_name = toks[0]
if isinstance(node_name, list) or isinstance(node_name, tuple):
if len(node_name) > 0:
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
node_name = node_name[0]
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
n = pydot.Node(str(node_name), **attrs)
return n
graphparser = None
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def graph_definition():
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
global graphparser
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if not graphparser:
# punctuation
colon = Literal(":")
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
lbrace = Literal("{")
rbrace = Literal("}")
lbrack = Literal("[")
rbrack = Literal("]")
lparen = Literal("(")
rparen = Literal(")")
equals = Literal("=")
comma = Literal(",")
# dot = Literal(".")
# slash = Literal("/")
# bslash = Literal("\\")
# star = Literal("*")
semi = Literal(";")
at = Literal("@")
minus = Literal("-")
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
# keywords
strict_ = CaselessLiteral("strict")
graph_ = CaselessLiteral("graph")
digraph_ = CaselessLiteral("digraph")
subgraph_ = CaselessLiteral("subgraph")
node_ = CaselessLiteral("node")
edge_ = CaselessLiteral("edge")
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
# token definitions
identifier = Word(alphanums + "_.").setName("identifier")
2013-07-26 00:15:57 -07:00
# dblQuotedString
double_quoted_string = QuotedString('"', multiline=True, unquoteResults=False)
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
2013-07-26 03:06:12 -07:00
noncomma_ = "".join([c for c in printables if c != ","])
alphastring_ = OneOrMore(CharsNotIn(noncomma_ + ' '))
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
def parse_html(s, loc, toks):
return '<%s>' % ''.join(toks[0])
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
opener = '<'
closer = '>'
html_text = nestedExpr(
opener, closer,
(CharsNotIn(opener + closer))
).setParseAction(parse_html).leaveWhitespace()
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
ID = (
identifier | html_text |
double_quoted_string | # .setParseAction(strip_quotes) |
alphastring_
).setName("ID")
2013-07-26 00:15:57 -07:00
float_number = Combine(
Optional(minus) +
OneOrMore(Word(nums + "."))
).setName("float_number")
2013-07-26 00:15:57 -07:00
righthand_id = (float_number | ID).setName("righthand_id")
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
port_angle = (at + ID).setName("port_angle")
2013-07-26 00:15:57 -07:00
port_location = (
OneOrMore(Group(colon + ID)) |
Group(colon + lparen + ID + comma + ID + rparen)
).setName("port_location")
2013-07-26 00:15:57 -07:00
port = (
Group(port_location + Optional(port_angle)) |
Group(port_angle + Optional(port_location))
).setName("port")
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
node_id = (ID + Optional(port))
a_list = OneOrMore(
ID + Optional(equals + righthand_id) + Optional(comma.suppress())
).setName("a_list")
2013-07-26 00:15:57 -07:00
attr_list = OneOrMore(
lbrack.suppress() + Optional(a_list) + rbrack.suppress()
).setName("attr_list")
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
attr_stmt = (Group(graph_ | node_ | edge_) + attr_list).setName("attr_stmt")
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
edgeop = (Literal("--") | Literal("->")).setName("edgeop")
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
stmt_list = Forward()
graph_stmt = Group(
lbrace.suppress() + Optional(stmt_list) +
rbrace.suppress() + Optional(semi.suppress())
).setName("graph_stmt")
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
edge_point = Forward()
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
edgeRHS = OneOrMore(edgeop + edge_point)
edge_stmt = edge_point + edgeRHS + Optional(attr_list)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
subgraph = Group(subgraph_ + Optional(ID) + graph_stmt).setName("subgraph")
2013-07-26 00:15:57 -07:00
edge_point << Group(subgraph | graph_stmt | node_id).setName('edge_point')
2013-07-26 00:15:57 -07:00
node_stmt = (
node_id + Optional(attr_list) + Optional(semi.suppress())
).setName("node_stmt")
2013-07-26 00:15:57 -07:00
assignment = (ID + equals + righthand_id).setName("assignment")
stmt = (
assignment | edge_stmt | attr_stmt |
subgraph | graph_stmt | node_stmt
).setName("stmt")
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
stmt_list << OneOrMore(stmt + Optional(semi.suppress()))
2013-07-26 00:15:57 -07:00
graphparser = OneOrMore((
Optional(strict_) + Group((graph_ | digraph_)) +
Optional(ID) + graph_stmt
).setResultsName("graph"))
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
singleLineComment = Group("//" + restOfLine) | Group("#" + restOfLine)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
# actions
graphparser.ignore(singleLineComment)
graphparser.ignore(cStyleComment)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
assignment.setParseAction(push_attr_list)
a_list.setParseAction(push_attr_list)
edge_stmt.setParseAction(push_edge_stmt)
node_stmt.setParseAction(push_node_stmt)
attr_stmt.setParseAction(push_default_stmt)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
subgraph.setParseAction(push_subgraph_stmt)
graph_stmt.setParseAction(push_graph_stmt)
graphparser.setParseAction(push_top_graph_stmt)
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return graphparser
def parse_dot_data(data):
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
global top_graphs
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
top_graphs = list()
2013-07-26 03:06:12 -07:00
if PY3:
if isinstance(data, bytes):
# this is extremely hackish
try:
idx = data.index(b'charset') + 7
while data[idx] in b' \t\n\r=':
idx += 1
fst = idx
while data[idx] not in b' \t\n\r];,':
idx += 1
charset = data[fst:idx].strip(b'"\'').decode('ascii')
data = data.decode(charset)
except:
data = data.decode('utf-8')
else:
if data.startswith(codecs.BOM_UTF8):
data = data.decode('utf-8')
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
try:
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
graphparser = graph_definition()
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
if pyparsing_version >= '1.2':
graphparser.parseWithTabs()
2013-07-26 00:15:57 -07:00
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
tokens = graphparser.parseString(data)
if len(tokens) == 1:
return tokens[0]
else:
return [g for g in tokens]
2013-07-26 00:15:57 -07:00
2013-07-26 03:06:12 -07:00
except ParseException:
err = sys.exc_info()[1]
print(err.line)
print(" " * (err.column - 1) + "^")
2013-07-26 03:06:12 -07:00
print(err)
Commiting pydot 1.0.2 -The parser has been improved a lot. It passes all of GraphViz's regression tests (which I consider quite an accomplishment seeing the kind of crazy constructs on those ) -Different charsets should now be dealt with properly. -The search of GraphViz's executables has been improved for all platforms. On Windows, paths and registry keys are searched. On Unix now it should exhibit the same behavior as the traditional shell path search. (Thanks Andy Gimblett and many others) -Double-quoted paths in Windows are nor properly handled. The os.path.exists() check fails if a valid path is enclosed within quotes. -'type' keyword has been changed everywhere to 'graph_type' -Better handling of Node/Edge/Graph defaults. Added methods: set_graph_defaults, set_node_defaults, set_edge_defaults, get_graph_defaults, get_node_defaults, get_edge_defaults -Now it's possible to use rank to lay out nodes at the same level graph = pydot.Dot('graphname', graph_type='digraph') subg = pydot.Subgraph('', rank='same') subg.add_node(pydot.Node('a')) graph.add_subgraph(subg) subg.add_node(pydot.Node('b')) subg.add_node(pydot.Node('c')) -Multiple main graphs in a file are now supported, will be returned as a list of graph instances -Handling of shapefiles Dot().set_shape_files() -Added method "add_style()" to the Node class to easily append styles to a node -Attribute lists updated to reflect the available ones in graphviz 2.16 -Added error reporting when rendering graphs with GraphViz executables. There was an often reported problem where the output graphs would have 0 size. In most cases this was due to Graphviz missing a library for a format that pydot assumed to be there. Now the error given by the executable will be reported instead of being silently ignored (Thanks Jarno) -Improved parsing of identifiers -Added non-GraphViz attributes needed by dot2tex -Jose Fonseca contributed a fix dealing with quoted strings the the dot parsing module -setup.py updated so that it's possible to install pydot through Setuptools' easy_install -Edge()'s can be created passing two Node objects as well as, the previously supported, two strings with node names. Warning: when passing two Node instances, the attributes won't be taken into account. The edge will only read the Nodes' names to create an edge, the Nodes must be separately added to the graph so all their attributes are "remembered". -Substituted all str()'s for unicode()'s -It's possible now to manually specify the path to GraphViz's executables in the case they can't be found automatically. The method 'set_graphviz_executables(paths)' will take a dictionary specifying the location of the executables. Please refer to the documentation for usage detailed information. -And too many bugfixes to list... git-svn-id: http://pydot.googlecode.com/svn/trunk@8 06aa9b79-7134-0410-ae7e-c1cd3e483e87
2008-02-14 22:31:48 +00:00
return None