Skip to content

Commit 03bb283

Browse files
hugovkradarhere
andauthored
Use walrus operator
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
1 parent 890e5f4 commit 03bb283

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

.github/compare-dist-sizes.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@
5050

5151
def key_for(filename: str) -> str | None:
5252
"""Return a version-independent identifier for a dist file."""
53-
m = WHEEL_RE.match(filename)
54-
if m:
53+
if m := WHEEL_RE.match(filename):
5554
build = f"-{m['build']}" if m["build"] else ""
5655
return f"wheel:{build}-{m['python']}-{m['abi']}-{m['platform']}"
57-
m = SDIST_RE.match(filename)
58-
if m:
56+
if m := SDIST_RE.match(filename):
5957
return "sdist"
6058
return None
6159

@@ -275,8 +273,7 @@ def main() -> int:
275273

276274
print(render_table(baseline_label, baseline_sizes, local_sizes, markdown=False))
277275

278-
summary_path = os.environ.get("GITHUB_STEP_SUMMARY")
279-
if summary_path:
276+
if summary_path := os.environ.get("GITHUB_STEP_SUMMARY"):
280277
with open(summary_path, "a", encoding="utf-8") as f:
281278
f.write(
282279
render_table(baseline_label, baseline_sizes, local_sizes, markdown=True)

0 commit comments

Comments
 (0)