def method2format(output, _format='png', mx=None, raw=None):
 try:
  import pydot
 except ImportError:
  error('module pydot not found')
 buff = 'digraph {\n'
 buff += 'graph [rankdir=TB]\n'
 buff += 'node [shape=plaintext]\n'
 if raw:
  data = raw
 else:
  data = method2dot(mx)
 buff += (('subgraph cluster_' + hashlib.md5(output).hexdigest()) + (' {\nlabel="%s"\n' % data['name']))
 buff += data['nodes']
 buff += '}\n'
 buff += data['edges']
 buff += '}\n'
 d = pydot.graph_from_dot_data(buff)
 if d:
  getattr(d, ('write_' + _format.lower()))(output)

def method2format ( output , _format = 'png' , mx = None , raw = None ) : try : import pydot except ImportError : error ( 'module pydot not found' ) buff = 'digraph {\n' buff += 'graph [rankdir=TB]\n' buff += 'node [shape=plaintext]\n' if raw : data = raw else : data = method2dot ( mx ) buff += ( ( 'subgraph cluster_' + hashlib . md5 ( output ) . hexdigest ( ) ) + ( ' {\nlabel="%s"\n' % data [ 'name' ] ) ) buff += data [ 'nodes' ] buff += '}\n' buff += data [ 'edges' ] buff += '}\n' d = pydot . graph_from_dot_data ( buff ) if d : getattr ( d , ( 'write_' + _format . lower ( ) ) ) ( output )
export method to a specific file format .