$42 GRAYBYTE WORDPRESS FILE MANAGER $35

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/

HOME
Current File : /opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli//progress_bars.py
import functools
from typing import Callable, Generator, Iterable, Iterator, Optional, Tuple

from pip._vendor.rich.progress import (
    BarColumn,
    DownloadColumn,
    FileSizeColumn,
    Progress,
    ProgressColumn,
    SpinnerColumn,
    TextColumn,
    TimeElapsedColumn,
    TimeRemainingColumn,
    TransferSpeedColumn,
)

from pip._internal.utils.logging import get_indentation

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


def _rich_progress_bar(
    iterable: Iterable[bytes],
    *,
    bar_type: str,
    size: int,
) -> Generator[bytes, None, None]:
    assert bar_type == "on", "This should only be used in the default mode."

    if not size:
        total = float("inf")
        columns: Tuple[ProgressColumn, ...] = (
            TextColumn("[progress.description]{task.description}"),
            SpinnerColumn("line", speed=1.5),
            FileSizeColumn(),
            TransferSpeedColumn(),
            TimeElapsedColumn(),
        )
    else:
        total = size
        columns = (
            TextColumn("[progress.description]{task.description}"),
            BarColumn(),
            DownloadColumn(),
            TransferSpeedColumn(),
            TextColumn("eta"),
            TimeRemainingColumn(),
        )

    progress = Progress(*columns, refresh_per_second=30)
    task_id = progress.add_task(" " * (get_indentation() + 2), total=total)
    with progress:
        for chunk in iterable:
            yield chunk
            progress.update(task_id, advance=len(chunk))


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

    Returns a callable, that takes an iterable to "wrap".
    """
    if bar_type == "on":
        return functools.partial(_rich_progress_bar, bar_type=bar_type, size=size)
    else:
        return iter  # no-op, when passed an iterator


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.49 PM
root / linksafe
0755
__pycache__
--
3 Mar 2024 10.49 PM
root / linksafe
0755
__init__.py
0.129 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
autocompletion.py
6.52 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
base_command.py
7.955 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
cmdoptions.py
29.282 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
command_context.py
0.756 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
main.py
2.414 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
main_parser.py
2.553 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
parser.py
10.563 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
progress_bars.py
1.922 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
req_command.py
17.746 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
spinners.py
4.979 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
status_codes.py
0.113 KB
13 Nov 2023 9.40 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF