Dusting some modules

This commit is contained in:
nemunaire 2014-07-25 18:02:30 +02:00
commit 5bec50744c
5 changed files with 44 additions and 68 deletions

View file

@ -57,21 +57,17 @@ def print_station_status(msg, station):
(available, free) = station_status(station)
if available is not None and free is not None:
return Response(msg.sender,
"%s: à la station %s : %d vélib et %d points d'attache"
" disponibles." % (msg.nick, station, available, free),
msg.channel)
else:
return Response(msg.sender,
"%s: station %s inconnue." % (msg.nick, station),
msg.channel)
"à la station %s : %d vélib et %d points d'attache"
" disponibles." % (station, available, free),
channel=msg.channel, nick=msg.nick)
raise IRCException("station %s inconnue." % station)
def ask_stations(msg):
"""Hook entry from !velib"""
global DATAS
if len(msg.cmds) > 5:
return Response(msg.sender,
"Demande-moi moins de stations à la fois.",
msg.channel, nick=msg.nick)
raise IRCException("demande-moi moins de stations à la fois.")
elif len(msg.cmds) > 1:
for station in msg.cmds[1:]:
if re.match("^[0-9]{4,5}$", station):
@ -79,10 +75,7 @@ def ask_stations(msg):
elif station in DATAS.index:
return print_station_status(msg, DATAS.index[station]["number"])
else:
return Response(msg.sender,
"numéro de station invalide.",
msg.channel, nick=msg.nick)
raise IRCException("numéro de station invalide.")
else:
return Response(msg.sender,
"Pour quelle station ?",
msg.channel, nick=msg.nick)
raise IRCException("pour quelle station ?")