Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
merge_hashes.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file merge_hashes.py
1 #!/usr/bin/env python3
2 import argparse
3 
4 p = argparse.ArgumentParser()
5 p.add_argument("output")
6 p.add_argument("files", nargs="+")
7 
8 args = p.parse_args()
9 
10 items = {}
11 
12 for file in args.files:
13  with open(file) as fh:
14  for line in fh:
15  key, value = line.split(":", 1)
16  items[key.strip()] = value.strip()
17 
18 with open(args.output, "w") as fh:
19  for key, value in items.items():
20  fh.write(f"{key}: {value}\n")