use zip for pairwise hop iteration in path_findings

This commit is contained in:
Andrew Pimenov 2026-08-09 16:11:29 +03:00
parent fb3c6ca77f
commit 93c6ac526a

View file

@ -127,8 +127,7 @@ def path_findings(trace: TraceResult) -> list[Finding]:
# rate limiting on those routers, not a real problem, no matter how many hops # rate limiting on those routers, not a real problem, no matter how many hops
# in a row stayed silent; only loss that persists all the way to the end is real. # in a row stayed silent; only loss that persists all the way to the end is real.
loss_persists_to_the_end = trace.hops[-1].loss_pct >= 20.0 loss_persists_to_the_end = trace.hops[-1].loss_pct >= 20.0
for index, hop in enumerate(trace.hops[:-1]): for hop, following in zip(trace.hops, trace.hops[1:]):
following = trace.hops[index + 1]
if loss_persists_to_the_end and hop.loss_pct >= 20.0 and following.loss_pct >= 20.0: if loss_persists_to_the_end and hop.loss_pct >= 20.0 and following.loss_pct >= 20.0:
findings.append( findings.append(
Finding( Finding(