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

Change subject: pagegenerators: Reuse page title in ignore filter
......................................................................

pagegenerators: Reuse page title in ignore filter

Read each page title once while applying configured ignore patterns.

Reuse the same value for every regex and the optional verbose message.

Change-Id: I2aec1be49da31e420cf3c234234edce2c97273ed
---
M pywikibot/pagegenerators/_filters.py
1 file changed, 6 insertions(+), 6 deletions(-)

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




diff --git a/pywikibot/pagegenerators/_filters.py 
b/pywikibot/pagegenerators/_filters.py
index 190bb13..32aa660 100644
--- a/pywikibot/pagegenerators/_filters.py
+++ b/pywikibot/pagegenerators/_filters.py
@@ -94,20 +94,20 @@
         language codes are mapped to lists of page titles. Each title must
         be a valid regex as they are compared using :py:obj:`re.search`.
     """
-    def is_ignored(page: pywikibot.page.BasePage) -> bool:
+    for page in generator:
         try:
             site_ig_list = ignore_list[page.site.family.name][page.site.code]
         except KeyError:
-            return False
-        return any(re.search(ig, page.title()) for ig in site_ig_list)
+            yield page
+            continue

-    for page in generator:
-        if not is_ignored(page):
+        page_title = page.title()
+        if not any(re.search(ig, page_title) for ig in site_ig_list):
             yield page
             continue

         if config.verbose_output:
-            pywikibot.info(f'Ignoring page {page.title()}')
+            pywikibot.info(f'Ignoring page {page_title}')


 def RedirectFilterPageGenerator(

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