jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693589 )
Change subject: [cleanup] Flag deprecations with FutureWarning ......................................................................
[cleanup] Flag deprecations with FutureWarning
This flags all deprecations up to the end of 2019 as FutureWarnings.
Change-Id: I07321736fb755934012d02732c35b46120ed71ec --- M pywikibot/comms/http.py M pywikibot/config.py M pywikibot/date.py M pywikibot/echo.py M pywikibot/families/wowwiki_family.py M pywikibot/family.py M pywikibot/page/__init__.py M pywikibot/pagegenerators.py M pywikibot/site/_apisite.py M pywikibot/site/_basesite.py M pywikibot/site/_datasite.py M pywikibot/site/_generators.py M pywikibot/textlib.py M pywikibot/tools/__init__.py 14 files changed, 42 insertions(+), 26 deletions(-)
Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py index d0ddea1..f42901b 100644 --- a/pywikibot/comms/http.py +++ b/pywikibot/comms/http.py @@ -196,7 +196,8 @@ return formatted
-@deprecated('pywikibot.comms.http.fake_user_agent', since='20161205') +@deprecated('pywikibot.comms.http.fake_user_agent', since='20161205', + future_warning=True) def get_fake_user_agent(): """ Return a fake user agent depending on `fake_user_agent` option in config. diff --git a/pywikibot/config.py b/pywikibot/config.py index 0cb1b17..7d50b6c 100644 --- a/pywikibot/config.py +++ b/pywikibot/config.py @@ -72,7 +72,8 @@ if new_env_name not in environ: environ[new_env_name] = env_value issue_deprecation_warning( - env_name + ' environment variable', new_env_name, 0, since='20180803') + env_name + ' environment variable', new_env_name, 0, since='20180803', + future_warning=True)
# This frozen set should contain all imported modules/variables, so it must diff --git a/pywikibot/date.py b/pywikibot/date.py index 5abb2d4..b5a6cfd 100644 --- a/pywikibot/date.py +++ b/pywikibot/date.py @@ -1935,7 +1935,7 @@ return None, None
-@deprecated('date.format_date', since='20190526') +@deprecated('date.format_date', since='20190526', future_warning=True) class FormatDate:
"""DEPRECATED. Format a date.""" diff --git a/pywikibot/echo.py b/pywikibot/echo.py index 3b66d15..8ed2c72 100644 --- a/pywikibot/echo.py +++ b/pywikibot/echo.py @@ -51,7 +51,7 @@ return notif
@property - @deprecated('event_id', since='20190106') + @deprecated('event_id', since='20190106', future_warning=True) def id(self): """ DEPRECATED: Return notification id as unicode. diff --git a/pywikibot/families/wowwiki_family.py b/pywikibot/families/wowwiki_family.py index 6e98ce4..029513d 100644 --- a/pywikibot/families/wowwiki_family.py +++ b/pywikibot/families/wowwiki_family.py @@ -26,7 +26,7 @@ code_aliases = {'nn': 'no'}
@classproperty - @deprecated('codes attribute', since='20190422') + @deprecated('codes attribute', since='20190422', future_warning=True) def languages_by_size(cls): """DEPRECATED. languages_by_size property for compatibility purpose.""" return list(cls.codes) diff --git a/pywikibot/family.py b/pywikibot/family.py index 6196f28..2b7bb17 100644 --- a/pywikibot/family.py +++ b/pywikibot/family.py @@ -650,7 +650,8 @@ cr_set.add(newtitle) self._catredirtemplates[code] = list(cr_template_tuple) + list(cr_set)
- @deprecated('site.category_redirects()', since='20170608') + @deprecated('site.category_redirects()', since='20170608', + future_warning=True) def get_cr_templates(self, code, fallback): """DEPRECATED: Build list of category redirect templates.""" self._get_cr_templates(code, fallback) @@ -1256,4 +1257,5 @@
wrapper = ModuleDeprecationWrapper(__name__) wrapper.add_deprecated_attr('WikiaFamily', replacement=FandomFamily, - since='20190420') + since='20190420', + future_warning=True) diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py index 4c58d68..b63f61f 100644 --- a/pywikibot/page/__init__.py +++ b/pywikibot/page/__init__.py @@ -1281,7 +1281,7 @@ **kwargs)
@deprecated('put(asynchronous=True) or save(asynchronous=True)', - since='20180501') + since='20180501', future_warning=True) @deprecated_args(comment='summary', watchArticle='watch', minorEdit='minor') def put_async(self, newtext, summary=None, watch=None, minor=True, @@ -4148,7 +4148,7 @@ # alias for backwards compatibility ItemPage.concept_url = redirect_func( ItemPage.concept_uri, old_name='concept_url', class_name='ItemPage', - since='20170222') + since='20170222', future_warning=True)
class Property: diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index d72d391..91b0116 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -1270,7 +1270,7 @@ return v if (v is None or v == '') else int(v)
-@deprecated('Site.allpages()', since='20180512') +@deprecated('Site.allpages()', since='20180512', future_warning=True) @deprecated_args(step=True) def AllpagesPageGenerator(start: str = '!', namespace=0, includeredirects=True, site=None, @@ -1417,7 +1417,7 @@ return gen
-@deprecated('site.unconnected_pages()', since='20180512') +@deprecated('site.unconnected_pages()', since='20180512', future_warning=True) @deprecated_args(step=True) def UnconnectedPageGenerator(site=None, total: Optional[int] = None): """ @@ -2029,7 +2029,8 @@ pywikibot.output('Skipping {}'.format(page.title(as_link=True)))
-@deprecated('itertools.chain(*iterables)', since='20180513') +@deprecated('itertools.chain(*iterables)', since='20180513', + future_warning=True) def CombinedPageGenerator(generators): """Yield from each iterable until exhausted, then proceed with the next.""" return itertools.chain(*generators) # pragma: no cover @@ -2067,7 +2068,8 @@ yield page.toggleTalkPage()
-@deprecated('LiveRCPageGenerator or EventStreams', since='20180415') +@deprecated('LiveRCPageGenerator or EventStreams', since='20180415', + future_warning=True) def RepeatingGenerator(generator, key_func=lambda x: x, sleep_duration=60, total: Optional[int] = None, **kwargs): """Yield items in live time. @@ -2392,7 +2394,7 @@ return site.pages_with_property(name, total=total)
-@deprecated('Site.wantedpages', since='20180803') +@deprecated('Site.wantedpages', since='20180803', future_warning=True) def WantedPagesPageGenerator(total: int = 100, site=None): # pragma: no cover """ Wanted page generator. @@ -2962,10 +2964,11 @@
DuplicateFilterPageGenerator = redirect_func( - filter_unique, old_name='DuplicateFilterPageGenerator', since='20180715') + filter_unique, old_name='DuplicateFilterPageGenerator', since='20180715', + future_warning=True) PreloadingItemGenerator = redirect_func(PreloadingEntityGenerator, old_name='PreloadingItemGenerator', - since='20170314') + since='20170314', future_warning=True)
if __name__ == '__main__': # pragma: no cover pywikibot.output('Pagegenerators cannot be run as script - are you ' diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py index dbe6654..ce3e02f 100644 --- a/pywikibot/site/_apisite.py +++ b/pywikibot/site/_apisite.py @@ -1144,7 +1144,7 @@ **args) self._update_page(page, query, verify_imageinfo=True)
- @deprecated('page.exists()', since='20180218') + @deprecated('page.exists()', since='20180218', future_warning=True) def page_exists(self, page): """Return True if and only if page is an existing page on site.""" return page.pageid > 0 diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py index 7a8e354..be7271a 100644 --- a/pywikibot/site/_basesite.py +++ b/pywikibot/site/_basesite.py @@ -410,27 +410,32 @@
# namespace shortcuts for backwards-compatibility
- @deprecated('namespaces.SPECIAL.custom_name', since='20160407') + @deprecated('namespaces.SPECIAL.custom_name', since='20160407', + future_warning=True) def special_namespace(self): """Return local name for the Special: namespace.""" return self.namespace(-1)
- @deprecated('namespaces.FILE.custom_name', since='20160407') + @deprecated('namespaces.FILE.custom_name', since='20160407', + future_warning=True) def image_namespace(self): """Return local name for the File namespace.""" return self.namespace(6)
- @deprecated('namespaces.MEDIAWIKI.custom_name', since='20160407') + @deprecated('namespaces.MEDIAWIKI.custom_name', since='20160407', + future_warning=True) def mediawiki_namespace(self): """Return local name for the MediaWiki namespace.""" return self.namespace(8)
- @deprecated('namespaces.TEMPLATE.custom_name', since='20160407') + @deprecated('namespaces.TEMPLATE.custom_name', since='20160407', + future_warning=True) def template_namespace(self): """Return local name for the Template namespace.""" return self.namespace(10)
- @deprecated('namespaces.CATEGORY.custom_name', since='20160407') + @deprecated('namespaces.CATEGORY.custom_name', since='20160407', + future_warning=True) def category_namespace(self): """Return local name for the Category namespace.""" return self.namespace(14) diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py index 8b271b3..5cfef3b 100644 --- a/pywikibot/site/_datasite.py +++ b/pywikibot/site/_datasite.py @@ -262,7 +262,8 @@ page.get() # cannot provide get_redirect=True (T145971) yield page
- @deprecated('DataSite.preload_entities', since='20170314') + @deprecated('DataSite.preload_entities', since='20170314', + future_warning=True) def preloaditempages(self, pagelist, groupsize=50): """DEPRECATED.""" return self.preload_entities(pagelist, groupsize) diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py index 701f67b..9025750 100644 --- a/pywikibot/site/_generators.py +++ b/pywikibot/site/_generators.py @@ -1867,7 +1867,8 @@ yield (newpage, pageitem['timestamp'], pageitem['newlen'], '', pageitem['user'], pageitem['comment'])
- @deprecated('APISite.logevents(logtype="upload")', since='20170619') + @deprecated('APISite.logevents(logtype="upload")', since='20170619', + future_warning=True) @deprecated_args(lestart='start', leend='end', leuser='user', letitle=True, repeat=True, number='total', step=True) def newfiles(self, user=None, start=None, end=None, reverse=False, diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 78c7321..6698506 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -671,7 +671,8 @@ issue_deprecation_warning( 'site=None', 'a valid site for list or tuple parameter "replace"', - 2, since='20190223') + 2, since='20190223', + future_warning=True) elif site is None: raise ValueError('The "site" argument must be provided.')
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py index 115f28f..d822429 100644 --- a/pywikibot/tools/__init__.py +++ b/pywikibot/tools/__init__.py @@ -1966,7 +1966,8 @@ # deprecated parts ############################################################
-@deprecated('bot_choice.Option and its subclasses', since='20181217') +@deprecated('bot_choice.Option and its subclasses', since='20181217', + future_warning=True) def concat_options(message, line_length, options): """DEPRECATED. Concatenate options.""" indent = len(message) + 2
pywikibot-commits@lists.wikimedia.org