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

Change subject: Reuse category graph edge endpoints
......................................................................

Reuse category graph edge endpoints

Read each edge's source and destination once when updating the forward
and reverse mappings. Reuse the endpoint values instead of calling
each getter twice.

Change-Id: I1522a3f8f75daa5dec8b4b7e1cff711df3c2c0e6
---
M scripts/category_graph.py
1 file changed, 4 insertions(+), 2 deletions(-)

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




diff --git a/scripts/category_graph.py b/scripts/category_graph.py
index 75b224d..6fd43f7 100755
--- a/scripts/category_graph.py
+++ b/scripts/category_graph.py
@@ -174,8 +174,10 @@
             # repeat recursively
             self.scan_level(subcat, level - 1, h)
             # track graph's structure to reduce too big graph
-            self.rev[e.get_destination()].append(e.get_source())
-            self.fw[e.get_source()].append(e.get_destination())
+            source = e.get_source()
+            destination = e.get_destination()
+            self.rev[destination].append(source)
+            self.fw[source].append(destination)

     def run(self) -> None:
         """Main function of CategoryGraphBot."""

-- 
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340629?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: I1522a3f8f75daa5dec8b4b7e1cff711df3c2c0e6
Gerrit-Change-Number: 1340629
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Mahveotm <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to