summaryrefslogtreecommitdiff
path: root/build-aux/measurestack/analyze.py
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-28 23:37:27 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-06 11:50:46 -0600
commit7259e7ffbebffa74c1c07257076bcb86fdf08689 (patch)
treea843fe047b337b8708cf9acd0806d1046d792f68 /build-aux/measurestack/analyze.py
parent8e21fcfc3b332e749135e4081dacb5556b30f5be (diff)
measurestack: Fix+test skipmodel chain collections
Diffstat (limited to 'build-aux/measurestack/analyze.py')
-rw-r--r--build-aux/measurestack/analyze.py12
1 files changed, 6 insertions, 6 deletions
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