jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/934680 )

Change subject: [bugfix] Fix warning message in CheckImagesBot
......................................................................

[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(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




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 https://gerrit.wikimedia.org/r/c/pywikibot/core/+/934680
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: I280c5c9de88b0729bc3ba2444d2c8b415cb8aeba
Gerrit-Change-Number: 934680
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Matěj Suchánek <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to