jenkins-bot merged this change.

View Change

Approvals: D3r1ck01: Looks good to me, approved jenkins-bot: Verified
[IMPR] Improvements for askForHints (2)

- decrease nested code

Change-Id: I0380a8c3342e9672da86e372c9ab985b886fc84d
---
M scripts/interwiki.py
1 file changed, 28 insertions(+), 28 deletions(-)

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):
"""

To view, visit change 540853. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0380a8c3342e9672da86e372c9ab985b886fc84d
Gerrit-Change-Number: 540853
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: jenkins-bot (75)