Skip to content

Commit 7f90f61

Browse files
committed
updates: drop lchop and rchop
Addon will require Python >=3.9 Signed-off-by: Ian Leonard <[email protected]>
1 parent 07b014a commit 7f90f61

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()
@@ -479,9 +464,9 @@ def get_available_builds(self, shortname=None):
479464

480465
def pretty_filename(s):
481466
"""Make filenames prettier to users."""
482-
s = self.lchop(s, f'{oe.DISTRIBUTION}-{oe.ARCHITECTURE}-')
483-
s = self.rchop(s, '.tar')
484-
s = self.rchop(s, '.img.gz')
467+
s = s.removeprefix(f'{oe.DISTRIBUTION}-{oe.ARCHITECTURE}-')
468+
s = s.removesuffix('.tar')
469+
s = s.removesuffix('.img.gz')
485470
return s
486471

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

0 commit comments

Comments
 (0)