jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1346420?usp=email )

Change subject: checkimages: Use a set to track loaded settings
......................................................................

checkimages: Use a set to track loaded settings

Track decoded strings in a seen set instead of searching the growing
result list for each match. This avoids quadratic duplicate checks on
large configuration lists.

Keep the result as a list in first-occurrence order. Preserve matching,
backslash decoding and deduplication after decoding.

Change-Id: I632c1d0492592cc89b3ed960843f39d74a18da75
---
M scripts/checkimages.py
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 2f90ffe..c585210 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1290,13 +1290,15 @@
     def load(raw) -> list[str]:
         """Load a list of objects from a string using regex."""
         list_loaded = []
+        seen = set()
         # I search with a regex how many user have not the talk page
         # and i put them in a list (i find it more easy and secure)
         regl = r"(\"|\')(.*?)\1(?:,|\])"
         pl = re.compile(regl)
         for xl in pl.finditer(raw):
             word = xl[2].replace('\\\\', '\\')
-            if word not in list_loaded:
+            if word not in seen:
+                seen.add(word)
                 list_loaded.append(word)
         return list_loaded


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1346420?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I632c1d0492592cc89b3ed960843f39d74a18da75
Gerrit-Change-Number: 1346420
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to