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

Change subject: Reuse entity IDs when serializing lexeme properties
......................................................................

Reuse entity IDs when serializing lexeme properties

Read each language and lexical category ID once and reuse it for the
JSON comparison and assignment. Avoid a second getID() call when the
property differs from the supplied data.

Change-Id: Ic9c3b2def31b2b6c9f5eced238312519612bf2b7
---
M pywikibot/page/_wikibase.py
1 file changed, 3 insertions(+), 2 deletions(-)

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




diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 4e2df9a..d05a999 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -2320,8 +2320,9 @@
             value = getattr(self, prop, None)
             if not value:
                 continue
-            if not diffto or diffto.get(prop) != value.getID():
-                data[prop] = value.getID()
+            value_id = value.getID()
+            if not diffto or diffto.get(prop) != value_id:
+                data[prop] = value_id

         return data


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

Reply via email to