def usage(): if len(sys.argv) != 3: sys.stderr.write("Kasutamine: " + sys.argv[0] + " <valimiste-id> <valijate-fail>\n") sys.exit(1) evcommon.checkfile(sys.argv[2])
def usage(): if (len(sys.argv) != 3): sys.stderr.write('Kasutamine: ' + sys.argv[0] + \ ' <valimiste-id> <valikute-fail>\n') sys.exit(1) evcommon.checkfile(sys.argv[2])
def usage(): """ Kontrollib BDoc konfiguratsiooni. """ if len(sys.argv) != 2: sys.stderr.write('Kasutamine: ' + sys.argv[0] + ' <conf_dir>\n') sys.exit(1) evcommon.checkfile(sys.argv[1])
def usage(): """ Laadib BDoc spetsiifilisi konfiguratsioonifaile. Sertifikaatide jaoks bdoc.conf. """ if len(sys.argv) != 2: sys.stderr.write('Kasutamine: ' + sys.argv[0] + ' <conf_dir>\n') sys.exit(1) evcommon.checkfile(sys.argv[1])
def usage(): if (len(sys.argv) < 2): usage_print() if not sys.argv[1] in evcommon.APPTYPES: usage_print() if sys.argv[1] == evcommon.APPTYPE_HES or \ sys.argv[1] == evcommon.APPTYPE_HTS: if (len(sys.argv) != 6): usage_print() else: evcommon.checkfile(sys.argv[3]) evcommon.checkfile(sys.argv[4]) evcommon.checkfile(sys.argv[5]) if sys.argv[1] == evcommon.APPTYPE_HLR: if (len(sys.argv) != 5): usage_print() else: evcommon.checkfile(sys.argv[3]) evcommon.checkfile(sys.argv[4])
def usage(): if len(sys.argv) < 2: usage_print() if not sys.argv[1] in evcommon.APPTYPES: usage_print() if sys.argv[1] in [evcommon.APPTYPE_HES, evcommon.APPTYPE_HTS]: if len(sys.argv) != 7: usage_print() evcommon.checkfile(sys.argv[3]) evcommon.checkfile(sys.argv[4]) evcommon.checkfile(sys.argv[5]) evcommon.checkfile(sys.argv[6]) if sys.argv[1] == evcommon.APPTYPE_HLR: if len(sys.argv) != 5: usage_print() evcommon.checkfile(sys.argv[3]) evcommon.checkfile(sys.argv[4])
dist_f = None choices_f = None voters_f = None try: opts, args = getopt.getopt(args[1:], "d:c:v:h") except getopt.GetoptError, err: print str(err) usage() sys.exit(2) for option, value in opts: if option == "-v": voters_f = value evcommon.checkfile(voters_f) elif option == "-c": choices_f = value evcommon.checkfile(choices_f) elif option == "-d": dist_f = value evcommon.checkfile(dist_f) elif option == "-h": usage() sys.exit() else: assert False, "unhandled option" if (not dist_f) and (not choices_f) and (not voters_f): usage() sys.exit()
def check_inputlists(args): ed = None ch = None vl = None dist_f = None choices_f = None voters_f = None try: opts, args = getopt.getopt(args[1:], "d:c:v:h") except getopt.GetoptError as err: print str(err) usage() sys.exit(2) for option, value in opts: if option == "-v": voters_f = value evcommon.checkfile(voters_f) elif option == "-c": choices_f = value evcommon.checkfile(choices_f) elif option == "-d": dist_f = value evcommon.checkfile(dist_f) elif option == "-h": usage() sys.exit() else: assert False, "unhandled option" if (not dist_f) and (not choices_f) and (not voters_f): usage() sys.exit() blog = BufferedLog() if dist_f: ed = inputlists.Districts() ed.attach_logger(blog) if not ed.check_format(dist_f, 'Kontrollin jaoskondade nimekirja: '): print "Jaoskondade nimekiri ei vasta nõuetele" else: print "Jaoskondade nimekiri OK" if choices_f: ch = inputlists.ChoicesList(ed) ch.attach_logger(blog) if not ch.check_format(choices_f, 'Kontrollin valikute nimekirja: '): print "Valikute nimekiri ei vasta nõuetele" else: print "Valikute nimekiri OK" if voters_f: vl = inputlists.VotersList(None, None, ed) vl.attach_logger(blog) vl.ignore_errors() if not vl.check_format(voters_f, 'Kontrollin valijate nimekirja: '): print "Valijate nimekiri ei vasta nõuetele" else: print "Valijate nimekiri OK"