jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/453088 )
Change subject: pywikibot.tools.DeprecatedRegex: Make `since` a param of __init__
......................................................................
pywikibot.tools.DeprecatedRegex: Make `since` a param of __init__
It does not make sense to hardcode `since` in DeprecatedRegex, different
regexes may get deprecated at different times.
Add `since` as a parameter for __init__ and fix the only two usages of this
class.
Change-Id: I52843e5e4b27cb3ea5993a9c22e915cf1f2dfd80
---
M pywikibot/textlib.py
M pywikibot/tools/__init__.py
M pywikibot/tools/ip.py
3 files changed, 15 insertions(+), 12 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index e6ee2c1..b9cc974 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -63,15 +63,17 @@
# that allows system variables, but does not match nested templates.
# It exists for backwards compatibility to the old 'TEMP_REGEX'
# which was the _ETP_REGEX.
-TEMP_REGEX = DeprecatedRegex(r"""
-{{\s*(?:msg:\s*)?
- (?P<name>[^{\|]+?)\s*
- (?:\|(?P<params>[^{]*
- (?:(?:{}|{{[A-Z]+(?:\:[^}])?}}|{{{[^}]+}}}) [^{]*)*
- )?
- )?
-}}
-""", re.VERBOSE, 'textlib.TEMP_REGEX', 'textlib.NESTED_TEMPLATE_REGEX')
+TEMP_REGEX = DeprecatedRegex(
+ r"""
+ {{\s*(?:msg:\s*)?
+ (?P<name>[^{\|]+?)\s*
+ (?:\|(?P<params>[^{]*
+ (?:(?:{}|{{[A-Z]+(?:\:[^}])?}}|{{{[^}]+}}}) [^{]*)*
+ )?
+ )?
+ }}
+ """, re.VERBOSE, 'textlib.TEMP_REGEX', 'textlib.NESTED_TEMPLATE_REGEX',
+ since='20150212')
# The regex below collects nested templates, providing simpler
# identification of templates used at the top-level of wikitext.
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index d3b0b94..e35b2cb 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -410,7 +410,7 @@
"""Regex object that issues a deprecation notice."""
- def __init__(self, pattern, flags=0, name=None, instead=None):
+ def __init__(self, pattern, flags=0, name=None, instead=None, since=None):
"""
Initializer.
@@ -426,11 +426,12 @@
super(DeprecatedRegex, self).__init__(pattern, flags)
self._name = name or self.raw
self._instead = instead
+ self._since = since
def __getattr__(self, attr):
"""Issue deprecation warning."""
issue_deprecation_warning(
- self._name, self._instead, 2, since='20150212')
+ self._name, self._instead, 2, since=self._since)
return super(DeprecatedRegex, self).__getattr__(attr)
diff --git a/pywikibot/tools/ip.py b/pywikibot/tools/ip.py
index a4d131d..3fba28c 100644
--- a/pywikibot/tools/ip.py
+++ b/pywikibot/tools/ip.py
@@ -88,7 +88,7 @@
r'(([\dA-F]{1,4}(\4|:\b|$)|\2){2}|'
r'(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\Z',
re.IGNORECASE,
- 'page.ip_regexp', 'tools.ip.is_IP')
+ 'page.ip_regexp', 'tools.ip.is_IP', since='20150212')
def is_IP(IP):
--
To view, visit https://gerrit.wikimedia.org/r/453088
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I52843e5e4b27cb3ea5993a9c22e915cf1f2dfd80
Gerrit-Change-Number: 453088
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/452671 )
Change subject: test_WbGeoShape_error_on_wrong_page_type: Use another tabular data page
......................................................................
test_WbGeoShape_error_on_wrong_page_type: Use another tabular data page
Bug: T201922
Change-Id: I71b3d9c44ca6d3e1243a68afa59f800e940d92ba
---
M tests/wikibase_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 78608f4..7407847 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -729,7 +729,7 @@
def test_WbGeoShape_error_on_wrong_page_type(self):
"""Test WbGeoShape error handling of a non-map page."""
non_data_page = Page(self.commons, 'File:Foo.jpg')
- non_map_page = Page(self.commons, 'Data:Templatedata/Graph:Lines.tab')
+ non_map_page = Page(self.commons, 'Data:TemplateData/TemplateData.tab')
regex = r"^Page must be in 'Data:' namespace and end in '\.map' " + \
r"for geo-shape\.$"
with self.assertRaisesRegex(ValueError, regex):
--
To view, visit https://gerrit.wikimedia.org/r/452671
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I71b3d9c44ca6d3e1243a68afa59f800e940d92ba
Gerrit-Change-Number: 452671
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)