From 1a84e2c4ca6694ee0af7cb5800a892e0dc5c6e8e Mon Sep 17 00:00:00 2001 From: Pablo Alvarez Lopez Date: Wed, 24 Mar 2021 11:06:38 +0100 Subject: [PATCH] Updated computeStoppingPlaceUsage.py. Refs #8405 --- tools/output/computeStoppingPlaceUsage.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tools/output/computeStoppingPlaceUsage.py b/tools/output/computeStoppingPlaceUsage.py index 43be207915cf..bd120940821d 100644 --- a/tools/output/computeStoppingPlaceUsage.py +++ b/tools/output/computeStoppingPlaceUsage.py @@ -31,21 +31,20 @@ import os,sys def get_options(args=None): - optParser = optparse.OptionParser() - optParser.add_option("-o", "--stop-output-file", dest="stopOutput", + parser = sumolib.options.ArgumentParser(description="Compute Stopping Place usage") + parser.add_argument("-o", "--stop-output-file", dest="stopOutput", help="output route file with stops") - optParser.add_option("-s", "--stopping-place", dest="stoppingPlace", + parser.add_argument("-s", "--stopping-place", dest="stoppingPlace", help="stoppingPlace Type (busStop, parkingArea...)", default="parkingArea") - optParser.add_option("-c", "--csv", dest="csv", - help="write in CSV format", default="") - (options, args) = optParser.parse_args(args=args) + parser.add_argument("--csv", action="store_true", default=False, + help="write in CSV format") + options = parser.parse_args(args=args) if not options.stopOutput: optParser.print_help() sys.exit() return options - def main(options): # declare veh counts vehCounts = defaultdict(list) @@ -84,10 +83,9 @@ def main(options): outf.write("%s,%s\n" % (tPrev, count)) else: outf.write(" \n" % (t, count)) - if (options.csv == ""): + if (options.csv == False): # close route tag outf.write("\n") if __name__ == "__main__": - options = get_options(sys.argv) - main(options) + main(get_options())