jenkins-bot submitted this change.
[bugfix] Fix warning message in CheckImagesBot
Fix warning message in CheckImagesBot which could print a tuple of
values if delta.days is not 0. Also use f-strings.
Change-Id: I280c5c9de88b0729bc3ba2444d2c8b415cb8aeba
---
M scripts/checkimages.py
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 8c0f4b9..ee33a89 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -77,7 +77,7 @@
"""
#
-# (C) Pywikibot team, 2006-2022
+# (C) Pywikibot team, 2006-2023
#
# Distributed under the terms of the MIT license.
#
@@ -713,11 +713,11 @@
else:
commentox = commento2
+ new_text = f'{testoattuale}\n\n'
if second_text:
- new_text = f'{testoattuale}\n\n{self.notification2}'
+ new_text += f'{self.notification2}'
else:
- new_text = '{}\n\n== {} ==\n{}'.format(testoattuale, self.head,
- self.notification)
+ new_text += f'== {self.head} ==\n{self.notification}'
# Check maximum number of notifications for this talk page
if (self.num_notify is not None
@@ -934,8 +934,8 @@
pywikibot.info(
f'{dup_page} is a duplicate and has to be tagged...')
images_to_tag_list.append(dup_page.title())
- string += '* {}\n'.format(dup_page.title(as_link=True,
- textlink=True))
+ string += (
+ f'* {dup_page.title(as_link=True, textlink=True)}\n')
else:
pywikibot.info(
"Already put the dupe-template in the files's page"
@@ -1364,11 +1364,10 @@
if delta.total_seconds() > wait_time:
yield image
else:
- pywikibot.warning(
- 'Skipping {}, uploaded {} {} ago..'
- .format(image.title(), delta.days, 'days')
- if delta.days > 0
- else (image.title(), delta.seconds, 'seconds'))
+ pywikibot.warning('Skipping {}, uploaded {} ago.'
+ .format(image.title(),
+ f'{delta.days} days' if delta.days
+ else f'{delta.seconds} seconds'))
def is_tagged(self) -> bool:
"""Understand if a file is already tagged or not."""
To view, visit change 934680. To unsubscribe, or for help writing mail filters, visit settings.