@@ -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