From 7ea028fbab44f71ba4211d1a77ba29690229ac5d Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 16:33:15 +0100 Subject: [PATCH 1/9] Full flake8ify for bytebot.py --- bytebot.py | 68 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/bytebot.py b/bytebot.py index ff995f4..195ff7d 100644 --- a/bytebot.py +++ b/bytebot.py @@ -1,26 +1,17 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- -import sys -import re -import inspect -import json -import resource -import ssl - -try: - from urllib.request import urlopen -except ImportError: - from urllib import urlopen - -from bytebot_config import * -from bytebotpluginloader import ByteBotPluginLoader -from time import time -from bytebot_log import * - -from twisted.words.protocols import irc -from twisted.internet import reactor, protocol, ssl, task -from twisted.python import logfile, log +from twisted.words.protocols import irc +from twisted.internet import reactor, protocol, ssl, task +from twisted.python import logfile, log + +from bytebot_config import BYTEBOT_NICK, BYTEBOT_PASSWORD, BYTEBOT_CHANNEL, \ + BYTEBOT_SSL, BYTEBOT_PORT, BYTEBOT_SERVER, BYTEBOT_PLUGINS, \ + BYTEBOT_LOGPATH, BYTEBOT_LOGLEVEL +from bytebotpluginloader import ByteBotPluginLoader +from bytebot_log import BytebotLogObserver, LOG_ERROR, LOG_INFO, LOG_WARN, \ + LOG_DEBUG + class ByteBot(irc.IRCClient): @@ -37,11 +28,10 @@ def registerCommand(self, name, description=''): def connectionMade(self): irc.IRCClient.connectionMade(self) - self.factory.plugins.run('registerCommand', - { - 'irc': self - } - ) + self.factory.plugins.run( + 'registerCommand', + {'irc': self} + ) def connectionLost(self, reason): irc.IRCClient.connectionLost(self, reason) @@ -72,7 +62,10 @@ def privmsg(self, user, channel, msg): if channel == self.nickname: """ User whispering to the bot""" - self.msg(user, "I don't usually whisper back. But when I do, it's to you.") + self.msg( + user, + "I don't usually whisper back. But when I do, it's to you." + ) return if msg.startswith(self.nickname + ":"): @@ -151,6 +144,7 @@ def runPerDay(): self.dayCron = task.LoopingCall(runPerDay) self.dayCron.start(86400.0) + class ByteBotFactory(protocol.ClientFactory): def __init__(self, nickname, password, channel): @@ -181,18 +175,26 @@ def clientConnectionFailed(self, connector, reason): log_info = logfile.LogFile("bytebot.log", BYTEBOT_LOGPATH, rotateLength=10000000, maxRotatedFiles=100) - logger_error = BytebotLogObserver(log_error, - (BYTEBOT_LOGLEVEL & ~LOG_INFO & ~LOG_DEBUG & ~LOG_WARN)) - logger_info = BytebotLogObserver(log_info, - (BYTEBOT_LOGLEVEL & ~LOG_ERROR)) + logger_error = BytebotLogObserver( + log_error, + (BYTEBOT_LOGLEVEL & ~LOG_INFO & ~LOG_DEBUG & ~LOG_WARN) + ) + logger_info = BytebotLogObserver( + log_info, + (BYTEBOT_LOGLEVEL & ~LOG_ERROR) + ) log.addObserver(logger_error.emit) log.addObserver(logger_info.emit) f = ByteBotFactory(BYTEBOT_NICK, BYTEBOT_PASSWORD, BYTEBOT_CHANNEL) - if BYTEBOT_SSL == True: - reactor.connectSSL(BYTEBOT_SERVER, int(BYTEBOT_PORT), f, ssl.ClientContextFactory()) + if BYTEBOT_SSL is True: + reactor.connectSSL( + BYTEBOT_SERVER, + int(BYTEBOT_PORT), + f, + ssl.ClientContextFactory() + ) else: reactor.connectTCP(BYTEBOT_SERVER, int(BYTEBOT_PORT), f) reactor.run() - From 65b48eba4da789b1fff45913ca749298ba7018c5 Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 16:33:28 +0100 Subject: [PATCH 2/9] Removed useless function --- bytebot.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bytebot.py b/bytebot.py index 195ff7d..4fdf3cd 100644 --- a/bytebot.py +++ b/bytebot.py @@ -105,10 +105,6 @@ def noticed(self, user, channel, message): def action(self, user, channel, msg): user = user.split("!", 1)[0] - def irc_NICK(self, prefix, params): - old_nick = prefix.split("!")[0] - new_nick = params[0] - def irc_RPL_TOPIC(self, prefix, params): self.current_topic = params From 4a27c9402f6dfa8d6d9000fce34826cf6f96edee Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 16:34:50 +0100 Subject: [PATCH 3/9] Added missing newline (flake8) --- bytebot_log.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bytebot_log.py b/bytebot_log.py index b26160b..753b190 100644 --- a/bytebot_log.py +++ b/bytebot_log.py @@ -1,12 +1,13 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- +from twisted.python import log + LOG_DEBUG = 0b0001 LOG_INFO = 0b0010 LOG_WARN = 0b0100 LOG_ERROR = 0b1000 -from twisted.python import log class BytebotLogObserver(log.FileLogObserver): def __init__(self, f, level=LOG_ERROR): From 0725f8a5b9827c275d8b6a6e8405e01fb748e646 Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 17:05:12 +0100 Subject: [PATCH 4/9] Fixed imports (flake8) --- bytebotpluginloader.py | 9 +++++---- plugins/autoop.py | 3 ++- plugins/autotopic.py | 7 ++++--- plugins/dates.py | 11 ++++++----- plugins/ircquestions.py | 1 + plugins/messagelogger.py | 3 ++- plugins/muschi.py | 4 +++- plugins/penis.py | 4 +++- plugins/plugin.py | 1 + plugins/rss.py | 10 ++++++---- 10 files changed, 33 insertions(+), 20 deletions(-) diff --git a/bytebotpluginloader.py b/bytebotpluginloader.py index 0880123..b9499d9 100644 --- a/bytebotpluginloader.py +++ b/bytebotpluginloader.py @@ -1,10 +1,11 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- -from sys import exit -from twisted.internet import reactor -from bytebot_log import * -from twisted.python import log +from sys import exit +from twisted.internet import reactor +from bytebot_log import LOG_DEBUG, LOG_WARN, LOG_ERROR +from twisted.python import log + class ByteBotPluginLoader(object): """This class enables automatic loading and method calling for plugin diff --git a/plugins/autoop.py b/plugins/autoop.py index 583ea36..5b094c9 100644 --- a/plugins/autoop.py +++ b/plugins/autoop.py @@ -4,7 +4,8 @@ from plugins.plugin import Plugin from bytebot_config import BYTEBOT_PLUGIN_CONFIG from twisted.python import log -from bytebot_log import LOG_INFO, LOG_WARN +from bytebot_log import LOG_INFO, LOG_WARN + class autoop(Plugin): def onIrc_JOIN(self, irc, prefix, params): diff --git a/plugins/autotopic.py b/plugins/autotopic.py index 7644586..b7beb01 100644 --- a/plugins/autotopic.py +++ b/plugins/autotopic.py @@ -1,12 +1,13 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- +import json +import re +from urllib import urlopen + from plugins.plugin import Plugin from bytebot_config import BYTEBOT_STATUS_URL, BYTEBOT_TOPIC, BYTEBOT_CHANNEL -from urllib import urlopen -import json -import re class autotopic(Plugin): diff --git a/plugins/dates.py b/plugins/dates.py index c61caf6..1a243be 100644 --- a/plugins/dates.py +++ b/plugins/dates.py @@ -2,16 +2,17 @@ # -*- coding: utf-8 -*- import time +from datetime import datetime, timedelta -from plugins.plugin import Plugin -from bytebot_config import BYTEBOT_PLUGIN_CONFIG from icalendar import Calendar from icalendar.prop import vDDDTypes -from datetime import date, datetime, timedelta from pytz import utc, timezone from urllib import urlopen -from dateutil.rrule import * -from dateutil.parser import * +from dateutil.rrule import rruleset, rrulestr +from dateutil.parser import parse + +from plugins.plugin import Plugin +from bytebot_config import BYTEBOT_PLUGIN_CONFIG class dates(Plugin): diff --git a/plugins/ircquestions.py b/plugins/ircquestions.py index abf1022..1a8fbf1 100644 --- a/plugins/ircquestions.py +++ b/plugins/ircquestions.py @@ -4,6 +4,7 @@ from bytebot_config import BYTEBOT_PLUGIN_CONFIG from plugins.plugin import Plugin + class ircquestions(Plugin): def __init__(self): pass diff --git a/plugins/messagelogger.py b/plugins/messagelogger.py index c0a8ea5..0b858ad 100644 --- a/plugins/messagelogger.py +++ b/plugins/messagelogger.py @@ -1,10 +1,11 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- +import time + from plugins.plugin import Plugin from bytebot_config import BYTEBOT_PLUGIN_CONFIG -import time class messagelogger(Plugin): def __init__(self): diff --git a/plugins/muschi.py b/plugins/muschi.py index ca45630..400541a 100644 --- a/plugins/muschi.py +++ b/plugins/muschi.py @@ -1,9 +1,11 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- -from plugins.plugin import Plugin from time import time +from plugins.plugin import Plugin + + class muschi(Plugin): def __init__(self): pass diff --git a/plugins/penis.py b/plugins/penis.py index a0a0318..ad69b59 100644 --- a/plugins/penis.py +++ b/plugins/penis.py @@ -1,9 +1,11 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- -from plugins.plugin import Plugin from time import time +from plugins.plugin import Plugin + + class penis(Plugin): def __init__(self): pass diff --git a/plugins/plugin.py b/plugins/plugin.py index f923666..46cb84d 100644 --- a/plugins/plugin.py +++ b/plugins/plugin.py @@ -1,6 +1,7 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- + class Plugin(object): """ This class is a skeleton plugin class defining event hooks on which diff --git a/plugins/rss.py b/plugins/rss.py index bddffda..750cb83 100644 --- a/plugins/rss.py +++ b/plugins/rss.py @@ -2,16 +2,18 @@ # -*- coding: utf-8 -*- import time -import feedparser import os import datetime -import pytz +import feedparser +import pytz from twisted.python import log -from dateutil import parser +from dateutil import parser + from plugins.plugin import Plugin from bytebot_config import BYTEBOT_PLUGIN_CONFIG, BYTEBOT_CHANNEL -from bytebot_log import LOG_WARN +from bytebot_log import LOG_WARN + class rss(Plugin): def __init__(self): From 333396da971e3a3415aca76a9bc841ba2889d546 Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 17:06:18 +0100 Subject: [PATCH 5/9] Fixed line length / indentation (flake8) --- bytebotpluginloader.py | 8 ++++--- plugins/autoop.py | 48 +++++++++++++++++++++++++++++----------- plugins/autotopic.py | 5 ++++- plugins/ircquestions.py | 7 ++++-- plugins/parking.py | 5 +++-- plugins/rss.py | 49 +++++++++++++++++++++++++++-------------- plugins/shorturl.py | 4 ++-- 7 files changed, 87 insertions(+), 39 deletions(-) diff --git a/bytebotpluginloader.py b/bytebotpluginloader.py index b9499d9..40b4205 100644 --- a/bytebotpluginloader.py +++ b/bytebotpluginloader.py @@ -63,7 +63,9 @@ def run(self, fn, args={}, threaded=True): level=LOG_DEBUG) reactor.callInThread(method, **args) except Exception as e: - log.msg("WARNING: An error occured while executing %s in %s with %s" % - (fn, plugin, args), - level=LOG_WARN) + log.msg( + "WARNING: An error occured while executing %s in %s " + + "with %s" % (fn, plugin, args), + level=LOG_WARN + ) log.msg("WARNING: %s" % e, level=LOG_DEBUG) diff --git a/plugins/autoop.py b/plugins/autoop.py index 5b094c9..a4ea4de 100644 --- a/plugins/autoop.py +++ b/plugins/autoop.py @@ -13,26 +13,48 @@ def onIrc_JOIN(self, irc, prefix, params): user = prefix.split('!')[0] if 'autoop' in BYTEBOT_PLUGIN_CONFIG.keys(): if 'hostmask' in BYTEBOT_PLUGIN_CONFIG['autoop'].keys(): - if channel in BYTEBOT_PLUGIN_CONFIG['autoop']['hostmask'].keys(): - if prefix in BYTEBOT_PLUGIN_CONFIG['autoop']['hostmask'][channel]: + if channel in BYTEBOT_PLUGIN_CONFIG['autoop'][ + 'hostmask'].keys(): + if prefix in BYTEBOT_PLUGIN_CONFIG['autoop']['hostmask'][ + channel]: log.msg("Giving user %s +o on channel %s" % (prefix, channel), level=LOG_INFO) irc.mode(channel, True, 'o', user=user) - irc.msg(channel, "Hey, %s, it seems like you're a nice guy. Let me op you hard" % user) - if user in BYTEBOT_PLUGIN_CONFIG['autoop']['name'][channel]: + irc.msg( + channel, + "Hey, %s, it seems like you're a nice guy. Let " + + "me op you hard" % user + ) + if user in BYTEBOT_PLUGIN_CONFIG['autoop']['name'][ + channel]: log.msg("Giving user %s +o on channel %s" % (user, channel), level=LOG_INFO) irc.mode(channel, True, 'o', user=user) - irc.msg(channel, "Hey, %s, it seems like you're a nice guy. Let me op you hard" % user) + irc.msg( + channel, + "Hey, %s, it seems like you're a nice guy. Let " + + "me op you hard" % user + ) else: - log.msg("User %s not in autoop list %s" % - (prefix, channel), level=LOG_INFO) + log.msg( + "User %s not in autoop list %s" % ( + prefix, channel), + level=LOG_INFO + ) else: - log.msg("Channel name %s not in bytebot_config.py" % - channel, level=LOG_WARN) + log.msg( + "Channel name %s not in bytebot_config.py" % channel, + level=LOG_WARN + ) else: - log.msg("BYTEBOT_PLUGIN_CONFIG in bytebot_config.py has no 'hostmask' section", - level=LOG_WARN) + log.msg( + "BYTEBOT_PLUGIN_CONFIG in bytebot_config.py has no " + + "'hostmask' section", + level=LOG_WARN + ) else: - log.msg("BYTEBOT_PLUGIN_CONFIG in bytebot_config.py has no 'autoop' section", - level=LOG_WARN) + log.msg( + "BYTEBOT_PLUGIN_CONFIG in bytebot_config.py has no 'autoop' " + + "section", + level=LOG_WARN + ) diff --git a/plugins/autotopic.py b/plugins/autotopic.py index b7beb01..74955bd 100644 --- a/plugins/autotopic.py +++ b/plugins/autotopic.py @@ -33,7 +33,10 @@ def minuteCron(self, irc): old_status = "closed" if old_status != status: - irc.topic(BYTEBOT_CHANNEL, unicode(topic).encode('utf-8', errors='replace')) + irc.topic( + BYTEBOT_CHANNEL, + unicode(topic).encode('utf-8', errors='replace') + ) irc.topic(BYTEBOT_CHANNEL) except Exception as e: print(e) diff --git a/plugins/ircquestions.py b/plugins/ircquestions.py index 1a8fbf1..e4b9d00 100644 --- a/plugins/ircquestions.py +++ b/plugins/ircquestions.py @@ -35,8 +35,11 @@ def onPrivmsg(self, irc, msg, channel, user): try: question = msg.split(' ')[1] - except IndexError as e: - irc.msg(channel, "Sorry, das habe ich nicht verstanden. Versuch doch mal !help") + except IndexError: + irc.msg( + channel, + "Sorry, das habe ich nicht verstanden. Versuch doch mal !help" + ) return if question in BYTEBOT_PLUGIN_CONFIG['ircquestions']: diff --git a/plugins/parking.py b/plugins/parking.py index 5af407b..3349d51 100644 --- a/plugins/parking.py +++ b/plugins/parking.py @@ -22,7 +22,7 @@ def _get_parking_status(self): url = BYTEBOT_PLUGIN_CONFIG['parking']['url'] data = urllib2.urlopen(url, timeout=BYTEBOT_HTTP_TIMEOUT).read( - BYTEBOT_HTTP_MAXSIZE) + BYTEBOT_HTTP_MAXSIZE) data = unicode(data, errors='ignore') @@ -51,7 +51,8 @@ def onPrivmsg(self, irc, msg, channel, user): for x in range(1, len(data)): name = data[x][u'name'].encode('ascii', 'ignore') - occupied = int(data[x][u'belegt'].encode('ascii', 'ignore')) + occupied = int(data[x][u'belegt'].encode('ascii', + 'ignore')) spaces = int(data[x][u'maximal'].encode('ascii', 'ignore')) if(occupied < 0): diff --git a/plugins/rss.py b/plugins/rss.py index 750cb83..73bf62e 100644 --- a/plugins/rss.py +++ b/plugins/rss.py @@ -22,7 +22,7 @@ def __init__(self): def registerCommand(self, irc): """Registers the '!rss' command to the global command list - irc: An instance of the bytebot. Will be passed by the plugin loader + irc: An instance of the bytebot. Will be passed by the plugin loader """ irc.registerCommand('!rss', 'Show the last recent changes') @@ -30,7 +30,7 @@ def registerCommand(self, irc): def fiveMinuteCron(self, irc): """Checks RSS feed every 5 minutes and post recent changes - irc: An instance of the bytebot. Will be passed by the plugin loader + irc: An instance of the bytebot. Will be passed by the plugin loader """ try: @@ -44,12 +44,11 @@ def fiveMinuteCron(self, irc): print(e) print("Error while processing rss feed") - def onPrivmsg(self, irc, msg, channel, user): """Looks for a '!rss' command in messages posted to the channel and returns a list of recent changes. - irc: An instance of the bytebot. Will be passed by the plugin loader + irc: An instance of the bytebot. Will be passed by the plugin loader msg: The msg sent to the channel channel: The channels name user: The user who sent the message @@ -60,9 +59,16 @@ def onPrivmsg(self, irc, msg, channel, user): # Found rss command without source, show details if msg.find(' ') == -1: - irc.msg(channel, "Use !rss with one of the following second parameter to specify source:") + irc.msg( + channel, + "Use !rss with one of the following second parameter to " + + "specify source:" + ) for feed in BYTEBOT_PLUGIN_CONFIG['rss']: - irc.msg(channel, " %s (%s)" % (feed['name'].lower(), feed['url'])) + irc.msg( + channel, + " %s (%s)" % (feed['name'].lower(), feed['url']) + ) return self.irc = irc @@ -77,7 +83,8 @@ def process_feed(self, feed, numberOfEntries=-1): """Process a rss feed an post numberOfEntries feed: Dictionary with feed informations - numberOfEntries: Number of entries to post. -1 means to post only new entries based on cached informations + numberOfEntries: Number of entries to post. -1 means to post + only new entries based on cached informations """ if numberOfEntries == -1 and os.path.isfile(feed['cache']): @@ -99,7 +106,8 @@ def process_feed(self, feed, numberOfEntries=-1): # Feed not successfull retrieved, so stop with error if request.status != 200: - log.msg("Unknown HTTP status retrieved for feed %s: %d" % (feed['name'], request.status), level=LOG_WARN) + log.msg("Unknown HTTP status retrieved for feed %s: %d" % + (feed['name'], request.status), level=LOG_WARN) # local timezone timezoneEF = pytz.timezone('Europe/Berlin') @@ -127,10 +135,11 @@ def process_feed(self, feed, numberOfEntries=-1): last_entry=dt_now) return - # traverse feed entries in reversed order (post oldest first) + """Traverses feed entries in reversed order (post oldest first)""" for entry in reversed(request.entries): - # parse date of entry dependent on the feedtype and convert to timestamp + """parse date of entry dependent on the feedtype and + convert to timestamp""" if feed['type'] == 'dokuwiki': dt = parser.parse(entry.date) elif feed['type'] == 'wordpress': @@ -141,18 +150,20 @@ def process_feed(self, feed, numberOfEntries=-1): dt.astimezone(timezoneEF) dt_timestamp = dt.strftime('%s') - # skip old entries if we would only new entries + """skip old entries if we would only new entries""" if numberOfEntries == -1 and last_entry_timestamp >= dt_timestamp: continue # create irc message dependent on the feedtype if feed['type'] == 'dokuwiki': - message = "%s changed %s" % (entry.author, entry.title.split(" - ", 1)[0]) + message = "%s changed %s" % (entry.author, + entry.title.split(" - ", 1)[0]) message2 = "(%s)" % entry.link.split("?", 1)[0] if len(entry.title.split(" - ", 1)) == 2: - message += " - comment: %s" % entry.title.split(" - ")[1] + message += " - comment: %s" % entry.title.split(" - ")[1] elif feed['type'] == 'wordpress': - message = "%s added \"%s\"" % (entry.author, entry.title_detail.value) + message = "%s added \"%s\"" % (entry.author, + entry.title_detail.value) message2 = "(%s)" % entry.link elif feed['type'] == 'github': message = "%s pushed a new commit:" % entry.author @@ -164,8 +175,14 @@ def process_feed(self, feed, numberOfEntries=-1): # post messages with named prefix message = "%s | %s" % (feed['name'].upper(), message) message2 = "%s %s" % (" " * len(feed['name']), message2) - self.irc.say(self.channel, unicode(message).encode('utf-8', errors='replace')) - self.irc.say(self.channel, unicode(message2).encode('utf-8', errors='replace')) + self.irc.say( + self.channel, + unicode(message).encode('utf-8', errors='replace') + ) + self.irc.say( + self.channel, + unicode(message2).encode('utf-8', errors='replace') + ) if numberOfEntries == -1: self.save_cache(filename=feed['cache'], diff --git a/plugins/shorturl.py b/plugins/shorturl.py index def7f7c..856a066 100644 --- a/plugins/shorturl.py +++ b/plugins/shorturl.py @@ -75,8 +75,8 @@ def getTags(self, url): def onPrivmsg(self, irc, msg, channel, user): try: - url = re.findall( - 'http[s]?://(?:[^\s]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', msg)[0] + url = re.findall("http[s]?://(?:[^\s]|[0-9]|[$-_@.&+]|[!*\(\),]|" + + "(?:%[0-9a-fA-F][0-9a-fA-F]))+", msg)[0] try: short_function = getattr(self, BYTEBOT_PLUGIN_CONFIG[ 'shorturl']['shortener']) From b2efa8e60e4599d0853ecae83b15b2f10cd017bb Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 17:06:44 +0100 Subject: [PATCH 6/9] Changed '==' to 'is' (flake8) --- plugins/autotopic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/autotopic.py b/plugins/autotopic.py index 74955bd..03e6d24 100644 --- a/plugins/autotopic.py +++ b/plugins/autotopic.py @@ -19,7 +19,7 @@ def minuteCron(self, irc): topic = BYTEBOT_TOPIC response = urlopen(BYTEBOT_STATUS_URL) data = json.loads(response.read()) - if data['state']['open'] == True: + if data['state']['open'] is True: topic += u' | Space is open' status = 'open' else: From 4c316c5318f1bc40dbea7988cd23946547a5eb45 Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 17:07:11 +0100 Subject: [PATCH 7/9] Removed unused variables in except clause (flake8) --- plugins/mensa.py | 2 +- plugins/muschi.py | 2 +- plugins/penis.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/mensa.py b/plugins/mensa.py index 8a087b4..424c056 100644 --- a/plugins/mensa.py +++ b/plugins/mensa.py @@ -38,7 +38,7 @@ def onPrivmsg(self, irc, msg, channel, user): try: last_mensa = irc.last_mensa - except Exception as e: + except Exception: last_mensa = 0 if last_mensa < (time() - 60): diff --git a/plugins/muschi.py b/plugins/muschi.py index 400541a..22c75c2 100644 --- a/plugins/muschi.py +++ b/plugins/muschi.py @@ -22,7 +22,7 @@ def onPrivmsg(self, irc, msg, channel, user): try: last_muschi = irc.last_muschi - except Exception as e: + except Exception: last_muschi = 0 if last_muschi < (time() - 300): diff --git a/plugins/penis.py b/plugins/penis.py index ad69b59..b27b24f 100644 --- a/plugins/penis.py +++ b/plugins/penis.py @@ -22,7 +22,7 @@ def onPrivmsg(self, irc, msg, channel, user): try: last_penis = irc.last_penis - except Exception as e: + except Exception: last_penis = 0 if last_penis < (time() - 300): From 3a722fcfe5a10d7f4a8146042f5403150dc88f26 Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 17:07:23 +0100 Subject: [PATCH 8/9] Added missing parameters --- plugins/messagelogger.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/messagelogger.py b/plugins/messagelogger.py index 0b858ad..51e20fd 100644 --- a/plugins/messagelogger.py +++ b/plugins/messagelogger.py @@ -37,6 +37,5 @@ def onPrivmsg(self, irc, user, channel, msg): def onAction(self, irc, user, channel, msg): self.log("%s: * %s %s" % (channel, user, msg)) - def onIrc_Nick(self, irc): + def onIrc_Nick(self, irc, old_nick, new_nick): self.log("%s is now know as %s" % (old_nick, new_nick)) - From a86f0e0e63de5c82005fa6f620cadac5e6248e27 Mon Sep 17 00:00:00 2001 From: MKzero Date: Thu, 5 Nov 2015 17:26:55 +0100 Subject: [PATCH 9/9] Let's be honest - like we reach py3.x support anywhere in the near future --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2a5f120..d01989b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ cache: bundler python: - "2.7" - - "3.2" before_install: - git submodule update --init --recursive