mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-06 00:36:28 +00:00

* Fix mypy issues in plugins * Fix mypy issues in resolution module * fix misses in resolution check * Fix signatures on evaluate methods * nitpick fix suggestions
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Evaluation class for network manager."""
|
|
|
|
from ...const import CoreState
|
|
from ...coresys import CoreSys
|
|
from ...host.const import HostFeature
|
|
from ..const import UnsupportedReason
|
|
from .base import EvaluateBase
|
|
|
|
|
|
def setup(coresys: CoreSys) -> EvaluateBase:
|
|
"""Initialize evaluation-setup function."""
|
|
return EvaluateNetworkManager(coresys)
|
|
|
|
|
|
class EvaluateNetworkManager(EvaluateBase):
|
|
"""Evaluate network manager."""
|
|
|
|
@property
|
|
def reason(self) -> UnsupportedReason:
|
|
"""Return a UnsupportedReason enum."""
|
|
return UnsupportedReason.NETWORK_MANAGER
|
|
|
|
@property
|
|
def on_failure(self) -> str:
|
|
"""Return a string that is printed when self.evaluate is True."""
|
|
return "NetworkManager is not correctly configured"
|
|
|
|
@property
|
|
def states(self) -> list[CoreState]:
|
|
"""Return a list of valid states when this evaluation can run."""
|
|
return [CoreState.SETUP, CoreState.RUNNING]
|
|
|
|
async def evaluate(self) -> bool:
|
|
"""Run evaluation."""
|
|
return HostFeature.NETWORK not in self.sys_host.features
|