From d1b2010ed216a2bde2e388d06cb2342d43276c94 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 6 Mar 2026 22:31:38 -1000 Subject: [PATCH] Use walrus operator in crystal regex match --- esphome/__main__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index 0ae6aed014..b216593edb 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -649,8 +649,7 @@ def _make_crystal_freq_callback( crystal_re = re.compile(r"Crystal frequency:\s+(\d+(?:\.\d+)?)\s*MHz") def check_crystal_line(line: str) -> str | None: - match = crystal_re.search(line) - if not match: + if not (match := crystal_re.search(line)): return None detected = int(float(match.group(1))) if detected == configured_freq: