From 85da4aab1f24d5ced22939edfd324c1ea4062af4 Mon Sep 17 00:00:00 2001 From: Andrew Pimenov Date: Sun, 9 Aug 2026 16:09:05 +0300 Subject: [PATCH] optimize _unix_annotations dedup with dict.fromkeys --- src/netsleuth/traceparse.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/netsleuth/traceparse.py b/src/netsleuth/traceparse.py index 6de15e8..e1ebcbe 100644 --- a/src/netsleuth/traceparse.py +++ b/src/netsleuth/traceparse.py @@ -47,11 +47,7 @@ def _unix_probes(body: str) -> list[float | None]: def _unix_annotations(body: str) -> list[str]: - seen: list[str] = [] - for token in ANNOTATION_RE.findall(body): - if token not in seen: - seen.append(token) - return seen + return list(dict.fromkeys(ANNOTATION_RE.findall(body))) def parse_linux(text: str) -> list[TraceHop]: