From 478ac9d9f2f4a4f48ee25aaeb46ae8a3d48c7e14 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 22 Mar 2026 11:32:36 -1000 Subject: [PATCH] lint --- esphome/cpp_generator.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/esphome/cpp_generator.py b/esphome/cpp_generator.py index 2937a43754..5c7da6e1c1 100644 --- a/esphome/cpp_generator.py +++ b/esphome/cpp_generator.py @@ -580,7 +580,7 @@ def Pvariable(id_: ID, rhs: SafeExpType, type_: "MockObj" = None) -> "MockObj": if type_ is not None: id_.type = type_ - if isinstance(rhs, MockObj) and rhs._is_new_expr: + if isinstance(rhs, MockObj) and rhs.is_new_expr: # For 'new' allocations, use placement new into static storage # to avoid heap fragmentation on embedded devices. the_type = id_.type @@ -825,12 +825,12 @@ class MockObj(Expression): Mostly consists of magic methods that allow ESPHome's codegen syntax. """ - __slots__ = ("base", "op", "_is_new_expr") + __slots__ = ("base", "op", "is_new_expr") - def __init__(self, base, op=".", is_new_expr=False): + def __init__(self, base, op=".", is_new_expr=False) -> None: self.base = base self.op = op - self._is_new_expr = is_new_expr + self.is_new_expr = is_new_expr def __getattr__(self, attr: str) -> "MockObj": # prevent python dunder methods being replaced by mock objects @@ -845,7 +845,7 @@ class MockObj(Expression): def __call__(self, *args: SafeExpType) -> "MockObj": call = CallExpression(self.base, *args) - return MockObj(call, self.op, is_new_expr=self._is_new_expr) + return MockObj(call, self.op, is_new_expr=self.is_new_expr) def __str__(self): return str(self.base)