Bool (hwx.inspire.Attributes)#
- class Bool(default=False, **kwds)#
Bases:
Attribute
Store True or False
# Name
Type
default
bool
state
NoneType
# Name
Description
castForGet
(self, obj, value)castForSet
(self, obj, value)create
(self, obj)getInCoreValue
(self, obj)setInCoreValue
(self, obj, value)Example
from hwx.inspire import * class Switch(GeneralObject): on = Bool(True) switch = Switch() print(switch.on)
- create(obj)#
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
- castForGet(obj, value)#
Converts and returns the attribute value to its external type.
- Parameters:
obj (GeneralObject) – Object this attribute belongs to.
value (Any) – Value of the attribute to be converted.
- Returns:
Converted value.
- Return type:
value (Any)
- castForSet(obj, value)#
Converts and validates the value of the attribute before setting.
Converts the value it to its internal type (and base units if applicable).
- Parameters:
obj (GeneralObject) – Object this attribute belongs to.
value (Any) – Value of the attribute to set.
- Returns:
Validated and converted value.
- Return type:
value (Any)