jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/845863 )
Change subject: [cleanup] Cleanup MW version dependency in Site.notifications ......................................................................
[cleanup] Cleanup MW version dependency in Site.notifications
Also update documentation of EchoMixin
Bug: T306637 Change-Id: Ie009d508d1dd2ec923450e420c629cdd9bf65ab6 --- M pywikibot/site/_extensions.py 1 file changed, 7 insertions(+), 11 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site/_extensions.py b/pywikibot/site/_extensions.py index 6c5cf58..f252c5d 100644 --- a/pywikibot/site/_extensions.py +++ b/pywikibot/site/_extensions.py @@ -29,12 +29,11 @@ def notifications(self, **kwargs): """Yield Notification objects from the Echo extension.
- :keyword format: If specified, notifications will be returned formatted - this way. Its value is either 'model', 'special' or None. Default - is 'special'. - :type format: str or None + :keyword Optional[str] format: If specified, notifications will + be returned formatted this way. Its value is either ``model``, + ``special`` or ``None``. Default is ``special``.
- Refer API reference for other keywords. + .. seealso:: :api:`Notifications` for other keywords. """ params = { 'action': 'query', @@ -48,19 +47,16 @@ data = self.simple_request(**params).submit() notifications = data['query']['notifications']['list']
- # Support API before 1.27.0-wmf.22 - if hasattr(notifications, 'values'): - notifications = notifications.values() - return (Notification.fromJSON(self, notification) for notification in notifications)
@need_extension('Echo') - def notifications_mark_read(self, **kwargs): + def notifications_mark_read(self, **kwargs) -> bool: """Mark selected notifications as read.
+ .. seealso:: :api:`echomarkread` + :return: whether the action was successful - :rtype: bool """ # TODO: ensure that the 'echomarkread' action # is supported by the site
pywikibot-commits@lists.wikimedia.org