Cleanup: run black on tree
[lttng-tools.git] / extras / bindings / swig / python / tests / example.py
index 45587b56bcc6d580dc351b3c7a71c5d42e27ad07..56835625b2fc24348817e766bfbb35659cabf7f0 100644 (file)
@@ -7,18 +7,21 @@
 
 from lttng import *
 
+
 # This error will be raised is something goes wrong
 class LTTngError(Exception):
-       def __init__(self, value):
-               self.value = value
-       def __str__(self):
-               return repr(self.value)
+    def __init__(self, value):
+        self.value = value
+
+    def __str__(self):
+        return repr(self.value)
+
 
-#Setting up the domain to use
+# Setting up the domain to use
 dom = Domain()
 dom.type = DOMAIN_KERNEL
 
-#Setting up a channel to use
+# Setting up a channel to use
 channel = Channel()
 channel.name = "mychan"
 channel.attr.overwrite = 0
@@ -28,7 +31,7 @@ channel.attr.switch_timer_interval = 0
 channel.attr.read_timer_interval = 200
 channel.attr.output = EVENT_SPLICE
 
-#Setting up some events that will be used
+# Setting up some events that will be used
 event = Event()
 event.type = EVENT_TRACEPOINT
 event.loglevel_type = EVENT_LOGLEVEL_ALL
@@ -49,66 +52,66 @@ sched_process_free.type = EVENT_TRACEPOINT
 sched_process_free.loglevel_type = EVENT_LOGLEVEL_ALL
 
 
-#Creating a new session
-res = create("test","/lttng-traces/test")
-if res<0:
-       raise LTTngError(strerror(res))
+# Creating a new session
+res = create("test", "/lttng-traces/test")
+if res < 0:
+    raise LTTngError(strerror(res))
 
-#Creating handle
+# Creating handle
 han = None
 han = Handle("test", dom)
 if han is None:
-       raise LTTngError("Handle not created")
+    raise LTTngError("Handle not created")
 
-#Enabling the kernel channel
+# Enabling the kernel channel
 res = enable_channel(han, channel)
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
-#Enabling some events in given channel
-#To enable all events in default channel, use
-#enable_event(han, event, None)
+# Enabling some events in given channel
+# To enable all events in default channel, use
+# enable_event(han, event, None)
 res = enable_event(han, sched_switch, channel.name)
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
 res = enable_event(han, sched_process_exit, channel.name)
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
 res = enable_event(han, sched_process_free, channel.name)
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
-#Disabling an event
+# Disabling an event
 res = disable_event(han, sched_switch.name, channel.name)
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
-#Getting a list of the channels
+# Getting a list of the channels
 l = list_channels(han)
 if type(l) is int:
-               raise LTTngError(strerror(l))
+    raise LTTngError(strerror(l))
 
-#Starting the trace
+# Starting the trace
 res = start("test")
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
-#Stopping the trace
+# Stopping the trace
 res = stop("test")
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
-#Disabling a channel
+# Disabling a channel
 res = disable_channel(han, channel.name)
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
 
-#Destroying the handle
+# Destroying the handle
 del han
 
-#Destroying the session
+# Destroying the session
 res = destroy("test")
-if res<0:
-       raise LTTngError(strerror(res))
+if res < 0:
+    raise LTTngError(strerror(res))
This page took 0.026474 seconds and 4 git commands to generate.