Use json.dumps over pprint.format

This commit is contained in:
Matthias Metelka 2022-10-21 01:25:16 +02:00
parent 0645aef8c6
commit 94e398fd2f
4 changed files with 5 additions and 7 deletions

View file

@ -49,7 +49,7 @@ class CellRow:
) -> None:
self.refreshed_at: float = time.time()
self.cells: tuple[Cell, ...] = tuple(Cell(*cell) for cell in cells)
self.color: tuple[str, str] | None = backend_color_to_aqt_color(color)
self.color: dict[str, str] | None = backend_color_to_aqt_color(color)
self.font_name: str = font_name or "arial"
self.font_size: int = font_size if font_size > 0 else 12

View file

@ -47,5 +47,3 @@ with open(input_svg, "r") as f:
substitute(svg_data, light_svg, "light")
substitute(svg_data, dark_svg, "dark")

View file

@ -6,6 +6,7 @@ from aqt import colors
from aqt.qt import *
from aqt.theme import theme_manager
class Switch(QAbstractButton):
"""A horizontal slider to toggle between two states which can be denoted by strings and/or QIcons.

View file

@ -4,7 +4,6 @@
import json
import re
import sys
import pprint
# bazel genrule "srcs"
root_vars_css = sys.argv[1]
@ -75,7 +74,7 @@ with open(colors_py, "w") as buf:
if not "dark" in val:
val["dark"] = val.light
buf.write(f'{color} = {pprint.pformat(val, width=50, sort_dicts=False)}\n')
buf.write(re.sub(r'\"\n', '",\n', f"{color} = {json.dumps(val, indent=4)}\n"))
with open(props_py, "w") as buf:
@ -86,4 +85,4 @@ with open(props_py, "w") as buf:
if not "dark" in val:
val["dark"] = val.light
buf.write(f'{prop} = {pprint.pformat(val, width=50, sort_dicts=False)}\n')
buf.write(re.sub(r'\"\n', '",\n', f"{prop} = {json.dumps(val, indent=4)}\n"))