Skip to content

Commit

Permalink
fix: Adapt cli tool to internal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Jan 21, 2025
1 parent d62719a commit b87524e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/gallia/cli/netzteil.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ def serialize_target_uri(self, target_uri: TargetURI | None) -> Any:

@model_validator(mode="after")
def check_power_supply_requirements(self) -> Self:
for driver in power_supply_drivers:
if self.power_supply.product_id == driver.PRODUCT_ID:
break
else:
if self.power_supply.product_id not in power_supply_drivers:
raise ValueError(f"powersupply {self.power_supply.product_id} is not supported")

return self
Expand All @@ -61,11 +58,8 @@ def __init__(self, config: CLIConfig):
self.config: CLIConfig = config

async def _client(self) -> BasePowerSupplyDriver:
for driver in power_supply_drivers:
if self.config.power_supply.product_id == driver.PRODUCT_ID:
return await driver.connect(self.config.power_supply, timeout=1.0)

assert False
driver = power_supply_drivers[self.config.power_supply.product_id]
return await driver.connect(self.config.power_supply, timeout=1.0)


class GetCLI(CLI, ABC):
Expand Down

0 comments on commit b87524e

Please sign in to comment.