Update the progress bar by advancing a specified number of steps, and optionally set the ``current_item`` for this new position. :param n_steps: Number of steps to advance. :param current_item: Optional item to set as ``current_item`` for the updated posi
(self, n_steps: int, current_item: V | None = None)
| 322 | self.eta_known = self.length is not None |
| 323 | |
| 324 | def update(self, n_steps: int, current_item: V | None = None) -> None: |
| 325 | class="st">"""Update the progress bar by advancing a specified number of |
| 326 | steps, and optionally set the ``current_item`` for this new |
| 327 | position. |
| 328 | |
| 329 | :param n_steps: Number of steps to advance. |
| 330 | :param current_item: Optional item to set as ``current_item`` |
| 331 | for the updated position. |
| 332 | |
| 333 | .. versionchanged:: 8.0 |
| 334 | Added the ``current_item`` optional parameter. |
| 335 | |
| 336 | .. versionchanged:: 8.0 |
| 337 | Only render when the number of steps meets the |
| 338 | ``update_min_steps`` threshold. |
| 339 | class="st">""" |
| 340 | if current_item is not None: |
| 341 | self.current_item = current_item |
| 342 | |
| 343 | self._completed_intervals += n_steps |
| 344 | |
| 345 | if self._completed_intervals >= self.update_min_steps: |
| 346 | self.make_step(self._completed_intervals) |
| 347 | self.render_progress() |
| 348 | self._completed_intervals = 0 |
| 349 | |
| 350 | def finish(self) -> None: |
| 351 | self.eta_known = False |