python: standardize intra-bt2 imports
[babeltrace.git] / src / bindings / python / bt2 / bt2 / clock_class.py
index 27e05f17d5adc02e9f3793a7d4acf87df400b791..576fb7cb6ba581a803b5fb57a612221dfb4764ce 100644 (file)
@@ -2,15 +2,17 @@
 #
 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
 
-from bt2 import native_bt, object, utils
+from bt2 import native_bt
+from bt2 import object as bt2_object
+from bt2 import utils as bt2_utils
 from bt2 import value as bt2_value
 import uuid as uuidp
 
 
 class ClockClassOffset:
     def __init__(self, seconds=0, cycles=0):
-        utils._check_int64(seconds)
-        utils._check_int64(cycles)
+        bt2_utils._check_int64(seconds)
+        bt2_utils._check_int64(cycles)
         self._seconds = seconds
         self._cycles = cycles
 
@@ -30,7 +32,7 @@ class ClockClassOffset:
         return (self.seconds, self.cycles) == (other.seconds, other.cycles)
 
 
-class _ClockClassConst(object._SharedObject):
+class _ClockClassConst(bt2_object._SharedObject):
     @staticmethod
     def _get_ref(ptr):
         native_bt.clock_class_get_ref(ptr)
@@ -88,10 +90,10 @@ class _ClockClassConst(object._SharedObject):
         return uuidp.UUID(bytes=uuid_bytes)
 
     def cycles_to_ns_from_origin(self, cycles):
-        utils._check_uint64(cycles)
+        bt2_utils._check_uint64(cycles)
         status, ns = native_bt.clock_class_cycles_to_ns_from_origin(self._ptr, cycles)
         error_msg = "cannot convert clock value to nanoseconds from origin for given clock class"
-        utils._handle_func_status(status, error_msg)
+        bt2_utils._handle_func_status(status, error_msg)
         return ns
 
 
@@ -105,45 +107,47 @@ class _ClockClass(_ClockClassConst):
 
     def _user_attributes(self, user_attributes):
         value = bt2_value.create_value(user_attributes)
-        utils._check_type(value, bt2_value.MapValue)
+        bt2_utils._check_type(value, bt2_value.MapValue)
         native_bt.clock_class_set_user_attributes(self._ptr, value._ptr)
 
     _user_attributes = property(fset=_user_attributes)
 
     def _name(self, name):
-        utils._check_str(name)
+        bt2_utils._check_str(name)
         status = native_bt.clock_class_set_name(self._ptr, name)
-        utils._handle_func_status(status, "cannot set clock class object's name")
+        bt2_utils._handle_func_status(status, "cannot set clock class object's name")
 
     _name = property(fset=_name)
 
     def _description(self, description):
-        utils._check_str(description)
+        bt2_utils._check_str(description)
         status = native_bt.clock_class_set_description(self._ptr, description)
-        utils._handle_func_status(status, "cannot set clock class object's description")
+        bt2_utils._handle_func_status(
+            status, "cannot set clock class object's description"
+        )
 
     _description = property(fset=_description)
 
     def _frequency(self, frequency):
-        utils._check_uint64(frequency)
+        bt2_utils._check_uint64(frequency)
         native_bt.clock_class_set_frequency(self._ptr, frequency)
 
     _frequency = property(fset=_frequency)
 
     def _precision(self, precision):
-        utils._check_uint64(precision)
+        bt2_utils._check_uint64(precision)
         native_bt.clock_class_set_precision(self._ptr, precision)
 
     _precision = property(fset=_precision)
 
     def _offset(self, offset):
-        utils._check_type(offset, ClockClassOffset)
+        bt2_utils._check_type(offset, ClockClassOffset)
         native_bt.clock_class_set_offset(self._ptr, offset.seconds, offset.cycles)
 
     _offset = property(fset=_offset)
 
     def _origin_is_unix_epoch(self, origin_is_unix_epoch):
-        utils._check_bool(origin_is_unix_epoch)
+        bt2_utils._check_bool(origin_is_unix_epoch)
         native_bt.clock_class_set_origin_is_unix_epoch(
             self._ptr, int(origin_is_unix_epoch)
         )
@@ -151,7 +155,7 @@ class _ClockClass(_ClockClassConst):
     _origin_is_unix_epoch = property(fset=_origin_is_unix_epoch)
 
     def _uuid(self, uuid):
-        utils._check_type(uuid, uuidp.UUID)
+        bt2_utils._check_type(uuid, uuidp.UUID)
         native_bt.clock_class_set_uuid(self._ptr, uuid.bytes)
 
     _uuid = property(fset=_uuid)
This page took 0.024774 seconds and 4 git commands to generate.