Skip to content

Commit 3813c53

Browse files
committed
docs and typing
1 parent d4a15f0 commit 3813c53

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

rich/progress.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
NamedTuple,
3030
NewType,
3131
Optional,
32-
Sequence,
3332
TextIO,
3433
Tuple,
3534
Type,
@@ -103,7 +102,7 @@ def __exit__(
103102

104103

105104
def track(
106-
sequence: Union[Sequence[ProgressType], Iterable[ProgressType]],
105+
sequence: Iterable[ProgressType],
107106
description: str = "Working...",
108107
total: Optional[float] = None,
109108
completed: int = 0,
@@ -122,8 +121,10 @@ def track(
122121
) -> Iterable[ProgressType]:
123122
"""Track progress by iterating over a sequence.
124123
124+
You can also track progress of an iterable, which might require that you additionally specify ``total``.
125+
125126
Args:
126-
sequence (Iterable[ProgressType]): A sequence (must support "len") you wish to iterate over.
127+
sequence (Iterable[ProgressType]): Values you wish to iterate over and track progress.
127128
description (str, optional): Description of task show next to progress bar. Defaults to "Working".
128129
total: (float, optional): Total number of steps. Default is len(sequence).
129130
completed (int, optional): Number of steps completed so far. Defaults to 0.
@@ -1189,7 +1190,7 @@ def __exit__(
11891190

11901191
def track(
11911192
self,
1192-
sequence: Union[Iterable[ProgressType], Sequence[ProgressType]],
1193+
sequence: Iterable[ProgressType],
11931194
total: Optional[float] = None,
11941195
completed: int = 0,
11951196
task_id: Optional[TaskID] = None,
@@ -1198,8 +1199,10 @@ def track(
11981199
) -> Iterable[ProgressType]:
11991200
"""Track progress by iterating over a sequence.
12001201
1202+
You can also track progress of an iterable, which might require that you additionally specify ``total``.
1203+
12011204
Args:
1202-
sequence (Sequence[ProgressType]): A sequence of values you want to iterate over and track progress.
1205+
sequence (Iterable[ProgressType]): Values you want to iterate over and track progress.
12031206
total: (float, optional): Total number of steps. Default is len(sequence).
12041207
completed (int, optional): Number of steps completed so far. Defaults to 0.
12051208
task_id: (TaskID): Task to track. Default is new task.

0 commit comments

Comments
 (0)