| Conditions | 2 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from typing import Sequence |
||
| 20 | @classmethod |
||
| 21 | def df_to_hits(cls, self: HitFrame) -> Sequence[AbstractHit]: |
||
| 22 | hits = [] |
||
| 23 | for row in self.itertuples(): |
||
| 24 | clazz = HIT_CLASSES[row.hit_class] |
||
| 25 | # ignore extra columns |
||
| 26 | # if cols are missing, let it fail on clazz.__init__ |
||
| 27 | data = {f: getattr(row, f) for f in clazz.fields()} |
||
| 28 | # noinspection PyArgumentList |
||
| 29 | hit = clazz(**data) |
||
| 30 | hits.append(hit) |
||
| 31 | return hits |
||
| 32 | |||
| 35 |