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

Change subject: Refactor: Decouple interwiki.py from global 
config.interwiki_graph
......................................................................

Refactor: Decouple interwiki.py from global config.interwiki_graph

Moves the 'graph' option from the global config object to the local
InterwikiBotConfig instance. This improves encapsulation and allows
the bot to be configured programmatically without side effects.

Bug: T416116
Change-Id: I88b410eb1fa68547dcdd918d0cd1086806be288e
---
M scripts/interwiki.py
1 file changed, 5 insertions(+), 5 deletions(-)

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




diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 200a083..00ac4d7 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -347,7 +347,7 @@
    default site only, instead of the origin page.
 """
 #
-# (C) Pywikibot team, 2003-2025
+# (C) Pywikibot team, 2003-2026
 #
 # Distributed under the terms of the MIT license.
 #
@@ -487,6 +487,7 @@
     summary = ''
     untranslated = False
     untranslatedonly = False
+    graph = config.interwiki_graph

     def note(self, text: str) -> None:
         """Output a notification message with.
@@ -548,8 +549,7 @@
         elif arg == 'showpage':
             self.showtextlink += self.showtextlinkadd
         elif arg == 'graph':
-            # override configuration
-            config.interwiki_graph = True
+            self.graph = True
         elif arg == 'bracket':
             self.parenthesesonly = True
         elif arg == 'localright':
@@ -1207,7 +1207,7 @@
                     f.write(
                         f'* {self.origin} '
                         f'{{Found more than one link for {page.site}}}')
-                    if config.interwiki_graph and config.interwiki_graph_url:
+                    if self.conf.graph and config.interwiki_graph_url:
                         filename = interwiki_graph.getFilename(
                             self.origin,
                             extension=config.interwiki_graph_formats[0])
@@ -1355,7 +1355,7 @@
             return {site: pages[0] for site, pages in new.items()}

         # There are any errors.
-        if config.interwiki_graph:
+        if self.conf.graph:
             graphDrawer = interwiki_graph.GraphDrawer(self)
             graphDrawer.createGraph()


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1237162?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: I88b410eb1fa68547dcdd918d0cd1086806be288e
Gerrit-Change-Number: 1237162
Gerrit-PatchSet: 3
Gerrit-Owner: Anotida Expected <[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