(row)
| 127 | field2type = {field.name: field.type for field in fields(_Datum)} |
| 128 | |
| 129 | def make_datum(row) -> _Datum: |
| 130 | datum = {} |
| 131 | |
| 132 | for name, value in row.items(): |
| 133 | if name in field2type: |
| 134 | if field2type[name] is bool: |
| 135 | datum[name] = bool(int(value)) |
| 136 | else: |
| 137 | datum[name] = field2type[name](value) # type: ignore |
| 138 | |
| 139 | return _Datum(**datum) |
| 140 | |
| 141 | with open(where) as fh: |
| 142 | lines = fh.readlines() |