Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make progrgress_bar param accept a dict #778

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
# 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)

Check warning on line 117 in papermill/engines.py

View check run for this annotation

Codecov / codecov/patch

papermill/engines.py#L114-L117

Added lines #L114 - L117 were not covered by tests
else:
raise TypeError(

Check warning on line 119 in papermill/engines.py

View check run for this annotation

Codecov / codecov/patch

papermill/engines.py#L119

Added line #L119 was not covered by tests
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