jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/540853 )
Change subject: [IMPR] Improvements for askForHints (2) ......................................................................
[IMPR] Improvements for askForHints (2)
- decrease nested code
Change-Id: I0380a8c3342e9672da86e372c9ab985b886fc84d --- M scripts/interwiki.py 1 file changed, 28 insertions(+), 28 deletions(-)
Approvals: D3r1ck01: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py index 35da344..36bcc7f 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -1178,35 +1178,35 @@ and not self.originPage.isCategoryRedirect()):
self.hintsAsked = True - if self.conf.untranslated: - t = self.conf.showtextlink - if t: - pywikibot.output(self.originPage.get()[:t]) + if not self.conf.untranslated: + return
- while True: - newhint = pywikibot.input( - 'Give a hint (? to see pagetext):') - if not newhint: - break - if newhint == '?': - t += self.conf.showtextlinkadd - pywikibot.output(self.originPage.get()[:t]) - elif ':' not in newhint: - pywikibot.output(fill( - 'Please enter a hint in the format ' - 'language:pagename or type nothing if you do not ' - 'have a hint.')) - else: - links = titletranslate.translate( - self.originPage, - hints=[newhint], - auto=self.conf.auto, - removebrackets=self.conf.hintnobracket) - for link in links: - page = pywikibot.Page(link) - self.addIfNew(page, counter, None) - if self.conf.hintsareright: - self.hintedsites.add(page.site) + t = self.conf.showtextlink + if t: + pywikibot.output(self.originPage.get()[:t]) + + while True: + newhint = pywikibot.input('Give a hint (? to see pagetext):') + if not newhint: + break + if newhint == '?': + t += self.conf.showtextlinkadd + pywikibot.output(self.originPage.get()[:t]) + elif ':' not in newhint: + pywikibot.output(fill( + 'Please enter a hint in the format language:pagename ' + 'or type nothing if you do not have a hint.')) + else: + links = titletranslate.translate( + self.originPage, + hints=[newhint], + auto=self.conf.auto, + removebrackets=self.conf.hintnobracket) + for link in links: + page = pywikibot.Page(link) + self.addIfNew(page, counter, None) + if self.conf.hintsareright: + self.hintedsites.add(page.site)
def batchLoaded(self, counter): """
pywikibot-commits@lists.wikimedia.org