jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1344814?usp=email )
Change subject: page: Check disambiguation templates with isdisjoint
......................................................................
page: Check disambiguation templates with isdisjoint
Use the cached disambiguation-template set directly to check for matching
page templates. Avoid copying the set and constructing an intersection
that is only used as a boolean.
Change-Id: I1536ebf453d1de53584d497eec684e57aabede40
---
M pywikibot/page/_basepage.py
1 file changed, 1 insertion(+), 6 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index a6d65e5..791281a 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -1169,13 +1169,8 @@
templates = {tl.title(with_ns=False)
for tl in self.templates(namespaces=Namespace.TEMPLATE)}
- disambigs = set()
- # always use cached disambig templates
- disambigs.update(self.site._disambigtemplates)
- # see if any template on this page is in the set of disambigs
- disambig_in_page = disambigs.intersection(templates)
return (self.namespace() != Namespace.TEMPLATE
- and bool(disambig_in_page))
+ and not self.site._disambigtemplates.isdisjoint(templates))
def getReferences(self,
follow_redirects: bool = True,
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1344814?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: I1536ebf453d1de53584d497eec684e57aabede40
Gerrit-Change-Number: 1344814
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]