jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693504 )
Change subject: [cleanup] Disallow site to be None when required for regex ......................................................................
[cleanup] Disallow site to be None when required for regex
Our _get_regexes() issued a deprecation warning when a site is required but not provided. It's time we enforce it.
Change-Id: I56c9c1cff7e8a192d525dd66533c44209e0fc5dc --- M pywikibot/textlib.py 1 file changed, 2 insertions(+), 6 deletions(-)
Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index ae7060d..2b14c97 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -296,12 +296,8 @@ if isinstance(_regex_cache[exc], tuple): if not site and exc in ('interwiki', 'property', 'invoke', 'category', 'file'): - issue_deprecation_warning( - 'site=None', - "a valid site for '{}' regex".format(exc), - warning_class=FutureWarning, - since='20151006') - site = pywikibot.Site() + raise ValueError("Site cannot be None for the '{}' regex" + .format(exc))
if (exc, site) not in _regex_cache: re_text, re_var = _regex_cache[exc]