Compare commits

...

2 Commits

Author SHA1 Message Date
Brian S. Stephan 98abab560e
flake8 cleanups 2023-03-27 16:14:11 -05:00
Brian S. Stephan 86e55cb812
ignore migrations in the flake8 checking 2023-03-27 16:13:52 -05:00
2 changed files with 3 additions and 6 deletions

View File

@ -181,7 +181,7 @@ exclude =
.tox/
versioneer.py
_version.py
instance/
**/migrations/
extend-ignore = T101
max-complexity = 10
max-line-length = 120

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: