From a973d8572b8241ac419e5190c9cdde22e35102a7 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 16 Nov 2022 08:27:31 +1100 Subject: [PATCH] Update ancient hacking version This version should work with modern python. Fix up a few minor formatting things it picks up. Change-Id: Ie9bebfa5eacc53aa8cbc857c48c7b71c55141864 --- statusbot/bot.py | 29 ++++++++++++++++++----------- test-requirements.txt | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/statusbot/bot.py b/statusbot/bot.py index 56731b5..2f82028 100755 --- a/statusbot/bot.py +++ b/statusbot/bot.py @@ -167,11 +167,14 @@ class SuccessPage(object): self.backend = backend(config) self.ready = False if isinstance(self.backend, WikiPage): - self.backend.pageid = config.get('wiki', 'successpageid', fallback=None) - self.backend.pageurl = config.get('wiki', 'successpageurl', fallback=None) + self.backend.pageid = config.get('wiki', 'successpageid', + fallback=None) + self.backend.pageurl = config.get('wiki', 'successpageurl', + fallback=None) self.ready = self.backend.pageid is not None elif isinstance(self.backend, EtherPage): - self.backend.pad = config.get('etherpad', 'successpad', fallback=None) + self.backend.pad = config.get('etherpad', 'successpad', + fallback=None) self.ready = self.backend.pad is not None if config.has_option('irclogs', 'url'): self.irclogs_url = config.get('irclogs', 'url') @@ -200,11 +203,14 @@ class ThanksPage(object): def __init__(self, config, backend): self.backend = backend(config) if isinstance(self.backend, WikiPage): - self.backend.pageid = config.get('wiki', 'thankspageid', fallback=None) - self.backend.pageurl = config.get('wiki', 'thankspageurl', fallback=None) + self.backend.pageid = config.get('wiki', 'thankspageid', + fallback=None) + self.backend.pageurl = config.get('wiki', 'thankspageurl', + fallback=None) self.ready = self.backend.pageid is not None elif isinstance(self.backend, EtherPage): - self.backend.pad = config.get('etherpad', 'thankspad', fallback=None) + self.backend.pad = config.get('etherpad', 'thankspad', + fallback=None) self.ready = self.backend.pad is not None if config.has_option('irclogs', 'url'): self.irclogs_url = config.get('irclogs', 'url') @@ -266,7 +272,7 @@ class Tweet(UpdateInterface): if len(tweets) > 1: for i in range(0, len(tweets)): tweet = tweets[i] - tweets[i] = tweet + " %d/%d" % (i+1, len(tweets)) + tweets[i] = tweet + " %d/%d" % (i + 1, len(tweets)) try: prior_tweet = None @@ -274,10 +280,11 @@ class Tweet(UpdateInterface): if not prior_tweet: prior_tweet = self.api.update_status(status=tweet) else: - prior_tweet = self.api.update_status(status=tweet, - in_reply_to_status_id = prior_tweet.id, - auto_populate_reply_metadata=True) - except tweepy.TweepyException as e: + prior_tweet = self.api.update_status( + status=tweet, + in_reply_to_status_id=prior_tweet.id, + auto_populate_reply_metadata=True) + except tweepy.TweepyException: self.logger.exception("Failed to tweet") def alert(self, msg=None): diff --git a/test-requirements.txt b/test-requirements.txt index 770c57d..0a5b877 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1 @@ -hacking<0.11,>=0.10.0 +hacking