mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 18:48:22 +00:00
Adjust
This commit is contained in:
parent
e50f5f9309
commit
86f1de056e
@ -20,7 +20,4 @@ class DhcpServiceInfo(BaseServiceInfo):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
"""Post-init processing."""
|
"""Post init checks."""
|
||||||
# Ensure macaddress is always a lowercase string without colons
|
|
||||||
if self.macaddress != self.macaddress.lower().replace(":", ""):
|
|
||||||
raise ValueError("macaddress is not correctly formatted")
|
|
||||||
|
@ -156,6 +156,18 @@ asyncio.set_event_loop_policy(runner.HassEventLoopPolicy(False))
|
|||||||
asyncio.set_event_loop_policy = lambda policy: None
|
asyncio.set_event_loop_policy = lambda policy: None
|
||||||
|
|
||||||
|
|
||||||
|
def _dhcp_service_info_post_init(self: DhcpServiceInfo) -> None:
|
||||||
|
"""Post-init processing for DhcpServiceInfo.
|
||||||
|
|
||||||
|
Ensure that the macaddress is always in lowercase and without colons to match DHCP service.
|
||||||
|
"""
|
||||||
|
if self.macaddress != self.macaddress.lower().replace(":", ""):
|
||||||
|
raise ValueError("macaddress is not correctly formatted")
|
||||||
|
|
||||||
|
|
||||||
|
DhcpServiceInfo.__post_init__ = _dhcp_service_info_post_init
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser: pytest.Parser) -> None:
|
def pytest_addoption(parser: pytest.Parser) -> None:
|
||||||
"""Register custom pytest options."""
|
"""Register custom pytest options."""
|
||||||
parser.addoption("--dburl", action="store", default="sqlite://")
|
parser.addoption("--dburl", action="store", default="sqlite://")
|
||||||
@ -2079,15 +2091,3 @@ def disable_block_async_io() -> Generator[None]:
|
|||||||
blocking_call.object, blocking_call.function, blocking_call.original_func
|
blocking_call.object, blocking_call.function, blocking_call.original_func
|
||||||
)
|
)
|
||||||
calls.clear()
|
calls.clear()
|
||||||
|
|
||||||
|
|
||||||
def _dhcp_service_info_post_init(self: DhcpServiceInfo) -> None:
|
|
||||||
"""Post-init processing for DhcpServiceInfo.
|
|
||||||
|
|
||||||
Ensure that the macaddress is always in lowercase and without colons to match DHCP service.
|
|
||||||
"""
|
|
||||||
if self.macaddress != self.macaddress.lower().replace(":", ""):
|
|
||||||
raise ValueError("macaddress is not correctly formatted")
|
|
||||||
|
|
||||||
|
|
||||||
DhcpServiceInfo.__post_init__ = _dhcp_service_info_post_init
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user