Python bt2 fix: erroneous imports following split of clock class and value
[babeltrace.git] / bindings / python / bt2 / bt2 / notification.py
index 2ad8487893dd8a141c3c3610c6cff44bd66f88e7..dab9909e1e0ca1815845260684417b3d626029d8 100644 (file)
@@ -22,6 +22,7 @@
 
 from bt2 import native_bt, object, utils
 import bt2.clock_class_priority_map
+import bt2.clock_value
 import bt2.packet
 import bt2.stream
 import bt2.event
@@ -39,6 +40,19 @@ def _create_from_ptr(ptr):
     return _NOTIF_TYPE_TO_CLS[notif_type]._create_from_ptr(ptr)
 
 
+def _notif_types_from_notif_classes(notification_types):
+    if notification_types is None:
+        notif_types = None
+    else:
+        for notif_cls in notification_types:
+            if notif_cls not in _NOTIF_TYPE_TO_CLS.values():
+                raise ValueError("'{}' is not a notification class".format(notif_cls))
+
+        notif_types = [notif_cls._TYPE for notif_cls in notification_types]
+
+    return notif_types
+
+
 class _Notification(object._Object):
     pass
 
@@ -280,11 +294,11 @@ class InactivityNotification(_CopyableNotification):
         if clock_value_ptr is None:
             return
 
-        clock_value = bt2.clock_class._create_clock_value_from_ptr(clock_value_ptr)
+        clock_value = bt2.clock_value._create_clock_value_from_ptr(clock_value_ptr)
         return clock_value
 
     def add_clock_value(self, clock_value):
-        utils._check_type(clock_value, bt2.clock_class._ClockValue)
+        utils._check_type(clock_value, bt2.clock_value._ClockValue)
         ret = native_bt.notification_inactivity_set_clock_value(self._ptr,
                                                                 clock_value._ptr)
         utils._handle_ret(ret, "cannot set inactivity notification object's clock value")
@@ -403,7 +417,7 @@ class _DiscardedPacketsNotification(_DiscardedElementsNotification):
         if clock_value_ptr is None:
             return
 
-        clock_value = bt2.clock_class._create_clock_value_from_ptr(clock_value_ptr)
+        clock_value = bt2.clock_value._create_clock_value_from_ptr(clock_value_ptr)
         return clock_value
 
     @property
@@ -413,7 +427,7 @@ class _DiscardedPacketsNotification(_DiscardedElementsNotification):
         if clock_value_ptr is None:
             return
 
-        clock_value = bt2.clock_class._create_clock_value_from_ptr(clock_value_ptr)
+        clock_value = bt2.clock_value._create_clock_value_from_ptr(clock_value_ptr)
         return clock_value
 
 
@@ -439,7 +453,7 @@ class _DiscardedEventsNotification(_DiscardedElementsNotification):
         if clock_value_ptr is None:
             return
 
-        clock_value = bt2.clock_class._create_clock_value_from_ptr(clock_value_ptr)
+        clock_value = bt2.clock_value._create_clock_value_from_ptr(clock_value_ptr)
         return clock_value
 
     @property
@@ -449,7 +463,7 @@ class _DiscardedEventsNotification(_DiscardedElementsNotification):
         if clock_value_ptr is None:
             return
 
-        clock_value = bt2.clock_class._create_clock_value_from_ptr(clock_value_ptr)
+        clock_value = bt2.clock_value._create_clock_value_from_ptr(clock_value_ptr)
         return clock_value
 
 
This page took 0.024536 seconds and 4 git commands to generate.