flake8 cleanups

This commit is contained in:
Brian S. Stephan 2023-03-27 16:14:11 -05:00
parent 86e55cb812
commit 98abab560e
Signed by: bss
GPG Key ID: 3DE06D3180895FCB

View File

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