From fe9f5df14673e19b55f0f4462ec2c99f6b96451f Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 9 Dec 2014 19:54:50 -0500 Subject: [PATCH] Python: add top-level class writer.IntegerBase MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Documenting, and using in general, top-level classes is easier than nested classes in Python. babeltrace.writer.FieldDeclaration.IntegerBase still exists for backward compatibility. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- bindings/python/writer.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/bindings/python/writer.py b/bindings/python/writer.py index 2751e4e2..e8606554 100644 --- a/bindings/python/writer.py +++ b/bindings/python/writer.py @@ -295,6 +295,27 @@ class Clock: raise ValueError("Invalid time value.") +class IntegerBase: + """ + Display base of an integer. + """ + + #: Unknown + INTEGER_BASE_UNKNOWN = -1 + + #: Binary + INTEGER_BASE_BINARY = 2 + + #: Octal + INTEGER_BASE_OCTAL = 8 + + #: Decimal + INTEGER_BASE_DECIMAL = 10 + + #: Hexadecimal + INTEGER_BASE_HEXADECIMAL = 16 + + class FieldDeclaration: """ Base class of all field declarations. This class is not meant to @@ -302,14 +323,8 @@ class FieldDeclaration: declaration subclasses instead. """ - class IntegerBase: - # These values are based on the bt_ctf_integer_base enum - # declared in event-types.h. - INTEGER_BASE_UNKNOWN = -1 - INTEGER_BASE_BINARY = 2 - INTEGER_BASE_OCTAL = 8 - INTEGER_BASE_DECIMAL = 10 - INTEGER_BASE_HEXADECIMAL = 16 + class IntegerBase(IntegerBase): + pass def __init__(self): if self._ft is None: -- 2.34.1