jenkins-bot has submitted this change and it was merged.
Change subject: [cleanup] import need_version, use deprecated_args
......................................................................
[cleanup] import need_version, use deprecated_args
- use need_version from pywikibot.site and use this as decorator
- replace multiple deprecate_arg decorators by a single deprecated_args
Change-Id: I82d5a3d3b5a32e35874583b49997eb3729a10cda
---
M pywikibot/page.py
1 file changed, 7 insertions(+), 10 deletions(-)
Approvals:
Lokal Profil: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 93c36f5..2f1bdda 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -64,7 +64,7 @@
UserRightsError,
)
from pywikibot.family import Family
-from pywikibot.site import Namespace
+from pywikibot.site import Namespace, need_version
from pywikibot.tools import (
PYTHON_VERSION,
MediaWikiVersion, UnicodeMixin, ComparableMixin, DotReadableDict,
@@ -1893,8 +1893,7 @@
raise ValueError(u'Timestamp %d is not a deleted revision' %
timestamp)
self._deletedRevs[timestamp]['marked'] = undelete
- @deprecate_arg('throttle', None)
- @deprecate_arg('comment', 'reason')
+ @deprecated_args(comment='reason', throttle=None)
def undelete(self, reason=None):
"""
Undelete revisions based on the markers set by previous calls.
@@ -2167,8 +2166,7 @@
"""Page: A MediaWiki page."""
- @deprecate_arg("insite", None)
- @deprecate_arg("defaultNamespace", "ns")
+ @deprecated_args(defaultNamespace='ns', insite=None)
def __init__(self, source, title=u"", ns=0):
"""Instantiate a Page object."""
if isinstance(source, pywikibot.site.BaseSite):
@@ -2663,7 +2661,7 @@
if total == 0:
return
- @pywikibot.site.need_version("1.13")
+ @need_version('1.13')
def isEmptyCategory(self):
"""
Return True if category has no members (including subcategories).
@@ -2673,7 +2671,7 @@
ci = self.categoryinfo
return sum(ci[k] for k in ['files', 'pages', 'subcats'])
== 0
- @pywikibot.site.need_version("1.11")
+ @need_version('1.11')
def isHiddenCategory(self):
"""
Return True if the category is hidden.
@@ -3215,8 +3213,7 @@
for item in self.contributions(total=total):
yield item[0]
- @deprecate_arg("limit", "total") # To be consistent with rest of
framework
- @deprecate_arg("namespace", "namespaces")
+ @deprecated_args(limit='total', namespace='namespaces')
def contributions(self, total=500, namespaces=[]):
"""
Yield tuples describing this user edits.
@@ -3939,7 +3936,7 @@
data['sitelinks'] = self.sitelinks
return data
- @pywikibot.site.need_version("1.28-wmf.23")
+ @need_version('1.28-wmf.23')
def concept_url(self):
"""Return the full concept URL."""
return '{0}{1}'.format(self.site.concept_base_uri, self.id)
--
To view, visit
https://gerrit.wikimedia.org/r/319991
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I82d5a3d3b5a32e35874583b49997eb3729a10cda
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>