jenkins-bot has submitted this change and it was merged.
Change subject: Deprecate unused 'default' argument for magicwords
......................................................................
Deprecate unused 'default' argument for magicwords
compat has a 'default' argument for each of the methods which
return a magic word. It is now unused and deprecated in compat.
Use @deprecated_args to also deprecate it in core.
Change-Id: Ia600aed3fc43d950e9c98851029c20fd895a4438
---
M pywikibot/site.py
M tests/site_tests.py
2 files changed, 16 insertions(+), 18 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Nullzero: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index ba1b00c..268ebbd 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -685,20 +685,18 @@
old_name='normalizeNamespace',
class_name='BaseSite')
- def redirect(self, default=True):
- """Return list of localized redirect tags for the site.
-
- If default is True, falls back to 'REDIRECT' if the site has no
- special redirect tag.
-
- """
+ @deprecated_args(default=None)
+ def redirect(self):
+ """Return list of localized redirect tags for the site."""
return [u"REDIRECT"]
- def pagenamecodes(self, default=True):
+ @deprecated_args(default=None)
+ def pagenamecodes(self):
"""Return list of localized PAGENAME tags for the site."""
return [u"PAGENAME"]
- def pagename2codes(self, default=True):
+ @deprecated_args(default=None)
+ def pagename2codes(self):
"""Return list of localized PAGENAMEE tags for the site."""
return [u"PAGENAMEE"]
@@ -1980,6 +1978,7 @@
return pywikibot.Timestamp.fromtimestampformat(
self.expand_text("{{CURRENTTIMESTAMP}}"))
+ @need_version("1.14")
def getmagicwords(self, word):
"""Return list of localized "word" magic words for the site."""
if not hasattr(self, "_magicwords"):
@@ -1992,12 +1991,9 @@
else:
return [word]
- def redirect(self, default=True):
- """Return the preferred localized #REDIRECT keyword.
-
- Argument is ignored (but maintained for backwards-compatibility).
-
- """
+ @deprecated_args(default=None)
+ def redirect(self):
+ """Return the localized #REDIRECT keyword."""
# return the magic word without the preceding '#' character
return self.getmagicwords("redirect")[0].lstrip("#")
@@ -2018,11 +2014,13 @@
pattern = None
return BaseSite.redirectRegex(self, pattern)
- def pagenamecodes(self, default=True):
+ @deprecated_args(default=None)
+ def pagenamecodes(self):
"""Return list of localized PAGENAME tags for the site."""
return self.getmagicwords("pagename")
- def pagename2codes(self, default=True):
+ @deprecated_args(default=None)
+ def pagename2codes(self):
"""Return list of localized PAGENAMEE tags for the site."""
return self.getmagicwords("pagenamee")
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 10d36ed..408c60b 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -130,7 +130,7 @@
'Site("%s", "%s")'
% (self.code, self.family))
self.assertIsInstance(mysite.linktrail(), basestring)
- self.assertIsInstance(mysite.redirect(default=True), basestring)
+ self.assertIsInstance(mysite.redirect(), basestring)
try:
dabcat = mysite.disambcategory()
except pywikibot.Error as e:
--
To view, visit https://gerrit.wikimedia.org/r/172499
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia600aed3fc43d950e9c98851029c20fd895a4438
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Nullzero <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits