From e9253684f238ff2a4be4dd1f797222c119ad59a4 Mon Sep 17 00:00:00 2001 From: Sasan <30176885+aminissn@users.noreply.github.com> Date: Tue, 20 Feb 2024 18:22:04 +0100 Subject: [PATCH] getMaxTLLinkIndex --- tools/sumolib/net/node.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/sumolib/net/node.py b/tools/sumolib/net/node.py index cce1d7a3aa3d..9c9f90fae9d0 100644 --- a/tools/sumolib/net/node.py +++ b/tools/sumolib/net/node.py @@ -206,11 +206,14 @@ def getNeighboringNodes(self, outgoingNodes=True, incomingNodes=True): neighboring.append(e.getToNode()) return neighboring - def getMaxTLLinkIndex(self): - idx = [] - for conn in self.getConnections(): - idx.append(conn.getTLLinkIndex()) - return(max(idx)) - def __repr__(self): return '' % self._id + + def getMaxTLLinkIndex(self): + idx = [] + if self.getType()=='traffic_light': + for conn in self.getConnections(): + idx.append(conn.getTLLinkIndex()) + return(max(idx)) + else: + return None