Skip to content

Commit a5c3b87

Browse files
committed
Code feedback
1 parent 628a20d commit a5c3b87

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# .PHONY: help clean% check% format% docs% lint test pyright playwright% install% testrail% coverage release
2-
31
# Depend on `FORCE` to ensure the target is always run
42
FORCE:
53

@@ -82,7 +80,7 @@ PYTEST = $(SITE_PACKAGES)/pytest
8280
COVERAGE = $(SITE_PACKAGES)/coverage
8381
PYRIGHT = $(SITE_PACKAGES)/pyright
8482
PLAYWRIGHT = $(SITE_PACKAGES)/playwright
85-
$(PYTEST) $(COVERAGE) $(PYRIGHT) $(PLAYWRIGHT):
83+
$(RUFF) $(PYTEST) $(COVERAGE) $(PYRIGHT) $(PLAYWRIGHT):
8684
@$(MAKE) install-deps
8785

8886

examples/model-score/app.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
THRESHOLD_LOW = 0.5
1717
THRESHOLD_LOW_COLOR = "rgb(193, 0, 0)"
1818

19+
20+
def value_box_theme(score):
21+
if score > THRESHOLD_MID:
22+
return "text-success"
23+
elif score < THRESHOLD_LOW:
24+
return "bg-danger"
25+
else:
26+
return "text-warning"
27+
28+
1929
# Start a background thread that writes fake data to the SQLite database every second
2030
scoredata.begin()
2131

@@ -195,13 +205,7 @@ def value_boxes():
195205
ui.value_box(
196206
model,
197207
ui.h2(score),
198-
theme=(
199-
"text-success"
200-
if score > THRESHOLD_MID
201-
else "text-warning"
202-
if score > THRESHOLD_LOW
203-
else "bg-danger"
204-
),
208+
theme=value_box_theme(score),
205209
)
206210
for model, score in scores_by_model.items()
207211
],

0 commit comments

Comments
 (0)