jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/611828 )
Change subject: Update misspelling for py3 ......................................................................
Update misspelling for py3
Bug: T257399 Change-Id: I075a48bf647447fd5bfa39d99d52b9920f597bbe --- M scripts/misspelling.py 1 file changed, 11 insertions(+), 17 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/misspelling.py b/scripts/misspelling.py index 8288375..7a7c454 100755 --- a/scripts/misspelling.py +++ b/scripts/misspelling.py @@ -21,18 +21,16 @@ -main only check pages in the main namespace, not in the talk, wikipedia, user, etc. namespaces. """ -# (C) Pywikibot team, 2007-2019 +# (C) Pywikibot team, 2007-2020 # # Distributed under the terms of the MIT license. # -from __future__ import absolute_import, division, unicode_literals - from itertools import chain +from typing import Generator
import pywikibot
from pywikibot import i18n, pagegenerators - from pywikibot.tools import UnicodeType
from scripts.solve_disambiguation import DisambiguationRobot @@ -67,18 +65,14 @@ 'nl': 'Categorie:Wikipedia:Redirect voor spelfout', }
- def __init__(self, always, firstPageTitle, main_only): + def __init__(self, always, firstPageTitle, main_only) -> None: """Initializer.""" - super(MisspellingRobot, self).__init__( - always, [], True, False, None, False, main_only) + super().__init__(always, [], True, False, None, False, main_only) self.generator = self.createPageGenerator(firstPageTitle)
- def createPageGenerator(self, firstPageTitle): - """ - Generator to retrieve misspelling pages or misspelling redirects. - - @rtype: generator - """ + def createPageGenerator(self, firstPageTitle) -> Generator[pywikibot.Page, + None, None]: + """Generator to retrieve misspelling pages or misspelling redirects.""" mycode = self.site.code if mycode in self.misspellingCategory: categories = self.misspellingCategory[mycode] @@ -111,14 +105,13 @@ preloadingGen = pagegenerators.PreloadingGenerator(generator) return preloadingGen
- def findAlternatives(self, disambPage): + def findAlternatives(self, disambPage) -> bool: """ Append link target to a list of alternative links.
Overrides the DisambiguationRobot method.
@return: True if alternate link was appended - @rtype: bool or None """ if disambPage.isRedirectPage(): self.alternatives.append(disambPage.getRedirectTarget().title()) @@ -142,8 +135,9 @@ # only one correct spelling. self.alternatives.append(correctSpelling) return True + return False
- def setSummaryMessage(self, disambPage, *args, **kwargs): + def setSummaryMessage(self, disambPage, *args, **kwargs) -> None: """ Setup the summary message.
@@ -155,7 +149,7 @@ {'page': disambPage.title()})
-def main(*args): +def main(*args) -> None: """ Process command line arguments and invoke bot.
pywikibot-commits@lists.wikimedia.org