summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2020-07-31 16:54:46 -0400
committerJohn Kacur <jkacur@redhat.com>2020-07-31 22:56:08 -0400
commit377431d2c55a9229e16a22ddac0bb522a2325d70 (patch)
tree54329048bb3f02aa069d7d5a62c05771a8dbd246
parente1cc3e9c11d32e4acd7e5e14a5dbf8b7383fadbd (diff)
downloadtuna-377431d2c55a9229e16a22ddac0bb522a2325d70.tar.gz
tuna: cpuview.py: A few more style improvements
A few more style fixups suggested by pylint-3 Signed-off-by: John Kacur <jkacur@redhat.com>
-rwxr-xr-xtuna/gui/cpuview.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index 58034b8..bcb8467 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
@@ -24,15 +24,14 @@ def set_affinity_warning(tid, affinity):
dialog.destroy()
def drop_handler_move_threads_to_cpu(new_affinity, data):
- pid_list = [ int(pid) for pid in data.split(",") ]
+ pid_list = [int(pid) for pid in data.split(",")]
return tuna.move_threads_to_cpu(new_affinity,
pid_list, set_affinity_warning)
def drop_handler_move_irqs_to_cpu(cpus, data):
- irq_list = [ int(irq) for irq in data.split(",") ]
- new_affinity = [ reduce(lambda a, b: a | b,
- [1 << cpu for cpu in cpus]), ]
+ irq_list = [int(irq) for irq in data.split(",")]
+ new_affinity = [reduce(lambda a, b: a | b, [1 << cpu for cpu in cpus]),]
for irq in irq_list:
tuna.set_irq_affinity(irq, new_affinity)
@@ -44,7 +43,7 @@ def drop_handler_move_irqs_to_cpu(cpus, data):
class cpu_socket_frame(Gtk.Frame):
- ( COL_FILTER, COL_CPU, COL_USAGE ) = list(range(3))
+ (COL_FILTER, COL_CPU, COL_USAGE) = list(range(3))
def __init__(self, socket, cpus, creator):
@@ -67,23 +66,23 @@ class cpu_socket_frame(Gtk.Frame):
renderer = Gtk.CellRendererToggle()
renderer.connect('toggled', self.filter_toggled, self.list_store)
column = Gtk.TreeViewColumn(_('Filter'), renderer,
- active = self.COL_FILTER)
+ active=self.COL_FILTER)
self.treeview.append_column(column)
# CPU# column
column = Gtk.TreeViewColumn(_('CPU'), Gtk.CellRendererText(),
- text = self.COL_CPU)
+ text=self.COL_CPU)
self.treeview.append_column(column)
# CPU usage column
try:
column = Gtk.TreeViewColumn(_('Usage'), Gtk.CellRendererProgress(),
- text = self.COL_USAGE,
- value = self.COL_USAGE)
+ text=self.COL_USAGE,
+ value=self.COL_USAGE)
except:
# CellRendererProgress needs pygtk2 >= 2.6
column = Gtk.TreeViewColumn(_('Usage'), Gtk.CellRendererText(),
- text = self.COL_USAGE)
+ text=self.COL_USAGE)
self.treeview.append_column(column)
self.add(self.treeview)
self.treeview.enable_model_drag_dest(gui.DND_TARGETS,
@@ -94,7 +93,7 @@ class cpu_socket_frame(Gtk.Frame):
self.on_cpu_socket_frame_button_press_event)
self.drop_handlers = {
"pid": (drop_handler_move_threads_to_cpu,
- self.creator.procview),
+ self.creator.procview),
"irq": (drop_handler_move_irqs_to_cpu, self.creator.irqview),}
self.drag_dest_set(Gtk.DestDefaults.ALL, gui.DND_TARGETS,
@@ -105,7 +104,7 @@ class cpu_socket_frame(Gtk.Frame):
def on_frame_drag_data_received_data(self, w, context, x, y,
selection, info, etime):
# Move to all CPUs in this socket
- cpus = [ int(cpu.name[3:]) for cpu in self.cpus ]
+ cpus = [int(cpu.name[3:]) for cpu in self.cpus]
# pid list, a irq list, etc
source, data = selection.data.split(":")
@@ -115,7 +114,7 @@ class cpu_socket_frame(Gtk.Frame):
else:
print("cpu_socket_frame: unhandled drag source '%s'" % source)
- def on_drag_data_received_data(self, treeview, context, x, y,selection,
+ def on_drag_data_received_data(self, treeview, context, x, y, selection,
info, etime):
drop_info = treeview.get_dest_row_at_pos(x, y)
@@ -126,10 +125,10 @@ class cpu_socket_frame(Gtk.Frame):
model = treeview.get_model()
path, position = drop_info
iter = model.get_iter(path)
- cpus = [ model.get_value(iter, self.COL_CPU), ]
+ cpus = [model.get_value(iter, self.COL_CPU),]
else:
# Move to all CPUs in this socket
- cpus = [ int(cpu.name[3:]) for cpu in self.cpus ]
+ cpus = [int(cpu.name[3:]) for cpu in self.cpus]
if source in self.drop_handlers:
if self.drop_handlers[source][0](cpus, data):
@@ -180,13 +179,13 @@ class cpu_socket_frame(Gtk.Frame):
def isolate_cpu_socket(self, a):
# Isolate all CPUs in this socket
- cpus = [ int(cpu.name[3:]) for cpu in self.cpus ]
+ cpus = [int(cpu.name[3:]) for cpu in self.cpus]
self.creator.isolate_cpus(cpus)
def include_cpu_socket(self, a):
# Include all CPUs in this socket
- cpus = [ int(cpu.name[3:]) for cpu in self.cpus ]
+ cpus = [int(cpu.name[3:]) for cpu in self.cpus]
self.creator.include_cpus(cpus)
def on_cpu_socket_frame_button_press_event(self, treeview, event):