Skip to content

Commit

Permalink
Use is/is not for None comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rn3j committed Mar 3, 2025
1 parent 37f2f80 commit 4a13e45
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/tauon/t_modules/t_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4856,7 +4856,7 @@ def render(self) -> None:
ddt.text((x_run + x, y_run + ytoff), label, fx[0], self.font, max_w=self.w - (x + 9 * gui.scale), bg=bg)

# Render the items hint
if self.items[i].hint != None:
if self.items[i].hint is not None:

if is_light(bg) or colours.lm:
hint_colour = rgb_add_hls(bg, 0, -0.30, -0.3)
Expand Down Expand Up @@ -4991,7 +4991,7 @@ def activate(self, in_reference: int = 0, position: list[int] | None = None) ->

Menu.active = True

if position != None:
if position is not None:
self.pos = [position[0], position[1]]
else:
self.pos = [copy.deepcopy(inp.mouse_position[0]), copy.deepcopy(inp.mouse_position[1])]
Expand Down Expand Up @@ -6242,7 +6242,7 @@ def fix_encoding(self, index: int, mode: int, enc :str) -> None:
for q in range(len(todo)):
# key = self.pctl.master_library[todo[q]].title + self.pctl.master_library[todo[q]].filename
old_star = self.star_store.full_get(todo[q])
if old_star != None:
if old_star is not None:
self.star_store.remove(todo[q])

if enc_field == "All" or enc_field == "Artist":
Expand All @@ -6263,7 +6263,7 @@ def fix_encoding(self, index: int, mode: int, enc :str) -> None:
line = line.decode(enc, "ignore")
self.pctl.master_library[todo[q]].title = line

if old_star != None:
if old_star is not None:
self.star_store.insert(todo[q], old_star)

# if key in self.pctl.star_library:
Expand Down Expand Up @@ -10348,7 +10348,7 @@ def intel_moji(self, index: int):
track.comment = recode(track.comment, detect)
track.lyrics = recode(track.lyrics, detect)

if key != None:
if key is not None:
self.star_store.insert(item, key)

self.search_string_cache.pop(track.index, None)
Expand Down Expand Up @@ -13786,7 +13786,7 @@ def pl_gen(self,

Creates a default playlist when called without parameters
"""
if playlist_ids == None:
if playlist_ids is None:
playlist_ids = []
if notify:
self.pctl.notify_change()
Expand Down Expand Up @@ -14339,7 +14339,7 @@ def pl_toggle_playlist_break(self, ref) -> None:
self.gui.pl_update = 1

def transcode_single(self, item: list[tuple[int, str]], manual_directory: Path | None = None, manual_name: str | None = None):
if manual_directory != None:
if manual_directory is not None:
codec = "opus"
output = manual_directory
track = item
Expand Down Expand Up @@ -19447,7 +19447,7 @@ def d():
self.text):
while g() == " ":
d()
while g() != " " and g() != None:
while g() != " " and g() is not None:
d()

# Ctrl + left to move cursor back a word
Expand All @@ -19456,7 +19456,7 @@ def d():
self.cursor_position += 1
if not self.inp.key_shift_down:
self.selection = self.cursor_position
while g() != None and g() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
while g() is not None and g() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
self.cursor_position += 1
if not self.inp.key_shift_down:
self.selection = self.cursor_position
Expand All @@ -19472,7 +19472,7 @@ def d():
self.cursor_position -= 1
if not self.inp.key_shift_down:
self.selection = self.cursor_position
while g2() != None and g2() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
while g2() is not None and g2() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
self.cursor_position -= 1
if not self.inp.key_shift_down:
self.selection = self.cursor_position
Expand Down Expand Up @@ -19873,7 +19873,7 @@ def d():
self.text):
while g() == " ":
d()
while g() != " " and g() != None:
while g() != " " and g() is not None:
d()

# Ctrl + left to move cursor back a word
Expand All @@ -19882,7 +19882,7 @@ def d():
self.cursor_position += 1
if not inp.key_shift_down:
self.selection = self.cursor_position
while g() != None and g() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
while g() is not None and g() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
self.cursor_position += 1
if not inp.key_shift_down:
self.selection = self.cursor_position
Expand All @@ -19898,7 +19898,7 @@ def d():
self.cursor_position -= 1
if not inp.key_shift_down:
self.selection = self.cursor_position
while g2() != None and g2() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
while g2() is not None and g2() not in " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~":
self.cursor_position -= 1
if not inp.key_shift_down:
self.selection = self.cursor_position
Expand Down Expand Up @@ -20290,7 +20290,7 @@ def fast_display(self, index, location, box, source: list[tuple[int, str]], offs
max_h = unit.actual_size[1]
found_unit = unit

if found_unit == None:
if found_unit is None:
return 1

unit = found_unit
Expand Down

0 comments on commit 4a13e45

Please sign in to comment.