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

Change subject: Reuse descriptor values when formatting page tags
......................................................................

Reuse descriptor values when formatting page tags

Read each descriptor value once when collecting page-tag attributes.
Use an assignment expression to avoid a second WeakKeyDictionary lookup
for attributes that are present, retaining the explicit None check.

Change-Id: If13aea5a56241be501ba2cfa149a8224fcbde1a9
---
M pywikibot/proofreadpage.py
1 file changed, 2 insertions(+), 2 deletions(-)

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




diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index b9dc3f4..6ade64d 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -343,8 +343,8 @@

     def __str__(self) -> str:
         descriptors = self.get_descriptors().items()
-        attrs = [v.attrs.get(self) for k, v in descriptors
-                 if v.attrs.get(self) is not None]
+        attrs = [attr for k, v in descriptors
+                 if (attr := v.attrs.get(self)) is not None]
         attrs = ' '.join(str(attr) for attr in attrs)
         return f'<pages {attrs} />' if attrs else '<pages />'


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340525?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: If13aea5a56241be501ba2cfa149a8224fcbde1a9
Gerrit-Change-Number: 1340525
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Mahveotm <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to