nodetype.py
Go to the documentation of this file.
1 import json
2 from collections import namedtuple
3 
4 NodeType = namedtuple("NodeType","type category input_types output_types concurrency")
5 def make(type="", category=-1, input_types=None, output_types=None, concurrency=1):
6  '''Return a representation of information about a concrete
7  WireCell::INode class with some defaults. '''
8  return NodeType(type, category, input_types or list(), output_types or list(), concurrency)
9 
10 def loads(jsonstr):
11  '''
12  Load a JSON string, such as produced by WireCellApps::NodeDumper, into dict of NodeType keyed by type.
13  '''
14  dat = json.loads(jsonstr)
15  ret = dict()
16  for d in dat:
17  nt = make(**d)
18  ret[nt.type] = nt
19  return ret
20 
21 
22 def to_dots(desc):
23  '''
24  Return a dot string representation of the description of node types.
25  '''
26 
def make(type="", category=-1, input_types=None, output_types=None, concurrency=1)
Definition: nodetype.py:5
def loads(jsonstr)
Definition: nodetype.py:10
def to_dots(desc)
Definition: nodetype.py:22