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

Change subject: IMPR: replace codecs.open() with open() in 
parser_function_count.py
......................................................................

IMPR: replace codecs.open() with open() in parser_function_count.py

Bug: T395187
Change-Id: I57225980e75ab26fbe3806cb60e7bfdbe024f32a
---
M scripts/parser_function_count.py
1 file changed, 2 insertions(+), 7 deletions(-)

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




diff --git a/scripts/parser_function_count.py b/scripts/parser_function_count.py
index 5900508..60c02ed 100755
--- a/scripts/parser_function_count.py
+++ b/scripts/parser_function_count.py
@@ -43,13 +43,12 @@
 functions will be listed.
 """
 #
-# (C) Pywikibot team, 2013-2022
+# (C) Pywikibot team, 2013-2025
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import annotations

-import codecs
 import re
 from collections import Counter

@@ -163,12 +162,8 @@

         # File operations:
         if self.opt.save:
-            # This opens in strict error mode, that means bot will stop
-            # on encoding errors with ValueError.
-            # See https://docs.python.org/3/library/codecs.html#codecs.open
             try:
-                with codecs.open(
-                        self.opt.save, encoding='utf-8', mode='a') as f:
+                with open(self.opt.save, 'a', encoding='utf-8') as f:
                     f.write(resultlist)
             except OSError as e:
                 pywikibot.error(e)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1152437?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: I57225980e75ab26fbe3806cb60e7bfdbe024f32a
Gerrit-Change-Number: 1152437
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[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