From 62bd4891f6c31fc8b12721e16f8ea17dfb1406b4 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 7 Feb 2024 23:59:35 -0500 Subject: [PATCH] be more forgiving about checking index deltas --- dlibrary/dlibrary.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 785e626..92021ad 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -235,15 +235,17 @@ def complete_prefix_number_ordering(entries): unified_indices = list(unified_indices) unified_indices.sort() + min_delta_by_level = {} if len(unified_indices) > 1: for i in range(1, len(unified_indices)): cur = unified_indices[i] prev = unified_indices[i-1] for level in range(min(len(cur), len(prev))): if cur[level] != prev[level]: - if cur[level] - prev[level] > 2: - return None - break + delta = cur[level] - prev[level] + min_delta_by_level[level] = min(min_delta_by_level.get(level, delta), delta) + if any(delta > 2 for delta in min_delta_by_level.values()): + return None unified_indices.append(None)