jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/776285 )
Change subject: [Lexemes] Update supported wikibase types in Property.types
......................................................................
[Lexemes] Update supported wikibase types in Property.types
Bug: T305297
Change-Id: I9a41fbe86c10ae35be91f770fa4bc6c71664b06d
---
M pywikibot/page/_wikibase.py
1 file changed, 32 insertions(+), 15 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index b584121..36eca8f 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -1112,21 +1112,26 @@
behaviour and semantics.
"""
- types = {'wikibase-item': ItemPage,
- # 'wikibase-property': PropertyPage, must be declared first
- 'string': str,
- 'commonsMedia': FilePage,
- 'globe-coordinate': pywikibot.Coordinate,
- 'url': str,
- 'time': pywikibot.WbTime,
- 'quantity': pywikibot.WbQuantity,
- 'monolingualtext': pywikibot.WbMonolingualText,
- 'math': str,
- 'external-id': str,
- 'geo-shape': pywikibot.WbGeoShape,
- 'tabular-data': pywikibot.WbTabularData,
- 'musical-notation': str,
- }
+ types = {
+ 'commonsMedia': FilePage,
+ 'external-id': str,
+ 'geo-shape': pywikibot.WbGeoShape,
+ 'globe-coordinate': pywikibot.Coordinate,
+ 'math': str,
+ 'monolingualtext': pywikibot.WbMonolingualText,
+ 'musical-notation': str,
+ 'quantity': pywikibot.WbQuantity,
+ 'string': str,
+ 'tabular-data': pywikibot.WbTabularData,
+ 'time': pywikibot.WbTime,
+ 'url': str,
+ 'wikibase-item': ItemPage,
+ # The following types are added later, they must be declared first
+ # 'wikibase-form': LexemeForm,
+ # 'wikibase-sense': LexemeSense,
+ # 'wikibase-lexeme': LexemePage,
+ # 'wikibase-property': PropertyPage,
+ }
# the value type where different from the type
value_types = {'wikibase-item': 'wikibase-entityid',
@@ -2045,6 +2050,10 @@
return super().isRedirectPage()
+# Add LexemePage to the class attribute "types" after its declaration.
+Property.types['wikibase-lexeme'] = LexemePage
+
+
class LexemeSubEntity(WikibaseEntity):
"""Common super class for LexemeForm and LexemeSense."""
@@ -2199,6 +2208,10 @@
self._content = updates['form']
+# Add LexemeForm to the class attribute "types" after its declaration.
+Property.types['wikibase-form'] = LexemeForm
+
+
class LexemeSense(LexemeSubEntity):
"""Wikibase lexeme sense."""
@@ -2211,6 +2224,10 @@
}
+# Add LexemeSnese to the class attribute "types" after its declaration.
+Property.types['wikibase-sense'] = LexemeSense
+
+
class LexemeFormCollection(SubEntityCollection):
type_class = LexemeForm
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/776285
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9a41fbe86c10ae35be91f770fa4bc6c71664b06d
Gerrit-Change-Number: 776285
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]