jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/567492 )
Change subject: [IMPR] Timeout retries due to maxlag
......................................................................
[IMPR] Timeout retries due to maxlag
Currently there is no Timeout due to maxlag parameter.
With this patch a Timeout is implemented after 5 or more
retries given by config.config.max_retries.
Bug: T242081
Change-Id: Iec6db16b2e4efb7bbede6ba09b05b43021aa0b26
---
M pywikibot/data/api.py
1 file changed, 10 insertions(+), 5 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 8e9132b..ee4b6bf 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1971,7 +1971,7 @@
"""
self._add_defaults()
use_get = self._use_get()
-
+ retries = 0
while True:
paramstring = self._http_param_string()
@@ -2023,11 +2023,13 @@
continue
if code == 'maxlag':
- lag = lagpattern.search(info)
+ retries += 1
+ if retries > max(5, pywikibot.config.max_retries):
+ break
pywikibot.log('Pausing due to database lag: ' + info)
- if lag:
- lag = lag.group('lag')
- self.site.throttle.lag(int(lag or 0))
+ lag = lagpattern.search(info)
+ lag = int(lag.group('lag')) if lag else 0
+ self.site.throttle.lag(lag * retries)
continue
elif code == 'help' and self.action == 'help':
@@ -2086,6 +2088,9 @@
except TypeError:
raise RuntimeError(result)
+ raise TimeoutError(
+ 'Maximum retries attempted due to maxlag without success.')
+
def wait(self):
"""Determine how long to wait after a failed request."""
self.max_retries -= 1
--
To view, visit https://gerrit.wikimedia.org/r/567492
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: Iec6db16b2e4efb7bbede6ba09b05b43021aa0b26
Gerrit-Change-Number: 567492
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/567470 )
Change subject: [bugfix] Fix Python 2 Unicode error in page.py
......................................................................
[bugfix] Fix Python 2 Unicode error in page.py
Bug: T222623
Change-Id: Ida6af7b8971626d77a3b8aac3291b737c882bf4b
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index ec0adc2..582300c 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -370,7 +370,7 @@
title = title.replace(' ', '_')
if as_url:
encoded_title = title.encode(self.site.encoding())
- title = quote_from_bytes(encoded_title, safe='')
+ title = quote_from_bytes(encoded_title, safe=str(''))
if as_filename:
# Replace characters that are not possible in file names on some
# systems.
--
To view, visit https://gerrit.wikimedia.org/r/567470
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: Ida6af7b8971626d77a3b8aac3291b737c882bf4b
Gerrit-Change-Number: 567470
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/567484 )
Change subject: [IMPR] use setdefault in api._add_defaults
......................................................................
[IMPR] use setdefault in api._add_defaults
- use setdefault in api._add_defaults to simplify the code and
reduce code complexity
Change-Id: Ic8a436f36889ff8c10e987c09465d0b04678ba43
---
M pywikibot/data/api.py
1 file changed, 5 insertions(+), 7 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 8e9132b..a9f6d50 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1508,17 +1508,15 @@
# version number is at least 1.25wmf5 we add a dummy rawcontinue
# parameter. Querying siteinfo is save as it adds 'continue'.
if ('continue' not in self._params
- and 'rawcontinue' not in self._params
and self.site.mw_version >= '1.25wmf5'):
- self._params['rawcontinue'] = ['']
+ self._params.setdefault('rawcontinue', [''])
elif self.action == 'help' and self.site.mw_version > '1.24':
self._params['wrap'] = ['']
- if 'maxlag' not in self._params and config.maxlag:
- self._params['maxlag'] = [str(config.maxlag)]
- if 'format' not in self._params:
- self._params['format'] = ['json']
- elif self._params['format'] != ['json']:
+ if config.maxlag:
+ self._params.setdefault('maxlag', str(config.maxlag))
+ self._params.setdefault('format', ['json'])
+ if self._params['format'] != ['json']:
raise TypeError("Query format '%s' cannot be parsed."
% self._params['format'])
--
To view, visit https://gerrit.wikimedia.org/r/567484
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: Ic8a436f36889ff8c10e987c09465d0b04678ba43
Gerrit-Change-Number: 567484
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/567332 )
Change subject: [bugfix] http://wiki.arabeyes.org moved to new url
......................................................................
[bugfix] http://wiki.arabeyes.org moved to new url
Bug: T243707
Change-Id: I8ffbf5f2b85cc144033c737aaf5bfd253a8c1824
---
M tests/site_detect_tests.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index 7cd9082..a2fddc2 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -102,8 +102,8 @@
self.assertSite('https://wiki.gentoo.org/wiki/$1')
def test_arabeyes(self):
- """Test detection of MediaWiki sites for wiki.arabeyes.org."""
- self.assertSite('http://wiki.arabeyes.org/$1')
+ """Test detection of MediaWiki sites for www.arabeyes.org."""
+ self.assertSite('https://www.arabeyes.org/$1')
def test_tfwiki(self):
"""Test detection of MediaWiki sites for tfwiki.net."""
--
To view, visit https://gerrit.wikimedia.org/r/567332
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: I8ffbf5f2b85cc144033c737aaf5bfd253a8c1824
Gerrit-Change-Number: 567332
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/563730 )
Change subject: [bugfix] Cleanup sysop usage
......................................................................
[bugfix] Cleanup sysop usage
config.sysopnames is deprecated since 6f0cafd
- remove its usage from flickrripper.py
- print deletion right instead of sysop right in followlive.py
- use sysop right instead of sysop account in nowcommons.py doc
- use delete right in redirect.py instead of logged_in(sysop=True)
which never will be True
Change-Id: I948f1692eba5847ddbb6e36b062675029fe2ea7b
---
M scripts/flickrripper.py
M scripts/followlive.py
M scripts/nowcommons.py
M scripts/redirect.py
4 files changed, 11 insertions(+), 13 deletions(-)
Approvals:
Huji: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 248050e..cd54e2c 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -20,7 +20,7 @@
"""
#
# (C) Multichill, 2009
-# (C) Pywikibot team, 2009-2019
+# (C) Pywikibot team, 2009-2020
#
# Distributed under the terms of the MIT license.
#
@@ -438,9 +438,6 @@
# Set the Flickr reviewer
if config.flickr['reviewer']:
reviewer = config.flickr['reviewer']
- elif 'commons' in config.sysopnames['commons']:
- pywikibot.output(config.sysopnames['commons'])
- reviewer = config.sysopnames['commons']['commons']
elif 'commons' in config.usernames['commons']:
reviewer = config.usernames['commons']['commons']
else:
diff --git a/scripts/followlive.py b/scripts/followlive.py
index 3105049..eb54db9 100644
--- a/scripts/followlive.py
+++ b/scripts/followlive.py
@@ -15,7 +15,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2005-2019
+# (C) Pywikibot team, 2005-2020
#
# Distributed under the terms of the MIT license.
#
@@ -390,7 +390,7 @@
b) blank page
e) edit page
-d) delete page (need sysop right)
+d) delete page (needs deletion right)
q) quit cleaningbot
Enter) OK
What is it? """
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index 1940081..11091d8 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -10,7 +10,7 @@
the source wiki. If multiple versions of the file exist, the script will not
delete. If the SHA1 comparison is not equal, the script will not delete.
-A sysop account on the local wiki is required if you want all features of
+A sysop rights on the local wiki is required if you want all features of
this script to work properly.
This script understands various command-line arguments:
@@ -31,7 +31,7 @@
file, including where it is used as a template parameter
or in galleries. However, it can also make more mistakes.
- -replaceonly Use this if you do not have a local sysop account, but do
+ -replaceonly Use this if you do not have a local sysop rights, but do
wish to replace links from the NowCommons template.
Example
@@ -49,8 +49,8 @@
#
# (C) Wikipedian, 2006-2007
# (C) Siebrand Mazeland, 2007-2008
-# (C) xqt, 2010-2019
-# (C) Pywikibot team, 2006-2019
+# (C) xqt, 2010-2020
+# (C) Pywikibot team, 2006-2020
#
# Distributed under the terms of the MIT license.
#
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 2f11609..7f576f8 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -72,8 +72,8 @@
#
# (C) Daniel Herding, 2004
# (C) Purodha Blissenbach, 2009
-# (C) xqt, 2009-2019
-# (C) Pywikibot team, 2004-2019
+# (C) xqt, 2009-2020
+# (C) Pywikibot team, 2004-2020
#
# Distributed under the terms of the MIT license.
#
@@ -427,7 +427,8 @@
@return: A valid speedy deletion template.
@rtype: str or None
"""
- if self.getOption('delete') and not self.site.logged_in(sysop=True):
+ if self.getOption('delete') \
+ and 'delete' not in self.site.userinfo['rights']:
sd = self.getOption('sdtemplate')
if not sd and i18n.twhas_key(self.site,
'redirect-broken-redirect-template'):
--
To view, visit https://gerrit.wikimedia.org/r/563730
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: I948f1692eba5847ddbb6e36b062675029fe2ea7b
Gerrit-Change-Number: 563730
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/567294 )
Change subject: [doc] Fix doc warning introduced in a892b382
......................................................................
[doc] Fix doc warning introduced in a892b382
Change-Id: I1b0ed4cd857922b9a8e34fd27a58871fe7926c4f
---
M pywikibot/site.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index fc675fb..c710057 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -7685,7 +7685,8 @@
"""
Return a new instance for given entity id.
- @raises NoWikibaseEntity: there is no entity with the id
+ @raises pywikibot.exceptions.NoWikibaseEntity: there is no entity
+ with the id
@return: a WikibaseEntity subclass
@rtype: WikibaseEntity
"""
--
To view, visit https://gerrit.wikimedia.org/r/567294
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: I1b0ed4cd857922b9a8e34fd27a58871fe7926c4f
Gerrit-Change-Number: 567294
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)