Skip to content

pbar module

Utilities for progress bars.


with_progress_hidden function

with_progress_hidden(
    *args
)

Decorator to run a function with ProgressHidden.


with_progress_shown function

with_progress_shown(
    *args
)

Decorator to run a function with ProgressShown.


ProgressBar class

ProgressBar(
    iterable=None,
    bar_id=None,
    bar_type=None,
    force_open_bar=None,
    reuse=None,
    disable=None,
    show_progress=None,
    show_progress_desc=None,
    prefix=None,
    postfix=None,
    desc_kwargs=None,
    registry=<vectorbtpro.registries.pbar_registry.PBarRegistry object>,
    silence_warnings=None,
    **kwargs
)

Context manager to manage a progress bar.

Supported types:

  • 'tqdm_auto'
  • 'tqdm_notebook'
  • 'tqdm_gui'
  • 'tqdm'

For defaults, see pbar.

Superclasses

Inherited members


active class property

Whether the bar is active.


after_update method

ProgressBar.after_update()

Do something after an update.


bar class property

Bar.


bar_id class property

Bar id.


bar_type class property

Bar type.


before_update method

ProgressBar.before_update()

Do something before an update.


close method

ProgressBar.close(
    reuse=None,
    close_children=True
)

Close the bar.


close_time class property

Time the bar was closed.


desc_kwargs class property

Keyword arguments passed to ProgressBar.set_description.


disabled class property

Whether the bar is disabled.


displayed class property

Whether the bar is displayed.


enter method

ProgressBar.enter(
    **kwargs
)

Enter the bar.


exit method

ProgressBar.exit(
    **kwargs
)

Exit the bar.


force_open_bar class property

Whether to force-open a bar even if progress is not shown.


format_num class method

ProgressBar.format_num(
    n
)

Format a number.


iter method

ProgressBar.iter()

Get iterator over ProgressBar.iterable.


iterable class property

Iterable.


kwargs class property

Keyword arguments passed to initialize the bar.


open method

ProgressBar.open(
    reuse=None
)

Open the bar.


open_time class property

Time the bar was opened.


pending class property

Whether the bar is pending.


prepare_desc class method

ProgressBar.prepare_desc(
    desc
)

Prepare description.


refresh method

ProgressBar.refresh()

Refresh the bar.


refresh_time class property

Time the bar was refreshed.


registry class property

Registry of type PBarRegistry.

If None, registry is disabled.


remove_bar method

ProgressBar.remove_bar()

Remove the bar.


reset method

ProgressBar.reset()

Reset the bar.


reuse class property

Whether the bar can be reused.


set_bar method

ProgressBar.set_bar(
    bar=None
)

Set the bar.


set_description method

ProgressBar.set_description(
    desc,
    as_postfix=None,
    refresh=None
)

Set description.

Uses the method ProgressBar.set_prefix if as_postfix=True in ProgressBar.desc_kwargs. Otherwise, uses the method ProgressBar.set_postfix.

Uses ProgressBar.desc_kwargs as keyword arguments.


set_description_str method

ProgressBar.set_description_str(
    desc,
    as_postfix=None,
    refresh=None
)

Set description without preparation.

Uses the method ProgressBar.set_prefix_str if as_postfix=True in ProgressBar.desc_kwargs. Otherwise, uses the method ProgressBar.set_postfix_str.

Uses ProgressBar.desc_kwargs as keyword arguments.


set_postfix method

ProgressBar.set_postfix(
    desc,
    refresh=None
)

Set postfix.

Prepares it with ProgressBar.prepare_desc.


set_postfix_str method

ProgressBar.set_postfix_str(
    desc,
    refresh=None
)

Set postfix without preparation.


set_prefix method

ProgressBar.set_prefix(
    desc,
    refresh=None
)

Set prefix.

Prepares it with ProgressBar.prepare_desc.


set_prefix_str method

ProgressBar.set_prefix_str(
    desc,
    refresh=None
)

Set prefix without preparation.


should_display class property

Whether the bar should be displayed.


show_progress class property

Whether to show the bar.


show_progress_desc class property

Whether show the bar description.


silence_warnings class property

Whether to silence warnings.


update method

ProgressBar.update(
    n=1
)

Update with one or more iterations.


update_time class property

Time the bar was updated.


update_to method

ProgressBar.update_to(
    n
)

Update to a specific number.


ProgressHidden class

ProgressHidden(
    disable_registry=True,
    disable_machinery=True
)

Context manager to hide progress.

Superclasses

Inherited members


disable_machinery class property

Whether to disable machinery.


disable_registry class property

Whether to disable registry.


init_settings class property

Initial settings.


ProgressShown class

ProgressShown(
    enable_registry=True,
    enable_machinery=True
)

Context manager to show progress.

Superclasses

Inherited members


enable_machinery class property

Whether to enable machinery.


enable_registry class property

Whether to enable registry.


init_settings class property

Initial settings.