Skip to content

Commit c9d7ff4

Browse files
committed
call parseargv() only once, more unknown parameter foo
1 parent 7aadbd9 commit c9d7ff4

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

main

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ def parseargv(): #parses argv, returns StopID and LineID
5959
global DEBUG
6060
DEBUG=True
6161
else:
62-
print("What's this?: {}".format(elem))
62+
print("Unknown parameter {!r}".format(elem))
6363
query_ids.sort(key=int)
6464
return (query_stop, query_ids)
6565

66-
def getjson():
67-
(stop, ids) = parseargv()
66+
def getjson(data):
67+
(stop, ids) = data
6868
stop_filter = filter_s.format(stop)
6969
if (ids == []):
7070
line_filter = ""
@@ -91,24 +91,25 @@ def parsejson(data):
9191
output.sort(key=lambda tup: tup[0])
9292
return output
9393

94-
def info():
95-
(query_stop, query_ids) = parseargv()
94+
def info(data):
95+
(stop, ids) = data
9696
try:
97-
halt = stops[query_stop].strip()
97+
halt = stops[stop].strip()
9898
except:
9999
print("Error: Invalid StopID")
100100
exit(1)
101-
haltid = query_stop
102-
linien = " ".join(query_ids)
101+
haltid = stop
102+
linien = " ".join(ids)
103103
out = infotext.format(halt, haltid, linien)
104104
debug(out)
105105

106+
data = parseargv()
106107

107108
debug('=== Start')
108-
info()
109+
info(data)
109110

110111
debug('=== Get JSON')
111-
jsondata = getjson()
112+
jsondata = getjson(data)
112113

113114
debug('=== Parse JSON')
114115
output = parsejson(jsondata)

0 commit comments

Comments
 (0)