summaryrefslogtreecommitdiff
path: root/build/lib/nba/playoff.py
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-05-04 17:12:26 -0500
committerChristian Cleberg <[email protected]>2026-05-04 17:13:16 -0500
commit052cd6852c73f5fe4096e1391f9e90c426fb94c6 (patch)
tree64ae308a728e8092571a9a3f2c44db4827556428 /build/lib/nba/playoff.py
parent14d8039e4a6ae27c1a7441a375b87617fd5aea4d (diff)
downloadnba-scores-052cd6852c73f5fe4096e1391f9e90c426fb94c6.tar.gz
nba-scores-052cd6852c73f5fe4096e1391f9e90c426fb94c6.tar.bz2
nba-scores-052cd6852c73f5fe4096e1391f9e90c426fb94c6.zip
fix: ruff format & remove unused home_title var
Diffstat (limited to 'build/lib/nba/playoff.py')
-rw-r--r--build/lib/nba/playoff.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/build/lib/nba/playoff.py b/build/lib/nba/playoff.py
index eb3b12b..42c3b0b 100644
--- a/build/lib/nba/playoff.py
+++ b/build/lib/nba/playoff.py
@@ -21,6 +21,7 @@ def fetch_playoff_picture() -> dict:
def _clinch_status(row: list, idx: dict) -> str:
"""Return a color-coded status string from clinch/elimination columns."""
+
def val(col):
return row[idx[col]] if col in idx else None
@@ -54,19 +55,31 @@ def _build_conference_table(result_sets: list, name: str) -> str:
losses = get(row, "LOSSES")
pct = get(row, "PCT")
pct_str = f"{float(pct):.3f}" if pct not in ("", None) else ""
- table_data.append([
- get(row, "RANK"),
- get(row, "TEAM"),
- f"{wins}-{losses}",
- pct_str,
- get(row, "GB"),
- get(row, "HOME"),
- get(row, "AWAY"),
- get(row, "CONF"),
- _clinch_status(row, idx),
- ])
-
- display_headers = ["#", "Team", "W-L", "PCT", "GB", "HOME", "AWAY", "CONF", "Status"]
+ table_data.append(
+ [
+ get(row, "RANK"),
+ get(row, "TEAM"),
+ f"{wins}-{losses}",
+ pct_str,
+ get(row, "GB"),
+ get(row, "HOME"),
+ get(row, "AWAY"),
+ get(row, "CONF"),
+ _clinch_status(row, idx),
+ ]
+ )
+
+ display_headers = [
+ "#",
+ "Team",
+ "W-L",
+ "PCT",
+ "GB",
+ "HOME",
+ "AWAY",
+ "CONF",
+ "Status",
+ ]
conf_label = "Eastern" if "East" in name else "Western"
title = f"{BOLD}{conf_label} Conference Playoff Picture:{END}"
return title + "\n" + tabulate(table_data, headers=display_headers, tablefmt="grid")