jenkins-bot merged this change.
[IMPR] Derive CommonscatBot from SingleSiteBot
Step 1 of commonscat.py improvements
Change-Id: I83619482bd40ed417b91ceaf895ee6b3845b221c
---
M scripts/commonscat.py
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 032181c..5ca659d 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -52,8 +52,8 @@
# November 2013
#
# (C) Multichill, 2008-2009
-# (C) Xqt, 2009-2018
-# (C) Pywikibot team, 2008-2018
+# (C) Xqt, 2009-2019
+# (C) Pywikibot team, 2008-2019
#
# Distributed under the terms of the MIT license.
#
@@ -63,7 +63,8 @@
import pywikibot
-from pywikibot import i18n, pagegenerators, Bot
+from pywikibot import i18n, pagegenerators
+from pywikibot.bot import SingleSiteBot
from scripts.add_text import add_text
@@ -225,18 +226,16 @@
}
-class CommonscatBot(Bot):
+class CommonscatBot(SingleSiteBot):
"""Commons categorisation bot."""
- def __init__(self, generator, **kwargs):
+ def __init__(self, **kwargs):
"""Initializer."""
self.availableOptions.update({
'summary': None,
})
super(CommonscatBot, self).__init__(**kwargs)
- self.generator = generator
- self.site = pywikibot.Site()
def treat(self, page):
"""Load the given page, do some changes, and save it."""
@@ -553,7 +552,7 @@
if generator:
if not genFactory.nopreload:
generator = pagegenerators.PreloadingGenerator(generator)
- bot = CommonscatBot(generator, **options)
+ bot = CommonscatBot(generator=generator, **options)
bot.run()
return True
else:
To view, visit change 507332. To unsubscribe, or for help writing mail filters, visit settings.