1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-13 14:20:29 +01:00

[zeroconf] Ruff formatting (#8338)

This commit is contained in:
Jesse Hills 2025-02-28 09:12:21 +13:00 committed by GitHub
parent 7c3a7b68d3
commit 476f1b701b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -166,7 +166,7 @@ class DashboardImportDiscovery:
class EsphomeZeroconf(Zeroconf): class EsphomeZeroconf(Zeroconf):
def resolve_host(self, host: str, timeout: float = 3.0) -> list[str] | None: def resolve_host(self, host: str, timeout: float = 3.0) -> list[str] | None:
"""Resolve a host name to an IP address.""" """Resolve a host name to an IP address."""
info = AddressResolver(f'{host.partition(".")[0]}.local.') info = AddressResolver(f"{host.partition('.')[0]}.local.")
if ( if (
info.load_from_cache(self) info.load_from_cache(self)
or (timeout and info.request(self, timeout * 1000)) or (timeout and info.request(self, timeout * 1000))
@ -180,7 +180,7 @@ class AsyncEsphomeZeroconf(AsyncZeroconf):
self, host: str, timeout: float = 3.0 self, host: str, timeout: float = 3.0
) -> list[str] | None: ) -> list[str] | None:
"""Resolve a host name to an IP address.""" """Resolve a host name to an IP address."""
info = AddressResolver(f'{host.partition(".")[0]}.local.') info = AddressResolver(f"{host.partition('.')[0]}.local.")
if ( if (
info.load_from_cache(self.zeroconf) info.load_from_cache(self.zeroconf)
or (timeout and await info.async_request(self.zeroconf, timeout * 1000)) or (timeout and await info.async_request(self.zeroconf, timeout * 1000))