jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/638332 )
Change subject: [tests] Remove some deprecated code from code coverage ......................................................................
[tests] Remove some deprecated code from code coverage
Change-Id: I385dbf2a0dfa093c2ef6dff06874e7d1059b75d4 --- M pywikibot/bot.py M pywikibot/comms/http.py M pywikibot/comms/threadedhttp.py M pywikibot/data/api.py M pywikibot/data/wikistats.py M pywikibot/families/wikimediachapter_family.py M pywikibot/page/__init__.py M pywikibot/site/__init__.py M pywikibot/version.py 9 files changed, 60 insertions(+), 56 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 6a954c7..dc5599d 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -861,7 +861,7 @@
@deprecated('handle_args', since='20150409', future_warning=True) -def handleArgs(*args): +def handleArgs(*args): # pragma: no cover """DEPRECATED. Use handle_args().""" return handle_args(args)
@@ -896,7 +896,7 @@
@deprecated('show_help', since='20200705') -def showHelp(module_name=None): +def showHelp(module_name=None): # pragma: no cover """DEPRECATED. Use show_help().""" return show_help(module_name)
@@ -1092,7 +1092,7 @@ return cls.available_options
@deprecated('set_options', since='20201006') - def setOptions(self, **kwargs): + def setOptions(self, **kwargs): # pragma: no cover """DEPRECATED. Set the instance options.""" self.set_options(**kwargs)
@@ -1122,7 +1122,7 @@ .format(opt))
@deprecated(_DEPRECATION_MSG, since='20201006') - def getOption(self, option): + def getOption(self, option): # pragma: no cover """DEPRECATED. Get the current value of an option.
@param option: key defined in OptionHandler.available_options @@ -1133,13 +1133,13 @@
@property @deprecated(_DEPRECATION_MSG, since='20201006', future_warning=True) - def options(self): + def options(self): # pragma: no cover """DEPRECATED. Return changed options.""" return self.opt._options
@options.setter @deprecated(_DEPRECATION_MSG, since='20201006', future_warning=True) - def options(self, options): + def options(self, options): # pragma: no cover """DEPRECATED. Return changed options.""" self.set_options(**options)
@@ -1347,7 +1347,7 @@ return False
@deprecated('generator.close()', since='20200804') - def stop(self): + def stop(self): # pragma: no cover """Stop iterating.""" pywikibot.output('Generator has been stopped.') self.generator.close() diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py index ef9cb6e..deea88f 100644 --- a/pywikibot/comms/http.py +++ b/pywikibot/comms/http.py @@ -294,7 +294,7 @@
@deprecated(since='20201015', future_warning=True) -def _http_process(session, http_request) -> None: +def _http_process(session, http_request) -> None: # pragma: no cover """DEPRECATED.
Process an `threadedhttp.HttpRequest` instance. @@ -366,7 +366,7 @@
@deprecated(since='20201015', future_warning=True) def _enqueue(uri, method='GET', params=None, body=None, headers=None, - data=None, **kwargs): + data=None, **kwargs): # pragma: no cover """DEPRECATED.
Enqueue non-blocking threaded HTTP request with callback. diff --git a/pywikibot/comms/threadedhttp.py b/pywikibot/comms/threadedhttp.py index 39d739c..659acab 100644 --- a/pywikibot/comms/threadedhttp.py +++ b/pywikibot/comms/threadedhttp.py @@ -59,27 +59,27 @@
@property @deprecated('the `url` attribute', since='20201011', future_warning=True) - def uri(self): + def uri(self): # pragma: no cover """DEPRECATED. Return the response URL.""" return self.url
@uri.setter @deprecated('the `url` attribute', since='20201011', future_warning=True) - def uri(self, value): + def uri(self, value): # pragma: no cover """DEPRECATED. Set the response URL.""" self.url = value
@property @deprecated('the `all_headers` property', since='20201011', future_warning=True) - def headers(self): + def headers(self): # pragma: no cover """DEPRECATED. Return the response headers.""" return self.all_headers
@headers.setter @deprecated('the `all_headers` property', since='20201011', future_warning=True) - def headers(self, value): + def headers(self, value): # pragma: no cover """DEPRECATED. Set the response headers.""" self.all_headers = value
@@ -128,7 +128,7 @@ @property @deprecated('urlparse(HttpRequest.url)', since='20201011', future_warning=True) - def parsed_uri(self): + def parsed_uri(self): # pragma: no cover """DEPRECATED. Return the parsed requested uri.""" if not self._parsed_uri: self._parsed_uri = urlparse(self.uri) @@ -137,14 +137,14 @@ @property @deprecated('urlparse(HttpRequest.url).netloc', since='20201011', future_warning=True) - def hostname(self): + def hostname(self): # pragma: no cover """DEPRECATED. Return the host of the request.""" return self.parsed_uri.netloc
@property @deprecated('the `status_code` property', since='20201011', future_warning=True) - def status(self) -> Optional[int]: + def status(self) -> Optional[int]: # pragma: no cover """DEPRECATED. Return the HTTP response status.""" return self.status_code
@@ -225,14 +225,14 @@ return result
@deprecated('the `text` property', since='20201011', future_warning=True) - def decode(self, encoding, errors='strict') -> str: + def decode(self, encoding, errors='strict') -> str: # pragma: no cover """Return the decoded response.""" return self.raw.decode(encoding, errors) if not self.exception else None
@property @deprecated('the `text` property', since='20180321', future_warning=True) - def content(self) -> str: + def content(self) -> str: # pragma: no cover """DEPRECATED. Return the response decoded by the detected encoding.
@note: The behaviour will be changed. @@ -246,11 +246,11 @@ return self.raw.decode(self.encoding)
@deprecated('the `text` property', since='20201011', future_warning=True) - def __str__(self) -> str: + def __str__(self) -> str: # pragma: no cover """Return the response decoded by the detected encoding.""" return self.text
@deprecated(since='20201011', future_warning=True) - def __bytes__(self) -> Optional[bytes]: + def __bytes__(self) -> Optional[bytes]: # pragma: no cover """Return the undecoded response.""" return self.raw diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index a092e46..cb6abe1 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -1335,7 +1335,7 @@ return list(self._params.items())
@deprecated(since='20141006', future_warning=True) - def http_params(self): + def http_params(self): # pragma: no cover """Return the parameters formatted for inclusion in an HTTP request.
DEPRECATED. See _encoded_items for explanation of encoding used. diff --git a/pywikibot/data/wikistats.py b/pywikibot/data/wikistats.py index 53757ab..edf811c 100644 --- a/pywikibot/data/wikistats.py +++ b/pywikibot/data/wikistats.py @@ -80,7 +80,7 @@ self._data = {}
@deprecated('get', since='20201017', future_warning=True) - def fetch(self, table: str, format='xml') -> bytes: + def fetch(self, table: str, format='xml') -> bytes: # pragma: no cover """ DEPRECATED. Fetch data from WikiStats.
@@ -104,7 +104,8 @@ return r.raw
@deprecated('get', since='20201017', future_warning=True) - def raw_cached(self, table: str, format='csv') -> bytes: + def raw_cached(self, table: str, + format='csv') -> bytes: # pragma: no cover """ DEPRECATED. Cache raw data.
@@ -120,7 +121,7 @@ return data
@deprecated('get', since='20201017', future_warning=True) - def csv(self, table: str) -> list: + def csv(self, table: str) -> list: # pragma: no cover """ DEPRECATED. Get a list of a table of data.
diff --git a/pywikibot/families/wikimediachapter_family.py b/pywikibot/families/wikimediachapter_family.py index 063f771..bb08c2c 100644 --- a/pywikibot/families/wikimediachapter_family.py +++ b/pywikibot/families/wikimediachapter_family.py @@ -29,6 +29,6 @@
@classproperty @deprecated(since='20150621', future_warning=True) - def countries(cls): + def countries(cls): # pragma: no cover """Deprecated.""" return cls.codes diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py index 386ee55..35b04b6 100644 --- a/pywikibot/page/__init__.py +++ b/pywikibot/page/__init__.py @@ -587,12 +587,12 @@ self._revid = value
@deprecated('latest_revision_id', since='20150727', future_warning=True) - def latestRevision(self): + def latestRevision(self): # pragma: no cover """Return the current revision id for this page.""" return self.latest_revision_id
@deprecated('latest_revision_id', since='20150407', future_warning=True) - def pageAPInfo(self): + def pageAPInfo(self): # pragma: no cover """Return the current revision id for this page.""" if self.isRedirectPage(): raise pywikibot.IsRedirectPage(self) @@ -740,7 +740,7 @@ @property @deprecated('latest_revision.parent_id (0 instead of -1 when no parent)', since='20150609', future_warning=True) - def previous_revision_id(self) -> int: + def previous_revision_id(self) -> int: # pragma: no cover """ Return the revision id for the previous revision of this Page.
@@ -750,7 +750,7 @@
@deprecated('latest_revision.parent_id (0 instead of -1 when no parent)', since='20150609', future_warning=True) - def previousRevision(self) -> int: + def previousRevision(self) -> int: # pragma: no cover """ Return the revision id for the previous revision.
@@ -835,7 +835,7 @@ raise pywikibot.IsNotRedirectPage(self)
@deprecated(since='20151207', future_warning=True) - def isEmpty(self) -> bool: + def isEmpty(self) -> bool: # pragma: no cover """ Return True if the page text has less than 4 characters.
@@ -1080,7 +1080,7 @@ return self.site.page_can_be_edited(self, action)
@deprecated("Page.has_permission('edit')", since='20200208') - def canBeEdited(self): + def canBeEdited(self): # pragma: no cover """DEPRECATED. Determine whether the page may be edited.""" return self.has_permission()
@@ -1332,11 +1332,13 @@ force=force, asynchronous=asynchronous, callback=callback, **kwargs)
- @deprecated('put(asynchronous=True) or save(asynchronous=True)') + @deprecated('put(asynchronous=True) or save(asynchronous=True)', + since='20180501') @deprecated_args(comment='summary', watchArticle='watch', minorEdit='minor') def put_async(self, newtext, summary=None, watch=None, minor=True, - botflag=None, force=False, callback=None, **kwargs): + botflag=None, force=False, callback=None, + **kwargs): # pragma: no cover """ Put page on queue to be saved to wiki asynchronously.
@@ -1646,7 +1648,7 @@ return self.site.getredirtarget(self)
@deprecated('moved_target()', since='20150524', future_warning=True) - def getMovedTarget(self): + def getMovedTarget(self): # pragma: no cover """ Return a Page object for the target this Page was moved to.
@@ -1727,7 +1729,8 @@ starttime=starttime, endtime=endtime))
@deprecated('contributors().keys()', since='20150206', future_warning=True) - def contributingUsers(self, total: Optional[int] = None): + def contributingUsers(self, + total: Optional[int] = None): # pragma: no cover """ Return a set of usernames (or IPs) of users who edited this page.
@@ -1761,7 +1764,7 @@
@deprecated('contributors() or revisions()', since='20150206', future_warning=True) - @deprecated_args(limit='total') + @deprecated_args(limit='total') # pragma: no cover def getLatestEditors(self, total=1) -> list: """ Get a list of revision information of the last total edits. @@ -2156,7 +2159,7 @@ return False
@deprecated('Page.is_flow_page()', since='20150128', future_warning=True) - def isFlowPage(self): + def isFlowPage(self): # pragma: no cover """DEPRECATED: use self.is_flow_page instead.""" return self.is_flow_page()
@@ -2197,7 +2200,7 @@ # ####### DEPRECATED METHODS ########
@deprecated('Page.protection()', since='20150725', future_warning=True) - def getRestrictions(self): + def getRestrictions(self): # pragma: no cover """DEPRECATED. Use self.protection() instead.""" restrictions = self.protection() return {k: list(restrictions[k]) for k in restrictions} @@ -2479,7 +2482,7 @@ return self._imagePageHtml
@deprecated('get_file_url', since='20160609') - def fileUrl(self): + def fileUrl(self): # pragma: no cover """Return the URL for the file described on this page.""" return self.latest_file_info.url
@@ -2515,7 +2518,7 @@ return self.latest_file_info.thumburl
@deprecated('file_is_shared', since='20200618') - def fileIsShared(self) -> bool: + def fileIsShared(self) -> bool: # pragma: no cover """DEPRECATED. Check if the image is stored on Wikimedia Commons.""" return self.file_is_shared()
@@ -3011,7 +3014,7 @@ 'This is an autoblock ID, you can only use to unblock it.')
@deprecated('User.username', since='20160504') - def name(self) -> str: + def name(self) -> str: # pragma: no cover """ The username.
@@ -4817,7 +4820,7 @@ return self._type
@deprecated('Property.type', since='20140607', future_warning=True) - def getType(self): + def getType(self): # pragma: no cover """ Return the type of this property.
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py index 5a23f86..dbee6f6 100644 --- a/pywikibot/site/__init__.py +++ b/pywikibot/site/__init__.py @@ -392,7 +392,7 @@ @classmethod @deprecated('NamespacesDict.lookup_name', since='20150703', future_warning=True) - def lookup_name(cls, name: str, namespaces=None): + def lookup_name(cls, name: str, namespaces=None): # pragma: no cover """ Find the Namespace for a name.
@@ -410,7 +410,7 @@ @staticmethod @deprecated('NamespacesDict.resolve', since='20150703', future_warning=True) - def resolve(identifiers, namespaces=None): + def resolve(identifiers, namespaces=None): # pragma: no cover """ Resolve namespace identifiers to obtain Namespace objects.
@@ -948,7 +948,7 @@
@deprecated('APISite.namespaces.lookup_name', since='20150703', future_warning=True) - def ns_index(self, namespace): + def ns_index(self, namespace): # pragma: no cover """ Return the Namespace for a given namespace name.
@@ -961,7 +961,7 @@
@deprecated('APISite.namespaces.lookup_name', since='20150703', future_warning=True) - def getNamespaceIndex(self, namespace): + def getNamespaceIndex(self, namespace): # pragma: no cover """DEPRECATED: Return the Namespace for a given namespace name.""" return self.namespaces.lookup_name(namespace)
@@ -1159,7 +1159,7 @@
@deprecated('list(namespaces.CATEGORY)', since='20150829', future_warning=True) - def category_namespaces(self): + def category_namespaces(self): # pragma: no cover """Return names for the Category namespace.""" return list(self.namespace(14, all=True))
@@ -1182,7 +1182,7 @@
@deprecated('pywikibot.data.api.encode_url', since='20151211', future_warning=True) - def urlEncode(self, query): + def urlEncode(self, query): # pragma: no cover """DEPRECATED.""" return api.encode_url(query)
@@ -1986,7 +1986,7 @@ return [word]
@deprecated('expand_text', since='20150831', future_warning=True) - def resolvemagicwords(self, wikitext): + def resolvemagicwords(self, wikitext): # pragma: no cover """ Replace the {{ns:xx}} marks in a wikitext with the namespace names.
@@ -2082,7 +2082,7 @@
@deprecated('siteinfo or Namespace instance', since='20150830', future_warning=True) - def case(self): + def case(self): # pragma: no cover """Return this site's capitalization rule.""" # This is the global setting via $wgCapitalLinks, it is used whenever # the namespaces don't propagate the namespace specific value. @@ -2093,7 +2093,7 @@ return self.siteinfo['wikiid']
@deprecated('APISite.lang', since='20150629', future_warning=True) - def language(self): + def language(self): # pragma: no cover """Return the code for the language of this Site.""" return self.lang
@@ -2474,7 +2474,7 @@
@deprecated('Check the content model instead', since='20150128', future_warning=True) - def loadflowinfo(self, page): + def loadflowinfo(self, page): # pragma: no cover """ Load Flow-related information about a given page.
@@ -2943,7 +2943,7 @@
@deprecated("the 'tokens' property", since='20150218', future_warning=True) @remove_last_args(['sysop']) - def getToken(self, getalways=True, getagain=False): + def getToken(self, getalways=True, getagain=False): # pragma: no cover """DEPRECATED: Get edit token.""" if self.username() != self.user(): raise ValueError('The token for {0} was requested but only the ' @@ -2960,7 +2960,7 @@
@deprecated("the 'tokens' property", since='20150218', future_warning=True) @remove_last_args(['sysop']) - def getPatrolToken(self): + def getPatrolToken(self): # pragma: no cover """DEPRECATED: Get patrol token.""" if self.username() != self.user(): raise ValueError('The token for {0} was requested but only the ' @@ -7002,7 +7002,7 @@ return wbdata[props]
@deprecated('pywikibot.ItemPage', since='20130307', future_warning=True) - def get_item(self, source, **params): + def get_item(self, source, **params): # pragma: no cover """Get the data for multiple Wikibase items.""" return self._get_item(source, **params)
diff --git a/pywikibot/version.py b/pywikibot/version.py index 7a0884d..ce66b6f 100644 --- a/pywikibot/version.py +++ b/pywikibot/version.py @@ -386,7 +386,7 @@
@deprecated('get_module_version, get_module_filename and get_module_mtime', since='20150221', future_warning=True) -def getfileversion(filename: str): +def getfileversion(filename: str): # pragma: no cover """Retrieve revision number of file.
Extracts __version__ variable containing Id tag, without importing it.
pywikibot-commits@lists.wikimedia.org