jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/692862 )
Change subject: [IMPR] use itertools.count in reflinks.py ......................................................................
[IMPR] use itertools.count in reflinks.py
Change-Id: I7ff4e138a61ea27813367fad503248b21ae93981 --- M scripts/reflinks.py 1 file changed, 3 insertions(+), 1 deletion(-)
Approvals: Matěj Suchánek: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/reflinks.py b/scripts/reflinks.py index dc437c4..2c4a9d1 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -41,11 +41,13 @@ # import codecs import http.client as httplib +import itertools import os import re import socket import subprocess import tempfile + from contextlib import suppress from functools import partial from http import HTTPStatus @@ -353,7 +355,7 @@ used_numbers.add(int(number))
# generator to give the next free number - free_number = (str(i) for i in range(1, 1000) # should be enough + free_number = (str(i) for i in itertools.count(start=1) if i not in used_numbers)
for (g, d) in found_refs.items():
pywikibot-commits@lists.wikimedia.org