Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._internal.cli.progress_bars Namespace Reference

Functions

Generator[bytes, None, None_rich_progress_bar (Iterable[bytes] iterable, *str bar_type, int size)
 
DownloadProgressRenderer get_download_progress_renderer (*str bar_type, Optional[int] size=None)
 

Variables

 DownloadProgressRenderer = Callable[[Iterable[bytes]], Iterator[bytes]]
 

Function Documentation

◆ _rich_progress_bar()

Generator[bytes, None, None] _rich_progress_bar ( Iterable[bytes]  iterable,
*str  bar_type,
int  size 
)
protected

Definition at line 22 of file progress_bars.py.

27) -> Generator[bytes, None, None]:
28 assert bar_type == "on", "This should only be used in the default mode."
29
30 if not size:
31 total = float("inf")
32 columns: Tuple[ProgressColumn, ...] = (
33 TextColumn("[progress.description]{task.description}"),
34 SpinnerColumn("line", speed=1.5),
35 FileSizeColumn(),
36 TransferSpeedColumn(),
37 TimeElapsedColumn(),
38 )
39 else:
40 total = size
41 columns = (
42 TextColumn("[progress.description]{task.description}"),
43 BarColumn(),
44 DownloadColumn(),
45 TransferSpeedColumn(),
46 TextColumn("eta"),
47 TimeRemainingColumn(),
48 )
49
50 progress = Progress(*columns, refresh_per_second=30)
51 task_id = progress.add_task(" " * (get_indentation() + 2), total=total)
52 with progress:
53 for chunk in iterable:
54 yield chunk
55 progress.update(task_id, advance=len(chunk))
56
57
for i

References i.

◆ get_download_progress_renderer()

DownloadProgressRenderer get_download_progress_renderer ( *str  bar_type,
Optional[int]   size = None 
)
Get an object that can be used to render the download progress.

Returns a callable, that takes an iterable to "wrap".

Definition at line 58 of file progress_bars.py.

60) -> DownloadProgressRenderer:
61 """Get an object that can be used to render the download progress.
62
63 Returns a callable, that takes an iterable to "wrap".
64 """
65 if bar_type == "on":
66 return functools.partial(_rich_progress_bar, bar_type=bar_type, size=size)
67 else:
68 return iter # no-op, when passed an iterator

References i.

Variable Documentation

◆ DownloadProgressRenderer

DownloadProgressRenderer = Callable[[Iterable[bytes]], Iterator[bytes]]

Definition at line 19 of file progress_bars.py.