From 0aba651240849d4bbfc238e37a36439792cdb3f5 Mon Sep 17 00:00:00 2001 From: xenofem Date: Mon, 15 Jul 2024 13:01:12 -0400 Subject: [PATCH] add more debug info --- dlibrary/dlibrary.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 787f68f..ec8ca26 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -873,8 +873,10 @@ def complete_prefix_number_ordering(entries): if cur[level] != prev[level] and not (cur[level] == 5 and prev[level] == 0): 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 + for level, delta in min_delta_by_level.items(): + if delta > 2: + debug(f'Found a minimum delta of {delta} at level {level}, this might not be a numbering') + return None unified_indices.append(None) @@ -919,10 +921,13 @@ def unique_hierarchical_prefix_numbering(entries, start_point=0): else: n = NUMBER_REGEX.match(nname(e)[pos:]) if n is None: + debug(f'Entry {e} does not have a number after prefix') return None i = int(n.group()) numbering.setdefault((i,), []).append(e) + debug(f'Numbering found for prefix {prefix}') + indices = list(numbering.keys()) for idx in indices: if len(numbering[idx]) > 1: