mirror of
https://github.com/esphome/esphome.git
synced 2026-09-04 03:56:04 +00:00
[core] Widen validator input annotations to Any
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user