jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462498 )
Change subject: [IMPR] use enumerate instead of a counter variable ......................................................................
[IMPR] use enumerate instead of a counter variable
Also fix the total number
Change-Id: I4ee945befa9cd8648355bffb19886b8d51a92ad2 --- M scripts/redirect.py 1 file changed, 4 insertions(+), 5 deletions(-)
Approvals: Dvorapa: Looks good to me, but someone else must approve Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/redirect.py b/scripts/redirect.py index 5fff9d7..f387739 100755 --- a/scripts/redirect.py +++ b/scripts/redirect.py @@ -340,15 +340,14 @@ break elif self.xmlFilename: redict = self.get_redirects_from_dump() - num = 0 - for (key, value) in redict.items(): - num += 1 + total = len(redict) + for num, (key, value) in enumerate(redict.items(), start=1): # check if the value - that is, the redirect target - is a # redirect as well if num > self.offset and value in redict: - yield key pywikibot.output('\nChecking redirect {0} of {1}...' - .format(num + 1, len(redict))) + .format(num, total)) + yield key elif self.page_title: yield self.page_title else:
pywikibot-commits@lists.wikimedia.org