jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/507332 )
Change subject: [IMPR] Derive CommonscatBot from SingleSiteBot ......................................................................
[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(-)
Approvals: Dvorapa: Looks good to me, but someone else must approve D3r1ck01: Looks good to me, approved jenkins-bot: Verified
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: