jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655722 )
Change subject: [cleanup] remove positional arguments of page.Revision object
......................................................................
[cleanup] remove positional arguments of page.Revision object
Usage of positional arguments is deprecated already.
Follow up for T259428
Change-Id: I69ae7cbef8e4f8c4a22ab524985c1ac9dd290fb5
---
M pywikibot/page/_revision.py
1 file changed, 3 insertions(+), 31 deletions(-)
Approvals:
DannyS712: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_revision.py b/pywikibot/page/_revision.py
index 627fda0..46913f5 100644
--- a/pywikibot/page/_revision.py
+++ b/pywikibot/page/_revision.py
@@ -1,6 +1,6 @@
"""Object representing page revision."""
#
-# (C) Pywikibot team, 2008-2020
+# (C) Pywikibot team, 2008-2021
#
# Distributed under the terms of the MIT license.
#
@@ -9,7 +9,7 @@
from collections.abc import Mapping
from pywikibot import Timestamp, warning
-from pywikibot.tools import deprecated, issue_deprecation_warning
+from pywikibot.tools import deprecated
class Revision(Mapping):
@@ -26,40 +26,12 @@
Sample for Revision access
"""
- def __init__(self, *args, **kwargs):
+ def __init__(self, **kwargs):
"""Initializer."""
- self._clean_args(args, kwargs)
self._data = kwargs
self._upcast_dict(self._data)
super().__init__()
- def _clean_args(self, args: tuple, kwargs: dict):
- """Cleanup positional arguments.
-
- Replace positional arguments with keyword arguments for
- backwards compatibility.
- @param: args: tuple of positional arguments
- @param: kwargs: mutable dict of keyword arguments to be updated
- """
- keys = ( # postional argument keys by old order
- 'revid', 'timestamp', 'user', 'anon',
'comment', 'text', 'minor',
- 'rollbacktoken', 'parentid', 'contentmodel',
'sha1', 'slots'
- )
-
- # replace positional arguments with keyword arguments
- for i, (arg, key) in enumerate(zip(args, keys)): # pragma: no cover
- issue_deprecation_warning('Positional argument {} ({})'
- .format(i + 1, arg),
- 'keyword argument "{}={}"'
- .format(key, arg),
- warning_class=FutureWarning,
- since='20200802')
- if key in kwargs:
- warning('"{}" is given as keyword argument "{}"
already; '
- 'ignoring "{}"'.format(key, arg, kwargs[key]))
- else:
- kwargs[key] = arg
-
@staticmethod
def _upcast_dict(map_):
"""Upcast dictionary values."""
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655722
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: I69ae7cbef8e4f8c4a22ab524985c1ac9dd290fb5
Gerrit-Change-Number: 655722
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: DannyS712 <DannyS712.enwiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged