From 2feb3295e1d33c07d37446bb375e15b6b8ce1f6c Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 14 May 2023 23:03:46 +0200 Subject: [PATCH] Fix some dw bugs --- pyhon/appliance.py | 2 +- pyhon/commands.py | 3 ++- pyhon/parameter/range.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyhon/appliance.py b/pyhon/appliance.py index 5201330..74f0b7c 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -169,7 +169,7 @@ class HonAppliance: category = category.split(".")[-1].lower() categories[category] = result[0] if categories: - return [list(categories.values())[0]] + return [list(categories.values())[-1]] return [] def _get_commands(self, data): diff --git a/pyhon/commands.py b/pyhon/commands.py index 532f2cd..ff6d094 100644 --- a/pyhon/commands.py +++ b/pyhon/commands.py @@ -1,5 +1,6 @@ from typing import Optional, Dict, Any, List, TYPE_CHECKING, Union +from pyhon import exceptions from pyhon.parameter.base import HonParameter from pyhon.parameter.enum import HonParameterEnum from pyhon.parameter.fixed import HonParameterFixed @@ -7,7 +8,7 @@ from pyhon.parameter.program import HonParameterProgram from pyhon.parameter.range import HonParameterRange if TYPE_CHECKING: - from pyhon import HonAPI, exceptions + from pyhon import HonAPI from pyhon.appliance import HonAppliance diff --git a/pyhon/parameter/range.py b/pyhon/parameter/range.py index 9c0eea2..00c1fb3 100644 --- a/pyhon/parameter/range.py +++ b/pyhon/parameter/range.py @@ -43,7 +43,7 @@ class HonParameterRange(HonParameter): @value.setter def value(self, value: float) -> None: value = str_to_float(value) - if self._min <= value <= self._max and not value % self._step: + if self._min <= value <= self._max and not (value - self._min) % self._step: self._value = value else: raise ValueError(