jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[bugfix] Fix regressions from lexeme support

These code fragments were probably dropped during rebase. Sigh.

Bug: T189321
Change-Id: I5246b0652552161b6d2b3df11572300d25637352
---
M pywikibot/page/_wikibase.py
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 7a5c618..26ea6ae 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -1140,6 +1140,9 @@
# the value type where different from the type
value_types = {'wikibase-item': 'wikibase-entityid',
'wikibase-property': 'wikibase-entityid',
+ 'wikibase-lexeme': 'wikibase-entityid',
+ 'wikibase-form': 'wikibase-entityid',
+ 'wikibase-sense': 'wikibase-entityid',
'commonsMedia': 'string',
'url': 'string',
'globe-coordinate': 'globecoordinate',
@@ -1299,6 +1302,9 @@
ItemPage(site, 'Q' + str(value['numeric-id'])),
'wikibase-property': lambda value, site:
PropertyPage(site, 'P' + str(value['numeric-id'])),
+ 'wikibase-lexeme': lambda value, site: LexemePage(site, value['id']),
+ 'wikibase-form': lambda value, site: LexemeForm(site, value['id']),
+ 'wikibase-sense': lambda value, site: LexemeSense(site, value['id']),
'commonsMedia': lambda value, site:
FilePage(pywikibot.Site('commons', 'commons'), value), # T90492
'globe-coordinate': pywikibot.Coordinate.fromWikibase,
@@ -1775,7 +1781,7 @@

The function checks for:

- - WikibasePage ID equality
+ - WikibaseEntity ID equality
- WbTime year equality
- Coordinate equality, regarding precision
- WbMonolingualText text equality
@@ -1785,7 +1791,7 @@
:return: true if the Claim's target is equal to the value provided,
false otherwise
"""
- if (isinstance(self.target, WikibasePage)
+ if (isinstance(self.target, WikibaseEntity)
and isinstance(value, str)):
return self.target.id == value

@@ -1836,9 +1842,14 @@

:return: JSON value
"""
+ # todo: eventually unify the following two groups
if self.type in ('wikibase-item', 'wikibase-property'):
value = {'entity-type': self.getTarget().entity_type,
'numeric-id': self.getTarget().getID(numeric=True)}
+ elif self.type in (
+ 'wikibase-lexeme', 'wikibase-form', 'wikibase-sense'):
+ value = {'entity-type': self.getTarget().entity_type,
+ 'id': self.getTarget().getID()}
elif self.type in ('string', 'url', 'math', 'external-id',
'musical-notation'):
value = self.getTarget()

To view, visit change 776902. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5246b0652552161b6d2b3df11572300d25637352
Gerrit-Change-Number: 776902
Gerrit-PatchSet: 2
Gerrit-Owner: Matěj Suchánek <matejsuchanek97@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged