def logger_log_action_to_code(config, action_id, arg_type, template_arg): esp_log = LOG_LEVEL_TO_ESP_LOG[config[CONF_LEVEL]] args = [RawExpression(text_type(x)) for x in config[CONF_ARGS]] text = text_type(statement(esp_log(config[CONF_TAG], config[CONF_FORMAT], *args))) for lambda_ in process_lambda(Lambda(text), [(arg_type, 'x')], return_type=void): yield None rhs = LambdaAction.new(template_arg, lambda_) type = LambdaAction.template(template_arg) yield Pvariable(action_id, rhs, type=type)
def lambda_(value): if isinstance(value, Lambda): return value return Lambda(string_strict(value))
def _lambda(loader, node): return Lambda(unicode(node.value))
def _lambda(loader, node): return Lambda(text_type(node.value))