@property
def is_set(self):
- is_set = native_bt.ctf_field_value_is_set(self._ptr)
+ is_set = native_bt.ctf_field_is_set(self._ptr)
return is_set > 0
def reset(self):
- ret = native_bt.ctf_field_reset_value(self._ptr)
+ ret = native_bt.ctf_field_reset(self._ptr)
utils._handle_ret(ret, "cannot reset field object's value")
return _create_from_ptr(ptr)
def __setitem__(self, key, value):
- # we can only set numbers and strings
- if not isinstance(value, (numbers.Number, str)):
- raise TypeError('expecting number object or string')
-
- # raises if index is somehow invalid
+ # raises if key is somehow invalid
field = self[key]
- if not isinstance(field, (_NumericField, _StringField)):
- raise TypeError('can only set the value of a number or string field')
-
# the field's property does the appropriate conversion or raises
# the appropriate exception
field.value = value