From 7259e7ffbebffa74c1c07257076bcb86fdf08689 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 28 Apr 2025 23:37:27 -0600 Subject: measurestack: Fix+test skipmodel chain collections --- build-aux/measurestack/analyze.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'build-aux/measurestack/analyze.py') diff --git a/build-aux/measurestack/analyze.py b/build-aux/measurestack/analyze.py index 93bf885..f454b7e 100644 --- a/build-aux/measurestack/analyze.py +++ b/build-aux/measurestack/analyze.py @@ -232,10 +232,10 @@ class AnalyzeResult(typing.NamedTuple): class SkipModel(typing.NamedTuple): """Running the skipmodel calls `.fn(chain, ...)` with the chain consisting of the last `.nchain` items (if .nchain is an int), or - the chain starting with the *last* occurance of `.nchain` (if - .nchain is a collection). If the chain is not that long or does - not contain a member of the collection, then .fn is not called and - the call is *not* skipped. + the chain starting with the *last* occurance of `.nchain` in + chain[:-1] (if .nchain is a collection). If the chain is not that + long or does not contain a member of the collection, then .fn is + not called and the call is *not* skipped. """ @@ -248,9 +248,9 @@ class SkipModel(typing.NamedTuple): _chain = chain[-self.nchain :] return self.fn(_chain, call), len(_chain) else: - for i in reversed(range(len(chain))): + for i in reversed(range(len(chain) - 1)): if chain[i].base() in self.nchain: - _chain = chain[i - 1 :] + _chain = chain[i:] return self.fn(_chain, call), len(_chain) return False, 0 -- cgit v1.2.3-2-g168b