Simplify chained comparisions
This commit is contained in:
parent
303711ab8d
commit
4eed8463b3
@ -213,7 +213,7 @@ def url(text, s, e):
|
||||
@postprocessor
|
||||
def brackets(text, s, e):
|
||||
# Remove matching brackets
|
||||
if e > s and e <= len(text):
|
||||
if s < e <= len(text):
|
||||
before = text[s]
|
||||
if before in '({[<' and text[e-1] == closing_bracket_map[before]:
|
||||
s += 1
|
||||
@ -224,7 +224,7 @@ def brackets(text, s, e):
|
||||
@postprocessor
|
||||
def quotes(text, s, e):
|
||||
# Remove matching quotes
|
||||
if e > s and e <= len(text):
|
||||
if s < e <= len(text):
|
||||
before = text[s]
|
||||
if before in '\'"' and text[e-1] == before:
|
||||
s += 1
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)))
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user