jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/364105 )
Change subject: [DOC] Improve deprecation warnings ......................................................................
[DOC] Improve deprecation warnings
- Provide a better deprecation warning for DataSite data access methods - Note: There is no equivalent value for info['type'] and urls property
Bug: T170075 Change-Id: I89bad3b050fb0dee3187c26468dc1bcdec35ee27 --- M pywikibot/site.py 1 file changed, 19 insertions(+), 1 deletion(-)
Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index e2bc6cc..d2756e3 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -7276,8 +7276,26 @@ props = attr.replace("get_", "") if props in ['info', 'sitelinks', 'aliases', 'labels', 'descriptions', 'urls']: + if props == 'info': + instead = ( + '\n' + "{'lastrevid': WikibasePage.latest_revision_id,\n" + " 'pageid': WikibasePage.pageid,\n" + " 'title': WikibasePage.title(),\n" + " 'modified': WikibasePage._timestamp,\n" + " 'ns': WikibasePage.namespace(),\n" + " 'type': WikibasePage.entity_type, # for subclasses\n" + " 'id': WikibasePage.id" + '}\n') + elif props == 'sitelinks': + instead = 'ItemPage.sitelinks' + elif props in ('aliases', 'labels', 'descriptions'): + instead = ('WikibasePage.{0} after WikibasePage.get()' + .format(attr)) + else: # urls + instead = None issue_deprecation_warning('DataSite.{0}()'.format(attr), - 'WikibasePage', 2) + instead, 2) if props == 'urls': props = 'sitelinks/urls' method = self._get_propertyitem
pywikibot-commits@lists.wikimedia.org