summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-05 13:14:15 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-05 13:20:47 +0200
commit0ce025e3bae4dc3e7dfaed07f47788229d3649ce (patch)
treee4ca8be9b3d786587f1ac2de47b852acf6fa54e8
parentFix tests (diff)
downloadrtems-central-0ce025e3bae4dc3e7dfaed07f47788229d3649ce.tar.bz2
validation: Reliably remove duplicate pre-conds
-rw-r--r--rtemsspec/validation.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index aa8e385b..e618dd58 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -632,8 +632,6 @@ def _compact(pre_conds: PreCondsOfPostCond) -> PreCondsOfPostCond:
combined_pre_conds = [last]
combined_count = 0
for row in pre_conds[1:]:
- if row == last:
- continue
diff = [
index for index, states in enumerate(last)
if states != row[index]
@@ -663,10 +661,11 @@ def _compact_more(pre_conds: PreCondsOfPostCond) -> PreCondsOfPostCond:
index for index, states in enumerate(first)
if states != row[index]
]
- if len(diff) == 1:
- index = diff[0]
- combined_count += 1
- first[index].extend(row[index])
+ if len(diff) <= 1:
+ if diff:
+ index = diff[0]
+ combined_count += 1
+ first[index].extend(row[index])
pre_conds.remove(row)
pre_conds = next_pre_conds
if combined_count == 0: