From b7b9e00f1949c5f032a0f84724163c70e61d1ace Mon Sep 17 00:00:00 2001 From: David Kruger Date: Thu, 22 May 2025 17:33:32 -0700 Subject: [PATCH] Tweaked output --- dnd5etools/scripts/spell_templates.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dnd5etools/scripts/spell_templates.py b/dnd5etools/scripts/spell_templates.py index cb4b1e0..f98970f 100644 --- a/dnd5etools/scripts/spell_templates.py +++ b/dnd5etools/scripts/spell_templates.py @@ -73,13 +73,13 @@ def main(): break print(f"{num_matches} matched from {len(all_template_spells)}") print("circles/diameter") - print_sizes(circles, " ") + print_sizes(circles, 2) print("squares/size") - print_sizes(squares, " ") + print_sizes(squares, 2) print("cones/size") - print_sizes(cones, " ") + print_sizes(cones, 2) print("lines/length") - print_sizes(lines, " ") + print_sizes(lines, 2) def is_template_spell(spell: dnd5etools.db.spells.Spell) -> bool: @@ -107,7 +107,10 @@ def has_timed_duration(spell: dnd5etools.db.spells.Spell) -> bool: return False -def print_sizes(sizes_dict: typing.Mapping[int, int], indent: str) -> None: +def print_sizes(sizes_dict: typing.Mapping[int, int], indent: int) -> None: + indent_str = " " * indent for s in sorted(sizes_dict.items(), key=lambda kv: len(kv[1]), reverse=True): - print(f"{indent} {s[0]}ft => {len(s[1])}") - print(f"{indent}{indent}{s[1]}") + print(f"{indent_str} {s[0]}ft/{s[0]/5}in => {len(s[1])}") + print( + f"{indent_str}{indent_str}{pprint.pformat(s[1], indent=3*indent, compact=True)}" + )