pyhOn/pyhon/parameter/fixed.py

26 lines
736 B
Python
Raw Normal View History

2023-04-22 21:08:44 +00:00
from typing import Dict, Any, List
2023-04-15 23:43:37 +00:00
from pyhon.parameter.base import HonParameter
class HonParameterFixed(HonParameter):
def __init__(self, key: str, attributes: Dict[str, Any]) -> None:
super().__init__(key, attributes)
self._value = attributes.get("fixedValue", None)
def __repr__(self) -> str:
return f"{self.__class__} (<{self.key}> fixed)"
@property
def value(self) -> str | float:
return self._value if self._value is not None else "0"
@value.setter
2023-04-16 00:44:20 +00:00
def value(self, value: str | float) -> None:
# Fixed values seems being not so fixed as thought
self._value = value
2023-04-22 21:08:44 +00:00
@property
def values(self) -> List[str]:
return list(str(self.value))