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:

--
To view, visit https://gerrit.wikimedia.org/r/462498
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4ee945befa9cd8648355bffb19886b8d51a92ad2
Gerrit-Change-Number: 462498
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: Dvorapa <[email protected]>
Gerrit-Reviewer: Framawiki <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Matěj Suchánek <[email protected]>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to