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)