[core] Widen validator input annotations to Any

This commit is contained in:
Jesse Hills
2026-08-13 17:03:30 +12:00
parent 66424aab68
commit 0b66c24e08
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -1,3 +1,5 @@
from typing import Any
from esphome import automation
import esphome.codegen as cg
from esphome.components.esp32 import (
@@ -78,7 +80,7 @@ CONF_DEVICE_TYPES = [
]
def _validate_txpower(value: float) -> int | float:
def _validate_txpower(value: Any) -> int | float:
if CORE.is_esp32:
variant = get_esp32_variant()
@@ -205,7 +207,7 @@ def _validate_platform(config: ConfigType) -> ConfigType:
)(config)
def _validate_tlv_hex(value: str) -> str:
def _validate_tlv_hex(value: Any) -> str:
s = cv.string_strict(value)
if len(s) % 2 != 0:
raise cv.Invalid("TLV must have an even number of hex characters")
+2 -1
View File
@@ -1,6 +1,7 @@
import hashlib
from pathlib import Path
import re
from typing import Any
from esphome import external_files, pins
import esphome.codegen as cg
@@ -167,7 +168,7 @@ def validate_firmware(value: ConfigType) -> ConfigType:
return config
def validate_sha256(value: str) -> str:
def validate_sha256(value: Any) -> str:
value = cv.string(value)
if not re.fullmatch(r"[0-9a-fA-F]{64}", value):
raise ValueError(f"Not a valid SHA256 hex string: {value}")