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

Change subject: blockpageschecker: Use search for template checks
......................................................................

blockpageschecker: Use search for template checks

Stop at the first protection-template match when only existence is needed.

Avoid collecting unused regex match lists for each page.

Change-Id: If67e6e3fd555234b546d3165130646bb325f7916
---
M scripts/blockpageschecker.py
1 file changed, 3 insertions(+), 6 deletions(-)

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




diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index 4c7524c..d689e0f 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -268,21 +268,18 @@
                     continue

                 for catch_regex in template:
-                    result_catch = re.findall(catch_regex, text)
-                    if result_catch:
+                    if re.search(catch_regex, text):
                         return _ParsedTemplate(
                             results[index], catch_regex, 'modifying')

             if tsmp and ttmp and ttp != ttmp and tsp != tsmp:
                 for catch_regex in ttmp:
-                    result_catch = re.findall(catch_regex, text)
-                    if result_catch:
+                    if re.search(catch_regex, text):
                         return _ParsedTemplate(
                             'sysop-move', catch_regex, 'modifying')

                 for catch_regex in tsmp:
-                    result_catch = re.findall(catch_regex, text)
-                    if result_catch:
+                    if re.search(catch_regex, text):
                         return _ParsedTemplate(
                             'autoconfirmed-move', catch_regex, 'modifying')


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328357?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: If67e6e3fd555234b546d3165130646bb325f7916
Gerrit-Change-Number: 1328357
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