Simplify chained comparisions

This commit is contained in:
Luflosi
2019-06-05 15:24:36 +02:00
parent 303711ab8d
commit 4eed8463b3
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ def set_font_family(opts=None, override_font_size=None, debug_font_matching=Fals
def add_line(buf, cell_width, position, thickness, cell_height):
y = position - thickness // 2
while thickness > 0 and y > -1 and y < cell_height:
while thickness > 0 and -1 < y < cell_height:
thickness -= 1
ctypes.memset(ctypes.addressof(buf) + (cell_width * y), 255, cell_width)
y += 1
+1 -1
View File
@@ -54,7 +54,7 @@ def layout_dimension(start_at, length, cell_length, decoration_pairs, left_align
inner_length = cells_in_window * cell_length
return inner_length + decoration_pairs[i][1]
if bias is not None and number_of_windows > 1 and len(bias) == number_of_windows and cells_per_window > 5:
if bias is not None and 1 < number_of_windows == len(bias) and cells_per_window > 5:
cells_map = [int(b * number_of_cells) for b in bias]
while min(cells_map) < 5:
maxi, mini = map(cells_map.index, (max(cells_map), min(cells_map)))
+1 -1
View File
@@ -480,7 +480,7 @@ class TabManager: # {{{
self.set_active_tab_idx((self.active_tab_idx + len(self.tabs) + delta) % len(self.tabs))
def goto_tab(self, tab_num):
if tab_num < len(self.tabs) and 0 <= tab_num:
if 0 <= tab_num < len(self.tabs):
self.set_active_tab_idx(tab_num)
elif tab_num < 0:
try: