mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 14:37:04 +00:00
[multiple] Fix misc low-priority bugs (batch 3) (#15506)
This commit is contained in:
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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(
|
||||
{
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user