MCPcopy Create free account
hub / github.com/apify/crawlee-python / to_table

Method to_table

src/crawlee/statistics/_models.py:36–45  ·  view source on GitHub ↗

Print out the Final Statistics data as a table.

(self)

Source from the content-addressed store, hash-verified

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()}

Callers 2

_logMethod · 0.80
runMethod · 0.80

Calls 3

format_durationFunction · 0.90
make_tableFunction · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected