python: run isort on everything
[babeltrace.git] / src / bindings / python / bt2 / bt2 / component_descriptor.py
index 3134886b3d6e9a1e44ab0fc49ddc662f23bc699b..35179ab7bcdab5f2724411471d5fa900236d1fff 100644 (file)
@@ -1,57 +1,39 @@
-# 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
+from bt2 import value as bt2_value
 from bt2 import component as bt2_component
-import bt2
+from bt2 import native_bt
 
 
 def _is_source_comp_cls(comp_cls):
-    if isinstance(comp_cls, bt2_component._SourceComponentClass):
+    if isinstance(comp_cls, bt2_component._SourceComponentClassConst):
         return True
 
     try:
         return issubclass(comp_cls, bt2_component._UserSourceComponent)
-    except:
+    except Exception:
         return False
 
 
 def _is_filter_comp_cls(comp_cls):
-    if isinstance(comp_cls, bt2_component._FilterComponentClass):
+    if isinstance(comp_cls, bt2_component._FilterComponentClassConst):
         return True
 
     try:
         return issubclass(comp_cls, bt2_component._UserFilterComponent)
-    except:
+    except Exception:
         return False
 
 
 def _is_sink_comp_cls(comp_cls):
-    if isinstance(comp_cls, bt2_component._SinkComponentClass):
+    if isinstance(comp_cls, bt2_component._SinkComponentClassConst):
         return True
 
     try:
         return issubclass(comp_cls, bt2_component._UserSinkComponent)
-    except:
+    except Exception:
         return False
 
 
@@ -71,10 +53,10 @@ class ComponentDescriptor:
         base_cc_ptr = component_class._bt_component_class_ptr()
 
         if obj is not None and not native_bt.bt2_is_python_component_class(base_cc_ptr):
-            raise ValueError('cannot pass a Python object to a non-Python component')
+            raise ValueError("cannot pass a Python object to a non-Python component")
 
         self._comp_cls = component_class
-        self._params = bt2.create_value(params)
+        self._params = bt2_value.create_value(params)
         self._obj = obj
 
     @property
This page took 0.024044 seconds and 4 git commands to generate.