From 5fc6245806d3c65e5ef298542ed412cb0cab2b9b Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sat, 22 Apr 2023 23:08:44 +0200 Subject: [PATCH] Get values for every parameter --- pyhon/parameter/fixed.py | 6 +++++- pyhon/parameter/range.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyhon/parameter/fixed.py b/pyhon/parameter/fixed.py index 52595ed..6c045ef 100644 --- a/pyhon/parameter/fixed.py +++ b/pyhon/parameter/fixed.py @@ -1,4 +1,4 @@ -from typing import Dict, Any +from typing import Dict, Any, List from pyhon.parameter.base import HonParameter @@ -19,3 +19,7 @@ class HonParameterFixed(HonParameter): def value(self, value: str | float) -> None: # Fixed values seems being not so fixed as thought self._value = value + + @property + def values(self) -> List[str]: + return list(str(self.value)) diff --git a/pyhon/parameter/range.py b/pyhon/parameter/range.py index d0d26d9..e58accb 100644 --- a/pyhon/parameter/range.py +++ b/pyhon/parameter/range.py @@ -1,4 +1,4 @@ -from typing import Dict, Any +from typing import Dict, Any, List from pyhon.parameter.base import HonParameter @@ -47,3 +47,7 @@ class HonParameterRange(HonParameter): raise ValueError( f"Allowed: min {self._min} max {self._max} step {self._step}" ) + + @property + def values(self) -> List[str]: + return [str(i) for i in range(int(self.min), int(self.max) + 1, int(self.step))]