Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.rich.progress Namespace Reference

Data Structures

class  _ReadContext
 
class  _Reader
 
class  _TrackThread
 
class  BarColumn
 
class  DownloadColumn
 
class  FileSizeColumn
 
class  MofNCompleteColumn
 
class  Progress
 
class  ProgressColumn
 
class  ProgressSample
 
class  RenderableColumn
 
class  SpinnerColumn
 
class  Task
 
class  TaskProgressColumn
 
class  TextColumn
 
class  TimeElapsedColumn
 
class  TimeRemainingColumn
 
class  TotalFileSizeColumn
 
class  TransferSpeedColumn
 

Functions

Iterable[ProgressTypetrack (Union[Sequence[ProgressType], Iterable[ProgressType]] sequence, str description="Working...", Optional[float] total=None, bool auto_refresh=True, Optional[Console] console=None, bool transient=False, Optional[Callable[[], float]] get_time=None, float refresh_per_second=10, StyleType style="bar.back", StyleType complete_style="bar.complete", StyleType finished_style="bar.finished", StyleType pulse_style="bar.pulse", float update_period=0.1, bool disable=False, bool show_speed=True)
 
ContextManager[BinaryIO] wrap_file (BinaryIO file, int total, *str description="Reading...", bool auto_refresh=True, Optional[Console] console=None, bool transient=False, Optional[Callable[[], float]] get_time=None, float refresh_per_second=10, StyleType style="bar.back", StyleType complete_style="bar.complete", StyleType finished_style="bar.finished", StyleType pulse_style="bar.pulse", bool disable=False)
 
ContextManager[TextIO] open (Union[str, "PathLike[str]", bytes] file, Union[Literal["rt"], Literal["r"]] mode, int buffering=-1, Optional[str] encoding=None, Optional[str] errors=None, Optional[str] newline=None, *Optional[int] total=None, str description="Reading...", bool auto_refresh=True, Optional[Console] console=None, bool transient=False, Optional[Callable[[], float]] get_time=None, float refresh_per_second=10, StyleType style="bar.back", StyleType complete_style="bar.complete", StyleType finished_style="bar.finished", StyleType pulse_style="bar.pulse", bool disable=False)
 
ContextManager[BinaryIO] open (Union[str, "PathLike[str]", bytes] file, Literal["rb"] mode, int buffering=-1, Optional[str] encoding=None, Optional[str] errors=None, Optional[str] newline=None, *Optional[int] total=None, str description="Reading...", bool auto_refresh=True, Optional[Console] console=None, bool transient=False, Optional[Callable[[], float]] get_time=None, float refresh_per_second=10, StyleType style="bar.back", StyleType complete_style="bar.complete", StyleType finished_style="bar.finished", StyleType pulse_style="bar.pulse", bool disable=False)
 
Union[ContextManager[BinaryIO], ContextManager[TextIO]] open (Union[str, "PathLike[str]", bytes] file, Union[Literal["rb"], Literal["rt"], Literal["r"]] mode="r", int buffering=-1, Optional[str] encoding=None, Optional[str] errors=None, Optional[str] newline=None, *Optional[int] total=None, str description="Reading...", bool auto_refresh=True, Optional[Console] console=None, bool transient=False, Optional[Callable[[], float]] get_time=None, float refresh_per_second=10, StyleType style="bar.back", StyleType complete_style="bar.complete", StyleType finished_style="bar.finished", StyleType pulse_style="bar.pulse", bool disable=False)
 

Variables

 TaskID = NewType("TaskID", int)
 
 ProgressType = TypeVar("ProgressType")
 
 GetTimeCallable = Callable[[], float]
 
 _I = typing.TypeVar("_I", TextIO, BinaryIO)
 
 syntax
 
 table = Table("foo", "bar", "baz")
 
list progress_renderables
 
 examples = cycle(progress_renderables)
 
 console = Console(record=True)
 
 transient
 
 task1 = progress.add_task("[red]Downloading", total=1000)
 
 task2 = progress.add_task("[green]Processing", total=1000)
 
 task3 = progress.add_task("[yellow]Thinking", total=None)
 
 advance
 

Function Documentation

◆ open() [1/3]

ContextManager[BinaryIO] open ( Union[str, "PathLike[str]", bytes]  file,
Literal["rb"]  mode,
int   buffering = -1,
Optional[str]   encoding = None,
Optional[str]   errors = None,
Optional[str]   newline = None,
*Optional[int]   total = None,
str   description = "Reading...",
bool   auto_refresh = True,
Optional[Console]   console = None,
bool   transient = False,
Optional[Callable[[], float]]   get_time = None,
float   refresh_per_second = 10,
StyleType   style = "bar.back",
StyleType   complete_style = "bar.complete",
StyleType   finished_style = "bar.finished",
StyleType   pulse_style = "bar.pulse",
bool   disable = False 
)

Definition at line 385 of file progress.py.

405) -> ContextManager[BinaryIO]:
406 pass
407
408

