def test_display(self): self.assertEqual('[ ] 0%', screen_utils.progress_bar(0, 10, bar_length=10)) self.assertEqual('[# ] 10%', screen_utils.progress_bar(1, 10, bar_length=10)) self.assertEqual('[##### ] 50%', screen_utils.progress_bar(5, 10, bar_length=10)) self.assertEqual('[#########] 100%', screen_utils.progress_bar(10, 10, bar_length=10)) self.assertEqual('[#########] 100%', screen_utils.progress_bar(15, 10, bar_length=10))
def continue_logging(monitor): nonlocal upload_completed if not upload_completed: uploaded_progress = monitor.bytes_read total_size = monitor.len upload_completed = monitor.encoder.finished progress_bar_text = screen_utils.progress_bar(uploaded_progress, total_size) log.progress(progress_bar_text, flush=upload_completed)
def continue_logging(monitor): nonlocal upload_completed if not upload_completed: uploaded_progress = monitor.bytes_read total_size = monitor.len upload_completed = monitor.encoder.finished progress_bar_text = screen_utils.progress_bar( uploaded_progress, total_size) log.progress(progress_bar_text, flush=upload_completed)
def continue_logging(count, block_size, total_size): downloaded_size = count * block_size is_download_complete = downloaded_size >= total_size progress_bar_text = screen_utils.progress_bar(downloaded_size, total_size) log.progress(progress_bar_text, flush=is_download_complete)