OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
bfaces
/
.venv
/
lib
/
python3.10
/
site-packages
/
pip
/
_internal
/
cli
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/24/2024 01:43:15 PM
rwxr-xr-x
📄
__init__.py
132 bytes
10/24/2024 01:43:12 PM
rw-r--r--
📁
__pycache__
-
10/24/2024 01:44:40 PM
rwxr-xr-x
📄
autocompletion.py
6.52 KB
10/24/2024 01:43:11 PM
rw-r--r--
📄
base_command.py
7.66 KB
10/24/2024 01:43:11 PM
rw-r--r--
📄
cmdoptions.py
28.81 KB
10/24/2024 01:43:11 PM
rw-r--r--
📄
command_context.py
774 bytes
10/24/2024 01:43:11 PM
rw-r--r--
📄
main.py
2.41 KB
10/24/2024 01:43:11 PM
rw-r--r--
📄
main_parser.py
4.24 KB
10/24/2024 01:43:11 PM
rw-r--r--
📄
parser.py
10.56 KB
10/24/2024 01:43:12 PM
rw-r--r--
📄
progress_bars.py
1.92 KB
10/24/2024 01:43:12 PM
rw-r--r--
📄
req_command.py
17.75 KB
10/24/2024 01:43:12 PM
rw-r--r--
📄
spinners.py
5 KB
10/24/2024 01:43:12 PM
rw-r--r--
📄
status_codes.py
116 bytes
10/24/2024 01:43:12 PM
rw-r--r--
Editing: progress_bars.py
Close
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