From: kaliko Date: Wed, 6 May 2020 15:13:11 +0000 (+0200) Subject: Some cleanup and reformatting. X-Git-Tag: 0.1.0~11 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=912b046c8bdf24a2e8a477269256ad99593f0728;p=sid.git Some cleanup and reformatting. --- diff --git a/sid/archive.py b/sid/archive.py index 9fb0f2e..b8cbfa4 100644 --- a/sid/archive.py +++ b/sid/archive.py @@ -32,7 +32,7 @@ class Archive(Plugin): @botcmd def archive(self, rcv, args): - """Fetch pkg info from the archive: + """Fetch pkg versions info from the archive: !archive pkg-name : Returns package versions (by suite) """ diff --git a/sid/bts.py b/sid/bts.py index b39197c..1a7fea4 100644 --- a/sid/bts.py +++ b/sid/bts.py @@ -31,7 +31,8 @@ class Bugs(Plugin): def __init__(self, bot): Plugin.__init__(self, bot) - bot.add_event_handler("muc::%s::message" % self.bot.room, self.muc_message) + bot.add_event_handler("muc::%s::message" % + self.bot.room, self.muc_message) def muc_message(self, msg): """Handler method dealing with MUC incoming messages""" @@ -83,11 +84,9 @@ class Bugs(Plugin): return reports = debianbts.get_status(reports_ids) reports = sorted(reports, key=lambda r: r.date) - rprt_nb = len(reports) - msg = ['Open reports for {1} (total {0})'.format(rprt_nb, pkg.string)] + msg = ['Latest reports for {1} (total {0})'.format(len(reports), pkg.string)] # Reverse and take last reports for rep in reports[::-1][:4]: msg.append('{r.bug_num}: {r.date:%Y-%m-%d} {r.subject}'.format(r=rep)) message = {'mbody': '\n'.join(msg)} self.reply(rcv, message) - diff --git a/sid/echo.py b/sid/echo.py index f19f7dc..90ccd90 100644 --- a/sid/echo.py +++ b/sid/echo.py @@ -17,6 +17,7 @@ from .plugin import Plugin, botcmd + class Echo(Plugin): """Drop a message to be sent when someone gets online. """ @@ -30,7 +31,8 @@ class Echo(Plugin): # any presences you send yourself. To limit event handling # to a single room, use the events muc::room@server::presence, # muc::room@server::got_online, or muc::room@server::got_offline. - bot.add_event_handler("muc::%s::presence" % self.bot.room, self.log_presence) + bot.add_event_handler("muc::%s::presence" % + self.bot.room, self.log_presence) def log_presence(self, pres): """Register presence""" diff --git a/sid/lib.py b/sid/lib.py index eeb99ff..bc8fbed 100644 --- a/sid/lib.py +++ b/sid/lib.py @@ -1,5 +1,19 @@ # coding: utf-8 +# Copyright (C) 2020 kaliko + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import json import logging @@ -24,7 +38,6 @@ def get_pkg(pkg): try: response = urlopen(req) ans = response.read() - #print(response.getcode()) except HTTPError as err: logger.info('The server couldn\'t fulfill the request.') logger.debug('Error code: %s', err.code) diff --git a/sid/ping.py b/sid/ping.py index 4f3f44f..3476e7a 100644 --- a/sid/ping.py +++ b/sid/ping.py @@ -16,6 +16,7 @@ from .plugin import Plugin, botcmd + class Ping(Plugin): PongURL = 'http://upload.wikimedia.org/wikipedia/commons/f/f8/Pong.png' diff --git a/sid/plugin.py b/sid/plugin.py index 6db1d59..b21cff9 100644 --- a/sid/plugin.py +++ b/sid/plugin.py @@ -17,6 +17,7 @@ from .sid import botcmd + class Plugin: """ Simple Plugin object to derive from: