From 306e3325f5ad1f251fc12bf99757acf36596db87 Mon Sep 17 00:00:00 2001 From: y-okumura Date: Thu, 13 Jan 2022 18:43:41 +0900 Subject: [PATCH] Unify duplicated if statements --- src/pathnode_vis/pathnode_vis/pubinfo_traverse.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/pathnode_vis/pathnode_vis/pubinfo_traverse.py b/src/pathnode_vis/pathnode_vis/pubinfo_traverse.py index 48c91847aff..8615b7942b4 100755 --- a/src/pathnode_vis/pathnode_vis/pubinfo_traverse.py +++ b/src/pathnode_vis/pathnode_vis/pubinfo_traverse.py @@ -202,17 +202,16 @@ def solve2(self, pubinfos, tgt_topic, tgt_stamp, queue.append((tgt_topic, tgt_stamp, root_results)) while len(queue) != 0: topic, stamp, cresult = queue.popleft() - info = pubinfos.get(topic, stamp) - if info: - cresult.add_data(info) - # NDT-EKF has loop, so stop - if topic in stops: + next_pubinfo = pubinfos.get(topic, stamp) + if next_pubinfo is not None: + cresult.add_data(next_pubinfo) + else: + # print(f"pubinfo of {topic} {stamp} not found") continue - # get next edges - next_pubinfo = pubinfos.get(topic, stamp) - if not next_pubinfo: + # NDT-EKF has loop, so stop + if topic in stops: continue for in_infos in next_pubinfo.in_infos.values():