From 4ebddda3c83bb6dc68bc90cfab7de138b90fff14 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Wed, 9 May 2012 07:54:55 +1200 Subject: [PATCH] PEP-8 --- plugins/weather.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/weather.py b/plugins/weather.py index 5314348..c20de21 100755 --- a/plugins/weather.py +++ b/plugins/weather.py @@ -1,9 +1,11 @@ "weather, thanks to google" from util import hook, http + def fahrenheit_to_celcius(f): return int(round((int(f) - 32) / 1.8, 0)) + @hook.command(autohelp=False) def forecast(inp, nick='', server='', reply=None, db=None, notice=None, say=None): @@ -38,10 +40,10 @@ def forecast(inp, nick='', server='', for elem in w.findall('forecast_conditions'): info = dict((e.tag, e.get('data')) for e in elem) - info['high'] = elem.find('high').get('data') - info['low'] = elem.find('low').get('data') - out += '[%(day_of_week)s]: %(condition)s (H:%(high)sF'\ - ', L:%(low)sF). ' % info + info['high'] = fahrenheit_to_celcius(elem.find('high').get('data')) + info['low'] = fahrenheit_to_celcius(elem.find('low').get('data')) + out += '[%(day_of_week)s]: %(condition)s (H:%(high)sC'\ + ', L:%(low)sC). ' % info return out