def _node_ports(graph, node):
 portinputs = {}
 portoutputs = {}
 for (u, _, d) in graph.in_edges_iter(node, data=True):
  for (src, dest) in d[u'connect']:
   portinputs[dest] = (u, src)
 for (_, v, d) in graph.out_edges_iter(node, data=True):
  for (src, dest) in d[u'connect']:
   if isinstance(src, tuple):
    srcport = src[0]
   else:
    srcport = src
   if (srcport not in portoutputs):
    portoutputs[srcport] = []
   portoutputs[srcport].append((v, dest, src))
 return (portinputs, portoutputs)

def _node_ports ( graph , node ) : portinputs = { } portoutputs = { } for ( u , _ , d ) in graph . in_edges_iter ( node , data = True ) : for ( src , dest ) in d [ u'connect' ] : portinputs [ dest ] = ( u , src ) for ( _ , v , d ) in graph . out_edges_iter ( node , data = True ) : for ( src , dest ) in d [ u'connect' ] : if isinstance ( src , tuple ) : srcport = src [ 0 ] else : srcport = src if ( srcport not in portoutputs ) : portoutputs [ srcport ] = [ ] portoutputs [ srcport ] . append ( ( v , dest , src ) ) return ( portinputs , portoutputs )
return the given nodes input and output ports the return value is the dictionaries .