python: run isort on everything
[babeltrace.git] / src / bindings / python / bt2 / bt2 / event_class.py
index e55e3019409330fe40f4b44085e2febcd7a3ac03..54ca10a6a4bc93336f592ecaddcd4746620d2df8 100644 (file)
@@ -1,28 +1,12 @@
-# The MIT License (MIT)
+# SPDX-License-Identifier: MIT
 #
 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-from bt2 import native_bt, object, utils
-from bt2 import field_class as bt2_field_class
+
+from bt2 import utils as bt2_utils
 from bt2 import value as bt2_value
+from bt2 import object as bt2_object
+from bt2 import native_bt
+from bt2 import field_class as bt2_field_class
 
 
 def _bt2_stream_class():
@@ -49,9 +33,15 @@ class EventClassLogLevel:
     DEBUG = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG
 
 
-class _EventClassConst(object._SharedObject):
-    _get_ref = staticmethod(native_bt.event_class_get_ref)
-    _put_ref = staticmethod(native_bt.event_class_put_ref)
+class _EventClassConst(bt2_object._SharedObject):
+    @staticmethod
+    def _get_ref(ptr):
+        native_bt.event_class_get_ref(ptr)
+
+    @staticmethod
+    def _put_ref(ptr):
+        native_bt.event_class_put_ref(ptr)
+
     _borrow_stream_class_ptr = staticmethod(
         native_bt.event_class_borrow_stream_class_const
     )
@@ -163,7 +153,7 @@ class _EventClass(_EventClassConst):
 
     def _emf_uri(self, emf_uri):
         status = native_bt.event_class_set_emf_uri(self._ptr, emf_uri)
-        utils._handle_func_status(status, "cannot set event class object's EMF URI")
+        bt2_utils._handle_func_status(status, "cannot set event class object's EMF URI")
 
     _emf_uri = property(fset=_emf_uri)
 
@@ -171,7 +161,7 @@ class _EventClass(_EventClassConst):
         status = native_bt.event_class_set_specific_context_field_class(
             self._ptr, context_field_class._ptr
         )
-        utils._handle_func_status(
+        bt2_utils._handle_func_status(
             status, "cannot set event class object's context field class"
         )
 
@@ -181,7 +171,7 @@ class _EventClass(_EventClassConst):
         status = native_bt.event_class_set_payload_field_class(
             self._ptr, payload_field_class._ptr
         )
-        utils._handle_func_status(
+        bt2_utils._handle_func_status(
             status, "cannot set event class object's payload field class"
         )
 
@@ -197,11 +187,11 @@ class _EventClass(_EventClassConst):
         payload_field_class,
     ):
         if name is not None:
-            utils._check_str(name)
+            bt2_utils._check_str(name)
 
         if user_attributes is not None:
             value = bt2_value.create_value(user_attributes)
-            utils._check_type(value, bt2_value.MapValue)
+            bt2_utils._check_type(value, bt2_value.MapValue)
 
         if log_level is not None:
             log_levels = (
@@ -226,15 +216,17 @@ class _EventClass(_EventClassConst):
                 raise ValueError("'{}' is not a valid log level".format(log_level))
 
         if emf_uri is not None:
-            utils._check_str(emf_uri)
+            bt2_utils._check_str(emf_uri)
 
         if specific_context_field_class is not None:
-            utils._check_type(
+            bt2_utils._check_type(
                 specific_context_field_class, bt2_field_class._StructureFieldClass
             )
 
         if payload_field_class is not None:
-            utils._check_type(payload_field_class, bt2_field_class._StructureFieldClass)
+            bt2_utils._check_type(
+                payload_field_class, bt2_field_class._StructureFieldClass
+            )
 
 
 _EVENT_CLASS_LOG_LEVEL_TO_OBJ = {
This page took 0.026074 seconds and 4 git commands to generate.