[multiple] Fix misc low-priority bugs (batch 3) (#15506)

This commit is contained in:
Jonathan Swoboda
2026-04-06 23:03:57 -04:00
committed by GitHub
parent 99ee405f4e
commit 9894bdc0f1
4 changed files with 4 additions and 5 deletions

View File

@@ -119,7 +119,7 @@ DisplayMenuOnPrevTrigger = display_menu_base_ns.class_(
def validate_format(format):
if re.search(r"^%([+-])*(\d+)*(\.\d+)*[fg]$", format) is None:
if re.search(r"^%[+-]*(\d+)?(\.\d+)?[fg]$", format) is None:
raise cv.Invalid(
f"{CONF_FORMAT}: has to specify a printf-like format string specifying exactly one f or g type conversion, '{format}' provided"
)

View File

@@ -24,7 +24,6 @@ CODEOWNERS = ["@vincentscode", "@latonita"]
ens160_ns = cg.esphome_ns.namespace("ens160_base")
CONF_AQI = "aqi"
UNIT_INDEX = "index"
CONFIG_SCHEMA_BASE = cv.Schema(
{

View File

@@ -238,7 +238,7 @@ def validate_font_config(config):
return config
FONT_EXTENSIONS = (".ttf", ".woff", ".otf", "bdf", ".pcf")
FONT_EXTENSIONS = (".ttf", ".woff", ".otf", ".bdf", ".pcf")
def validate_truetype_file(value):

View File

@@ -67,7 +67,7 @@ KNOWN_FIRMWARE = {
def parse_firmware_version(value):
match = re.match(r"(\d+).(\d+)", value)
match = re.fullmatch(r"(\d+)\.(\d+)", value)
if match is None:
raise ValueError(f"Not a valid version number {value}")
major = int(match[1])
@@ -129,7 +129,7 @@ def validate_firmware(value):
def validate_sha256(value):
value = cv.string(value)
if not value.isalnum() or not len(value) == 64:
if not re.fullmatch(r"[0-9a-fA-F]{64}", value):
raise ValueError(f"Not a valid SHA256 hex string: {value}")
return value