jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1346428?usp=email )

Change subject: category: Join list output fragments
......................................................................

category: Join list output fragments

Collect category list output fragments and join them once after iterating
the members. Avoid repeatedly concatenating the growing output string.

Preserve member ordering, file and talk links, trailing newlines, and
existing append behavior.

Change-Id: I2eaf5b2955093a6d4d8aa207fcba23fc7927c0f6
---
M scripts/category.py
1 file changed, 5 insertions(+), 4 deletions(-)

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




diff --git a/scripts/category.py b/scripts/category.py
index e7858dc..8878707 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -1031,17 +1031,18 @@
         if self.subcats:
             set_of_articles |= set(self.cat.subcategories())

-        list_string = ''
+        list_parts = []
         for article in sorted(set_of_articles):
             textlink = not (article.is_filepage() and self.show_images)
-            list_string += (
+            list_parts.append(
                 f'{self.prefix} '
                 f'{article.title(as_link=True, textlink=textlink)}'
             )
             if self.talk_pages and not article.isTalkPage():
-                list_string += (
+                list_parts.append(
                     f' -- [[{article.toggleTalkPage().title()}|talk]]')
-            list_string += '\n'
+            list_parts.append('\n')
+        list_string = ''.join(list_parts)

         if self.list.text and self.append:
             # append content by default at the bottom

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1346428?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2eaf5b2955093a6d4d8aa207fcba23fc7927c0f6
Gerrit-Change-Number: 1346428
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to