jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/725402 )
Change subject: [cleanup] Remove @remove_last_args decorator ......................................................................
[cleanup] Remove @remove_last_args decorator
Change-Id: I5c9ecb351d22671b408ffe1e5d60aca80679ecd7 --- M pywikibot/bot.py M pywikibot/data/wikistats.py M pywikibot/login.py M pywikibot/page/__init__.py M pywikibot/site/_apisite.py M pywikibot/site/_basesite.py M pywikibot/site/_generators.py M pywikibot/site/_obsoletesites.py M scripts/archive/imagecopy.py M scripts/noreferences.py 10 files changed, 1 insertion(+), 39 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 1877226..7f6be26 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -176,7 +176,6 @@ deprecated, deprecated_args, issue_deprecation_warning, - remove_last_args, ) from pywikibot.tools._logging import LoggingFormatter from pywikibot.tools.formatter import color_format @@ -320,7 +319,6 @@ return '{}.{}{}'.format(root, qualifier, ext)
-@remove_last_args(['strm']) def init_handlers() -> None: """Initialize logging system for terminal-based bots.
diff --git a/pywikibot/data/wikistats.py b/pywikibot/data/wikistats.py index 6865f57..f6db4b4 100644 --- a/pywikibot/data/wikistats.py +++ b/pywikibot/data/wikistats.py @@ -1,6 +1,6 @@ """Objects representing WikiStats API.""" # -# (C) Pywikibot team, 2014-2020 +# (C) Pywikibot team, 2014-2021 # # Distributed under the terms of the MIT license. # @@ -10,7 +10,6 @@
import pywikibot from pywikibot.comms import http -from pywikibot.tools import remove_last_args
class WikiStats: @@ -77,7 +76,6 @@ self.url = url self._data = {}
- @remove_last_args(['format']) def get(self, table: str) -> list: """Get a list of a table of data.
@@ -99,7 +97,6 @@ self._data[table] = data return data
- @remove_last_args(['format']) def get_dict(self, table: str) -> dict: """Get dictionary of a table of data.
diff --git a/pywikibot/login.py b/pywikibot/login.py index ba49ba1..144467d 100644 --- a/pywikibot/login.py +++ b/pywikibot/login.py @@ -23,7 +23,6 @@ deprecated_args, file_mode_checker, normalize_username, - remove_last_args, )
@@ -190,7 +189,6 @@ # THIS IS OVERRIDDEN IN data/api.py raise NotImplementedError
- @remove_last_args(['data']) def storecookiedata(self) -> None: """Store cookie data.""" http.cookie_jar.save(ignore_discard=True) diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py index ee06a02..dce0e77 100644 --- a/pywikibot/page/__init__.py +++ b/pywikibot/page/__init__.py @@ -77,7 +77,6 @@ issue_deprecation_warning, ModuleDeprecationWrapper, redirect_func, - remove_last_args, )
@@ -351,7 +350,6 @@ title = title.replace(forbidden, '_') return title
- @remove_last_args(('decode', 'underscore')) def section(self) -> Optional[str]: """ Return the name of the section this Page refers to. @@ -420,7 +418,6 @@ """Return True if title of this Page is in the autoFormat dict.""" return self.autoFormat()[0] is not None
- @remove_last_args(['sysop']) def get(self, force: bool = False, get_redirect: bool = False) -> str: """Return the wiki-text of the page.
@@ -483,7 +480,6 @@ self._getexception = IsRedirectPageError(self) raise self._getexception
- @remove_last_args(['sysop']) def getOldVersion(self, oldid, force: bool = False, get_redirect: bool = False) -> str: """ @@ -698,7 +694,6 @@
return self._lastNonBotUser
- @remove_last_args(('datetime', )) def editTime(self): """Return timestamp of last revision to page.
@@ -827,7 +822,6 @@ """Return True if this is a file description page, False otherwise.""" return self.namespace() == 6
- @remove_last_args(['get_Index']) def isDisambig(self) -> bool: """ Return True if this is a disambiguation page, False otherwise. @@ -1708,7 +1702,6 @@ self.site.merge_history(self, dest, timestamp, reason)
@deprecated_args(deleteAndMove='noredirect', movetalkpage='movetalk') - @remove_last_args(['safe']) def move(self, newtitle: str, reason: Optional[str] = None, diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py index 57503f0..368fe76 100644 --- a/pywikibot/site/_apisite.py +++ b/pywikibot/site/_apisite.py @@ -79,7 +79,6 @@ issue_deprecation_warning, merge_unique_dicts, normalize_username, - remove_last_args, )
@@ -109,7 +108,6 @@ Do not instantiate directly; use :py:obj:`pywikibot.Site` function. """
- @remove_last_args(['sysop']) def __init__(self, code, fam=None, user=None): """Initializer.""" super().__init__(code, fam, user) @@ -284,7 +282,6 @@ return self._request_class({'parameters': kwargs}).create_simple( self, **kwargs)
- @remove_last_args(['sysop']) def logged_in(self): """Verify the bot is logged into the site as the expected user.
@@ -521,7 +518,6 @@ self._globaluserinfo['registration'] = iso_ts return self._globaluserinfo
- @remove_last_args(['sysop']) def is_blocked(self): """ Return True when logged in user is blocked. @@ -605,7 +601,6 @@ start=start, end=end, reverse=reverse, is_ts=is_ts))
- @remove_last_args(['sysop']) def has_right(self, right): """Return true if and only if the user has a specific right.
@@ -617,7 +612,6 @@ """ return right.lower() in self.userinfo['rights']
- @remove_last_args(['sysop']) def has_group(self, group): """Return true if and only if the user is a member of specified group.
@@ -627,7 +621,6 @@ """ return group.lower() in self.userinfo['groups']
- @remove_last_args(['sysop']) def messages(self): """Return true if the user has new messages, and false otherwise.""" return 'messages' in self.userinfo @@ -830,7 +823,6 @@ return self._magicwords[word] return [word]
- @remove_last_args(('default', )) def redirect(self): """Return the localized #REDIRECT keyword.""" # return the magic word without the preceding '#' character @@ -858,12 +850,10 @@ pattern = None return super().redirectRegex(pattern)
- @remove_last_args(('default', )) def pagenamecodes(self): """Return list of localized PAGENAME tags for the site.""" return self.getmagicwords('pagename')
- @remove_last_args(('default', )) def pagename2codes(self): """Return list of localized PAGENAMEE tags for the site.""" return self.getmagicwords('pagenamee') diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py index 7a8e354..3a3a605 100644 --- a/pywikibot/site/_basesite.py +++ b/pywikibot/site/_basesite.py @@ -25,7 +25,6 @@ deprecated, first_upper, normalize_username, - remove_last_args, )
@@ -33,7 +32,6 @@
"""Site methods that are independent of the communication interface."""
- @remove_last_args(['sysop']) def __init__(self, code: str, fam=None, user=None) -> None: """ Initializer. @@ -186,7 +184,6 @@ return self.username() return None
- @remove_last_args(['sysop']) def username(self): """Return the username used for the site.""" return self._username @@ -264,17 +261,14 @@ index = self.namespaces.lookup_name(value) return self.namespace(index)
- @remove_last_args(('default', )) def redirect(self): """Return list of localized redirect tags for the site.""" return ['REDIRECT']
- @remove_last_args(('default', )) def pagenamecodes(self): """Return list of localized PAGENAME tags for the site.""" return ['PAGENAME']
- @remove_last_args(('default', )) def pagename2codes(self): """Return list of localized PAGENAMEE tags for the site.""" return ['PAGENAMEE'] diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py index 0a5d745..efe03bf 100644 --- a/pywikibot/site/_generators.py +++ b/pywikibot/site/_generators.py @@ -32,7 +32,6 @@ is_ip_address, issue_deprecation_warning, itergroup, - remove_last_args, )
@@ -589,7 +588,6 @@ return props
@deprecated_args(getText='content', sysop=True) - @remove_last_args(['rollback']) def loadrevisions(self, page, *, content=False, section=None, **kwargs): """Retrieve revision information and store it in page object.
diff --git a/pywikibot/site/_obsoletesites.py b/pywikibot/site/_obsoletesites.py index f306d5b..f66c9d4 100644 --- a/pywikibot/site/_obsoletesites.py +++ b/pywikibot/site/_obsoletesites.py @@ -8,7 +8,6 @@ from pywikibot.exceptions import NoPageError from pywikibot.site._apisite import APISite from pywikibot.site._basesite import BaseSite -from pywikibot.tools import remove_last_args
class RemovedSite(BaseSite): @@ -21,7 +20,6 @@ class ClosedSite(APISite): """Site closed to read-only mode."""
- @remove_last_args(['sysop']) def __init__(self, code, fam, user=None): """Initializer.""" super().__init__(code, fam, user) diff --git a/scripts/archive/imagecopy.py b/scripts/archive/imagecopy.py index 49577d0..3b36af9 100755 --- a/scripts/archive/imagecopy.py +++ b/scripts/archive/imagecopy.py @@ -72,7 +72,6 @@ from pywikibot import config, i18n, pagegenerators from pywikibot.comms.http import fetch from pywikibot.specialbots import UploadRobot -from pywikibot.tools import remove_last_args from scripts.image import ImageRobot
@@ -382,7 +381,6 @@
"""The dialog window for image info."""
- @remove_last_args(('commonsconflict',)) def __init__(self, image_title, content, uploader, url, templates): """Initializer.""" # Check if `Tkinter` wasn't imported diff --git a/scripts/noreferences.py b/scripts/noreferences.py index d719948..de7ea9a 100755 --- a/scripts/noreferences.py +++ b/scripts/noreferences.py @@ -41,7 +41,6 @@ from pywikibot.bot import ExistingPageBot, NoRedirectPageBot, SingleSiteBot from pywikibot.exceptions import LockedPageError from pywikibot.pagegenerators import XMLDumpPageGenerator -from pywikibot.tools import remove_last_args
# This is required for the text that is shown when you run this script @@ -516,7 +515,6 @@
"""References section bot."""
- @remove_last_args(['gen']) def __init__(self, **kwargs) -> None: """Initializer.""" self.available_options.update({