Normalize an iterable of Mark or MarkDecorator objects into a list of marks by retrieving the `mark` attribute on MarkDecorator instances. :param mark_list: marks to normalize :returns: A new list of the extracted Mark objects
(
mark_list: Iterable[Mark | MarkDecorator],
)
| 462 | |
| 463 | |
| 464 | def normalize_mark_list( |
| 465 | mark_list: Iterable[Mark | MarkDecorator], |
| 466 | ) -> Iterable[Mark]: |
| 467 | """ |
| 468 | Normalize an iterable of Mark or MarkDecorator objects into a list of marks |
| 469 | by retrieving the `mark` attribute on MarkDecorator instances. |
| 470 | |
| 471 | :param mark_list: marks to normalize |
| 472 | :returns: A new list of the extracted Mark objects |
| 473 | """ |
| 474 | for mark in mark_list: |
| 475 | mark_obj = getattr(mark, "mark", mark) |
| 476 | if not isinstance(mark_obj, Mark): |
| 477 | raise TypeError(f"got {mark_obj!r} instead of Mark") |
| 478 | yield mark_obj |
| 479 | |
| 480 | |
| 481 | def store_mark(obj, mark: Mark) -> None: |
no outgoing calls
no test coverage detected