flake8 cleanups
This commit is contained in:
parent
86e55cb812
commit
98abab560e
@ -1,20 +1,17 @@
|
|||||||
|
"""Report on the weather via wttr.in."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from ircbot.lib import Plugin
|
from ircbot.lib import Plugin
|
||||||
|
|
||||||
from weather.lib import weather_summary
|
from weather.lib import weather_summary
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger('weather.ircplugin')
|
log = logging.getLogger('weather.ircplugin')
|
||||||
|
|
||||||
|
|
||||||
class Weather(Plugin):
|
class Weather(Plugin):
|
||||||
|
|
||||||
"""Have IRC commands to do IRC things (join channels, quit, etc.)."""
|
"""Have IRC commands to do IRC things (join channels, quit, etc.)."""
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Set up the handlers."""
|
"""Set up the handlers."""
|
||||||
|
|
||||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!weather\s+(.*)$',
|
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!weather\s+(.*)$',
|
||||||
self.handle_weather, -20)
|
self.handle_weather, -20)
|
||||||
|
|
||||||
@ -22,12 +19,12 @@ class Weather(Plugin):
|
|||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
"""Tear down handlers."""
|
"""Tear down handlers."""
|
||||||
|
|
||||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_weather)
|
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_weather)
|
||||||
|
|
||||||
super(Weather, self).stop()
|
super(Weather, self).stop()
|
||||||
|
|
||||||
def handle_weather(self, connection, event, match):
|
def handle_weather(self, connection, event, match):
|
||||||
|
"""Make the weather query and format it for IRC."""
|
||||||
query = match.group(1)
|
query = match.group(1)
|
||||||
queryitems = query.split(" ")
|
queryitems = query.split(" ")
|
||||||
if len(queryitems) <= 0:
|
if len(queryitems) <= 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user