projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: strictly type function return status enumerations
[babeltrace.git]
/
src
/
bindings
/
python
/
bt2
/
bt2
/
value.py
diff --git
a/src/bindings/python/bt2/bt2/value.py
b/src/bindings/python/bt2/bt2/value.py
index 6cea6cd59a69f88fdfd043179750d48ab5b64f16..b6a5a4a1efc1c588b491836e162137e61daf4c77 100644
(file)
--- a/
src/bindings/python/bt2/bt2/value.py
+++ b/
src/bindings/python/bt2/bt2/value.py
@@
-29,13
+29,6
@@
import abc
import bt2
import bt2
-def _handle_status(status, obj_name):
- if status >= 0:
- return
- else:
- raise RuntimeError('unexpected error')
-
-
def _create_from_ptr(ptr):
if ptr is None or ptr == native_bt.value_null:
return
def _create_from_ptr(ptr):
if ptr is None or ptr == native_bt.value_null:
return
@@
-88,9
+81,6
@@
class _Value(object._SharedObject, metaclass=abc.ABCMeta):
def __ne__(self, other):
return not (self == other)
def __ne__(self, other):
return not (self == other)
- def _handle_status(self, status):
- _handle_status(status, self._NAME)
-
def _check_create_status(self, ptr):
if ptr is None:
raise bt2.CreationError(
def _check_create_status(self, ptr):
if ptr is None:
raise bt2.CreationError(
@@
-370,7
+360,7
@@
class StringValue(collections.abc.Sequence, _Value):
def _set_value(self, value):
status = native_bt.value_string_set(self._ptr, self._value_to_str(value))
def _set_value(self, value):
status = native_bt.value_string_set(self._ptr, self._value_to_str(value))
-
self._handle
_status(status)
+
utils._handle_func
_status(status)
value = property(fset=_set_value)
value = property(fset=_set_value)
@@
-473,7
+463,7
@@
class ArrayValue(_Container, collections.abc.MutableSequence, _Value):
status = native_bt.value_array_set_element_by_index(
self._ptr, index, ptr)
status = native_bt.value_array_set_element_by_index(
self._ptr, index, ptr)
-
self._handle
_status(status)
+
utils._handle_func
_status(status)
def append(self, value):
value = create_value(value)
def append(self, value):
value = create_value(value)
@@
-484,7
+474,7
@@
class ArrayValue(_Container, collections.abc.MutableSequence, _Value):
ptr = value._ptr
status = native_bt.value_array_append_element(self._ptr, ptr)
ptr = value._ptr
status = native_bt.value_array_append_element(self._ptr, ptr)
-
self._handle
_status(status)
+
utils._handle_func
_status(status)
def __iadd__(self, iterable):
# Python will raise a TypeError if there's anything wrong with
def __iadd__(self, iterable):
# Python will raise a TypeError if there's anything wrong with
@@
-590,7
+580,7
@@
class MapValue(_Container, collections.abc.MutableMapping, _Value):
ptr = value._ptr
status = native_bt.value_map_insert_entry(self._ptr, key, ptr)
ptr = value._ptr
status = native_bt.value_map_insert_entry(self._ptr, key, ptr)
-
self._handle
_status(status)
+
utils._handle_func
_status(status)
def __repr__(self):
items = ['{}: {}'.format(repr(k), repr(v)) for k, v in self.items()]
def __repr__(self):
items = ['{}: {}'.format(repr(k), repr(v)) for k, v in self.items()]
This page took
0.024305 seconds
and
4
git commands to generate.