projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Python: document writer.ArrayField
[babeltrace.git]
/
bindings
/
python
/
writer.py
diff --git
a/bindings/python/writer.py
b/bindings/python/writer.py
index a1f83e9d7f55c7bad4bf01efe2c38ec1a74cd1d5..f50b9d51fc25ec252cf9333fbf7a51f9e76ff9e3 100644
(file)
--- a/
bindings/python/writer.py
+++ b/
bindings/python/writer.py
@@
-1235,10
+1235,17
@@
class IntegerField(Field):
class EnumerationField(Field):
class EnumerationField(Field):
+ """
+ Enumeration field, based on an
+ :class:`EnumerationFieldDeclaration` object.
+ """
+
@property
def container(self):
"""
@property
def container(self):
"""
- Return the enumeration's underlying container field (an integer field).
+ Underlying container (:class:`IntegerField`).
+
+ :exc:`TypeError` is raised on error.
"""
container = IntegerField.__new__(IntegerField)
"""
container = IntegerField.__new__(IntegerField)
@@
-1252,23
+1259,23
@@
class EnumerationField(Field):
@property
def value(self):
"""
@property
def value(self):
"""
- Get the enumeration field's mapping name.
+ Current label of this enumeration field (:class:`str`).
+
+ Set this attribute to an integer (:class:`int`) to change the
+ enumeration field's value.
+
+ :exc:`ValueError` is raised on error.
"""
value = nbt._bt_ctf_field_enumeration_get_mapping_name(self._f)
if value is None:
"""
value = nbt._bt_ctf_field_enumeration_get_mapping_name(self._f)
if value is None:
- raise ValueError("Could not get enumeration
's
mapping name.")
+ raise ValueError("Could not get enumeration mapping name.")
return value
@value.setter
def value(self, value):
return value
@value.setter
def value(self, value):
- """
- Set the enumeration field's value. Must be an integer as mapping names
- may be ambiguous.
- """
-
if not isinstance(value, int):
raise TypeError("EnumerationField value must be an int")
if not isinstance(value, int):
raise TypeError("EnumerationField value must be an int")
@@
-1276,10
+1283,20
@@
class EnumerationField(Field):
class FloatingPointField(Field):
class FloatingPointField(Field):
+ """
+ Floating point number field, based on a
+ :class:`FloatingPointFieldDeclaration` object.
+ """
+
@property
def value(self):
"""
@property
def value(self):
"""
- Get a floating point field's value.
+ Floating point number value (:class:`float`).
+
+ Set this attribute to change the floating point number field's
+ value.
+
+ :exc:`ValueError` or :exc:`TypeError` are raised on error.
"""
ret, value = nbt._bt_ctf_field_floating_point_get_value(self._f)
"""
ret, value = nbt._bt_ctf_field_floating_point_get_value(self._f)
@@
-1291,10
+1308,6
@@
class FloatingPointField(Field):
@value.setter
def value(self, value):
@value.setter
def value(self, value):
- """
- Set a floating point field's value.
- """
-
if not isinstance(value, int) and not isinstance(value, float):
raise TypeError("Value must be either a float or an int")
if not isinstance(value, int) and not isinstance(value, float):
raise TypeError("Value must be either a float or an int")
@@
-1311,9
+1324,16
@@
class FloatFieldingPoint(FloatingPointField):
class StructureField(Field):
class StructureField(Field):
+ """
+ Structure field, based on a
+ :class:`StructureFieldDeclaration` object.
+ """
+
def field(self, field_name):
"""
def field(self, field_name):
"""
- Get the structure's field corresponding to the provided field name.
+ Returns the structure :class:`Field` named *field_name*.
+
+ :exc:`ValueError` is raised on error.
"""
native_instance = nbt._bt_ctf_field_structure_get_field(self._f,
"""
native_instance = nbt._bt_ctf_field_structure_get_field(self._f,
@@
-1326,9
+1346,17
@@
class StructureField(Field):
class VariantField(Field):
class VariantField(Field):
+ """
+ Variant field, based on a
+ :class:`VariantFieldDeclaration` object.
+ """
+
def field(self, tag):
"""
def field(self, tag):
"""
- Return the variant's selected field. The "tag" field is the selector enum field.
+ Returns the :class:`Field` selected by the current label of
+ *tag* (:class:`EnumerationField`).
+
+ :exc:`ValueError` is raised on error.
"""
native_instance = nbt._bt_ctf_field_variant_get_field(self._f, tag._f)
"""
native_instance = nbt._bt_ctf_field_variant_get_field(self._f, tag._f)
@@
-1340,9
+1368,17
@@
class VariantField(Field):
class ArrayField(Field):
class ArrayField(Field):
+ """
+ Static array field, based on an
+ :class:`ArrayFieldDeclaration` object.
+ """
+
def field(self, index):
"""
def field(self, index):
"""
- Return the array's field at position "index".
+ Returns the :class:`Field` at index *index* in this static
+ array.
+
+ :exc:`IndexError` is raised on error.
"""
native_instance = nbt._bt_ctf_field_array_get_field(self._f, index)
"""
native_instance = nbt._bt_ctf_field_array_get_field(self._f, index)
This page took
0.028053 seconds
and
4
git commands to generate.