jenkins-bot submitted this change.

View Change

Approvals: Rubin: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
[bugfix] Fix too many positional arguments for constructor call

image.ImageRobot has only 3 positional arguments.
Add keyword arguments to instantiate the bot

See https://deepsource.io/gh/xqt/pywikibot/issue/PYL-E1121/occurrences

Change-Id: Icea3a9516f42e36a10e3a7eda1fcf8ea69821a0f
---
M scripts/nowcommons.py
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index bebea54..9620ff5 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -283,7 +283,7 @@
'is still used in {1} pages.',
local_file_page.title(with_ns=False),
len(using_pages)))
- if self.opt.replace is True:
+ if self.opt.replace:
pywikibot.output(color_format(
'Replacing "{lightred}{0}{default}" by '
'"{lightgreen}{1}{default}\".',
@@ -293,8 +293,8 @@
pg.FileLinksGenerator(local_file_page),
local_file_page.title(with_ns=False),
commons_file_page.title(with_ns=False),
- '', self.opt.replacealways,
- self.opt.replaceloose)
+ always=self.opt.replacealways,
+ loose=self.opt.replaceloose)
bot.run()
# If the image is used with the urlname the
# previous function won't work
@@ -303,13 +303,12 @@
page.title()).using_pages(total=1)))
if is_used and self.opt.replaceloose:
bot = ImageBot(
- pg.FileLinksGenerator(
- local_file_page),
- local_file_page.title(
- with_ns=False, as_url=True),
+ pg.FileLinksGenerator(local_file_page),
+ local_file_page.title(with_ns=False,
+ as_url=True),
commons_file_page.title(with_ns=False),
- '', self.opt.replacealways,
- self.opt.replaceloose)
+ always=self.opt.replacealways,
+ loose=self.opt.replaceloose)
bot.run()
# refresh because we want the updated list
using_pages = len(list(pywikibot.FilePage(
@@ -323,7 +322,7 @@
'anymore.',
local_file_page.title(with_ns=False)))
commons_text = commons_file_page.get()
- if self.opt.replaceonly is False:
+ if not self.opt.replaceonly:
if sha1 == commons_file_page.latest_file_info.sha1:
pywikibot.output(
'The file is identical to the one on Commons.')

To view, visit change 688337. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Icea3a9516f42e36a10e3a7eda1fcf8ea69821a0f
Gerrit-Change-Number: 688337
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Rubin <rubin.happy@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged