Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +5 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/__main__.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_extension.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_ratio.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_windows.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_windows_renderer.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/abc.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/columns.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/containers.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/control.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/markup.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/panel.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/screen.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/theme.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/traceback.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/tree.cpython-310.pyc +0 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/_fileno.py +24 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/_windows_renderer.py +56 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/align.py +312 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/ansi.py +241 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/bar.py +93 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/control.py +225 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/json.py +139 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/palette.py +100 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/progress_bar.py +223 -0
- mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/repr.py +149 -0
- moondream/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-310.pyc +3 -0
- moondream/lib/python3.10/site-packages/torch/_decomp/__pycache__/decompositions.cpython-310.pyc +3 -0
- moondream/lib/python3.10/site-packages/torch/distributed/__pycache__/distributed_c10d.cpython-310.pyc +3 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_convert_indices_from_coo_to_csr_cuda_dispatch.h +25 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_clamp_max_cuda_dispatch.h +28 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_log2.h +44 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_lazy_clone_ops.h +28 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_mps_convolution_transpose_compositeexplicitautograd_dispatch.h +26 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_reshape_alias_ops.h +28 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_compressed_tensor_unsafe.h +69 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_softmax_backward_data_native.h +23 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_to_copy_compositeexplicitautograd_dispatch.h +26 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_bilinear2d_aa_meta.h +27 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_validate_sparse_csr_tensor_args_ops.h +28 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/adaptive_max_pool2d_backward_meta.h +27 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/align_to_native.h +22 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/align_to_ops.h +39 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/arccosh_ops.h +50 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/atan2_meta_dispatch.h +26 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/batch_norm_gather_stats_compositeexplicitautograd_dispatch.h +24 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/col_indices_copy_compositeexplicitautograd_dispatch.h +24 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/col_indices_copy_compositeexplicitautogradnonfunctional_dispatch.h +23 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/cudnn_grid_sampler_ops.h +39 -0
- moondream/lib/python3.10/site-packages/torch/include/ATen/ops/diff_compositeimplicitautograd_dispatch.h +25 -0
.gitattributes
CHANGED
|
@@ -527,3 +527,8 @@ mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/distlib/w64.exe filter=l
|
|
| 527 |
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text
|
| 528 |
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text
|
| 529 |
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text
|
| 528 |
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text
|
| 529 |
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
|
| 530 |
+
moondream/lib/python3.10/site-packages/torch/lib/libtorch.so filter=lfs diff=lfs merge=lfs -text
|
| 531 |
+
moondream/lib/python3.10/site-packages/torch/distributed/__pycache__/distributed_c10d.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 532 |
+
moondream/lib/python3.10/site-packages/torch/testing/_internal/distributed/__pycache__/distributed_test.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 533 |
+
moondream/lib/python3.10/site-packages/torch/_decomp/__pycache__/decompositions.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 534 |
+
moondream/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/__main__.cpython-310.pyc
ADDED
|
Binary file (7.17 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_extension.cpython-310.pyc
ADDED
|
Binary file (483 Bytes). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_ratio.cpython-310.pyc
ADDED
|
Binary file (5.15 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_windows.cpython-310.pyc
ADDED
|
Binary file (1.78 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_windows_renderer.cpython-310.pyc
ADDED
|
Binary file (2.03 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/abc.cpython-310.pyc
ADDED
|
Binary file (1.3 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/columns.cpython-310.pyc
ADDED
|
Binary file (6.19 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/containers.cpython-310.pyc
ADDED
|
Binary file (6.48 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/control.cpython-310.pyc
ADDED
|
Binary file (8.15 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/markup.cpython-310.pyc
ADDED
|
Binary file (6.14 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/panel.cpython-310.pyc
ADDED
|
Binary file (7.94 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/screen.cpython-310.pyc
ADDED
|
Binary file (1.87 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/theme.cpython-310.pyc
ADDED
|
Binary file (4.82 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/traceback.cpython-310.pyc
ADDED
|
Binary file (22.6 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/tree.cpython-310.pyc
ADDED
|
Binary file (7.63 kB). View file
|
|
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/_fileno.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import IO, Callable
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def get_fileno(file_like: IO[str]) -> int | None:
|
| 7 |
+
"""Get fileno() from a file, accounting for poorly implemented file-like objects.
|
| 8 |
+
|
| 9 |
+
Args:
|
| 10 |
+
file_like (IO): A file-like object.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
int | None: The result of fileno if available, or None if operation failed.
|
| 14 |
+
"""
|
| 15 |
+
fileno: Callable[[], int] | None = getattr(file_like, "fileno", None)
|
| 16 |
+
if fileno is not None:
|
| 17 |
+
try:
|
| 18 |
+
return fileno()
|
| 19 |
+
except Exception:
|
| 20 |
+
# `fileno` is documented as potentially raising a OSError
|
| 21 |
+
# Alas, from the issues, there are so many poorly implemented file-like objects,
|
| 22 |
+
# that `fileno()` can raise just about anything.
|
| 23 |
+
return None
|
| 24 |
+
return None
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/_windows_renderer.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Iterable, Sequence, Tuple, cast
|
| 2 |
+
|
| 3 |
+
from pip._vendor.rich._win32_console import LegacyWindowsTerm, WindowsCoordinates
|
| 4 |
+
from pip._vendor.rich.segment import ControlCode, ControlType, Segment
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def legacy_windows_render(buffer: Iterable[Segment], term: LegacyWindowsTerm) -> None:
|
| 8 |
+
"""Makes appropriate Windows Console API calls based on the segments in the buffer.
|
| 9 |
+
|
| 10 |
+
Args:
|
| 11 |
+
buffer (Iterable[Segment]): Iterable of Segments to convert to Win32 API calls.
|
| 12 |
+
term (LegacyWindowsTerm): Used to call the Windows Console API.
|
| 13 |
+
"""
|
| 14 |
+
for text, style, control in buffer:
|
| 15 |
+
if not control:
|
| 16 |
+
if style:
|
| 17 |
+
term.write_styled(text, style)
|
| 18 |
+
else:
|
| 19 |
+
term.write_text(text)
|
| 20 |
+
else:
|
| 21 |
+
control_codes: Sequence[ControlCode] = control
|
| 22 |
+
for control_code in control_codes:
|
| 23 |
+
control_type = control_code[0]
|
| 24 |
+
if control_type == ControlType.CURSOR_MOVE_TO:
|
| 25 |
+
_, x, y = cast(Tuple[ControlType, int, int], control_code)
|
| 26 |
+
term.move_cursor_to(WindowsCoordinates(row=y - 1, col=x - 1))
|
| 27 |
+
elif control_type == ControlType.CARRIAGE_RETURN:
|
| 28 |
+
term.write_text("\r")
|
| 29 |
+
elif control_type == ControlType.HOME:
|
| 30 |
+
term.move_cursor_to(WindowsCoordinates(0, 0))
|
| 31 |
+
elif control_type == ControlType.CURSOR_UP:
|
| 32 |
+
term.move_cursor_up()
|
| 33 |
+
elif control_type == ControlType.CURSOR_DOWN:
|
| 34 |
+
term.move_cursor_down()
|
| 35 |
+
elif control_type == ControlType.CURSOR_FORWARD:
|
| 36 |
+
term.move_cursor_forward()
|
| 37 |
+
elif control_type == ControlType.CURSOR_BACKWARD:
|
| 38 |
+
term.move_cursor_backward()
|
| 39 |
+
elif control_type == ControlType.CURSOR_MOVE_TO_COLUMN:
|
| 40 |
+
_, column = cast(Tuple[ControlType, int], control_code)
|
| 41 |
+
term.move_cursor_to_column(column - 1)
|
| 42 |
+
elif control_type == ControlType.HIDE_CURSOR:
|
| 43 |
+
term.hide_cursor()
|
| 44 |
+
elif control_type == ControlType.SHOW_CURSOR:
|
| 45 |
+
term.show_cursor()
|
| 46 |
+
elif control_type == ControlType.ERASE_IN_LINE:
|
| 47 |
+
_, mode = cast(Tuple[ControlType, int], control_code)
|
| 48 |
+
if mode == 0:
|
| 49 |
+
term.erase_end_of_line()
|
| 50 |
+
elif mode == 1:
|
| 51 |
+
term.erase_start_of_line()
|
| 52 |
+
elif mode == 2:
|
| 53 |
+
term.erase_line()
|
| 54 |
+
elif control_type == ControlType.SET_WINDOW_TITLE:
|
| 55 |
+
_, title = cast(Tuple[ControlType, str], control_code)
|
| 56 |
+
term.set_title(title)
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/align.py
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from itertools import chain
|
| 3 |
+
from typing import TYPE_CHECKING, Iterable, Optional
|
| 4 |
+
|
| 5 |
+
if sys.version_info >= (3, 8):
|
| 6 |
+
from typing import Literal
|
| 7 |
+
else:
|
| 8 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 9 |
+
|
| 10 |
+
from .constrain import Constrain
|
| 11 |
+
from .jupyter import JupyterMixin
|
| 12 |
+
from .measure import Measurement
|
| 13 |
+
from .segment import Segment
|
| 14 |
+
from .style import StyleType
|
| 15 |
+
|
| 16 |
+
if TYPE_CHECKING:
|
| 17 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 18 |
+
|
| 19 |
+
AlignMethod = Literal["left", "center", "right"]
|
| 20 |
+
VerticalAlignMethod = Literal["top", "middle", "bottom"]
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class Align(JupyterMixin):
|
| 24 |
+
"""Align a renderable by adding spaces if necessary.
|
| 25 |
+
|
| 26 |
+
Args:
|
| 27 |
+
renderable (RenderableType): A console renderable.
|
| 28 |
+
align (AlignMethod): One of "left", "center", or "right""
|
| 29 |
+
style (StyleType, optional): An optional style to apply to the background.
|
| 30 |
+
vertical (Optional[VerticalAlignMethod], optional): Optional vertical align, one of "top", "middle", or "bottom". Defaults to None.
|
| 31 |
+
pad (bool, optional): Pad the right with spaces. Defaults to True.
|
| 32 |
+
width (int, optional): Restrict contents to given width, or None to use default width. Defaults to None.
|
| 33 |
+
height (int, optional): Set height of align renderable, or None to fit to contents. Defaults to None.
|
| 34 |
+
|
| 35 |
+
Raises:
|
| 36 |
+
ValueError: if ``align`` is not one of the expected values.
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
def __init__(
|
| 40 |
+
self,
|
| 41 |
+
renderable: "RenderableType",
|
| 42 |
+
align: AlignMethod = "left",
|
| 43 |
+
style: Optional[StyleType] = None,
|
| 44 |
+
*,
|
| 45 |
+
vertical: Optional[VerticalAlignMethod] = None,
|
| 46 |
+
pad: bool = True,
|
| 47 |
+
width: Optional[int] = None,
|
| 48 |
+
height: Optional[int] = None,
|
| 49 |
+
) -> None:
|
| 50 |
+
if align not in ("left", "center", "right"):
|
| 51 |
+
raise ValueError(
|
| 52 |
+
f'invalid value for align, expected "left", "center", or "right" (not {align!r})'
|
| 53 |
+
)
|
| 54 |
+
if vertical is not None and vertical not in ("top", "middle", "bottom"):
|
| 55 |
+
raise ValueError(
|
| 56 |
+
f'invalid value for vertical, expected "top", "middle", or "bottom" (not {vertical!r})'
|
| 57 |
+
)
|
| 58 |
+
self.renderable = renderable
|
| 59 |
+
self.align = align
|
| 60 |
+
self.style = style
|
| 61 |
+
self.vertical = vertical
|
| 62 |
+
self.pad = pad
|
| 63 |
+
self.width = width
|
| 64 |
+
self.height = height
|
| 65 |
+
|
| 66 |
+
def __repr__(self) -> str:
|
| 67 |
+
return f"Align({self.renderable!r}, {self.align!r})"
|
| 68 |
+
|
| 69 |
+
@classmethod
|
| 70 |
+
def left(
|
| 71 |
+
cls,
|
| 72 |
+
renderable: "RenderableType",
|
| 73 |
+
style: Optional[StyleType] = None,
|
| 74 |
+
*,
|
| 75 |
+
vertical: Optional[VerticalAlignMethod] = None,
|
| 76 |
+
pad: bool = True,
|
| 77 |
+
width: Optional[int] = None,
|
| 78 |
+
height: Optional[int] = None,
|
| 79 |
+
) -> "Align":
|
| 80 |
+
"""Align a renderable to the left."""
|
| 81 |
+
return cls(
|
| 82 |
+
renderable,
|
| 83 |
+
"left",
|
| 84 |
+
style=style,
|
| 85 |
+
vertical=vertical,
|
| 86 |
+
pad=pad,
|
| 87 |
+
width=width,
|
| 88 |
+
height=height,
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
@classmethod
|
| 92 |
+
def center(
|
| 93 |
+
cls,
|
| 94 |
+
renderable: "RenderableType",
|
| 95 |
+
style: Optional[StyleType] = None,
|
| 96 |
+
*,
|
| 97 |
+
vertical: Optional[VerticalAlignMethod] = None,
|
| 98 |
+
pad: bool = True,
|
| 99 |
+
width: Optional[int] = None,
|
| 100 |
+
height: Optional[int] = None,
|
| 101 |
+
) -> "Align":
|
| 102 |
+
"""Align a renderable to the center."""
|
| 103 |
+
return cls(
|
| 104 |
+
renderable,
|
| 105 |
+
"center",
|
| 106 |
+
style=style,
|
| 107 |
+
vertical=vertical,
|
| 108 |
+
pad=pad,
|
| 109 |
+
width=width,
|
| 110 |
+
height=height,
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
@classmethod
|
| 114 |
+
def right(
|
| 115 |
+
cls,
|
| 116 |
+
renderable: "RenderableType",
|
| 117 |
+
style: Optional[StyleType] = None,
|
| 118 |
+
*,
|
| 119 |
+
vertical: Optional[VerticalAlignMethod] = None,
|
| 120 |
+
pad: bool = True,
|
| 121 |
+
width: Optional[int] = None,
|
| 122 |
+
height: Optional[int] = None,
|
| 123 |
+
) -> "Align":
|
| 124 |
+
"""Align a renderable to the right."""
|
| 125 |
+
return cls(
|
| 126 |
+
renderable,
|
| 127 |
+
"right",
|
| 128 |
+
style=style,
|
| 129 |
+
vertical=vertical,
|
| 130 |
+
pad=pad,
|
| 131 |
+
width=width,
|
| 132 |
+
height=height,
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
def __rich_console__(
|
| 136 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 137 |
+
) -> "RenderResult":
|
| 138 |
+
align = self.align
|
| 139 |
+
width = console.measure(self.renderable, options=options).maximum
|
| 140 |
+
rendered = console.render(
|
| 141 |
+
Constrain(
|
| 142 |
+
self.renderable, width if self.width is None else min(width, self.width)
|
| 143 |
+
),
|
| 144 |
+
options.update(height=None),
|
| 145 |
+
)
|
| 146 |
+
lines = list(Segment.split_lines(rendered))
|
| 147 |
+
width, height = Segment.get_shape(lines)
|
| 148 |
+
lines = Segment.set_shape(lines, width, height)
|
| 149 |
+
new_line = Segment.line()
|
| 150 |
+
excess_space = options.max_width - width
|
| 151 |
+
style = console.get_style(self.style) if self.style is not None else None
|
| 152 |
+
|
| 153 |
+
def generate_segments() -> Iterable[Segment]:
|
| 154 |
+
if excess_space <= 0:
|
| 155 |
+
# Exact fit
|
| 156 |
+
for line in lines:
|
| 157 |
+
yield from line
|
| 158 |
+
yield new_line
|
| 159 |
+
|
| 160 |
+
elif align == "left":
|
| 161 |
+
# Pad on the right
|
| 162 |
+
pad = Segment(" " * excess_space, style) if self.pad else None
|
| 163 |
+
for line in lines:
|
| 164 |
+
yield from line
|
| 165 |
+
if pad:
|
| 166 |
+
yield pad
|
| 167 |
+
yield new_line
|
| 168 |
+
|
| 169 |
+
elif align == "center":
|
| 170 |
+
# Pad left and right
|
| 171 |
+
left = excess_space // 2
|
| 172 |
+
pad = Segment(" " * left, style)
|
| 173 |
+
pad_right = (
|
| 174 |
+
Segment(" " * (excess_space - left), style) if self.pad else None
|
| 175 |
+
)
|
| 176 |
+
for line in lines:
|
| 177 |
+
if left:
|
| 178 |
+
yield pad
|
| 179 |
+
yield from line
|
| 180 |
+
if pad_right:
|
| 181 |
+
yield pad_right
|
| 182 |
+
yield new_line
|
| 183 |
+
|
| 184 |
+
elif align == "right":
|
| 185 |
+
# Padding on left
|
| 186 |
+
pad = Segment(" " * excess_space, style)
|
| 187 |
+
for line in lines:
|
| 188 |
+
yield pad
|
| 189 |
+
yield from line
|
| 190 |
+
yield new_line
|
| 191 |
+
|
| 192 |
+
blank_line = (
|
| 193 |
+
Segment(f"{' ' * (self.width or options.max_width)}\n", style)
|
| 194 |
+
if self.pad
|
| 195 |
+
else Segment("\n")
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
def blank_lines(count: int) -> Iterable[Segment]:
|
| 199 |
+
if count > 0:
|
| 200 |
+
for _ in range(count):
|
| 201 |
+
yield blank_line
|
| 202 |
+
|
| 203 |
+
vertical_height = self.height or options.height
|
| 204 |
+
iter_segments: Iterable[Segment]
|
| 205 |
+
if self.vertical and vertical_height is not None:
|
| 206 |
+
if self.vertical == "top":
|
| 207 |
+
bottom_space = vertical_height - height
|
| 208 |
+
iter_segments = chain(generate_segments(), blank_lines(bottom_space))
|
| 209 |
+
elif self.vertical == "middle":
|
| 210 |
+
top_space = (vertical_height - height) // 2
|
| 211 |
+
bottom_space = vertical_height - top_space - height
|
| 212 |
+
iter_segments = chain(
|
| 213 |
+
blank_lines(top_space),
|
| 214 |
+
generate_segments(),
|
| 215 |
+
blank_lines(bottom_space),
|
| 216 |
+
)
|
| 217 |
+
else: # self.vertical == "bottom":
|
| 218 |
+
top_space = vertical_height - height
|
| 219 |
+
iter_segments = chain(blank_lines(top_space), generate_segments())
|
| 220 |
+
else:
|
| 221 |
+
iter_segments = generate_segments()
|
| 222 |
+
if self.style:
|
| 223 |
+
style = console.get_style(self.style)
|
| 224 |
+
iter_segments = Segment.apply_style(iter_segments, style)
|
| 225 |
+
yield from iter_segments
|
| 226 |
+
|
| 227 |
+
def __rich_measure__(
|
| 228 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 229 |
+
) -> Measurement:
|
| 230 |
+
measurement = Measurement.get(console, options, self.renderable)
|
| 231 |
+
return measurement
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
class VerticalCenter(JupyterMixin):
|
| 235 |
+
"""Vertically aligns a renderable.
|
| 236 |
+
|
| 237 |
+
Warn:
|
| 238 |
+
This class is deprecated and may be removed in a future version. Use Align class with
|
| 239 |
+
`vertical="middle"`.
|
| 240 |
+
|
| 241 |
+
Args:
|
| 242 |
+
renderable (RenderableType): A renderable object.
|
| 243 |
+
style (StyleType, optional): An optional style to apply to the background. Defaults to None.
|
| 244 |
+
"""
|
| 245 |
+
|
| 246 |
+
def __init__(
|
| 247 |
+
self,
|
| 248 |
+
renderable: "RenderableType",
|
| 249 |
+
style: Optional[StyleType] = None,
|
| 250 |
+
) -> None:
|
| 251 |
+
self.renderable = renderable
|
| 252 |
+
self.style = style
|
| 253 |
+
|
| 254 |
+
def __repr__(self) -> str:
|
| 255 |
+
return f"VerticalCenter({self.renderable!r})"
|
| 256 |
+
|
| 257 |
+
def __rich_console__(
|
| 258 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 259 |
+
) -> "RenderResult":
|
| 260 |
+
style = console.get_style(self.style) if self.style is not None else None
|
| 261 |
+
lines = console.render_lines(
|
| 262 |
+
self.renderable, options.update(height=None), pad=False
|
| 263 |
+
)
|
| 264 |
+
width, _height = Segment.get_shape(lines)
|
| 265 |
+
new_line = Segment.line()
|
| 266 |
+
height = options.height or options.size.height
|
| 267 |
+
top_space = (height - len(lines)) // 2
|
| 268 |
+
bottom_space = height - top_space - len(lines)
|
| 269 |
+
blank_line = Segment(f"{' ' * width}", style)
|
| 270 |
+
|
| 271 |
+
def blank_lines(count: int) -> Iterable[Segment]:
|
| 272 |
+
for _ in range(count):
|
| 273 |
+
yield blank_line
|
| 274 |
+
yield new_line
|
| 275 |
+
|
| 276 |
+
if top_space > 0:
|
| 277 |
+
yield from blank_lines(top_space)
|
| 278 |
+
for line in lines:
|
| 279 |
+
yield from line
|
| 280 |
+
yield new_line
|
| 281 |
+
if bottom_space > 0:
|
| 282 |
+
yield from blank_lines(bottom_space)
|
| 283 |
+
|
| 284 |
+
def __rich_measure__(
|
| 285 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 286 |
+
) -> Measurement:
|
| 287 |
+
measurement = Measurement.get(console, options, self.renderable)
|
| 288 |
+
return measurement
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
if __name__ == "__main__": # pragma: no cover
|
| 292 |
+
from pip._vendor.rich.console import Console, Group
|
| 293 |
+
from pip._vendor.rich.highlighter import ReprHighlighter
|
| 294 |
+
from pip._vendor.rich.panel import Panel
|
| 295 |
+
|
| 296 |
+
highlighter = ReprHighlighter()
|
| 297 |
+
console = Console()
|
| 298 |
+
|
| 299 |
+
panel = Panel(
|
| 300 |
+
Group(
|
| 301 |
+
Align.left(highlighter("align='left'")),
|
| 302 |
+
Align.center(highlighter("align='center'")),
|
| 303 |
+
Align.right(highlighter("align='right'")),
|
| 304 |
+
),
|
| 305 |
+
width=60,
|
| 306 |
+
style="on dark_blue",
|
| 307 |
+
title="Align",
|
| 308 |
+
)
|
| 309 |
+
|
| 310 |
+
console.print(
|
| 311 |
+
Align.center(panel, vertical="middle", style="on red", height=console.height)
|
| 312 |
+
)
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/ansi.py
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
import sys
|
| 3 |
+
from contextlib import suppress
|
| 4 |
+
from typing import Iterable, NamedTuple, Optional
|
| 5 |
+
|
| 6 |
+
from .color import Color
|
| 7 |
+
from .style import Style
|
| 8 |
+
from .text import Text
|
| 9 |
+
|
| 10 |
+
re_ansi = re.compile(
|
| 11 |
+
r"""
|
| 12 |
+
(?:\x1b[0-?])|
|
| 13 |
+
(?:\x1b\](.*?)\x1b\\)|
|
| 14 |
+
(?:\x1b([(@-Z\\-_]|\[[0-?]*[ -/]*[@-~]))
|
| 15 |
+
""",
|
| 16 |
+
re.VERBOSE,
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class _AnsiToken(NamedTuple):
|
| 21 |
+
"""Result of ansi tokenized string."""
|
| 22 |
+
|
| 23 |
+
plain: str = ""
|
| 24 |
+
sgr: Optional[str] = ""
|
| 25 |
+
osc: Optional[str] = ""
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def _ansi_tokenize(ansi_text: str) -> Iterable[_AnsiToken]:
|
| 29 |
+
"""Tokenize a string in to plain text and ANSI codes.
|
| 30 |
+
|
| 31 |
+
Args:
|
| 32 |
+
ansi_text (str): A String containing ANSI codes.
|
| 33 |
+
|
| 34 |
+
Yields:
|
| 35 |
+
AnsiToken: A named tuple of (plain, sgr, osc)
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
position = 0
|
| 39 |
+
sgr: Optional[str]
|
| 40 |
+
osc: Optional[str]
|
| 41 |
+
for match in re_ansi.finditer(ansi_text):
|
| 42 |
+
start, end = match.span(0)
|
| 43 |
+
osc, sgr = match.groups()
|
| 44 |
+
if start > position:
|
| 45 |
+
yield _AnsiToken(ansi_text[position:start])
|
| 46 |
+
if sgr:
|
| 47 |
+
if sgr == "(":
|
| 48 |
+
position = end + 1
|
| 49 |
+
continue
|
| 50 |
+
if sgr.endswith("m"):
|
| 51 |
+
yield _AnsiToken("", sgr[1:-1], osc)
|
| 52 |
+
else:
|
| 53 |
+
yield _AnsiToken("", sgr, osc)
|
| 54 |
+
position = end
|
| 55 |
+
if position < len(ansi_text):
|
| 56 |
+
yield _AnsiToken(ansi_text[position:])
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
SGR_STYLE_MAP = {
|
| 60 |
+
1: "bold",
|
| 61 |
+
2: "dim",
|
| 62 |
+
3: "italic",
|
| 63 |
+
4: "underline",
|
| 64 |
+
5: "blink",
|
| 65 |
+
6: "blink2",
|
| 66 |
+
7: "reverse",
|
| 67 |
+
8: "conceal",
|
| 68 |
+
9: "strike",
|
| 69 |
+
21: "underline2",
|
| 70 |
+
22: "not dim not bold",
|
| 71 |
+
23: "not italic",
|
| 72 |
+
24: "not underline",
|
| 73 |
+
25: "not blink",
|
| 74 |
+
26: "not blink2",
|
| 75 |
+
27: "not reverse",
|
| 76 |
+
28: "not conceal",
|
| 77 |
+
29: "not strike",
|
| 78 |
+
30: "color(0)",
|
| 79 |
+
31: "color(1)",
|
| 80 |
+
32: "color(2)",
|
| 81 |
+
33: "color(3)",
|
| 82 |
+
34: "color(4)",
|
| 83 |
+
35: "color(5)",
|
| 84 |
+
36: "color(6)",
|
| 85 |
+
37: "color(7)",
|
| 86 |
+
39: "default",
|
| 87 |
+
40: "on color(0)",
|
| 88 |
+
41: "on color(1)",
|
| 89 |
+
42: "on color(2)",
|
| 90 |
+
43: "on color(3)",
|
| 91 |
+
44: "on color(4)",
|
| 92 |
+
45: "on color(5)",
|
| 93 |
+
46: "on color(6)",
|
| 94 |
+
47: "on color(7)",
|
| 95 |
+
49: "on default",
|
| 96 |
+
51: "frame",
|
| 97 |
+
52: "encircle",
|
| 98 |
+
53: "overline",
|
| 99 |
+
54: "not frame not encircle",
|
| 100 |
+
55: "not overline",
|
| 101 |
+
90: "color(8)",
|
| 102 |
+
91: "color(9)",
|
| 103 |
+
92: "color(10)",
|
| 104 |
+
93: "color(11)",
|
| 105 |
+
94: "color(12)",
|
| 106 |
+
95: "color(13)",
|
| 107 |
+
96: "color(14)",
|
| 108 |
+
97: "color(15)",
|
| 109 |
+
100: "on color(8)",
|
| 110 |
+
101: "on color(9)",
|
| 111 |
+
102: "on color(10)",
|
| 112 |
+
103: "on color(11)",
|
| 113 |
+
104: "on color(12)",
|
| 114 |
+
105: "on color(13)",
|
| 115 |
+
106: "on color(14)",
|
| 116 |
+
107: "on color(15)",
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
class AnsiDecoder:
|
| 121 |
+
"""Translate ANSI code in to styled Text."""
|
| 122 |
+
|
| 123 |
+
def __init__(self) -> None:
|
| 124 |
+
self.style = Style.null()
|
| 125 |
+
|
| 126 |
+
def decode(self, terminal_text: str) -> Iterable[Text]:
|
| 127 |
+
"""Decode ANSI codes in an iterable of lines.
|
| 128 |
+
|
| 129 |
+
Args:
|
| 130 |
+
lines (Iterable[str]): An iterable of lines of terminal output.
|
| 131 |
+
|
| 132 |
+
Yields:
|
| 133 |
+
Text: Marked up Text.
|
| 134 |
+
"""
|
| 135 |
+
for line in terminal_text.splitlines():
|
| 136 |
+
yield self.decode_line(line)
|
| 137 |
+
|
| 138 |
+
def decode_line(self, line: str) -> Text:
|
| 139 |
+
"""Decode a line containing ansi codes.
|
| 140 |
+
|
| 141 |
+
Args:
|
| 142 |
+
line (str): A line of terminal output.
|
| 143 |
+
|
| 144 |
+
Returns:
|
| 145 |
+
Text: A Text instance marked up according to ansi codes.
|
| 146 |
+
"""
|
| 147 |
+
from_ansi = Color.from_ansi
|
| 148 |
+
from_rgb = Color.from_rgb
|
| 149 |
+
_Style = Style
|
| 150 |
+
text = Text()
|
| 151 |
+
append = text.append
|
| 152 |
+
line = line.rsplit("\r", 1)[-1]
|
| 153 |
+
for plain_text, sgr, osc in _ansi_tokenize(line):
|
| 154 |
+
if plain_text:
|
| 155 |
+
append(plain_text, self.style or None)
|
| 156 |
+
elif osc is not None:
|
| 157 |
+
if osc.startswith("8;"):
|
| 158 |
+
_params, semicolon, link = osc[2:].partition(";")
|
| 159 |
+
if semicolon:
|
| 160 |
+
self.style = self.style.update_link(link or None)
|
| 161 |
+
elif sgr is not None:
|
| 162 |
+
# Translate in to semi-colon separated codes
|
| 163 |
+
# Ignore invalid codes, because we want to be lenient
|
| 164 |
+
codes = [
|
| 165 |
+
min(255, int(_code) if _code else 0)
|
| 166 |
+
for _code in sgr.split(";")
|
| 167 |
+
if _code.isdigit() or _code == ""
|
| 168 |
+
]
|
| 169 |
+
iter_codes = iter(codes)
|
| 170 |
+
for code in iter_codes:
|
| 171 |
+
if code == 0:
|
| 172 |
+
# reset
|
| 173 |
+
self.style = _Style.null()
|
| 174 |
+
elif code in SGR_STYLE_MAP:
|
| 175 |
+
# styles
|
| 176 |
+
self.style += _Style.parse(SGR_STYLE_MAP[code])
|
| 177 |
+
elif code == 38:
|
| 178 |
+
# Foreground
|
| 179 |
+
with suppress(StopIteration):
|
| 180 |
+
color_type = next(iter_codes)
|
| 181 |
+
if color_type == 5:
|
| 182 |
+
self.style += _Style.from_color(
|
| 183 |
+
from_ansi(next(iter_codes))
|
| 184 |
+
)
|
| 185 |
+
elif color_type == 2:
|
| 186 |
+
self.style += _Style.from_color(
|
| 187 |
+
from_rgb(
|
| 188 |
+
next(iter_codes),
|
| 189 |
+
next(iter_codes),
|
| 190 |
+
next(iter_codes),
|
| 191 |
+
)
|
| 192 |
+
)
|
| 193 |
+
elif code == 48:
|
| 194 |
+
# Background
|
| 195 |
+
with suppress(StopIteration):
|
| 196 |
+
color_type = next(iter_codes)
|
| 197 |
+
if color_type == 5:
|
| 198 |
+
self.style += _Style.from_color(
|
| 199 |
+
None, from_ansi(next(iter_codes))
|
| 200 |
+
)
|
| 201 |
+
elif color_type == 2:
|
| 202 |
+
self.style += _Style.from_color(
|
| 203 |
+
None,
|
| 204 |
+
from_rgb(
|
| 205 |
+
next(iter_codes),
|
| 206 |
+
next(iter_codes),
|
| 207 |
+
next(iter_codes),
|
| 208 |
+
),
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
return text
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
if sys.platform != "win32" and __name__ == "__main__": # pragma: no cover
|
| 215 |
+
import io
|
| 216 |
+
import os
|
| 217 |
+
import pty
|
| 218 |
+
import sys
|
| 219 |
+
|
| 220 |
+
decoder = AnsiDecoder()
|
| 221 |
+
|
| 222 |
+
stdout = io.BytesIO()
|
| 223 |
+
|
| 224 |
+
def read(fd: int) -> bytes:
|
| 225 |
+
data = os.read(fd, 1024)
|
| 226 |
+
stdout.write(data)
|
| 227 |
+
return data
|
| 228 |
+
|
| 229 |
+
pty.spawn(sys.argv[1:], read)
|
| 230 |
+
|
| 231 |
+
from .console import Console
|
| 232 |
+
|
| 233 |
+
console = Console(record=True)
|
| 234 |
+
|
| 235 |
+
stdout_result = stdout.getvalue().decode("utf-8")
|
| 236 |
+
print(stdout_result)
|
| 237 |
+
|
| 238 |
+
for line in decoder.decode(stdout_result):
|
| 239 |
+
console.print(line)
|
| 240 |
+
|
| 241 |
+
console.save_html("stdout.html")
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/bar.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional, Union
|
| 2 |
+
|
| 3 |
+
from .color import Color
|
| 4 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 5 |
+
from .jupyter import JupyterMixin
|
| 6 |
+
from .measure import Measurement
|
| 7 |
+
from .segment import Segment
|
| 8 |
+
from .style import Style
|
| 9 |
+
|
| 10 |
+
# There are left-aligned characters for 1/8 to 7/8, but
|
| 11 |
+
# the right-aligned characters exist only for 1/8 and 4/8.
|
| 12 |
+
BEGIN_BLOCK_ELEMENTS = ["█", "█", "█", "▐", "▐", "▐", "▕", "▕"]
|
| 13 |
+
END_BLOCK_ELEMENTS = [" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉"]
|
| 14 |
+
FULL_BLOCK = "█"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Bar(JupyterMixin):
|
| 18 |
+
"""Renders a solid block bar.
|
| 19 |
+
|
| 20 |
+
Args:
|
| 21 |
+
size (float): Value for the end of the bar.
|
| 22 |
+
begin (float): Begin point (between 0 and size, inclusive).
|
| 23 |
+
end (float): End point (between 0 and size, inclusive).
|
| 24 |
+
width (int, optional): Width of the bar, or ``None`` for maximum width. Defaults to None.
|
| 25 |
+
color (Union[Color, str], optional): Color of the bar. Defaults to "default".
|
| 26 |
+
bgcolor (Union[Color, str], optional): Color of bar background. Defaults to "default".
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
def __init__(
|
| 30 |
+
self,
|
| 31 |
+
size: float,
|
| 32 |
+
begin: float,
|
| 33 |
+
end: float,
|
| 34 |
+
*,
|
| 35 |
+
width: Optional[int] = None,
|
| 36 |
+
color: Union[Color, str] = "default",
|
| 37 |
+
bgcolor: Union[Color, str] = "default",
|
| 38 |
+
):
|
| 39 |
+
self.size = size
|
| 40 |
+
self.begin = max(begin, 0)
|
| 41 |
+
self.end = min(end, size)
|
| 42 |
+
self.width = width
|
| 43 |
+
self.style = Style(color=color, bgcolor=bgcolor)
|
| 44 |
+
|
| 45 |
+
def __repr__(self) -> str:
|
| 46 |
+
return f"Bar({self.size}, {self.begin}, {self.end})"
|
| 47 |
+
|
| 48 |
+
def __rich_console__(
|
| 49 |
+
self, console: Console, options: ConsoleOptions
|
| 50 |
+
) -> RenderResult:
|
| 51 |
+
width = min(
|
| 52 |
+
self.width if self.width is not None else options.max_width,
|
| 53 |
+
options.max_width,
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
if self.begin >= self.end:
|
| 57 |
+
yield Segment(" " * width, self.style)
|
| 58 |
+
yield Segment.line()
|
| 59 |
+
return
|
| 60 |
+
|
| 61 |
+
prefix_complete_eights = int(width * 8 * self.begin / self.size)
|
| 62 |
+
prefix_bar_count = prefix_complete_eights // 8
|
| 63 |
+
prefix_eights_count = prefix_complete_eights % 8
|
| 64 |
+
|
| 65 |
+
body_complete_eights = int(width * 8 * self.end / self.size)
|
| 66 |
+
body_bar_count = body_complete_eights // 8
|
| 67 |
+
body_eights_count = body_complete_eights % 8
|
| 68 |
+
|
| 69 |
+
# When start and end fall into the same cell, we ideally should render
|
| 70 |
+
# a symbol that's "center-aligned", but there is no good symbol in Unicode.
|
| 71 |
+
# In this case, we fall back to right-aligned block symbol for simplicity.
|
| 72 |
+
|
| 73 |
+
prefix = " " * prefix_bar_count
|
| 74 |
+
if prefix_eights_count:
|
| 75 |
+
prefix += BEGIN_BLOCK_ELEMENTS[prefix_eights_count]
|
| 76 |
+
|
| 77 |
+
body = FULL_BLOCK * body_bar_count
|
| 78 |
+
if body_eights_count:
|
| 79 |
+
body += END_BLOCK_ELEMENTS[body_eights_count]
|
| 80 |
+
|
| 81 |
+
suffix = " " * (width - len(body))
|
| 82 |
+
|
| 83 |
+
yield Segment(prefix + body[len(prefix) :] + suffix, self.style)
|
| 84 |
+
yield Segment.line()
|
| 85 |
+
|
| 86 |
+
def __rich_measure__(
|
| 87 |
+
self, console: Console, options: ConsoleOptions
|
| 88 |
+
) -> Measurement:
|
| 89 |
+
return (
|
| 90 |
+
Measurement(self.width, self.width)
|
| 91 |
+
if self.width is not None
|
| 92 |
+
else Measurement(4, options.max_width)
|
| 93 |
+
)
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/control.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import time
|
| 3 |
+
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Union
|
| 4 |
+
|
| 5 |
+
if sys.version_info >= (3, 8):
|
| 6 |
+
from typing import Final
|
| 7 |
+
else:
|
| 8 |
+
from pip._vendor.typing_extensions import Final # pragma: no cover
|
| 9 |
+
|
| 10 |
+
from .segment import ControlCode, ControlType, Segment
|
| 11 |
+
|
| 12 |
+
if TYPE_CHECKING:
|
| 13 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 14 |
+
|
| 15 |
+
STRIP_CONTROL_CODES: Final = [
|
| 16 |
+
7, # Bell
|
| 17 |
+
8, # Backspace
|
| 18 |
+
11, # Vertical tab
|
| 19 |
+
12, # Form feed
|
| 20 |
+
13, # Carriage return
|
| 21 |
+
]
|
| 22 |
+
_CONTROL_STRIP_TRANSLATE: Final = {
|
| 23 |
+
_codepoint: None for _codepoint in STRIP_CONTROL_CODES
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
CONTROL_ESCAPE: Final = {
|
| 27 |
+
7: "\\a",
|
| 28 |
+
8: "\\b",
|
| 29 |
+
11: "\\v",
|
| 30 |
+
12: "\\f",
|
| 31 |
+
13: "\\r",
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
CONTROL_CODES_FORMAT: Dict[int, Callable[..., str]] = {
|
| 35 |
+
ControlType.BELL: lambda: "\x07",
|
| 36 |
+
ControlType.CARRIAGE_RETURN: lambda: "\r",
|
| 37 |
+
ControlType.HOME: lambda: "\x1b[H",
|
| 38 |
+
ControlType.CLEAR: lambda: "\x1b[2J",
|
| 39 |
+
ControlType.ENABLE_ALT_SCREEN: lambda: "\x1b[?1049h",
|
| 40 |
+
ControlType.DISABLE_ALT_SCREEN: lambda: "\x1b[?1049l",
|
| 41 |
+
ControlType.SHOW_CURSOR: lambda: "\x1b[?25h",
|
| 42 |
+
ControlType.HIDE_CURSOR: lambda: "\x1b[?25l",
|
| 43 |
+
ControlType.CURSOR_UP: lambda param: f"\x1b[{param}A",
|
| 44 |
+
ControlType.CURSOR_DOWN: lambda param: f"\x1b[{param}B",
|
| 45 |
+
ControlType.CURSOR_FORWARD: lambda param: f"\x1b[{param}C",
|
| 46 |
+
ControlType.CURSOR_BACKWARD: lambda param: f"\x1b[{param}D",
|
| 47 |
+
ControlType.CURSOR_MOVE_TO_COLUMN: lambda param: f"\x1b[{param+1}G",
|
| 48 |
+
ControlType.ERASE_IN_LINE: lambda param: f"\x1b[{param}K",
|
| 49 |
+
ControlType.CURSOR_MOVE_TO: lambda x, y: f"\x1b[{y+1};{x+1}H",
|
| 50 |
+
ControlType.SET_WINDOW_TITLE: lambda title: f"\x1b]0;{title}\x07",
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class Control:
|
| 55 |
+
"""A renderable that inserts a control code (non printable but may move cursor).
|
| 56 |
+
|
| 57 |
+
Args:
|
| 58 |
+
*codes (str): Positional arguments are either a :class:`~rich.segment.ControlType` enum or a
|
| 59 |
+
tuple of ControlType and an integer parameter
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
__slots__ = ["segment"]
|
| 63 |
+
|
| 64 |
+
def __init__(self, *codes: Union[ControlType, ControlCode]) -> None:
|
| 65 |
+
control_codes: List[ControlCode] = [
|
| 66 |
+
(code,) if isinstance(code, ControlType) else code for code in codes
|
| 67 |
+
]
|
| 68 |
+
_format_map = CONTROL_CODES_FORMAT
|
| 69 |
+
rendered_codes = "".join(
|
| 70 |
+
_format_map[code](*parameters) for code, *parameters in control_codes
|
| 71 |
+
)
|
| 72 |
+
self.segment = Segment(rendered_codes, None, control_codes)
|
| 73 |
+
|
| 74 |
+
@classmethod
|
| 75 |
+
def bell(cls) -> "Control":
|
| 76 |
+
"""Ring the 'bell'."""
|
| 77 |
+
return cls(ControlType.BELL)
|
| 78 |
+
|
| 79 |
+
@classmethod
|
| 80 |
+
def home(cls) -> "Control":
|
| 81 |
+
"""Move cursor to 'home' position."""
|
| 82 |
+
return cls(ControlType.HOME)
|
| 83 |
+
|
| 84 |
+
@classmethod
|
| 85 |
+
def move(cls, x: int = 0, y: int = 0) -> "Control":
|
| 86 |
+
"""Move cursor relative to current position.
|
| 87 |
+
|
| 88 |
+
Args:
|
| 89 |
+
x (int): X offset.
|
| 90 |
+
y (int): Y offset.
|
| 91 |
+
|
| 92 |
+
Returns:
|
| 93 |
+
~Control: Control object.
|
| 94 |
+
|
| 95 |
+
"""
|
| 96 |
+
|
| 97 |
+
def get_codes() -> Iterable[ControlCode]:
|
| 98 |
+
control = ControlType
|
| 99 |
+
if x:
|
| 100 |
+
yield (
|
| 101 |
+
control.CURSOR_FORWARD if x > 0 else control.CURSOR_BACKWARD,
|
| 102 |
+
abs(x),
|
| 103 |
+
)
|
| 104 |
+
if y:
|
| 105 |
+
yield (
|
| 106 |
+
control.CURSOR_DOWN if y > 0 else control.CURSOR_UP,
|
| 107 |
+
abs(y),
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
control = cls(*get_codes())
|
| 111 |
+
return control
|
| 112 |
+
|
| 113 |
+
@classmethod
|
| 114 |
+
def move_to_column(cls, x: int, y: int = 0) -> "Control":
|
| 115 |
+
"""Move to the given column, optionally add offset to row.
|
| 116 |
+
|
| 117 |
+
Returns:
|
| 118 |
+
x (int): absolute x (column)
|
| 119 |
+
y (int): optional y offset (row)
|
| 120 |
+
|
| 121 |
+
Returns:
|
| 122 |
+
~Control: Control object.
|
| 123 |
+
"""
|
| 124 |
+
|
| 125 |
+
return (
|
| 126 |
+
cls(
|
| 127 |
+
(ControlType.CURSOR_MOVE_TO_COLUMN, x),
|
| 128 |
+
(
|
| 129 |
+
ControlType.CURSOR_DOWN if y > 0 else ControlType.CURSOR_UP,
|
| 130 |
+
abs(y),
|
| 131 |
+
),
|
| 132 |
+
)
|
| 133 |
+
if y
|
| 134 |
+
else cls((ControlType.CURSOR_MOVE_TO_COLUMN, x))
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
@classmethod
|
| 138 |
+
def move_to(cls, x: int, y: int) -> "Control":
|
| 139 |
+
"""Move cursor to absolute position.
|
| 140 |
+
|
| 141 |
+
Args:
|
| 142 |
+
x (int): x offset (column)
|
| 143 |
+
y (int): y offset (row)
|
| 144 |
+
|
| 145 |
+
Returns:
|
| 146 |
+
~Control: Control object.
|
| 147 |
+
"""
|
| 148 |
+
return cls((ControlType.CURSOR_MOVE_TO, x, y))
|
| 149 |
+
|
| 150 |
+
@classmethod
|
| 151 |
+
def clear(cls) -> "Control":
|
| 152 |
+
"""Clear the screen."""
|
| 153 |
+
return cls(ControlType.CLEAR)
|
| 154 |
+
|
| 155 |
+
@classmethod
|
| 156 |
+
def show_cursor(cls, show: bool) -> "Control":
|
| 157 |
+
"""Show or hide the cursor."""
|
| 158 |
+
return cls(ControlType.SHOW_CURSOR if show else ControlType.HIDE_CURSOR)
|
| 159 |
+
|
| 160 |
+
@classmethod
|
| 161 |
+
def alt_screen(cls, enable: bool) -> "Control":
|
| 162 |
+
"""Enable or disable alt screen."""
|
| 163 |
+
if enable:
|
| 164 |
+
return cls(ControlType.ENABLE_ALT_SCREEN, ControlType.HOME)
|
| 165 |
+
else:
|
| 166 |
+
return cls(ControlType.DISABLE_ALT_SCREEN)
|
| 167 |
+
|
| 168 |
+
@classmethod
|
| 169 |
+
def title(cls, title: str) -> "Control":
|
| 170 |
+
"""Set the terminal window title
|
| 171 |
+
|
| 172 |
+
Args:
|
| 173 |
+
title (str): The new terminal window title
|
| 174 |
+
"""
|
| 175 |
+
return cls((ControlType.SET_WINDOW_TITLE, title))
|
| 176 |
+
|
| 177 |
+
def __str__(self) -> str:
|
| 178 |
+
return self.segment.text
|
| 179 |
+
|
| 180 |
+
def __rich_console__(
|
| 181 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 182 |
+
) -> "RenderResult":
|
| 183 |
+
if self.segment.text:
|
| 184 |
+
yield self.segment
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def strip_control_codes(
|
| 188 |
+
text: str, _translate_table: Dict[int, None] = _CONTROL_STRIP_TRANSLATE
|
| 189 |
+
) -> str:
|
| 190 |
+
"""Remove control codes from text.
|
| 191 |
+
|
| 192 |
+
Args:
|
| 193 |
+
text (str): A string possibly contain control codes.
|
| 194 |
+
|
| 195 |
+
Returns:
|
| 196 |
+
str: String with control codes removed.
|
| 197 |
+
"""
|
| 198 |
+
return text.translate(_translate_table)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def escape_control_codes(
|
| 202 |
+
text: str,
|
| 203 |
+
_translate_table: Dict[int, str] = CONTROL_ESCAPE,
|
| 204 |
+
) -> str:
|
| 205 |
+
"""Replace control codes with their "escaped" equivalent in the given text.
|
| 206 |
+
(e.g. "\b" becomes "\\b")
|
| 207 |
+
|
| 208 |
+
Args:
|
| 209 |
+
text (str): A string possibly containing control codes.
|
| 210 |
+
|
| 211 |
+
Returns:
|
| 212 |
+
str: String with control codes replaced with their escaped version.
|
| 213 |
+
"""
|
| 214 |
+
return text.translate(_translate_table)
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
if __name__ == "__main__": # pragma: no cover
|
| 218 |
+
from pip._vendor.rich.console import Console
|
| 219 |
+
|
| 220 |
+
console = Console()
|
| 221 |
+
console.print("Look at the title of your terminal window ^")
|
| 222 |
+
# console.print(Control((ControlType.SET_WINDOW_TITLE, "Hello, world!")))
|
| 223 |
+
for i in range(10):
|
| 224 |
+
console.set_window_title("🚀 Loading" + "." * i)
|
| 225 |
+
time.sleep(0.5)
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/json.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
from json import loads, dumps
|
| 3 |
+
from typing import Any, Callable, Optional, Union
|
| 4 |
+
|
| 5 |
+
from .text import Text
|
| 6 |
+
from .highlighter import JSONHighlighter, NullHighlighter
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class JSON:
|
| 10 |
+
"""A renderable which pretty prints JSON.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
json (str): JSON encoded data.
|
| 14 |
+
indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
|
| 15 |
+
highlight (bool, optional): Enable highlighting. Defaults to True.
|
| 16 |
+
skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
|
| 17 |
+
ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
|
| 18 |
+
check_circular (bool, optional): Check for circular references. Defaults to True.
|
| 19 |
+
allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
|
| 20 |
+
default (Callable, optional): A callable that converts values that can not be encoded
|
| 21 |
+
in to something that can be JSON encoded. Defaults to None.
|
| 22 |
+
sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
def __init__(
|
| 26 |
+
self,
|
| 27 |
+
json: str,
|
| 28 |
+
indent: Union[None, int, str] = 2,
|
| 29 |
+
highlight: bool = True,
|
| 30 |
+
skip_keys: bool = False,
|
| 31 |
+
ensure_ascii: bool = False,
|
| 32 |
+
check_circular: bool = True,
|
| 33 |
+
allow_nan: bool = True,
|
| 34 |
+
default: Optional[Callable[[Any], Any]] = None,
|
| 35 |
+
sort_keys: bool = False,
|
| 36 |
+
) -> None:
|
| 37 |
+
data = loads(json)
|
| 38 |
+
json = dumps(
|
| 39 |
+
data,
|
| 40 |
+
indent=indent,
|
| 41 |
+
skipkeys=skip_keys,
|
| 42 |
+
ensure_ascii=ensure_ascii,
|
| 43 |
+
check_circular=check_circular,
|
| 44 |
+
allow_nan=allow_nan,
|
| 45 |
+
default=default,
|
| 46 |
+
sort_keys=sort_keys,
|
| 47 |
+
)
|
| 48 |
+
highlighter = JSONHighlighter() if highlight else NullHighlighter()
|
| 49 |
+
self.text = highlighter(json)
|
| 50 |
+
self.text.no_wrap = True
|
| 51 |
+
self.text.overflow = None
|
| 52 |
+
|
| 53 |
+
@classmethod
|
| 54 |
+
def from_data(
|
| 55 |
+
cls,
|
| 56 |
+
data: Any,
|
| 57 |
+
indent: Union[None, int, str] = 2,
|
| 58 |
+
highlight: bool = True,
|
| 59 |
+
skip_keys: bool = False,
|
| 60 |
+
ensure_ascii: bool = False,
|
| 61 |
+
check_circular: bool = True,
|
| 62 |
+
allow_nan: bool = True,
|
| 63 |
+
default: Optional[Callable[[Any], Any]] = None,
|
| 64 |
+
sort_keys: bool = False,
|
| 65 |
+
) -> "JSON":
|
| 66 |
+
"""Encodes a JSON object from arbitrary data.
|
| 67 |
+
|
| 68 |
+
Args:
|
| 69 |
+
data (Any): An object that may be encoded in to JSON
|
| 70 |
+
indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
|
| 71 |
+
highlight (bool, optional): Enable highlighting. Defaults to True.
|
| 72 |
+
default (Callable, optional): Optional callable which will be called for objects that cannot be serialized. Defaults to None.
|
| 73 |
+
skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
|
| 74 |
+
ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
|
| 75 |
+
check_circular (bool, optional): Check for circular references. Defaults to True.
|
| 76 |
+
allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
|
| 77 |
+
default (Callable, optional): A callable that converts values that can not be encoded
|
| 78 |
+
in to something that can be JSON encoded. Defaults to None.
|
| 79 |
+
sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
|
| 80 |
+
|
| 81 |
+
Returns:
|
| 82 |
+
JSON: New JSON object from the given data.
|
| 83 |
+
"""
|
| 84 |
+
json_instance: "JSON" = cls.__new__(cls)
|
| 85 |
+
json = dumps(
|
| 86 |
+
data,
|
| 87 |
+
indent=indent,
|
| 88 |
+
skipkeys=skip_keys,
|
| 89 |
+
ensure_ascii=ensure_ascii,
|
| 90 |
+
check_circular=check_circular,
|
| 91 |
+
allow_nan=allow_nan,
|
| 92 |
+
default=default,
|
| 93 |
+
sort_keys=sort_keys,
|
| 94 |
+
)
|
| 95 |
+
highlighter = JSONHighlighter() if highlight else NullHighlighter()
|
| 96 |
+
json_instance.text = highlighter(json)
|
| 97 |
+
json_instance.text.no_wrap = True
|
| 98 |
+
json_instance.text.overflow = None
|
| 99 |
+
return json_instance
|
| 100 |
+
|
| 101 |
+
def __rich__(self) -> Text:
|
| 102 |
+
return self.text
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
if __name__ == "__main__":
|
| 106 |
+
import argparse
|
| 107 |
+
import sys
|
| 108 |
+
|
| 109 |
+
parser = argparse.ArgumentParser(description="Pretty print json")
|
| 110 |
+
parser.add_argument(
|
| 111 |
+
"path",
|
| 112 |
+
metavar="PATH",
|
| 113 |
+
help="path to file, or - for stdin",
|
| 114 |
+
)
|
| 115 |
+
parser.add_argument(
|
| 116 |
+
"-i",
|
| 117 |
+
"--indent",
|
| 118 |
+
metavar="SPACES",
|
| 119 |
+
type=int,
|
| 120 |
+
help="Number of spaces in an indent",
|
| 121 |
+
default=2,
|
| 122 |
+
)
|
| 123 |
+
args = parser.parse_args()
|
| 124 |
+
|
| 125 |
+
from pip._vendor.rich.console import Console
|
| 126 |
+
|
| 127 |
+
console = Console()
|
| 128 |
+
error_console = Console(stderr=True)
|
| 129 |
+
|
| 130 |
+
try:
|
| 131 |
+
if args.path == "-":
|
| 132 |
+
json_data = sys.stdin.read()
|
| 133 |
+
else:
|
| 134 |
+
json_data = Path(args.path).read_text()
|
| 135 |
+
except Exception as error:
|
| 136 |
+
error_console.print(f"Unable to read {args.path!r}; {error}")
|
| 137 |
+
sys.exit(-1)
|
| 138 |
+
|
| 139 |
+
console.print(JSON(json_data, indent=args.indent), soft_wrap=True)
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/palette.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from math import sqrt
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
from typing import Sequence, Tuple, TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
from .color_triplet import ColorTriplet
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from pip._vendor.rich.table import Table
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Palette:
|
| 12 |
+
"""A palette of available colors."""
|
| 13 |
+
|
| 14 |
+
def __init__(self, colors: Sequence[Tuple[int, int, int]]):
|
| 15 |
+
self._colors = colors
|
| 16 |
+
|
| 17 |
+
def __getitem__(self, number: int) -> ColorTriplet:
|
| 18 |
+
return ColorTriplet(*self._colors[number])
|
| 19 |
+
|
| 20 |
+
def __rich__(self) -> "Table":
|
| 21 |
+
from pip._vendor.rich.color import Color
|
| 22 |
+
from pip._vendor.rich.style import Style
|
| 23 |
+
from pip._vendor.rich.text import Text
|
| 24 |
+
from pip._vendor.rich.table import Table
|
| 25 |
+
|
| 26 |
+
table = Table(
|
| 27 |
+
"index",
|
| 28 |
+
"RGB",
|
| 29 |
+
"Color",
|
| 30 |
+
title="Palette",
|
| 31 |
+
caption=f"{len(self._colors)} colors",
|
| 32 |
+
highlight=True,
|
| 33 |
+
caption_justify="right",
|
| 34 |
+
)
|
| 35 |
+
for index, color in enumerate(self._colors):
|
| 36 |
+
table.add_row(
|
| 37 |
+
str(index),
|
| 38 |
+
repr(color),
|
| 39 |
+
Text(" " * 16, style=Style(bgcolor=Color.from_rgb(*color))),
|
| 40 |
+
)
|
| 41 |
+
return table
|
| 42 |
+
|
| 43 |
+
# This is somewhat inefficient and needs caching
|
| 44 |
+
@lru_cache(maxsize=1024)
|
| 45 |
+
def match(self, color: Tuple[int, int, int]) -> int:
|
| 46 |
+
"""Find a color from a palette that most closely matches a given color.
|
| 47 |
+
|
| 48 |
+
Args:
|
| 49 |
+
color (Tuple[int, int, int]): RGB components in range 0 > 255.
|
| 50 |
+
|
| 51 |
+
Returns:
|
| 52 |
+
int: Index of closes matching color.
|
| 53 |
+
"""
|
| 54 |
+
red1, green1, blue1 = color
|
| 55 |
+
_sqrt = sqrt
|
| 56 |
+
get_color = self._colors.__getitem__
|
| 57 |
+
|
| 58 |
+
def get_color_distance(index: int) -> float:
|
| 59 |
+
"""Get the distance to a color."""
|
| 60 |
+
red2, green2, blue2 = get_color(index)
|
| 61 |
+
red_mean = (red1 + red2) // 2
|
| 62 |
+
red = red1 - red2
|
| 63 |
+
green = green1 - green2
|
| 64 |
+
blue = blue1 - blue2
|
| 65 |
+
return _sqrt(
|
| 66 |
+
(((512 + red_mean) * red * red) >> 8)
|
| 67 |
+
+ 4 * green * green
|
| 68 |
+
+ (((767 - red_mean) * blue * blue) >> 8)
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
min_index = min(range(len(self._colors)), key=get_color_distance)
|
| 72 |
+
return min_index
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__": # pragma: no cover
|
| 76 |
+
import colorsys
|
| 77 |
+
from typing import Iterable
|
| 78 |
+
from pip._vendor.rich.color import Color
|
| 79 |
+
from pip._vendor.rich.console import Console, ConsoleOptions
|
| 80 |
+
from pip._vendor.rich.segment import Segment
|
| 81 |
+
from pip._vendor.rich.style import Style
|
| 82 |
+
|
| 83 |
+
class ColorBox:
|
| 84 |
+
def __rich_console__(
|
| 85 |
+
self, console: Console, options: ConsoleOptions
|
| 86 |
+
) -> Iterable[Segment]:
|
| 87 |
+
height = console.size.height - 3
|
| 88 |
+
for y in range(0, height):
|
| 89 |
+
for x in range(options.max_width):
|
| 90 |
+
h = x / options.max_width
|
| 91 |
+
l = y / (height + 1)
|
| 92 |
+
r1, g1, b1 = colorsys.hls_to_rgb(h, l, 1.0)
|
| 93 |
+
r2, g2, b2 = colorsys.hls_to_rgb(h, l + (1 / height / 2), 1.0)
|
| 94 |
+
bgcolor = Color.from_rgb(r1 * 255, g1 * 255, b1 * 255)
|
| 95 |
+
color = Color.from_rgb(r2 * 255, g2 * 255, b2 * 255)
|
| 96 |
+
yield Segment("▄", Style(color=color, bgcolor=bgcolor))
|
| 97 |
+
yield Segment.line()
|
| 98 |
+
|
| 99 |
+
console = Console()
|
| 100 |
+
console.print(ColorBox())
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/progress_bar.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import math
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
from time import monotonic
|
| 4 |
+
from typing import Iterable, List, Optional
|
| 5 |
+
|
| 6 |
+
from .color import Color, blend_rgb
|
| 7 |
+
from .color_triplet import ColorTriplet
|
| 8 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 9 |
+
from .jupyter import JupyterMixin
|
| 10 |
+
from .measure import Measurement
|
| 11 |
+
from .segment import Segment
|
| 12 |
+
from .style import Style, StyleType
|
| 13 |
+
|
| 14 |
+
# Number of characters before 'pulse' animation repeats
|
| 15 |
+
PULSE_SIZE = 20
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class ProgressBar(JupyterMixin):
|
| 19 |
+
"""Renders a (progress) bar. Used by rich.progress.
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
total (float, optional): Number of steps in the bar. Defaults to 100. Set to None to render a pulsing animation.
|
| 23 |
+
completed (float, optional): Number of steps completed. Defaults to 0.
|
| 24 |
+
width (int, optional): Width of the bar, or ``None`` for maximum width. Defaults to None.
|
| 25 |
+
pulse (bool, optional): Enable pulse effect. Defaults to False. Will pulse if a None total was passed.
|
| 26 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 27 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 28 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 29 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 30 |
+
animation_time (Optional[float], optional): Time in seconds to use for animation, or None to use system time.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
def __init__(
|
| 34 |
+
self,
|
| 35 |
+
total: Optional[float] = 100.0,
|
| 36 |
+
completed: float = 0,
|
| 37 |
+
width: Optional[int] = None,
|
| 38 |
+
pulse: bool = False,
|
| 39 |
+
style: StyleType = "bar.back",
|
| 40 |
+
complete_style: StyleType = "bar.complete",
|
| 41 |
+
finished_style: StyleType = "bar.finished",
|
| 42 |
+
pulse_style: StyleType = "bar.pulse",
|
| 43 |
+
animation_time: Optional[float] = None,
|
| 44 |
+
):
|
| 45 |
+
self.total = total
|
| 46 |
+
self.completed = completed
|
| 47 |
+
self.width = width
|
| 48 |
+
self.pulse = pulse
|
| 49 |
+
self.style = style
|
| 50 |
+
self.complete_style = complete_style
|
| 51 |
+
self.finished_style = finished_style
|
| 52 |
+
self.pulse_style = pulse_style
|
| 53 |
+
self.animation_time = animation_time
|
| 54 |
+
|
| 55 |
+
self._pulse_segments: Optional[List[Segment]] = None
|
| 56 |
+
|
| 57 |
+
def __repr__(self) -> str:
|
| 58 |
+
return f"<Bar {self.completed!r} of {self.total!r}>"
|
| 59 |
+
|
| 60 |
+
@property
|
| 61 |
+
def percentage_completed(self) -> Optional[float]:
|
| 62 |
+
"""Calculate percentage complete."""
|
| 63 |
+
if self.total is None:
|
| 64 |
+
return None
|
| 65 |
+
completed = (self.completed / self.total) * 100.0
|
| 66 |
+
completed = min(100, max(0.0, completed))
|
| 67 |
+
return completed
|
| 68 |
+
|
| 69 |
+
@lru_cache(maxsize=16)
|
| 70 |
+
def _get_pulse_segments(
|
| 71 |
+
self,
|
| 72 |
+
fore_style: Style,
|
| 73 |
+
back_style: Style,
|
| 74 |
+
color_system: str,
|
| 75 |
+
no_color: bool,
|
| 76 |
+
ascii: bool = False,
|
| 77 |
+
) -> List[Segment]:
|
| 78 |
+
"""Get a list of segments to render a pulse animation.
|
| 79 |
+
|
| 80 |
+
Returns:
|
| 81 |
+
List[Segment]: A list of segments, one segment per character.
|
| 82 |
+
"""
|
| 83 |
+
bar = "-" if ascii else "━"
|
| 84 |
+
segments: List[Segment] = []
|
| 85 |
+
if color_system not in ("standard", "eight_bit", "truecolor") or no_color:
|
| 86 |
+
segments += [Segment(bar, fore_style)] * (PULSE_SIZE // 2)
|
| 87 |
+
segments += [Segment(" " if no_color else bar, back_style)] * (
|
| 88 |
+
PULSE_SIZE - (PULSE_SIZE // 2)
|
| 89 |
+
)
|
| 90 |
+
return segments
|
| 91 |
+
|
| 92 |
+
append = segments.append
|
| 93 |
+
fore_color = (
|
| 94 |
+
fore_style.color.get_truecolor()
|
| 95 |
+
if fore_style.color
|
| 96 |
+
else ColorTriplet(255, 0, 255)
|
| 97 |
+
)
|
| 98 |
+
back_color = (
|
| 99 |
+
back_style.color.get_truecolor()
|
| 100 |
+
if back_style.color
|
| 101 |
+
else ColorTriplet(0, 0, 0)
|
| 102 |
+
)
|
| 103 |
+
cos = math.cos
|
| 104 |
+
pi = math.pi
|
| 105 |
+
_Segment = Segment
|
| 106 |
+
_Style = Style
|
| 107 |
+
from_triplet = Color.from_triplet
|
| 108 |
+
|
| 109 |
+
for index in range(PULSE_SIZE):
|
| 110 |
+
position = index / PULSE_SIZE
|
| 111 |
+
fade = 0.5 + cos(position * pi * 2) / 2.0
|
| 112 |
+
color = blend_rgb(fore_color, back_color, cross_fade=fade)
|
| 113 |
+
append(_Segment(bar, _Style(color=from_triplet(color))))
|
| 114 |
+
return segments
|
| 115 |
+
|
| 116 |
+
def update(self, completed: float, total: Optional[float] = None) -> None:
|
| 117 |
+
"""Update progress with new values.
|
| 118 |
+
|
| 119 |
+
Args:
|
| 120 |
+
completed (float): Number of steps completed.
|
| 121 |
+
total (float, optional): Total number of steps, or ``None`` to not change. Defaults to None.
|
| 122 |
+
"""
|
| 123 |
+
self.completed = completed
|
| 124 |
+
self.total = total if total is not None else self.total
|
| 125 |
+
|
| 126 |
+
def _render_pulse(
|
| 127 |
+
self, console: Console, width: int, ascii: bool = False
|
| 128 |
+
) -> Iterable[Segment]:
|
| 129 |
+
"""Renders the pulse animation.
|
| 130 |
+
|
| 131 |
+
Args:
|
| 132 |
+
console (Console): Console instance.
|
| 133 |
+
width (int): Width in characters of pulse animation.
|
| 134 |
+
|
| 135 |
+
Returns:
|
| 136 |
+
RenderResult: [description]
|
| 137 |
+
|
| 138 |
+
Yields:
|
| 139 |
+
Iterator[Segment]: Segments to render pulse
|
| 140 |
+
"""
|
| 141 |
+
fore_style = console.get_style(self.pulse_style, default="white")
|
| 142 |
+
back_style = console.get_style(self.style, default="black")
|
| 143 |
+
|
| 144 |
+
pulse_segments = self._get_pulse_segments(
|
| 145 |
+
fore_style, back_style, console.color_system, console.no_color, ascii=ascii
|
| 146 |
+
)
|
| 147 |
+
segment_count = len(pulse_segments)
|
| 148 |
+
current_time = (
|
| 149 |
+
monotonic() if self.animation_time is None else self.animation_time
|
| 150 |
+
)
|
| 151 |
+
segments = pulse_segments * (int(width / segment_count) + 2)
|
| 152 |
+
offset = int(-current_time * 15) % segment_count
|
| 153 |
+
segments = segments[offset : offset + width]
|
| 154 |
+
yield from segments
|
| 155 |
+
|
| 156 |
+
def __rich_console__(
|
| 157 |
+
self, console: Console, options: ConsoleOptions
|
| 158 |
+
) -> RenderResult:
|
| 159 |
+
width = min(self.width or options.max_width, options.max_width)
|
| 160 |
+
ascii = options.legacy_windows or options.ascii_only
|
| 161 |
+
should_pulse = self.pulse or self.total is None
|
| 162 |
+
if should_pulse:
|
| 163 |
+
yield from self._render_pulse(console, width, ascii=ascii)
|
| 164 |
+
return
|
| 165 |
+
|
| 166 |
+
completed: Optional[float] = (
|
| 167 |
+
min(self.total, max(0, self.completed)) if self.total is not None else None
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
bar = "-" if ascii else "━"
|
| 171 |
+
half_bar_right = " " if ascii else "╸"
|
| 172 |
+
half_bar_left = " " if ascii else "╺"
|
| 173 |
+
complete_halves = (
|
| 174 |
+
int(width * 2 * completed / self.total)
|
| 175 |
+
if self.total and completed is not None
|
| 176 |
+
else width * 2
|
| 177 |
+
)
|
| 178 |
+
bar_count = complete_halves // 2
|
| 179 |
+
half_bar_count = complete_halves % 2
|
| 180 |
+
style = console.get_style(self.style)
|
| 181 |
+
is_finished = self.total is None or self.completed >= self.total
|
| 182 |
+
complete_style = console.get_style(
|
| 183 |
+
self.finished_style if is_finished else self.complete_style
|
| 184 |
+
)
|
| 185 |
+
_Segment = Segment
|
| 186 |
+
if bar_count:
|
| 187 |
+
yield _Segment(bar * bar_count, complete_style)
|
| 188 |
+
if half_bar_count:
|
| 189 |
+
yield _Segment(half_bar_right * half_bar_count, complete_style)
|
| 190 |
+
|
| 191 |
+
if not console.no_color:
|
| 192 |
+
remaining_bars = width - bar_count - half_bar_count
|
| 193 |
+
if remaining_bars and console.color_system is not None:
|
| 194 |
+
if not half_bar_count and bar_count:
|
| 195 |
+
yield _Segment(half_bar_left, style)
|
| 196 |
+
remaining_bars -= 1
|
| 197 |
+
if remaining_bars:
|
| 198 |
+
yield _Segment(bar * remaining_bars, style)
|
| 199 |
+
|
| 200 |
+
def __rich_measure__(
|
| 201 |
+
self, console: Console, options: ConsoleOptions
|
| 202 |
+
) -> Measurement:
|
| 203 |
+
return (
|
| 204 |
+
Measurement(self.width, self.width)
|
| 205 |
+
if self.width is not None
|
| 206 |
+
else Measurement(4, options.max_width)
|
| 207 |
+
)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
if __name__ == "__main__": # pragma: no cover
|
| 211 |
+
console = Console()
|
| 212 |
+
bar = ProgressBar(width=50, total=100)
|
| 213 |
+
|
| 214 |
+
import time
|
| 215 |
+
|
| 216 |
+
console.show_cursor(False)
|
| 217 |
+
for n in range(0, 101, 1):
|
| 218 |
+
bar.update(n)
|
| 219 |
+
console.print(bar)
|
| 220 |
+
console.file.write("\r")
|
| 221 |
+
time.sleep(0.05)
|
| 222 |
+
console.show_cursor(True)
|
| 223 |
+
console.print()
|
mantis_evalkit/lib/python3.10/site-packages/pip/_vendor/rich/repr.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import inspect
|
| 2 |
+
from functools import partial
|
| 3 |
+
from typing import (
|
| 4 |
+
Any,
|
| 5 |
+
Callable,
|
| 6 |
+
Iterable,
|
| 7 |
+
List,
|
| 8 |
+
Optional,
|
| 9 |
+
Tuple,
|
| 10 |
+
Type,
|
| 11 |
+
TypeVar,
|
| 12 |
+
Union,
|
| 13 |
+
overload,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
T = TypeVar("T")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
Result = Iterable[Union[Any, Tuple[Any], Tuple[str, Any], Tuple[str, Any, Any]]]
|
| 20 |
+
RichReprResult = Result
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class ReprError(Exception):
|
| 24 |
+
"""An error occurred when attempting to build a repr."""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
@overload
|
| 28 |
+
def auto(cls: Optional[Type[T]]) -> Type[T]:
|
| 29 |
+
...
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
@overload
|
| 33 |
+
def auto(*, angular: bool = False) -> Callable[[Type[T]], Type[T]]:
|
| 34 |
+
...
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def auto(
|
| 38 |
+
cls: Optional[Type[T]] = None, *, angular: Optional[bool] = None
|
| 39 |
+
) -> Union[Type[T], Callable[[Type[T]], Type[T]]]:
|
| 40 |
+
"""Class decorator to create __repr__ from __rich_repr__"""
|
| 41 |
+
|
| 42 |
+
def do_replace(cls: Type[T], angular: Optional[bool] = None) -> Type[T]:
|
| 43 |
+
def auto_repr(self: T) -> str:
|
| 44 |
+
"""Create repr string from __rich_repr__"""
|
| 45 |
+
repr_str: List[str] = []
|
| 46 |
+
append = repr_str.append
|
| 47 |
+
|
| 48 |
+
angular: bool = getattr(self.__rich_repr__, "angular", False) # type: ignore[attr-defined]
|
| 49 |
+
for arg in self.__rich_repr__(): # type: ignore[attr-defined]
|
| 50 |
+
if isinstance(arg, tuple):
|
| 51 |
+
if len(arg) == 1:
|
| 52 |
+
append(repr(arg[0]))
|
| 53 |
+
else:
|
| 54 |
+
key, value, *default = arg
|
| 55 |
+
if key is None:
|
| 56 |
+
append(repr(value))
|
| 57 |
+
else:
|
| 58 |
+
if default and default[0] == value:
|
| 59 |
+
continue
|
| 60 |
+
append(f"{key}={value!r}")
|
| 61 |
+
else:
|
| 62 |
+
append(repr(arg))
|
| 63 |
+
if angular:
|
| 64 |
+
return f"<{self.__class__.__name__} {' '.join(repr_str)}>"
|
| 65 |
+
else:
|
| 66 |
+
return f"{self.__class__.__name__}({', '.join(repr_str)})"
|
| 67 |
+
|
| 68 |
+
def auto_rich_repr(self: Type[T]) -> Result:
|
| 69 |
+
"""Auto generate __rich_rep__ from signature of __init__"""
|
| 70 |
+
try:
|
| 71 |
+
signature = inspect.signature(self.__init__)
|
| 72 |
+
for name, param in signature.parameters.items():
|
| 73 |
+
if param.kind == param.POSITIONAL_ONLY:
|
| 74 |
+
yield getattr(self, name)
|
| 75 |
+
elif param.kind in (
|
| 76 |
+
param.POSITIONAL_OR_KEYWORD,
|
| 77 |
+
param.KEYWORD_ONLY,
|
| 78 |
+
):
|
| 79 |
+
if param.default is param.empty:
|
| 80 |
+
yield getattr(self, param.name)
|
| 81 |
+
else:
|
| 82 |
+
yield param.name, getattr(self, param.name), param.default
|
| 83 |
+
except Exception as error:
|
| 84 |
+
raise ReprError(
|
| 85 |
+
f"Failed to auto generate __rich_repr__; {error}"
|
| 86 |
+
) from None
|
| 87 |
+
|
| 88 |
+
if not hasattr(cls, "__rich_repr__"):
|
| 89 |
+
auto_rich_repr.__doc__ = "Build a rich repr"
|
| 90 |
+
cls.__rich_repr__ = auto_rich_repr # type: ignore[attr-defined]
|
| 91 |
+
|
| 92 |
+
auto_repr.__doc__ = "Return repr(self)"
|
| 93 |
+
cls.__repr__ = auto_repr # type: ignore[assignment]
|
| 94 |
+
if angular is not None:
|
| 95 |
+
cls.__rich_repr__.angular = angular # type: ignore[attr-defined]
|
| 96 |
+
return cls
|
| 97 |
+
|
| 98 |
+
if cls is None:
|
| 99 |
+
return partial(do_replace, angular=angular)
|
| 100 |
+
else:
|
| 101 |
+
return do_replace(cls, angular=angular)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
@overload
|
| 105 |
+
def rich_repr(cls: Optional[Type[T]]) -> Type[T]:
|
| 106 |
+
...
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
@overload
|
| 110 |
+
def rich_repr(*, angular: bool = False) -> Callable[[Type[T]], Type[T]]:
|
| 111 |
+
...
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def rich_repr(
|
| 115 |
+
cls: Optional[Type[T]] = None, *, angular: bool = False
|
| 116 |
+
) -> Union[Type[T], Callable[[Type[T]], Type[T]]]:
|
| 117 |
+
if cls is None:
|
| 118 |
+
return auto(angular=angular)
|
| 119 |
+
else:
|
| 120 |
+
return auto(cls)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
if __name__ == "__main__":
|
| 124 |
+
|
| 125 |
+
@auto
|
| 126 |
+
class Foo:
|
| 127 |
+
def __rich_repr__(self) -> Result:
|
| 128 |
+
yield "foo"
|
| 129 |
+
yield "bar", {"shopping": ["eggs", "ham", "pineapple"]}
|
| 130 |
+
yield "buy", "hand sanitizer"
|
| 131 |
+
|
| 132 |
+
foo = Foo()
|
| 133 |
+
from pip._vendor.rich.console import Console
|
| 134 |
+
|
| 135 |
+
console = Console()
|
| 136 |
+
|
| 137 |
+
console.rule("Standard repr")
|
| 138 |
+
console.print(foo)
|
| 139 |
+
|
| 140 |
+
console.print(foo, width=60)
|
| 141 |
+
console.print(foo, width=30)
|
| 142 |
+
|
| 143 |
+
console.rule("Angular repr")
|
| 144 |
+
Foo.__rich_repr__.angular = True # type: ignore[attr-defined]
|
| 145 |
+
|
| 146 |
+
console.print(foo)
|
| 147 |
+
|
| 148 |
+
console.print(foo, width=60)
|
| 149 |
+
console.print(foo, width=30)
|
moondream/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f2bdedabfaa94cb60038eb16b2342c3c87909a238dbdc4928f4d4994fc7a971
|
| 3 |
+
size 154766
|
moondream/lib/python3.10/site-packages/torch/_decomp/__pycache__/decompositions.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e3c3fe84db82e9590615c7dffaccd80972e5844d084f9e2db795fe8ae83e588
|
| 3 |
+
size 109721
|
moondream/lib/python3.10/site-packages/torch/distributed/__pycache__/distributed_c10d.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c7653865eee05fc57a16a333bf03f5a20d108d21ea64fbf5f5318b4b67668498
|
| 3 |
+
size 133059
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_convert_indices_from_coo_to_csr_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cuda {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor _convert_indices_from_coo_to_csr(const at::Tensor & self, int64_t size, bool out_int32=false);
|
| 21 |
+
TORCH_API at::Tensor & _convert_indices_from_coo_to_csr_out(at::Tensor & out, const at::Tensor & self, int64_t size, bool out_int32=false);
|
| 22 |
+
TORCH_API at::Tensor & _convert_indices_from_coo_to_csr_outf(const at::Tensor & self, int64_t size, bool out_int32, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace cuda
|
| 25 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_clamp_max_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cuda {
|
| 19 |
+
|
| 20 |
+
TORCH_API ::std::vector<at::Tensor> _foreach_clamp_max(at::TensorList self, const at::Scalar & scalar);
|
| 21 |
+
TORCH_API void _foreach_clamp_max_(at::TensorList self, const at::Scalar & scalar);
|
| 22 |
+
TORCH_API ::std::vector<at::Tensor> _foreach_clamp_max(at::TensorList self, at::TensorList other);
|
| 23 |
+
TORCH_API void _foreach_clamp_max_(at::TensorList self, at::TensorList other);
|
| 24 |
+
TORCH_API ::std::vector<at::Tensor> _foreach_clamp_max(at::TensorList self, at::ArrayRef<at::Scalar> scalars);
|
| 25 |
+
TORCH_API void _foreach_clamp_max_(at::TensorList self, at::ArrayRef<at::Scalar> scalars);
|
| 26 |
+
|
| 27 |
+
} // namespace cuda
|
| 28 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_log2.h
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/_foreach_log2_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::_foreach_log2(Tensor[] self) -> Tensor[]
|
| 26 |
+
inline ::std::vector<at::Tensor> _foreach_log2(at::TensorList self) {
|
| 27 |
+
return at::_ops::_foreach_log2::call(self);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// aten::_foreach_log2_(Tensor(a!)[] self) -> ()
|
| 31 |
+
inline void _foreach_log2_(at::TensorList self) {
|
| 32 |
+
return at::_ops::_foreach_log2_::call(self);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
// aten::_foreach_log2.out(Tensor[] self, *, Tensor(a!)[] out) -> ()
|
| 36 |
+
inline void _foreach_log2_out(at::TensorList out, at::TensorList self) {
|
| 37 |
+
return at::_ops::_foreach_log2_out::call(self, out);
|
| 38 |
+
}
|
| 39 |
+
// aten::_foreach_log2.out(Tensor[] self, *, Tensor(a!)[] out) -> ()
|
| 40 |
+
inline void _foreach_log2_outf(at::TensorList self, at::TensorList out) {
|
| 41 |
+
return at::_ops::_foreach_log2_out::call(self, out);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_lazy_clone_ops.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API _lazy_clone {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_lazy_clone")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_lazy_clone(Tensor self) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_mps_convolution_transpose_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor & _mps_convolution_transpose_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef output_padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups);
|
| 21 |
+
TORCH_API at::Tensor & _mps_convolution_transpose_outf(const at::Tensor & self, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef output_padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, at::Tensor & out);
|
| 22 |
+
TORCH_API at::Tensor & _mps_convolution_transpose_symint_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef output_padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups);
|
| 23 |
+
TORCH_API at::Tensor & _mps_convolution_transpose_symint_outf(const at::Tensor & self, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef output_padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, at::Tensor & out);
|
| 24 |
+
|
| 25 |
+
} // namespace compositeexplicitautograd
|
| 26 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_reshape_alias_ops.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API _reshape_alias {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, c10::SymIntArrayRef, c10::SymIntArrayRef);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_reshape_alias")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_reshape_alias(Tensor(a) self, SymInt[] size, SymInt[] stride) -> Tensor(a)")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self, c10::SymIntArrayRef size, c10::SymIntArrayRef stride);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef size, c10::SymIntArrayRef stride);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_compressed_tensor_unsafe.h
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/_sparse_compressed_tensor_unsafe_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::_sparse_compressed_tensor_unsafe(Tensor compressed_indices, Tensor plain_indices, Tensor values, SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 26 |
+
inline at::Tensor _sparse_compressed_tensor_unsafe(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, at::IntArrayRef size, at::TensorOptions options={}) {
|
| 27 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, c10::fromIntArrayRefSlow(size), c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 28 |
+
}
|
| 29 |
+
namespace symint {
|
| 30 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 31 |
+
at::Tensor _sparse_compressed_tensor_unsafe(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, at::IntArrayRef size, at::TensorOptions options={}) {
|
| 32 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, c10::fromIntArrayRefSlow(size), c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
// aten::_sparse_compressed_tensor_unsafe(Tensor compressed_indices, Tensor plain_indices, Tensor values, SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 37 |
+
inline at::Tensor _sparse_compressed_tensor_unsafe(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, at::IntArrayRef size, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 38 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, c10::fromIntArrayRefSlow(size), dtype, layout, device, pin_memory);
|
| 39 |
+
}
|
| 40 |
+
namespace symint {
|
| 41 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 42 |
+
at::Tensor _sparse_compressed_tensor_unsafe(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, at::IntArrayRef size, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 43 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, c10::fromIntArrayRefSlow(size), dtype, layout, device, pin_memory);
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// aten::_sparse_compressed_tensor_unsafe(Tensor compressed_indices, Tensor plain_indices, Tensor values, SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 48 |
+
inline at::Tensor _sparse_compressed_tensor_unsafe_symint(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, c10::SymIntArrayRef size, at::TensorOptions options={}) {
|
| 49 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, size, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 50 |
+
}
|
| 51 |
+
namespace symint {
|
| 52 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 53 |
+
at::Tensor _sparse_compressed_tensor_unsafe(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, c10::SymIntArrayRef size, at::TensorOptions options={}) {
|
| 54 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, size, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// aten::_sparse_compressed_tensor_unsafe(Tensor compressed_indices, Tensor plain_indices, Tensor values, SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 59 |
+
inline at::Tensor _sparse_compressed_tensor_unsafe_symint(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, c10::SymIntArrayRef size, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 60 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, size, dtype, layout, device, pin_memory);
|
| 61 |
+
}
|
| 62 |
+
namespace symint {
|
| 63 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 64 |
+
at::Tensor _sparse_compressed_tensor_unsafe(const at::Tensor & compressed_indices, const at::Tensor & plain_indices, const at::Tensor & values, c10::SymIntArrayRef size, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 65 |
+
return at::_ops::_sparse_compressed_tensor_unsafe::call(compressed_indices, plain_indices, values, size, dtype, layout, device, pin_memory);
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
}
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_softmax_backward_data_native.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <tuple>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API at::Tensor & _sparse_softmax_backward_data_out(const at::Tensor & grad_output, const at::Tensor & output, int64_t dim, const at::Tensor & self, at::Tensor & out);
|
| 20 |
+
TORCH_API at::Tensor softmax_backward_sparse_cpu(const at::Tensor & grad_output, const at::Tensor & output, int64_t dim, const at::Tensor & self);
|
| 21 |
+
TORCH_API at::Tensor softmax_backward_sparse_cuda(const at::Tensor & grad_output, const at::Tensor & output, int64_t dim, const at::Tensor & self);
|
| 22 |
+
} // namespace native
|
| 23 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_to_copy_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor _to_copy(const at::Tensor & self, at::TensorOptions options={}, bool non_blocking=false, c10::optional<at::MemoryFormat> memory_format=c10::nullopt);
|
| 21 |
+
TORCH_API at::Tensor _to_copy(const at::Tensor & self, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory, bool non_blocking, c10::optional<at::MemoryFormat> memory_format);
|
| 22 |
+
TORCH_API at::Tensor & _to_copy_out(at::Tensor & out, const at::Tensor & self, bool non_blocking=false, c10::optional<at::MemoryFormat> memory_format=c10::nullopt);
|
| 23 |
+
TORCH_API at::Tensor & _to_copy_outf(const at::Tensor & self, bool non_blocking, c10::optional<at::MemoryFormat> memory_format, at::Tensor & out);
|
| 24 |
+
|
| 25 |
+
} // namespace compositeexplicitautograd
|
| 26 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_upsample_bilinear2d_aa_meta.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeMetaFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/TensorIterator.h>
|
| 13 |
+
#include <ATen/TensorMeta.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
struct TORCH_API structured__upsample_bilinear2d_aa : public at::impl::MetaBase {
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
void meta(const at::Tensor & self, at::ArrayRef<int64_t> output_size, bool align_corners, c10::optional<double> scales_h, c10::optional<double> scales_w);
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
} // namespace native
|
| 27 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/_validate_sparse_csr_tensor_args_ops.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API _validate_sparse_csr_tensor_args {
|
| 18 |
+
using schema = void (const at::Tensor &, const at::Tensor &, const at::Tensor &, at::IntArrayRef);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_validate_sparse_csr_tensor_args")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_validate_sparse_csr_tensor_args(Tensor crow_indices, Tensor col_indices, Tensor values, int[] size) -> ()")
|
| 24 |
+
static void call(const at::Tensor & crow_indices, const at::Tensor & col_indices, const at::Tensor & values, at::IntArrayRef size);
|
| 25 |
+
static void redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & crow_indices, const at::Tensor & col_indices, const at::Tensor & values, at::IntArrayRef size);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/adaptive_max_pool2d_backward_meta.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeMetaFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/TensorIterator.h>
|
| 13 |
+
#include <ATen/TensorMeta.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
struct TORCH_API structured_adaptive_max_pool2d_backward : public at::impl::MetaBase {
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
void meta(const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & indices);
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
} // namespace native
|
| 27 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/align_to_native.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <tuple>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API at::Tensor align_to(const at::Tensor & self, at::DimnameList names);
|
| 20 |
+
TORCH_API at::Tensor align_to(const at::Tensor & self, at::DimnameList order, int64_t ellipsis_idx);
|
| 21 |
+
} // namespace native
|
| 22 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/align_to_ops.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API align_to {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, at::DimnameList);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::align_to")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "align_to(Tensor(a) self, Dimname[] names) -> Tensor(a)")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self, at::DimnameList names);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::DimnameList names);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API align_to_ellipsis_idx {
|
| 29 |
+
using schema = at::Tensor (const at::Tensor &, at::DimnameList, int64_t);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::align_to")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "ellipsis_idx")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "align_to.ellipsis_idx(Tensor(a) self, Dimname[] order, int ellipsis_idx) -> Tensor(a)")
|
| 35 |
+
static at::Tensor call(const at::Tensor & self, at::DimnameList order, int64_t ellipsis_idx);
|
| 36 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::DimnameList order, int64_t ellipsis_idx);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/arccosh_ops.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API arccosh {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::arccosh")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "arccosh(Tensor self) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API arccosh_ {
|
| 29 |
+
using schema = at::Tensor & (at::Tensor &);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::arccosh_")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "arccosh_(Tensor(a!) self) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(at::Tensor & self);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
struct TORCH_API arccosh_out {
|
| 40 |
+
using schema = at::Tensor & (const at::Tensor &, at::Tensor &);
|
| 41 |
+
using ptr_schema = schema*;
|
| 42 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 43 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::arccosh")
|
| 44 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 45 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "arccosh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)")
|
| 46 |
+
static at::Tensor & call(const at::Tensor & self, at::Tensor & out);
|
| 47 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out);
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
}} // namespace at::_ops
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/atan2_meta_dispatch.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor atan2(const at::Tensor & self, const at::Tensor & other);
|
| 21 |
+
TORCH_API at::Tensor & atan2_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & atan2_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 23 |
+
TORCH_API at::Tensor & atan2_(at::Tensor & self, const at::Tensor & other);
|
| 24 |
+
|
| 25 |
+
} // namespace meta
|
| 26 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/batch_norm_gather_stats_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> batch_norm_gather_stats_out(at::Tensor & out0, at::Tensor & out1, const at::Tensor & input, const at::Tensor & mean, const at::Tensor & invstd, const c10::optional<at::Tensor> & running_mean, const c10::optional<at::Tensor> & running_var, double momentum, double eps, int64_t count);
|
| 21 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> batch_norm_gather_stats_outf(const at::Tensor & input, const at::Tensor & mean, const at::Tensor & invstd, const c10::optional<at::Tensor> & running_mean, const c10::optional<at::Tensor> & running_var, double momentum, double eps, int64_t count, at::Tensor & out0, at::Tensor & out1);
|
| 22 |
+
|
| 23 |
+
} // namespace compositeexplicitautograd
|
| 24 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/col_indices_copy_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor & col_indices_copy_out(at::Tensor & out, const at::Tensor & self);
|
| 21 |
+
TORCH_API at::Tensor & col_indices_copy_outf(const at::Tensor & self, at::Tensor & out);
|
| 22 |
+
|
| 23 |
+
} // namespace compositeexplicitautograd
|
| 24 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/col_indices_copy_compositeexplicitautogradnonfunctional_dispatch.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautogradnonfunctional {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor col_indices_copy(const at::Tensor & self);
|
| 21 |
+
|
| 22 |
+
} // namespace compositeexplicitautogradnonfunctional
|
| 23 |
+
} // namespace at
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/cudnn_grid_sampler_ops.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API cudnn_grid_sampler {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cudnn_grid_sampler")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cudnn_grid_sampler(Tensor self, Tensor grid) -> Tensor output")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self, const at::Tensor & grid);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & grid);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API cudnn_grid_sampler_out {
|
| 29 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cudnn_grid_sampler")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cudnn_grid_sampler.out(Tensor self, Tensor grid, *, Tensor(a!) out) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(const at::Tensor & self, const at::Tensor & grid, at::Tensor & out);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & grid, at::Tensor & out);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
moondream/lib/python3.10/site-packages/torch/include/ATen/ops/diff_compositeimplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeimplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor diff(const at::Tensor & self, int64_t n=1, int64_t dim=-1, const c10::optional<at::Tensor> & prepend={}, const c10::optional<at::Tensor> & append={});
|
| 21 |
+
TORCH_API at::Tensor & diff_out(at::Tensor & out, const at::Tensor & self, int64_t n=1, int64_t dim=-1, const c10::optional<at::Tensor> & prepend={}, const c10::optional<at::Tensor> & append={});
|
| 22 |
+
TORCH_API at::Tensor & diff_outf(const at::Tensor & self, int64_t n, int64_t dim, const c10::optional<at::Tensor> & prepend, const c10::optional<at::Tensor> & append, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeimplicitautograd
|
| 25 |
+
} // namespace at
|