mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 07:08:20 +00:00
tweak
This commit is contained in:
parent
8b03c6a857
commit
9cf8a4558f
@ -1,5 +1,7 @@
|
|||||||
"""Helpers for config validation using voluptuous."""
|
"""Helpers for config validation using voluptuous."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -2040,7 +2042,7 @@ class Version:
|
|||||||
return f"{self.major}.{self.minor}.{self.patch}"
|
return f"{self.major}.{self.minor}.{self.patch}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parse(cls, value: str) -> "Version":
|
def parse(cls, value: str) -> Version:
|
||||||
match = re.match(r"^(\d+).(\d+).(\d+)-?\w*$", value)
|
match = re.match(r"^(\d+).(\d+).(\d+)-?\w*$", value)
|
||||||
if match is None:
|
if match is None:
|
||||||
raise ValueError(f"Not a valid version number {value}")
|
raise ValueError(f"Not a valid version number {value}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user