jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649372 )
Change subject: [doc] update ROADMAP.rst
......................................................................
[doc] update ROADMAP.rst
Change-Id: Ied6f57154a95ffb318ad8bbaad2e6e38e254fc1b
---
M ROADMAP.rst
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 878fccd..c701dca 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -23,6 +23,6 @@
* 5.0.0: HttpRequest result of http.fetch() will be replaced by requests.Response (T265206)
* 5.0.0: OptionHandler.options dict will be removed in favour of OptionHandler.opt
* 5.0.0: Methods deprecated for 5 years or longer will be removed
-* 5.0.0: Outdated recentchanges parameter will be removed
+* 5.0.0: Outdated Site.recentchanges() parameters will be removed
* 5.0.0: site.LoginStatus will be removed in favour of login.LoginStatus
* 5.0.0: pagegenerators.ReferringPageGenerator is desupported and will be removed
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649372
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ied6f57154a95ffb318ad8bbaad2e6e38e254fc1b
Gerrit-Change-Number: 649372
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/644053 )
Change subject: [IMPR] Reduce code complexity of date.escapePattern2
......................................................................
[IMPR] Reduce code complexity of date.escapePattern2
move inner part of pattern computing into a inner function and
dispatch it by the "dec" parameter type
Change-Id: I0c8509395143f5fca2733f208e8872cc07c71c5c
---
M pywikibot/date.py
1 file changed, 42 insertions(+), 24 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 541dcbc..a52f4f2 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -17,7 +17,17 @@
from pywikibot import Site
from pywikibot.textlib import NON_LATIN_DIGITS
-from pywikibot.tools import deprecated, first_lower, first_upper
+from pywikibot.tools import (
+ deprecated,
+ first_lower,
+ first_upper,
+ PYTHON_VERSION,
+)
+
+if PYTHON_VERSION >= (3, 9):
+ List = tuple
+else:
+ from typing import Tuple
#
# Different collections of well known formats
@@ -364,6 +374,36 @@
Allows matching of any _digitDecoders inside the string.
Returns a compiled regex object and a list of digit decoders.
"""
+ @singledispatch
+ def decode(dec: tuple, subpattern: str, newpattern: str,
+ strpattern: str) -> Tuple[str, str]:
+
+ if len(subpattern) == 3:
+ # enforce mandatory field size
+ newpattern += '([%s]{%s})' % (dec[0], subpattern[1])
+ # add the number of required digits as the last (4th)
+ # part of the tuple
+ decoders.append(dec + (int(s[1]),))
+ else:
+ newpattern += '([{}]+)'.format(dec[0])
+ decoders.append(dec)
+
+ # All encoders produce a string for strpattern.
+ # This causes problem with the zero padding.
+ # Need to rethink
+
+ return newpattern, strpattern + '%s'
+
+ @decode.register(str)
+ def _(dec: str, subpattern: str, newpattern: str,
+ strpattern: str) -> Tuple[str, str]:
+ # Special case for strings that are replaced instead of decoded
+ # Keep the original text for strPattern
+ assert len(subpattern) < 3, (
+ 'Invalid pattern {}: Cannot use zero padding size '
+ 'in {}!'.format(pattern, subpattern))
+ return newpattern + re.escape(dec), strpattern + subpattern
+
if pattern not in _escPtrnCache2:
newPattern = '' # match starts at the beginning of the string
strPattern = ''
@@ -376,29 +416,7 @@
and (len(s) == 2 or s[1] in _decimalDigits)):
# Must match a "%2d" or "%d" style
dec = _digitDecoders[s[-1]]
- if isinstance(dec, str):
- # Special case for strings that are replaced instead of
- # decoded
- assert len(s) < 3, (
- 'Invalid pattern {0}: Cannot use zero padding size '
- 'in {1}!'.format(pattern, s))
- newPattern += re.escape(dec)
- strPattern += s # Keep the original text
- else:
- if len(s) == 3:
- # enforce mandatory field size
- newPattern += '([%s]{%s})' % (dec[0], s[1])
- # add the number of required digits as the last (4th)
- # part of the tuple
- dec += (int(s[1]),)
- else:
- newPattern += '([{}]+)'.format(dec[0])
-
- decoders.append(dec)
- # All encoders produce a string
- # this causes problem with the zero padding.
- # Need to rethink
- strPattern += '%s'
+ newPattern, strPattern = decode(dec, s, newPattern, strPattern)
else:
newPattern += re.escape(s)
strPattern += s
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/644053
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I0c8509395143f5fca2733f208e8872cc07c71c5c
Gerrit-Change-Number: 644053
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649356 )
Change subject: [doc] update ROADMAP.rst
......................................................................
[doc] update ROADMAP.rst
Also increase release number to 5.3
Change-Id: Ide4bd8504063d2321b1b164da764137c09b9d519
---
M ROADMAP.rst
M pywikibot/__metadata__.py
2 files changed, 13 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 590a2d0..878fccd 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,18 @@
Current release changes
~~~~~~~~~~~~~~~~~~~~~~~
-* (no changes yet)
+* DataSite.get_item() method will be removed
+* global put_throttle option may be given as float (T269741)
+* Property.getType() method has been removed
+* Family.server_time() method was removed; it is still available from Site object (T89451)
+* All HttpRequest parameters except of charset has been dropped (T265206)
+* A lot of methods and properties of HttpRequest are deprecared in favour of requests.Resonse attributes (T265206)
+* Method and properties of HttpRequest are delegated to requests.Response object (T265206)
+* comms.threadedhttp.HttpRequest.raw was replaced by HttpRequest.content property (T265206)
+* Desupported version.getfileversion() has been removed
+* site parameter of comms.http.requests() function is mandatory and cannot be omitted
+* date.MakeParameter() function has been removed
+* api.Request.http_params() method has been removed
Future release notes
~~~~~~~~~~~~~~~~~~~~
@@ -11,12 +22,7 @@
* 5.0.0: PageRelatedError.getPage() will be removes in favour of PageRelatedError.page
* 5.0.0: HttpRequest result of http.fetch() will be replaced by requests.Response (T265206)
* 5.0.0: OptionHandler.options dict will be removed in favour of OptionHandler.opt
-* 5.0.0: version.getfileversion() is desupported and will be removed
* 5.0.0: Methods deprecated for 5 years or longer will be removed
* 5.0.0: Outdated recentchanges parameter will be removed
* 5.0.0: site.LoginStatus will be removed in favour of login.LoginStatus
-* 5.0.0: Property.getType() method will be removed
-* 5.0.0: Request.http_params() method will be removed
-* 5.0.0: DataSite.get_item() method will be removed
-* 5.0.0: date.MakeParameter() function will be removed
* 5.0.0: pagegenerators.ReferringPageGenerator is desupported and will be removed
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index b05fe6e..7b0a1ed 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -6,7 +6,7 @@
# Distributed under the terms of the MIT license.
#
__name__ = 'pywikibot'
-__version__ = '5.2.1.dev0'
+__version__ = '5.3.0.dev0'
__description__ = 'Python MediaWiki Bot Framework'
__maintainer__ = 'The Pywikibot team'
__maintainer_email__ = 'pywikibot(a)lists.wikimedia.org'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649356
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ide4bd8504063d2321b1b164da764137c09b9d519
Gerrit-Change-Number: 649356
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649114 )
Change subject: [fix] Ensure title is printed in ValueError
......................................................................
[fix] Ensure title is printed in ValueError
An empty string was printed if initialized from a link or page
Change-Id: I610ee30318a349b8c53666f94ab0b77f1bd18c44
---
M pywikibot/page/__init__.py
1 file changed, 6 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index c955d98..9b8b067 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -2359,7 +2359,8 @@
self._file_revisions = {} # dictionary to cache File history.
super().__init__(source, title, 6)
if self.namespace() != 6:
- raise ValueError("'%s' is not in the file namespace!" % title)
+ raise ValueError("'{}' is not in the file namespace!"
+ .format(self.title()))
def _load_file_revisions(self, imageinfo):
for file_rev in imageinfo:
@@ -2634,8 +2635,8 @@
self.sortKey = sort_key
super().__init__(source, title, ns=14)
if self.namespace() != 14:
- raise ValueError("'%s' is not in the category namespace!"
- % title)
+ raise ValueError("'{}' is not in the category namespace!"
+ .format(self.title()))
@deprecated_args(sortKey='sort_key')
def aslink(self, sort_key: Optional[str] = None) -> str:
@@ -2951,8 +2952,8 @@
self._isAutoblock = False
super().__init__(source, title, ns=2)
if self.namespace() != 2:
- raise ValueError("'%s' is not in the user namespace!"
- % title)
+ raise ValueError("'{}' is not in the user namespace!"
+ .format(self.title()))
if self._isAutoblock:
# This user is probably being queried for purpose of lifting
# an autoblock.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/649114
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I610ee30318a349b8c53666f94ab0b77f1bd18c44
Gerrit-Change-Number: 649114
Gerrit-PatchSet: 1
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged