Skip to content

Commit f36df1c

Browse files
add comments
1 parent 477b6bf commit f36df1c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

skore/src/skore/_utils/_progress_bar.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ def progress_decorator(
3838
def decorator(func: Callable[..., T]) -> Callable[..., T]:
3939
@wraps(func)
4040
def wrapper(*args: Any, **kwargs: Any) -> T:
41+
# Avoid circular import
4142
from skore import ComparisonReport
4243

44+
# The object to which a `rich.Progress` instance will be attached.
45+
# Expected to be a Report
46+
# (EstimatorReport | CrossValidationReport | ComparisonReport)
4347
self_obj: Any = args[0]
4448

49+
# If the decorated method is in an Accessor (e.g. MetricsAccessor),
50+
# then make sure `self_obj` is the Report, not the Accessor.
4551
if hasattr(self_obj, "_parent"):
4652
# self_obj is an accessor
4753
self_obj = self_obj._parent
@@ -67,7 +73,8 @@ def wrapper(*args: Any, **kwargs: Any) -> T:
6773
progress.start()
6874
created_progress = True
6975

70-
# assigning progress to child reports
76+
# Make child reports share their parent's Progress instance
77+
# so that there is only one Progress instance at any given point
7178
reports_to_cleanup: list[Any] = []
7279
if isinstance(self_obj, ComparisonReport):
7380
for report in self_obj.reports_.values():

0 commit comments

Comments
 (0)