def dispatch(e, args): e.election_dirname = ids.filename_safe(args.election_dirname) e.election_name = e.election_dirname dirpath = os.path.join(multi.ELECTIONS_ROOT, e.election_dirname) if os.path.exists(dirpath): warnings.warn("Erasing previous contents of directory {}.".format(dirpath)) subdirs = ["1-election-spec", "2-reported", "3-audit"] for subdir in subdirs: dirpathx = os.path.join(dirpath, subdir) if os.path.exists(dirpathx): shutil.rmtree(dirpathx) warnings.warn("Directory {} erased.".format(dirpathx)) if args.syn_type == '1': syn1.generate_syn_type_1(e, args) elif args.syn_type == '2': syn2.generate_syn_type_2(e, args) else: logger.info("Illegal syn_type:", args.syn_type) logger.info(" Done. Synthetic election written to: %s", dirpath)
def process_args(e, args): e.election_dirname = ids.filename_safe(args.election_dirname) e.election_name = e.election_dirname if args.syn_type == '1': syn1.generate_syn_type_1(e, args) elif args.syn_type == '2': syn2.generate_syn_type_2(e, args) else: print("Illegal syn_type:", args.syn_type)
def process_args(e, args): e.election_dirname = ids.filename_safe(args.election_dirname) e.election_name = e.election_dirname dirpath = os.path.join(multi.ELECTIONS_ROOT, e.election_dirname) if os.path.exists(dirpath): utils.mywarning("Existing directory {} erased.".format(dirpath)) shutil.rmtree(dirpath) if args.syn_type == '1': syn1.generate_syn_type_1(e, args) elif args.syn_type == '2': syn2.generate_syn_type_2(e, args) else: print("Illegal syn_type:", args.syn_type) print(" Done. Synthetic election written to:", dirpath)