| 227 | return bar |
| 228 | |
| 229 | def format_progress_line(self) -> str: |
| 230 | show_percent = self.show_percent |
| 231 | |
| 232 | info_bits = [] |
| 233 | if self.length is not None and show_percent is None: |
| 234 | show_percent = not self.show_pos |
| 235 | |
| 236 | if self.show_pos: |
| 237 | info_bits.append(self.format_pos()) |
| 238 | if show_percent: |
| 239 | info_bits.append(self.format_pct()) |
| 240 | if self.show_eta and self.eta_known and not self.finished: |
| 241 | info_bits.append(self.format_eta()) |
| 242 | if self.item_show_func is not None: |
| 243 | item_info = self.item_show_func(self.current_item) |
| 244 | if item_info is not None: |
| 245 | info_bits.append(item_info) |
| 246 | |
| 247 | return ( |
| 248 | self.bar_template |
| 249 | % { |
| 250 | "label": self.label, |
| 251 | "bar": self.format_bar(), |
| 252 | "info": self.info_sep.join(info_bits), |
| 253 | } |
| 254 | ).rstrip() |
| 255 | |
| 256 | def render_progress(self) -> None: |
| 257 | if self.hidden: |