9 parser = argparse.ArgumentParser(description=
'Get the inputs for chain extraction')
11 parser.add_argument(
'--chain', dest=
'chain', action=
'store', default=
'',
12 help=
'What chain are we extracting')
13 parser.add_argument(
'--menu_json', dest=
'input_json', action=
'store', default=
'',
14 help=
'What menu are we extracting the chain from')
16 args = parser.parse_args()
19 input_json = args.input_json
23 print(
"...extracting",chain,
"from menu json",input_json)
25 if chain
not in the_menu[
'chains']:
26 raise Exception(
"The requested chain isn't in the provided menu json, please try again.")
28 pprint.pprint(the_menu[
'chains'][chain])
30 print(
"Steps in the chain:")
32 for isq,seq
in enumerate(the_menu[
'chains'][chain][
'sequencers']):
35 print(
'step',isq+1,
'is empty')
38 print(
'step',isq+1,
'is sequence ',seq)
41 for chain
in the_menu[
'chains']:
42 if seq
in the_menu[
'chains'][chain][
'sequencers']:
43 other_chains += [chain]
44 if len(other_chains) > 0:
45 print (
' also used in the following chains:')
46 pprint.pprint(other_chains)
48 print (
' is not used in any other chains.')
50 print (
' contains algorithms/hypos:')
51 pprint.pprint(the_menu[
'sequencers'][seq])