def run(self, temp_files): for shard in temp_files: for filename in shard: # Try extra hard to delete the file. for _ in range(10): try: files.delete(filename) break except: pass
def delete_file_or_list(self, filename_or_list): if isinstance(filename_or_list, list): for filename in filename_or_list: self.delete_file_or_list(filename) else: filename = filename_or_list for _ in range(10): try: files.delete(filename) break except: pass