Print out the Final Statistics data as a table.
(self)
| 34 | crawler_runtime: timedelta |
| 35 | |
| 36 | def to_table(self) -> str: |
| 37 | """Print out the Final Statistics data as a table.""" |
| 38 | formatted_dict = {} |
| 39 | for k, v in asdict(self).items(): |
| 40 | if isinstance(v, timedelta): |
| 41 | formatted_dict[k] = format_duration(v) |
| 42 | else: |
| 43 | formatted_dict[k] = v |
| 44 | |
| 45 | return make_table([(str(k), str(v)) for k, v in formatted_dict.items()], width=_STATISTICS_TABLE_WIDTH) |
| 46 | |
| 47 | def to_dict(self) -> dict[str, float | int | list[int]]: |
| 48 | return {k: v.total_seconds() if isinstance(v, timedelta) else v for k, v in asdict(self).items()} |
no test coverage detected