From 21c4fb3880166a62bd26d027d9156f8dddb4bf97 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 6 Feb 2026 17:09:46 +0100 Subject: [PATCH] bot review --- esphome/analyze_memory/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/esphome/analyze_memory/__init__.py b/esphome/analyze_memory/__init__.py index b1116bf2833..34fbf2687d7 100644 --- a/esphome/analyze_memory/__init__.py +++ b/esphome/analyze_memory/__init__.py @@ -431,8 +431,6 @@ class MemoryAnalyzer: if result is None or result.returncode != 0: return cswtch_map - obj_dir_str = str(obj_dir) - for line in result.stdout.splitlines(): if "CSWTCH$" not in line: continue @@ -460,9 +458,9 @@ class MemoryAnalyzer: continue # Get relative path from obj_dir for readability - if file_path.startswith(obj_dir_str): - rel_path = file_path[len(obj_dir_str) :].lstrip("/") - else: + try: + rel_path = str(Path(file_path).relative_to(obj_dir)) + except ValueError: rel_path = file_path key = f"{sym_name}:{size}"