diff --git a/terminatorlib/container.py b/terminatorlib/container.py
index 2afbe913..e715cd1f 100644
--- a/terminatorlib/container.py
+++ b/terminatorlib/container.py
@@ -301,7 +301,7 @@ the tab will also close all terminals within it.')
layout['last_active_window'] = False
name = 'child%d' % count
- count = count + 1
+ count += 1
global_layout[name] = layout
@@ -309,7 +309,7 @@ the tab will also close all terminals within it.')
for child in self.get_children():
if hasattr(child, 'describe_layout'):
count = child.describe_layout(count, name, global_layout, child_order)
- child_order = child_order + 1
+ child_order += 1
return(count)
diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py
index 41e8187f..019d976b 100644
--- a/terminatorlib/notebook.py
+++ b/terminatorlib/notebook.py
@@ -133,7 +133,7 @@ class Notebook(Container, Gtk.Notebook):
elif child['type'] == 'HPaned':
page = self.get_nth_page(num)
self.split_axis(page, False)
- num = num + 1
+ num += 1
num = 0
for child_key in keys:
@@ -151,7 +151,7 @@ class Notebook(Container, Gtk.Notebook):
if layout.get('last_active_term', None):
self.last_active_term[page] = make_uuid(layout['last_active_term'][num])
- num = num + 1
+ num += 1
if 'active_page' in layout:
# Need to do it later, or layout changes result
@@ -442,7 +442,7 @@ class Notebook(Container, Gtk.Notebook):
"""Clean up any empty tabs and if we only have one tab left, die"""
numpages = self.get_n_pages()
while numpages > 0:
- numpages = numpages - 1
+ numpages -= 1
page = self.get_nth_page(numpages)
if not page:
dbg('Removing empty page: %d' % numpages)
diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py
index 0eea6d61..b1791347 100644
--- a/terminatorlib/paned.py
+++ b/terminatorlib/paned.py
@@ -211,12 +211,12 @@ class Paned(Container):
childset = [child, [], 0, curr]
curr[1].append(childset)
toproc.append(childset)
- number_splits = number_splits+1
+ number_splits += 1
else:
curr[1].append([None,[], 1, None])
p = curr
while p:
- p[2] = p[2] + 1
+ p[2] += 1
p = p[3]
# (1c) If Shift modifier, redistribute lower sections too
if recurse_down and \
@@ -231,7 +231,7 @@ class Paned(Container):
single_size = (avail_pixels - (number_splits * handle_size)) / (number_splits + 1)
arr_sizes = [single_size]*(number_splits+1)
for i in range(avail_pixels % (number_splits + 1)):
- arr_sizes[i] = arr_sizes[i] + 1
+ arr_sizes[i] += 1
#5 Descend down setting the handle position to s
# (Has to handle nesting properly)
toproc = [tree]
@@ -410,7 +410,7 @@ class Paned(Container):
self.split_axis(terminal, False)
else:
err('unknown child type: %s' % child['type'])
- num = num + 1
+ num += 1
self.get_child1().create_layout(children[keys[0]])
self.get_child2().create_layout(children[keys[1]])
diff --git a/terminatorlib/plugins/custom_commands.py b/terminatorlib/plugins/custom_commands.py
index e624358e..d7b2eb5a 100644
--- a/terminatorlib/plugins/custom_commands.py
+++ b/terminatorlib/plugins/custom_commands.py
@@ -118,13 +118,13 @@ class CustomCommandsMenu(plugin.MenuItem):
item['position'] = i
config.plugin_set(self.__class__.__name__, name, item)
- i = i + 1
+ i += 1
config.save()
def _execute(self, widget, data):
command = data['command']
if command[-1] != '\n':
- command = command + '\n'
+ command += '\n'
for terminal in data['terminals']:
terminal.vte.feed_child(command.encode())
@@ -253,7 +253,7 @@ class CustomCommandsMenu(plugin.MenuItem):
'name': name,
'command' : command}
iter = store.iter_next(iter)
- i = i + 1
+ i += 1
def on_toggled(self, widget, path, data):
diff --git a/terminatorlib/plugins/run_cmd_on_match.py b/terminatorlib/plugins/run_cmd_on_match.py
index e9010203..2d0ca1eb 100644
--- a/terminatorlib/plugins/run_cmd_on_match.py
+++ b/terminatorlib/plugins/run_cmd_on_match.py
@@ -154,7 +154,7 @@ class RunCmdOnMatchMenu(plugin.MenuItem):
item['position'] = i
config.plugin_set(self.__class__.__name__, regexp, item)
- i = i + 1
+ i += 1
config.save()
self._load_configured_handlers()
@@ -186,7 +186,7 @@ class RunCmdOnMatchMenu(plugin.MenuItem):
def _execute(self, widget, data):
command = data['command']
if command[-1] != '\n':
- command = command + '\n'
+ command += '\n'
for terminal in data['terminals']:
terminal.vte.feed_child(command.encode())
@@ -315,7 +315,7 @@ class RunCmdOnMatchMenu(plugin.MenuItem):
'regexp': regexp,
'command' : command}
iter = store.iter_next(iter)
- i = i + 1
+ i += 1
def on_toggled(self, widget, path, data):
diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py
index 90e2b04c..ade79b37 100755
--- a/terminatorlib/prefseditor.py
+++ b/terminatorlib/prefseditor.py
@@ -1331,7 +1331,7 @@ class PrefsEditor:
if newprofile in values:
i = 1
while newprofile in values:
- i = i + 1
+ i += 1
newprofile = '%s %d' % (name, i)
if self.config.add_profile(newprofile, toclone):
@@ -1392,7 +1392,7 @@ class PrefsEditor:
if name in values:
i = 0
while name in values:
- i = i + 1
+ i += 1
name = '%s %d' % (_('New Layout'), i)
if self.config.add_layout(name, current_layout):
@@ -1874,7 +1874,7 @@ class LayoutEditor:
self.profile_ids_to_profile[i] = profile
self.profile_profile_to_ids[profile] = i
chooser.append_text(profile)
- i = i + 1
+ i += 1
def on_layout_selection_changed(self, selection):
"""A different layout was selected"""
diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py
index 016ff214..d323654e 100644
--- a/terminatorlib/terminal.py
+++ b/terminatorlib/terminal.py
@@ -1725,7 +1725,7 @@ class Terminal(Gtk.VBox):
layout['title'] = title
layout['uuid'] = self.uuid
name = 'terminal%d' % count
- count = count + 1
+ count += 1
global_layout[name] = layout
return count
diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py
index 729c7513..b0c61ef2 100644
--- a/terminatorlib/terminator.py
+++ b/terminatorlib/terminator.py
@@ -238,7 +238,7 @@ class Terminator(Borg):
# Loop over the layout until we have consumed it, or hit 1000 loops.
# This is a stupid artificial limit, but it's safe.
while len(layout) > 0 and count < 1000:
- count = count + 1
+ count += 1
if count == 1000:
err('hit maximum loop boundary. THIS IS VERY LIKELY A BUG')
for obj in list(layout.keys()):
diff --git a/terminatorlib/window.py b/terminatorlib/window.py
index d2d581b2..9029d68d 100644
--- a/terminatorlib/window.py
+++ b/terminatorlib/window.py
@@ -647,10 +647,10 @@ class Window(Container, Gtk.Window):
rect = terminal.get_allocation()
if rect.x == 0:
cols, rows = terminal.get_size()
- row_sum = row_sum + rows
+ row_sum += rows
if rect.y == 0:
cols, rows = terminal.get_size()
- column_sum = column_sum + cols
+ column_sum += cols
if column_sum == 0 or row_sum == 0:
dbg('column_sum=%s,row_sum=%s. No terminals found in >=1 axis' %
@@ -812,12 +812,12 @@ class Window(Container, Gtk.Window):
if page == 0:
page = numpages
else:
- page = page - 1
+ page -= 1
elif direction == 'right':
if page == numpages - 1:
page = 0
else:
- page = page + 1
+ page += 1
else:
err('unknown direction: %s' % direction)
return
@@ -920,7 +920,7 @@ class Window(Container, Gtk.Window):
i = 2
while i < len(child['children']):
self.tab_new()
- i = i + 1
+ i += 1
elif child['type'] == 'Terminal':
pass
else:
diff --git a/tests/test_signalman.py b/tests/test_signalman.py
index 0044e11d..f8b5fb23 100755
--- a/tests/test_signalman.py
+++ b/tests/test_signalman.py
@@ -45,7 +45,7 @@ class TestWidget():
self.count = 0
def connect(self, signal, handler, *args):
- self.count = self.count + 1
+ self.count += 1
self.signals[self.count] = signal
return(self.count)
👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of augmented assignment statements accordingly.