From 0ce025e3bae4dc3e7dfaed07f47788229d3649ce Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 5 May 2021 13:14:15 +0200 Subject: validation: Reliably remove duplicate pre-conds --- rtemsspec/validation.py | 11 +++++------ 1 file 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: -- cgit v1.2.3