jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340524?usp=email )
Change subject: Reuse the globe mapping when resolving coordinates
......................................................................
Reuse the globe mapping when resolving coordinates
Fetch the globe mapping once and reuse it for membership testing and
entity URI lookup. Preserve the error for unsupported globes and the
handling of explicit globe entities.
Change-Id: I50681bb90e64a3d81bf3131236a43870430766b4
---
M pywikibot/_wbtypes.py
1 file changed, 3 insertions(+), 2 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index 5eeee87..945d377 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -168,11 +168,12 @@
by Wikibase
"""
if not self._entity:
- if self.globe not in self.site.globes():
+ globes = self.site.globes()
+ if self.globe not in globes:
raise exceptions.CoordinateGlobeUnknownError(
f'{self.globe} is not supported in Wikibase yet.')
- return self.site.globes()[self.globe]
+ return globes[self.globe]
if isinstance(self._entity, pywikibot.ItemPage):
return self._entity.concept_uri()
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340524?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: I50681bb90e64a3d81bf3131236a43870430766b4
Gerrit-Change-Number: 1340524
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]