From fbfe2f0eb12e23ebe2edc3dd6816c63e41ceccd4 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 10 Dec 2014 04:31:43 -0500 Subject: [PATCH] Python: document writer.EnumerationField MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- bindings/python/writer.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/bindings/python/writer.py b/bindings/python/writer.py index a1f83e9d..0ac9e482 100644 --- a/bindings/python/writer.py +++ b/bindings/python/writer.py @@ -1235,10 +1235,17 @@ class IntegerField(Field): class EnumerationField(Field): + """ + Enumeration field, based on an + :class:`EnumerationFieldDeclaration` object. + """ + @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) @@ -1252,23 +1259,23 @@ class EnumerationField(Field): @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: - 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): - """ - 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") -- 2.34.1