(self)
| 58 | rv.extend(["Details:"] + [f"- {line}" for line in self.details]) |
| 59 | return "\n".join(rv) |
| 60 | |
| 61 | def to_dict(self) -> dict[str, Any]: |
| 62 | # Going through some pain to ensure that the scores dict is always complete |
| 63 | player_names = set(self.player_stats.keys()) | set(self.scores.keys()) |
| 64 | return { |
| 65 | "round_num": self.round_num, |
| 66 | "winner": self.winner, |
| 67 | "details": self.details, |
| 68 | "scores": {name: self.scores.get(name, 0.0) for name in player_names}, |
| 69 | "player_stats": {name: stats.to_dict() for name, stats in self.player_stats.items()}, |
| 70 | } |
| 71 | |
| 72 |
no test coverage detected