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
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/845863
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: Ie009d508d1dd2ec923450e420c629cdd9bf65ab6
Gerrit-Change-Number: 845863
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged