Skip to content

Commit 228aa41

Browse files
committed
fix mypy issues
1 parent 47b845f commit 228aa41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/kohlrahbi/qualitymap/qualitymaptable.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def from_raw_table(cls, raw_table: list[list[str]]) -> "QualityMapTable":
104104
for row in raw_table:
105105
path_to_data_element, description = row[0].strip().split("\n", 1)
106106
segment_group = SegmentGroup(path_to_data_element=path_to_data_element, description=description)
107-
row_dict = {
107+
row_dict: dict[str, SegmentGroup | list[Cell]] = {
108108
"segment_group": segment_group,
109109
**{header: [] for header in HEADERS if header != "segment_group"},
110110
}
@@ -121,7 +121,9 @@ def from_raw_table(cls, raw_table: list[list[str]]) -> "QualityMapTable":
121121
qualifier, description = raw_cell.split("\n", 1)
122122
description = description.strip('"„“')
123123
cell = Cell(qualifier=qualifier, description=description)
124-
row_dict[column_name].append(cell)
124+
if isinstance(row_dict[column_name], SegmentGroup):
125+
raise ValueError(f"Expected a list for column '{column_name}'")
126+
row_dict[column_name].append(cell) # type: ignore[union-attr]
125127

126128
rows.append(Row.model_validate(row_dict))
127129
return cls(rows=rows)

0 commit comments

Comments
 (0)