add more debug info

This commit is contained in:
xenofem 2024-07-15 13:01:12 -04:00
parent b66e1c5372
commit 0aba651240

View file

@ -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: