Skip to content

Commit

Permalink
make progrgress_bar param accept a dict (#778)
Browse files Browse the repository at this point in the history
* add progrgress bar param extension

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
wsuzume and pre-commit-ci[bot] committed Feb 8, 2024
1 parent 5addc11 commit fc6d363
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion papermill/engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,16 @@ def __init__(self, nb, output_path=None, log_output=False, progress_bar=True, au
# lazy import due to implicit slow ipython import
from tqdm.auto import tqdm

self.pbar = tqdm(total=len(self.nb.cells), unit="cell", desc="Executing")
if isinstance(progress_bar, bool):
self.pbar = tqdm(total=len(self.nb.cells), unit="cell", desc="Executing")
elif isinstance(progress_bar, dict):
_progress_bar = {"unit": "cell", "desc": "Executing"}
_progress_bar.update(progress_bar)
self.pbar = tqdm(total=len(self.nb.cells), **_progress_bar)
else:
raise TypeError(
f"progress_bar must be instance of bool or dict, but actual type '{type(progress_bar)}'."
)

def now(self):
"""Helper to return current UTC time"""
Expand Down

0 comments on commit fc6d363

Please sign in to comment.