From 2b1e8411ab5eaa7e1349b78d03270ab02ae2950d Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 6 Oct 2014 16:52:53 +0200 Subject: Fix flake8 style nits --- client/modules/Weather.py | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'client/modules/Weather.py') diff --git a/client/modules/Weather.py b/client/modules/Weather.py index 5922d33..7076f50 100644 --- a/client/modules/Weather.py +++ b/client/modules/Weather.py @@ -9,7 +9,9 @@ WORDS = ["WEATHER", "TODAY", "TOMORROW"] def replaceAcronyms(text): - """Replaces some commonly-used acronyms for an improved verbal weather report.""" + """ + Replaces some commonly-used acronyms for an improved verbal weather report. + """ def parseDirections(text): words = { @@ -39,19 +41,21 @@ def getForecast(profile): def handle(text, mic, profile): """ - Responds to user-input, typically speech text, with a summary of - the relevant weather for the requested date (typically, weather - information will not be available for days beyond tomorrow). + Responds to user-input, typically speech text, with a summary of + the relevant weather for the requested date (typically, weather + information will not be available for days beyond tomorrow). - Arguments: + Arguments: text -- user-input, typically transcribed speech mic -- used to interact with the user (for both input and output) - profile -- contains information related to the user (e.g., phone number) + profile -- contains information related to the user (e.g., phone + number) """ if not profile['location']: mic.say( - "I'm sorry, I can't seem to access that information. Please make sure that you've set your location on the dashboard.") + "I'm sorry, I can't seem to access that information. Please make" + + "sure that you've set your location on the dashboard.") return tz = getTimezone(profile) @@ -77,14 +81,16 @@ def handle(text, mic, profile): for entry in forecast: try: date_desc = entry['title'].split()[0].strip().lower() - if date_desc == 'forecast': #For global forecasts - date_desc = entry['title'].split()[2].strip().lower() - weather_desc = entry['summary'] - - elif date_desc == 'current': #For first item of global forecasts - continue + if date_desc == 'forecast': + # For global forecasts + date_desc = entry['title'].split()[2].strip().lower() + weather_desc = entry['summary'] + elif date_desc == 'current': + # For first item of global forecasts + continue else: - weather_desc = entry['summary'].split('-')[1] #US forecasts + # US forecasts + weather_desc = entry['summary'].split('-')[1] if weekday == date_desc: output = date_keyword + \ @@ -108,4 +114,5 @@ def isValid(text): Arguments: text -- user-input, typically transcribed speech """ - return bool(re.search(r'\b(weathers?|temperature|forecast|outside|hot|cold|jacket|coat|rain)\b', text, re.IGNORECASE)) + return bool(re.search(r'\b(weathers?|temperature|forecast|outside|hot|' + + r'cold|jacket|coat|rain)\b', text, re.IGNORECASE)) -- cgit v1.3.1