Skip to content

Commit 78f1079

Browse files
pr comment
1 parent 404f3c3 commit 78f1079

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kensho_kenverters/tables_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ def _create_empty_annotation(row: int, col: int) -> AnnotationModel:
2525
def _validate_annotations(
2626
duplicated_annotations: list[AnnotationModel], max_row: int, max_col: int
2727
) -> list[AnnotationModel]:
28-
"""Validate duplicated annotations."""
28+
"""Validate duplicated annotations.
29+
30+
Fill with empty annotations if rows or columns are missing.
31+
"""
32+
2933
# Check all spans are 1 (annotations are duplicated)
3034
all_spans = [annotation.data.span for annotation in duplicated_annotations]
3135
if any(span != (1, 1) for span in all_spans):
@@ -36,6 +40,7 @@ def _validate_annotations(
3640
if len(set(all_indices)) != len(all_indices):
3741
raise ValueError("Overlapping indices in table.")
3842

43+
# Add any missing cells
3944
for row in range(max_row + 1):
4045
for col in range(max_col + 1):
4146
if (row, col) not in all_indices:

0 commit comments

Comments
 (0)