Debian Codegraph @

tools/stress_test_pretty.py

raw
1 from rich.console import Console
2 from rich.panel import Panel
3 from rich.pretty import Pretty
4 from rich._timer import timer
5
6 DATA = {
7 "foo": [1, 2, 3, (), {}, (1, 2, 3), {4, 5, 6, (7, 8, 9)}, "Hello, World"],
8 "bar": [None, (False, True)] * 2,
9 "Dune": {
10 "names": {
11 "Paul Atreides",
12 "Vladimir Harkonnen",
13 "Thufir Hawat",
14 "Duncan Idaho",
15 }
16 },
17 }
18 console = Console()
19 with timer("Stress test"):
20 for w in range(130):
21 console.print(Panel(Pretty(DATA, indent_guides=True), width=w))