Skip to content

docs and typing #3775

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

Merged
merged 1 commit into from
Jun 19, 2025
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
13 changes: 8 additions & 5 deletions rich/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
NamedTuple,
NewType,
Optional,
Sequence,
TextIO,
Tuple,
Type,
Expand Down Expand Up @@ -103,7 +102,7 @@ def __exit__(


def track(
sequence: Union[Sequence[ProgressType], Iterable[ProgressType]],
sequence: Iterable[ProgressType],
description: str = "Working...",
total: Optional[float] = None,
completed: int = 0,
Expand All @@ -122,8 +121,10 @@ def track(
) -> Iterable[ProgressType]:
"""Track progress by iterating over a sequence.

You can also track progress of an iterable, which might require that you additionally specify ``total``.

Args:
sequence (Iterable[ProgressType]): A sequence (must support "len") you wish to iterate over.
sequence (Iterable[ProgressType]): Values you wish to iterate over and track progress.
description (str, optional): Description of task show next to progress bar. Defaults to "Working".
total: (float, optional): Total number of steps. Default is len(sequence).
completed (int, optional): Number of steps completed so far. Defaults to 0.
Expand Down Expand Up @@ -1189,7 +1190,7 @@ def __exit__(

def track(
self,
sequence: Union[Iterable[ProgressType], Sequence[ProgressType]],
sequence: Iterable[ProgressType],
total: Optional[float] = None,
completed: int = 0,
task_id: Optional[TaskID] = None,
Expand All @@ -1198,8 +1199,10 @@ def track(
) -> Iterable[ProgressType]:
"""Track progress by iterating over a sequence.

You can also track progress of an iterable, which might require that you additionally specify ``total``.

Args:
sequence (Sequence[ProgressType]): A sequence of values you want to iterate over and track progress.
sequence (Iterable[ProgressType]): Values you want to iterate over and track progress.
total: (float, optional): Total number of steps. Default is len(sequence).
completed (int, optional): Number of steps completed so far. Defaults to 0.
task_id: (TaskID): Task to track. Default is new task.
Expand Down
Loading