def render(self, task): speed = task.speed if speed is None: return Text(f"0{self.unit}/s", style="progress.remaining") self.avg_speed = ema(speed, self.avg_speed, self.smoothing) return Text(f"{self.avg_speed:>3.2f}{self.unit}/s", style="progress.remaining")
def render(self, task): remaining = task.time_remaining if remaining is None: return Text("--m:--s<--m:--s", style="progress.remaining") self.avg_elapsed_seconds = ema(task.elapsed, self.avg_elapsed_seconds, self.smoothing) self.avg_remaining_seconds = ema(remaining, self.avg_remaining_seconds, self.smoothing) elapsed_delta = self.format_seconds(self.avg_elapsed_seconds) remaining_delta = self.format_seconds(self.avg_remaining_seconds) return Text(f"{elapsed_delta}<{remaining_delta}", style="progress.remaining")
def render(self, task): """Show data transfer speed.""" speed = task.speed if speed is None: return Text(f"? {self.unit}/s", style="progress.data.speed") if self.unit_scale: unit, suffix = filesize.pick_unit_and_suffix( speed, ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], self.unit_divisor, ) else: unit, suffix = filesize.pick_unit_and_suffix(speed, [""], 1) precision = 0 if unit == 1 else 1 return Text(f"{speed/unit:,.{precision}f} {suffix}{self.unit}/s", style="progress.data.speed")
def render(self, task): items = [] items.append(f"{self.time_elapsed(task)}<{self.time_estimated(task)}") if task.speed is not None: items.append(f"{task.speed:>.2f}it/s") items.append(self.bar_dict(task.fields)) return Text("[%s]" % ", ".join(items))
def render(self, task): """Calculate common unit for completed and total.""" completed = int(task.completed) total = int(task.total) if self.unit_scale: unit, suffix = filesize.pick_unit_and_suffix( total, ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], self.unit_divisor, ) else: unit, suffix = filesize.pick_unit_and_suffix(total, [""], 1) precision = 0 if unit == 1 else 1 return Text( f"{completed/unit:,.{precision}f}/{total/unit:,.{precision}f} {suffix}", style="progress.download")
def render(self, task: Any) -> Text: """Show data transfer speed.""" speed = task.finished_speed or task.speed if speed is None: return Text("?", style="progress.data.speed") return Text(f"{speed:{self.fmt}}", style="progress.data.speed")
def render(self, task): return Text(f"已处理 {int(task.completed)} / 共 {int(task.total)} 个文件", style="progress.download")
def render(self, task: "Task") -> Text: """Show data transfer speed.""" speed = task.speed if speed is None: return Text("?", style="progress.data.speed") return Text(f"{speed:2.2f} it/s", style="progress.data.speed")