Tweaked output

This commit is contained in:
David Kruger 2025-05-22 17:33:32 -07:00
parent 96624631b2
commit b7b9e00f19

View File

@ -73,13 +73,13 @@ def main():
break break
print(f"{num_matches} matched from {len(all_template_spells)}") print(f"{num_matches} matched from {len(all_template_spells)}")
print("circles/diameter") print("circles/diameter")
print_sizes(circles, " ") print_sizes(circles, 2)
print("squares/size") print("squares/size")
print_sizes(squares, " ") print_sizes(squares, 2)
print("cones/size") print("cones/size")
print_sizes(cones, " ") print_sizes(cones, 2)
print("lines/length") print("lines/length")
print_sizes(lines, " ") print_sizes(lines, 2)
def is_template_spell(spell: dnd5etools.db.spells.Spell) -> bool: 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 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): 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_str} {s[0]}ft/{s[0]/5}in => {len(s[1])}")
print(f"{indent}{indent}{s[1]}") print(
f"{indent_str}{indent_str}{pprint.pformat(s[1], indent=3*indent, compact=True)}"
)