Xqt has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/604926 )
Change subject: Revert "[IMMPR] Do not raise a RuntimeError if user-config.py is missing"
......................................................................
Revert "[IMMPR] Do not raise a RuntimeError if user-config.py is missing"
Makes generate_family_file.py return exit code 1 even when successfull
This reverts commit 8fb998ba7dd43b6a66eae3b66f39f04ca2b150de.
Change-Id: Ia439bee46b4eaf911c68ce838f8f5d0289f9f5ce
---
M pywikibot/config2.py
1 file changed, 1 insertion(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index b32710a..d57ed60 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -368,8 +368,7 @@
'location.\n'
' Directory where user-config.py is searched is determined '
'as follows:\n\n ') + get_base_dir.__doc__
- output(exc_text)
- sys.exit(1)
+ raise RuntimeError(exc_text)
return base_dir
--
To view, visit https://gerrit.wikimedia.org/r/604926
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: Ia439bee46b4eaf911c68ce838f8f5d0289f9f5ce
Gerrit-Change-Number: 604926
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/604754 )
Change subject: [IMPR] use fixed point notation rather than exp for values
......................................................................
[IMPR] use fixed point notation rather than exp for values
Change-Id: Ic3347dee14d386890ea7710e6fbf4073118906c5
---
M pywikibot/data/api.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 243dd7f..8a80457 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -2127,7 +2127,7 @@
if self.max_retries < 0:
raise TimeoutError('Maximum retries attempted without success.')
delay = delay or self.retry_wait
- pywikibot.warning('Waiting {:.1g} seconds before retrying.'
+ pywikibot.warning('Waiting {:.1f} seconds before retrying.'
.format(delay))
pywikibot.sleep(delay)
# double the next wait, but do not exceed config.retry_max seconds
--
To view, visit https://gerrit.wikimedia.org/r/604754
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: Ic3347dee14d386890ea7710e6fbf4073118906c5
Gerrit-Change-Number: 604754
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/508083 )
Change subject: [IMPR] derive ProtectionRobot from CurrentPageBot
......................................................................
[IMPR] derive ProtectionRobot from CurrentPageBot
Also rename treat to treat_page
detached from Ia4f25771
Change-Id: Ib771a4fd119e55d6be3dd3030bd441b9a71c0758
---
M scripts/protect.py
1 file changed, 17 insertions(+), 20 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/protect.py b/scripts/protect.py
index 6c86696..bfc1c7b 100755
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -55,7 +55,7 @@
# Written by https://it.wikisource.org/wiki/Utente:Qualc1
# Created by modifying delete.py
#
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
@@ -63,7 +63,7 @@
import pywikibot
from pywikibot import i18n, pagegenerators
-from pywikibot.bot import SingleSiteBot
+from pywikibot.bot import SingleSiteBot, CurrentPageBot
from pywikibot.tools import PY2
if PY2:
@@ -74,11 +74,11 @@
docuReplacements = {'¶ms;': pagegenerators.parameterHelp} # noqa: N816
-class ProtectionRobot(SingleSiteBot):
+class ProtectionRobot(SingleSiteBot, CurrentPageBot):
"""This bot allows protection of pages en masse."""
- def __init__(self, generator, protections, site=None, **kwargs):
+ def __init__(self, generator, protections, **kwargs):
"""
Create a new ProtectionRobot.
@@ -86,37 +86,34 @@
@type generator: generator
@param protections: protections as a dict with "type": "level"
@type protections: dict
- @param site: The site to which the protections apply. By default it's
- using the site of the first page returned from the generator. If
- True it's using the configured site.
- @type site: None, True or Site
- @param kwargs: additional arguments directly feed to Bot.__init__()
+ @param kwargs: additional arguments directly feed to super().__init__()
"""
self.availableOptions.update({
'summary': None,
'expiry': None,
})
- super(ProtectionRobot, self).__init__(site=site, **kwargs)
+ super(ProtectionRobot, self).__init__(**kwargs)
self.generator = generator
self.protections = protections
- def treat(self, page):
+ def treat_page(self):
"""Run the bot's action on each page.
- Bot.run() loops through everything in the page generator and applies
- the protections using this function.
+ treat_page treats every page given by the generator and applies
+ the protections using this method.
"""
- self.current_page = page
if not self.user_confirm(
'Do you want to change the protection level of {0}?'
- .format(page.title(as_link=True, force_interwiki=True))):
+ .format(self.current_page.title(as_link=True,
+ force_interwiki=True))):
return
- applicable = page.applicable_protections()
+
+ applicable = self.current_page.applicable_protections()
protections = dict(
prot for prot in self.protections.items() if prot[0] in applicable)
- page.protect(reason=self.getOption('summary'),
- expiry=self.getOption('expiry'),
- protections=protections)
+ self.current_page.protect(reason=self.getOption('summary'),
+ expiry=self.getOption('expiry'),
+ protections=protections)
def check_protection_level(operation, level, levels, default=None):
@@ -244,7 +241,7 @@
if not options.get('summary'):
options['summary'] = pywikibot.input(
'Enter a reason for the protection change:')
- bot = ProtectionRobot(generator, combined_protections, site, **options)
+ bot = ProtectionRobot(generator, combined_protections, **options)
bot.run()
else:
pywikibot.bot.suggest_help(missing_generator=True)
--
To view, visit https://gerrit.wikimedia.org/r/508083
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: Ib771a4fd119e55d6be3dd3030bd441b9a71c0758
Gerrit-Change-Number: 508083
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Matěj Suchánek <matejsuchanek97(a)gmail.com>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/598976 )
Change subject: [doc] Use python2 release for older mw versions
......................................................................
[doc] Use python2 release for older mw versions
mw 1.14 stupport is still available and will not be dropped before
sunset of Python 2 support.
Bug: T253719
Bug: T245350
Change-Id: I2aa518fd4324a583109b39b8d544f254cf65257e
---
M pywikibot/site/__init__.py
1 file changed, 3 insertions(+), 2 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index b53c999..0e4f405 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -2754,8 +2754,9 @@
warn('\n'
+ fill('Support of MediaWiki {version} will be dropped. '
'It is recommended to use MediaWiki 1.19 or above. '
- 'You may use Pywikibot stable release 3.0.20200111 '
- 'for older MediaWiki versions. '
+ 'You may use every Pywikibot 3.0.X release from '
+ 'pypi index or the "python2" release from the '
+ 'repository for older MediaWiki versions. '
'See T245350 for further information.'
.format(version=version)), FutureWarning)
--
To view, visit https://gerrit.wikimedia.org/r/598976
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: I2aa518fd4324a583109b39b8d544f254cf65257e
Gerrit-Change-Number: 598976
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
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/599034 )
Change subject: [IMMPR] Do not raise a RuntimeError if user-config.py is missing
......................................................................
[IMMPR] Do not raise a RuntimeError if user-config.py is missing
config2.py raises a RuntimeError if user-config.py is required but
not present. This looks ugly. Especially if operators are setting up
their bot they expect a pleasant hint instead of a traceback. And
developers usually know about this issue and do not need the code
snippet for debugging.
Change-Id: I15f7a6f356408e7113362745e81ec7758e9a01ab
---
M pywikibot/config2.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index d57ed60..b32710a 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -368,7 +368,8 @@
'location.\n'
' Directory where user-config.py is searched is determined '
'as follows:\n\n ') + get_base_dir.__doc__
- raise RuntimeError(exc_text)
+ output(exc_text)
+ sys.exit(1)
return base_dir
--
To view, visit https://gerrit.wikimedia.org/r/599034
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: I15f7a6f356408e7113362745e81ec7758e9a01ab
Gerrit-Change-Number: 599034
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)