Skip to content

Commit 6266655

Browse files
committed
fix(types): concrete dict generics; clean annotations; ignore arg-type on Text.assemble
1 parent b648b34 commit 6266655

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/diff_risk_dashboard/cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def _exit_code(risk: str) -> int:
2222
return {"green": 0, "yellow": 1, "red": 2}.get(risk, 0)
2323

2424

25-
def _summarize(apv: dict) -> dict[str, int][str, int]:
26-
counts: dict[str, int][str, int] = {}
25+
def _summarize(apv: dict) -> dict[str, int]:
26+
counts: dict[str, int] = {}
2727
for k, v in (apv.get("by_severity") or {}).items():
2828
counts[str(k).upper()] = int(v or 0)
2929
total = sum(counts.get(s, 0) for s in _SEVERITIES)
@@ -33,7 +33,7 @@ def _summarize(apv: dict) -> dict[str, int][str, int]:
3333

3434

3535
def _table_plain(summary: dict[str, Any]) -> str:
36-
counts: dict[str, int][str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
36+
counts: dict[str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
3737
total = int(summary["total"])
3838
w_sev = max(len("Severity"), max(len(s) for s in _SEVERITIES))
3939
w_cnt = max(len("Count"), len(str(total)))
@@ -51,7 +51,7 @@ def _table_plain(summary: dict[str, Any]) -> str:
5151

5252

5353
def _bar_plain(summary: dict[str, Any], width: int = 80) -> str:
54-
counts: dict[str, int][str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
54+
counts: dict[str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
5555
total = int(summary["total"])
5656
maxc = max(counts.values()) if counts else 0
5757
bar_w = max(10, min(40, width - 24))
@@ -66,7 +66,7 @@ def _bar_plain(summary: dict[str, Any], width: int = 80) -> str:
6666

6767

6868
def _table_rich(summary: dict[str, Any], width: int) -> Table:
69-
counts: dict[str, int][str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
69+
counts: dict[str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
7070
total = int(summary["total"])
7171
worst = str(summary.get("worst", "UNKNOWN")).upper()
7272
risk = str(summary.get("risk", summary.get("risk_level", "green")) or "green").lower()
@@ -87,7 +87,7 @@ def bar(n: int) -> str:
8787
w = max(1, round(n / maxc * bar_w))
8888
return "█" * w
8989

90-
title = Text.assemble(
90+
title = Text.assemble( # type: ignore[arg-type]
9191
("Diff Risk Dashboard ", "bold"),
9292
(emoji + " ",),
9393
("— Worst: ", "dim"),
@@ -126,7 +126,7 @@ def bar(n: int) -> str:
126126

127127
def _bar_rich(summary: dict[str, Any], width: int) -> None:
128128
console = Console()
129-
counts: dict[str, int][str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
129+
counts: dict[str, int] = {s: int(summary["by_severity"].get(s, 0)) for s in _SEVERITIES}
130130
total = int(summary["total"])
131131
maxc = max(counts.values()) if counts else 0
132132
bar_w = max(10, min(40, width - 24))

0 commit comments

Comments
 (0)