import argparse from pathlib import Path from ee.part import requirement, Part, PartDb, load_db, save_db def work(in_path: Path, out_path: Path): in_parts = load_db(in_path) with out_path.open("w") as f: print("", file=f) for xml in in_parts.iterparts(): part = Part(xml) analysis = requirement.analyze_requirements(part) print("Part: {}. Found {} requirements".format(analysis.part.printable_reference, len(analysis.requirements)), file=f) for r in analysis.requirements: print(" {}".format(r), file=f) print("", file=f) parser = argparse.ArgumentParser() parser.add_argument("--in", dest="in_path", required=True, metavar="PART DB") parser.add_argument("--out", required=True, metavar="REQUIREMENTS") args = parser.parse_args() work(Path(args.in_path), Path(args.out))