Python: add top-level class writer.IntegerBase
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 10 Dec 2014 00:54:50 +0000 (19:54 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Feb 2015 21:04:45 +0000 (16:04 -0500)
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 <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/writer.py

index 2751e4e2a47c95d8e8ccf3aa84c8ba0f6781e5fa..e860655497345d37b95979df52ca6d6704415df6 100644 (file)
@@ -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:
This page took 0.025455 seconds and 4 git commands to generate.