From 98820a683c9d98bb815fdb2cb78d5f26b8cd9793 Mon Sep 17 00:00:00 2001 From: "qwen.ai[bot]" Date: Wed, 12 Aug 2026 14:45:37 +0000 Subject: [PATCH] docs: add docstring to build_trace_result function --- src/netsleuth/traceparse.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/netsleuth/traceparse.py b/src/netsleuth/traceparse.py index 859428a..ea531bc 100644 --- a/src/netsleuth/traceparse.py +++ b/src/netsleuth/traceparse.py @@ -260,6 +260,21 @@ def build_trace_result( os_name: str, config: TraceConfig, ) -> TraceResult: + """Build a complete TraceResult from raw traceroute output. + + Parses the traceroute output and constructs a TraceResult object with + completion status indicators based on whether the target was reached. + + Args: + text: Raw output from a traceroute command. + os_name: The operating system name for selecting the correct parser. + config: TraceConfig containing target info and max hop count. + + Returns: + A TraceResult with parsed hops and completion flags: + - completed: True if the last hop matches the target IP + - max_hops_reached: True if we hit max hops without reaching target + """ hops = parse_traceroute(text, os_name) completed = bool(hops and config.resolved_ip and hops[-1].ip == config.resolved_ip) max_hops_reached = bool(hops) and not completed and hops[-1].ttl >= config.max_hops