Skip to content

Commit 6603e8f

Browse files
committed
updates: drop lchop and rchop
Addon will require Python >=3.9 Signed-off-by: Ian Leonard <[email protected]>
1 parent 379217d commit 6603e8f

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

resources/lib/modules/updates.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,6 @@ def do_init(self):
184184
def exit(self):
185185
pass
186186

187-
@log.log_function()
188-
def lchop(self, s, prefix):
189-
"""Remove prefix from string."""
190-
# TODO usage may be replaced by .removeprefix() in python >=3.9
191-
if prefix and s.startswith(prefix):
192-
return s[len(prefix):]
193-
return s
194-
195-
@log.log_function()
196-
def rchop(self, s, suffix):
197-
"""Remove suffix from string."""
198-
# TODO usage may be replaced by .removesuffix() in python >=3.9
199-
if suffix and s.endswith(suffix):
200-
return s[:-len(suffix)]
201-
return s
202187

203188
# Identify connected GPU card (card0, card1 etc.)
204189
@log.log_function()
@@ -475,9 +460,9 @@ def get_available_builds(self, shortname=None):
475460

476461
def pretty_filename(s):
477462
"""Make filenames prettier to users."""
478-
s = self.lchop(s, f'{oe.DISTRIBUTION}-{oe.ARCHITECTURE}-')
479-
s = self.rchop(s, '.tar')
480-
s = self.rchop(s, '.img.gz')
463+
s = s.removeprefix(f'{oe.DISTRIBUTION}-{oe.ARCHITECTURE}-')
464+
s = s.removesuffix('.tar')
465+
s = s.removesuffix('.img.gz')
481466
return s
482467

483468
channel = self.struct['update']['settings']['Channel']['value']

0 commit comments

Comments
 (0)