MCPcopy
hub / github.com/pallets/click / update

Method update

src/click/_termui_impl.py:324–348  ·  src/click/_termui_impl.py::ProgressBar.update

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)

Source from the content-addressed store, hash-verified

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

Callers 15

generatorMethod · 0.95
edit_filesMethod · 0.80
make_envMethod · 0.80
invokeMethod · 0.80
parse_argsMethod · 0.80
to_info_dictMethod · 0.80
list_commandsMethod · 0.80
process_valueMethod · 0.80
to_info_dictMethod · 0.80
add_optionMethod · 0.80
cliFunction · 0.80

Calls 2

make_stepMethod · 0.95
render_progressMethod · 0.95

Tested by 4

make_envMethod · 0.64
cliFunction · 0.64