mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 11:26:39 +00:00
[core] Store the validated-config cache as JSON to drop YAML off the upload fast path (#18106)
This commit is contained in:
@@ -321,14 +321,18 @@ LAMBDA_PROG = re.compile(r"\bid\(\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\)(\.?)")
|
||||
|
||||
class Lambda:
|
||||
def __init__(self, value):
|
||||
from esphome.cpp_generator import Expression, statement
|
||||
|
||||
# pylint: disable=protected-access
|
||||
if isinstance(value, Lambda):
|
||||
self._value = value._value
|
||||
elif isinstance(value, Expression):
|
||||
self._value = str(statement(value))
|
||||
elif isinstance(value, str):
|
||||
# The validated-config cache revives Lambdas from strings on the
|
||||
# upload/logs fast path; keep codegen off that path.
|
||||
self._value = value
|
||||
else:
|
||||
from esphome.cpp_generator import Expression, statement
|
||||
|
||||
if isinstance(value, Expression):
|
||||
value = str(statement(value))
|
||||
self._value = value
|
||||
self._parts = None
|
||||
self._requires_ids = None
|
||||
|
||||
Reference in New Issue
Block a user