◆ open() [2/3]

Union[ContextManager[BinaryIO], ContextManager[TextIO]] open ( Union[str, "PathLike[str]", bytes]  file,
Union[Literal["rb"], Literal["rt"], Literal["r"]]   mode = "r",
int   buffering = -1,
Optional[str]   encoding = None,
Optional[str]   errors = None,
Optional[str]   newline = None,
*Optional[int]   total = None,
str   description = "Reading...",
bool   auto_refresh = True,
Optional[Console]   console = None,
bool   transient = False,
Optional[Callable[[], float]]   get_time = None,
float   refresh_per_second = 10,
StyleType   style = "bar.back",
StyleType   complete_style = "bar.complete",
StyleType   finished_style = "bar.finished",
StyleType   pulse_style = "bar.pulse",
bool   disable = False 
)
Read bytes from a file while tracking progress.

Args:
    path (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
    mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
    buffering (int): The buffering strategy to use, see :func:`io.open`.
    encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
    errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
    newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`
    total: (int, optional): Total number of bytes to read. Must be provided if reading from a file handle. Default for a path is os.stat(file).st_size.
    description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
    auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
    transient: (bool, optional): Clear the progress on exit. Defaults to False.
    console (Console, optional): Console to write to. Default creates internal Console instance.
    refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
    style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
    complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
    finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
    pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
    disable (bool, optional): Disable display of progress.
    encoding (str, optional): The encoding to use when reading in text mode.

Returns:
    ContextManager[BinaryIO]: A context manager yielding a progress reader.

Definition at line 409 of file progress.py.

429) -> Union[ContextManager[BinaryIO], ContextManager[TextIO]]:
430 """Read bytes from a file while tracking progress.
431
432 Args:
433 path (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
434 mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
435 buffering (int): The buffering strategy to use, see :func:`io.open`.
436 encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
437 errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
438 newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`
439 total: (int, optional): Total number of bytes to read. Must be provided if reading from a file handle. Default for a path is os.stat(file).st_size.
440 description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
441 auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
442 transient: (bool, optional): Clear the progress on exit. Defaults to False.
443 console (Console, optional): Console to write to. Default creates internal Console instance.
444 refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
445 style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
446 complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
447 finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
448 pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
449 disable (bool, optional): Disable display of progress.
450 encoding (str, optional): The encoding to use when reading in text mode.
451
452 Returns:
453 ContextManager[BinaryIO]: A context manager yielding a progress reader.
454
455 """
456
457 columns: List["ProgressColumn"] = (
458 [TextColumn("[progress.description]{task.description}")] if description else []
459 )
461 (
462 BarColumn(
463 style=style,
464 complete_style=complete_style,
465 finished_style=finished_style,
466 pulse_style=pulse_style,
467 ),
468 DownloadColumn(),
469 TimeRemainingColumn(),
470 )
471 )
472 progress = Progress(
473 *columns,
474 auto_refresh=auto_refresh,
475 console=console,
476 transient=transient,
477 get_time=get_time,
478 refresh_per_second=refresh_per_second or 10,
479 disable=disable,
480 )
481
482 reader = progress.open(
483 file,
484 mode=mode,
485 buffering=buffering,
486 encoding=encoding,
487 errors=errors,
488 newline=newline,
489 total=total,
490 description=description,
491 )
492 return _ReadContext(progress, reader) # type: ignore[return-value, type-var]
493
494
for i

References i.

◆ open() [3/3]

ContextManager[TextIO] open ( Union[str, "PathLike[str]", bytes]  file,
Union[Literal["rt"], Literal["r"]]  mode,
int   buffering = -1,
Optional[str]   encoding = None,
Optional[str]   errors = None,
Optional[str]   newline = None,
*Optional[int]   total = None,
str   description = "Reading...",
bool   auto_refresh = True,
Optional[Console]   console = None,
bool   transient = False,
Optional[Callable[[], float]]   get_time = None,
float   refresh_per_second = 10,
StyleType   style = "bar.back",
StyleType   complete_style = "bar.complete",
StyleType   finished_style = "bar.finished",
StyleType   pulse_style = "bar.pulse",
bool   disable = False 
)

Definition at line 360 of file progress.py.

380) -> ContextManager[TextIO]:
381 pass
382
383
384@typing.overload

◆ track()

Iterable[ProgressType] track ( Union[Sequence[ProgressType], Iterable[ProgressType]]  sequence,
str   description = "Working...",
Optional[float]   total = None,
bool   auto_refresh = True,
Optional[Console]   console = None,
bool   transient = False,
Optional[Callable[[], float]]   get_time = None,
float   refresh_per_second = 10,
StyleType   style = "bar.back",
StyleType   complete_style = "bar.complete",
StyleType   finished_style = "bar.finished",
StyleType   pulse_style = "bar.pulse",
float   update_period = 0.1,
bool   disable = False,
bool   show_speed = True 
)
Track progress by iterating over a sequence.

Args:
    sequence (Iterable[ProgressType]): A sequence (must support "len") you wish to iterate over.
    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).
    auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
    transient: (bool, optional): Clear the progress on exit. Defaults to False.
    console (Console, optional): Console to write to. Default creates internal Console instance.
    refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
    style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
    complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
    finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
    pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
    update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.
    disable (bool, optional): Disable display of progress.
    show_speed (bool, optional): Show speed if total isn't known. Defaults to True.
Returns:
    Iterable[ProgressType]: An iterable of the values in the sequence.

Definition at line 103 of file progress.py.

119) -> Iterable[ProgressType]:
120 """Track progress by iterating over a sequence.
121
122 Args:
123 sequence (Iterable[ProgressType]): A sequence (must support "len") you wish to iterate over.
124 description (str, optional): Description of task show next to progress bar. Defaults to "Working".
125 total: (float, optional): Total number of steps. Default is len(sequence).
126 auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
127 transient: (bool, optional): Clear the progress on exit. Defaults to False.
128 console (Console, optional): Console to write to. Default creates internal Console instance.
129 refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
130 style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
131 complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
132 finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
133 pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
134 update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.
135 disable (bool, optional): Disable display of progress.
136 show_speed (bool, optional): Show speed if total isn't known. Defaults to True.
137 Returns:
138 Iterable[ProgressType]: An iterable of the values in the sequence.
139
140 """
141
142 columns: List["ProgressColumn"] = (
143 [TextColumn("[progress.description]{task.description}")] if description else []
144 )
146 (
147 BarColumn(
148 style=style,
149 complete_style=complete_style,
150 finished_style=finished_style,
151 pulse_style=pulse_style,
152 ),
153 TaskProgressColumn(show_speed=show_speed),
154 TimeRemainingColumn(elapsed_when_finished=True),
155 )
156 )
157 progress = Progress(
158 *columns,
159 auto_refresh=auto_refresh,
160 console=console,
161 transient=transient,
162 get_time=get_time,
163 refresh_per_second=refresh_per_second or 10,
164 disable=disable,
165 )
166
167 with progress:
168 yield from progress.track(
169 sequence, total=total, description=description, update_period=update_period
170 )
171
172

References i.

◆ wrap_file()

ContextManager[BinaryIO] wrap_file ( BinaryIO  file,
int  total,
*str   description = "Reading...",
bool   auto_refresh = True,
Optional[Console]   console = None,
bool   transient = False,
Optional[Callable[[], float]]   get_time = None,
float   refresh_per_second = 10,
StyleType   style = "bar.back",
StyleType   complete_style = "bar.complete",
StyleType   finished_style = "bar.finished",
StyleType   pulse_style = "bar.pulse",
bool   disable = False 
)
Read bytes from a file while tracking progress.

Args:
    file (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
    total (int): Total number of bytes to read.
    description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
    auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
    transient: (bool, optional): Clear the progress on exit. Defaults to False.
    console (Console, optional): Console to write to. Default creates internal Console instance.
    refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
    style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
    complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
    finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
    pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
    disable (bool, optional): Disable display of progress.
Returns:
    ContextManager[BinaryIO]: A context manager yielding a progress reader.

Definition at line 294 of file progress.py.

309) -> ContextManager[BinaryIO]:
310 """Read bytes from a file while tracking progress.
311
312 Args:
313 file (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
314 total (int): Total number of bytes to read.
315 description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
316 auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
317 transient: (bool, optional): Clear the progress on exit. Defaults to False.
318 console (Console, optional): Console to write to. Default creates internal Console instance.
319 refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
320 style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
321 complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
322 finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
323 pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
324 disable (bool, optional): Disable display of progress.
325 Returns:
326 ContextManager[BinaryIO]: A context manager yielding a progress reader.
327
328 """
329
330 columns: List["ProgressColumn"] = (
331 [TextColumn("[progress.description]{task.description}")] if description else []
332 )
334 (
335 BarColumn(
336 style=style,
337 complete_style=complete_style,
338 finished_style=finished_style,
339 pulse_style=pulse_style,
340 ),
341 DownloadColumn(),
342 TimeRemainingColumn(),
343 )
344 )
345 progress = Progress(
346 *columns,
347 auto_refresh=auto_refresh,
348 console=console,
349 transient=transient,
350 get_time=get_time,
351 refresh_per_second=refresh_per_second or 10,
352 disable=disable,
353 )
354
355 reader = progress.wrap_file(file, total=total, description=description)
356 return _ReadContext(progress, reader)
357
358
359@typing.overload

References i.

Variable Documentation

◆ _I

_I = typing.TypeVar("_I", TextIO, BinaryIO)
protected

Definition at line 60 of file progress.py.

◆ advance

◆ console

console = Console(record=True)

Definition at line 1683 of file progress.py.

◆ examples

examples = cycle(progress_renderables)

Definition at line 1681 of file progress.py.

◆ GetTimeCallable

GetTimeCallable = Callable[[], float]

Definition at line 57 of file progress.py.

◆ progress_renderables

list progress_renderables
Initial value:
1= [
2 "Text may be printed while the progress bars are rendering.",
3 Panel("In fact, [i]any[/i] renderable will work"),
4 "Such as [magenta]tables[/]...",
5 table,
6 "Pretty printed structures...",
7 {"type": "example", "text": "Pretty printed"},
8 "Syntax...",
9 syntax,
10 Rule("Give it a try!"),
11 ]

Definition at line 1667 of file progress.py.

◆ ProgressType

ProgressType = TypeVar("ProgressType")

Definition at line 55 of file progress.py.

◆ syntax

syntax
Initial value:
1= Syntax(
2 ,
3 "python",
4 line_numbers=True,
5 )

Definition at line 1648 of file progress.py.

◆ table

table = Table("foo", "bar", "baz")

Definition at line 1664 of file progress.py.

◆ task1

task1 = progress.add_task("[red]Downloading", total=1000)

Definition at line 1693 of file progress.py.

◆ task2

task2 = progress.add_task("[green]Processing", total=1000)

Definition at line 1694 of file progress.py.

◆ task3

task3 = progress.add_task("[yellow]Thinking", total=None)

Definition at line 1695 of file progress.py.

◆ TaskID

TaskID = NewType("TaskID", int)

Definition at line 53 of file progress.py.

◆ transient

transient

Definition at line 1690 of file progress.py.