Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/cli/__pycache__/__init__.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/cli/__pycache__/parse.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/__init__.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/entities.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/html_blocks.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/html_re.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/normalize_url.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/utils.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/__init__.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/parse_link_destination.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/parse_link_label.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/parse_link_title.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/__init__.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/commonmark.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/default.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/zero.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/__init__.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/blockquote.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/code.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/fence.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/heading.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/hr.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/html_block.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/lheading.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/list.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/paragraph.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/reference.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/state_block.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/table.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/__init__.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/block.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/inline.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/linkify.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/normalize.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/replacements.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/smartquotes.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/state_core.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/text_join.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_inline/__pycache__/emphasis.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_inline/__pycache__/link.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/__init__.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/hook-numpy.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/pyinstaller-smoke.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/test_pyinstaller.cpython-312.pyc +0 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/__init__.py +221 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_add_docstring.py +152 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_array_like.py +167 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_callable.pyi +338 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_char_codes.py +111 -0
- Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_dtype_like.py +246 -0
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/cli/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (221 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/cli/__pycache__/parse.cpython-312.pyc
ADDED
|
Binary file (4.55 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (224 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/entities.cpython-312.pyc
ADDED
|
Binary file (584 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/html_blocks.cpython-312.pyc
ADDED
|
Binary file (808 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/html_re.cpython-312.pyc
ADDED
|
Binary file (1.37 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/normalize_url.cpython-312.pyc
ADDED
|
Binary file (3.36 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/common/__pycache__/utils.cpython-312.pyc
ADDED
|
Binary file (10.1 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (490 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/parse_link_destination.cpython-312.pyc
ADDED
|
Binary file (2.21 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/parse_link_label.cpython-312.pyc
ADDED
|
Binary file (1.46 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/helpers/__pycache__/parse_link_title.cpython-312.pyc
ADDED
|
Binary file (1.98 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (1.64 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/commonmark.cpython-312.pyc
ADDED
|
Binary file (1.19 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/default.cpython-312.pyc
ADDED
|
Binary file (701 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/presets/__pycache__/zero.cpython-312.pyc
ADDED
|
Binary file (962 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (711 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/blockquote.cpython-312.pyc
ADDED
|
Binary file (6.95 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/code.cpython-312.pyc
ADDED
|
Binary file (1.41 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/fence.cpython-312.pyc
ADDED
|
Binary file (2.56 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/heading.cpython-312.pyc
ADDED
|
Binary file (2.66 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/hr.cpython-312.pyc
ADDED
|
Binary file (1.79 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/html_block.cpython-312.pyc
ADDED
|
Binary file (3.64 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/lheading.cpython-312.pyc
ADDED
|
Binary file (2.97 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/list.cpython-312.pyc
ADDED
|
Binary file (8.07 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/paragraph.cpython-312.pyc
ADDED
|
Binary file (2.21 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/reference.cpython-312.pyc
ADDED
|
Binary file (5.73 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/state_block.cpython-312.pyc
ADDED
|
Binary file (9.23 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_block/__pycache__/table.cpython-312.pyc
ADDED
|
Binary file (7.25 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (575 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/block.cpython-312.pyc
ADDED
|
Binary file (1.01 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/inline.cpython-312.pyc
ADDED
|
Binary file (853 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/linkify.cpython-312.pyc
ADDED
|
Binary file (5.35 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/normalize.cpython-312.pyc
ADDED
|
Binary file (835 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/replacements.cpython-312.pyc
ADDED
|
Binary file (4.96 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/smartquotes.cpython-312.pyc
ADDED
|
Binary file (6.21 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/state_core.cpython-312.pyc
ADDED
|
Binary file (1.12 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_core/__pycache__/text_join.cpython-312.pyc
ADDED
|
Binary file (1.5 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_inline/__pycache__/emphasis.cpython-312.pyc
ADDED
|
Binary file (3.9 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/markdown_it/rules_inline/__pycache__/link.cpython-312.pyc
ADDED
|
Binary file (4.09 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (224 Bytes). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/hook-numpy.cpython-312.pyc
ADDED
|
Binary file (1.03 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/pyinstaller-smoke.cpython-312.pyc
ADDED
|
Binary file (2.64 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/__pycache__/test_pyinstaller.cpython-312.pyc
ADDED
|
Binary file (1.99 kB). View file
|
|
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/__init__.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Private counterpart of ``numpy.typing``."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from .. import ufunc
|
| 6 |
+
from .._utils import set_module
|
| 7 |
+
from typing import TYPE_CHECKING, final
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
@final # Disallow the creation of arbitrary `NBitBase` subclasses
|
| 11 |
+
@set_module("numpy.typing")
|
| 12 |
+
class NBitBase:
|
| 13 |
+
"""
|
| 14 |
+
A type representing `numpy.number` precision during static type checking.
|
| 15 |
+
|
| 16 |
+
Used exclusively for the purpose static type checking, `NBitBase`
|
| 17 |
+
represents the base of a hierarchical set of subclasses.
|
| 18 |
+
Each subsequent subclass is herein used for representing a lower level
|
| 19 |
+
of precision, *e.g.* ``64Bit > 32Bit > 16Bit``.
|
| 20 |
+
|
| 21 |
+
.. versionadded:: 1.20
|
| 22 |
+
|
| 23 |
+
Examples
|
| 24 |
+
--------
|
| 25 |
+
Below is a typical usage example: `NBitBase` is herein used for annotating
|
| 26 |
+
a function that takes a float and integer of arbitrary precision
|
| 27 |
+
as arguments and returns a new float of whichever precision is largest
|
| 28 |
+
(*e.g.* ``np.float16 + np.int64 -> np.float64``).
|
| 29 |
+
|
| 30 |
+
.. code-block:: python
|
| 31 |
+
|
| 32 |
+
>>> from __future__ import annotations
|
| 33 |
+
>>> from typing import TypeVar, TYPE_CHECKING
|
| 34 |
+
>>> import numpy as np
|
| 35 |
+
>>> import numpy.typing as npt
|
| 36 |
+
|
| 37 |
+
>>> T1 = TypeVar("T1", bound=npt.NBitBase)
|
| 38 |
+
>>> T2 = TypeVar("T2", bound=npt.NBitBase)
|
| 39 |
+
|
| 40 |
+
>>> def add(a: np.floating[T1], b: np.integer[T2]) -> np.floating[T1 | T2]:
|
| 41 |
+
... return a + b
|
| 42 |
+
|
| 43 |
+
>>> a = np.float16()
|
| 44 |
+
>>> b = np.int64()
|
| 45 |
+
>>> out = add(a, b)
|
| 46 |
+
|
| 47 |
+
>>> if TYPE_CHECKING:
|
| 48 |
+
... reveal_locals()
|
| 49 |
+
... # note: Revealed local types are:
|
| 50 |
+
... # note: a: numpy.floating[numpy.typing._16Bit*]
|
| 51 |
+
... # note: b: numpy.signedinteger[numpy.typing._64Bit*]
|
| 52 |
+
... # note: out: numpy.floating[numpy.typing._64Bit*]
|
| 53 |
+
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
def __init_subclass__(cls) -> None:
|
| 57 |
+
allowed_names = {
|
| 58 |
+
"NBitBase", "_256Bit", "_128Bit", "_96Bit", "_80Bit",
|
| 59 |
+
"_64Bit", "_32Bit", "_16Bit", "_8Bit",
|
| 60 |
+
}
|
| 61 |
+
if cls.__name__ not in allowed_names:
|
| 62 |
+
raise TypeError('cannot inherit from final class "NBitBase"')
|
| 63 |
+
super().__init_subclass__()
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
# Silence errors about subclassing a `@final`-decorated class
|
| 67 |
+
class _256Bit(NBitBase): # type: ignore[misc]
|
| 68 |
+
pass
|
| 69 |
+
|
| 70 |
+
class _128Bit(_256Bit): # type: ignore[misc]
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
+
class _96Bit(_128Bit): # type: ignore[misc]
|
| 74 |
+
pass
|
| 75 |
+
|
| 76 |
+
class _80Bit(_96Bit): # type: ignore[misc]
|
| 77 |
+
pass
|
| 78 |
+
|
| 79 |
+
class _64Bit(_80Bit): # type: ignore[misc]
|
| 80 |
+
pass
|
| 81 |
+
|
| 82 |
+
class _32Bit(_64Bit): # type: ignore[misc]
|
| 83 |
+
pass
|
| 84 |
+
|
| 85 |
+
class _16Bit(_32Bit): # type: ignore[misc]
|
| 86 |
+
pass
|
| 87 |
+
|
| 88 |
+
class _8Bit(_16Bit): # type: ignore[misc]
|
| 89 |
+
pass
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
from ._nested_sequence import (
|
| 93 |
+
_NestedSequence as _NestedSequence,
|
| 94 |
+
)
|
| 95 |
+
from ._nbit import (
|
| 96 |
+
_NBitByte as _NBitByte,
|
| 97 |
+
_NBitShort as _NBitShort,
|
| 98 |
+
_NBitIntC as _NBitIntC,
|
| 99 |
+
_NBitIntP as _NBitIntP,
|
| 100 |
+
_NBitInt as _NBitInt,
|
| 101 |
+
_NBitLongLong as _NBitLongLong,
|
| 102 |
+
_NBitHalf as _NBitHalf,
|
| 103 |
+
_NBitSingle as _NBitSingle,
|
| 104 |
+
_NBitDouble as _NBitDouble,
|
| 105 |
+
_NBitLongDouble as _NBitLongDouble,
|
| 106 |
+
)
|
| 107 |
+
from ._char_codes import (
|
| 108 |
+
_BoolCodes as _BoolCodes,
|
| 109 |
+
_UInt8Codes as _UInt8Codes,
|
| 110 |
+
_UInt16Codes as _UInt16Codes,
|
| 111 |
+
_UInt32Codes as _UInt32Codes,
|
| 112 |
+
_UInt64Codes as _UInt64Codes,
|
| 113 |
+
_Int8Codes as _Int8Codes,
|
| 114 |
+
_Int16Codes as _Int16Codes,
|
| 115 |
+
_Int32Codes as _Int32Codes,
|
| 116 |
+
_Int64Codes as _Int64Codes,
|
| 117 |
+
_Float16Codes as _Float16Codes,
|
| 118 |
+
_Float32Codes as _Float32Codes,
|
| 119 |
+
_Float64Codes as _Float64Codes,
|
| 120 |
+
_Complex64Codes as _Complex64Codes,
|
| 121 |
+
_Complex128Codes as _Complex128Codes,
|
| 122 |
+
_ByteCodes as _ByteCodes,
|
| 123 |
+
_ShortCodes as _ShortCodes,
|
| 124 |
+
_IntCCodes as _IntCCodes,
|
| 125 |
+
_IntPCodes as _IntPCodes,
|
| 126 |
+
_IntCodes as _IntCodes,
|
| 127 |
+
_LongLongCodes as _LongLongCodes,
|
| 128 |
+
_UByteCodes as _UByteCodes,
|
| 129 |
+
_UShortCodes as _UShortCodes,
|
| 130 |
+
_UIntCCodes as _UIntCCodes,
|
| 131 |
+
_UIntPCodes as _UIntPCodes,
|
| 132 |
+
_UIntCodes as _UIntCodes,
|
| 133 |
+
_ULongLongCodes as _ULongLongCodes,
|
| 134 |
+
_HalfCodes as _HalfCodes,
|
| 135 |
+
_SingleCodes as _SingleCodes,
|
| 136 |
+
_DoubleCodes as _DoubleCodes,
|
| 137 |
+
_LongDoubleCodes as _LongDoubleCodes,
|
| 138 |
+
_CSingleCodes as _CSingleCodes,
|
| 139 |
+
_CDoubleCodes as _CDoubleCodes,
|
| 140 |
+
_CLongDoubleCodes as _CLongDoubleCodes,
|
| 141 |
+
_DT64Codes as _DT64Codes,
|
| 142 |
+
_TD64Codes as _TD64Codes,
|
| 143 |
+
_StrCodes as _StrCodes,
|
| 144 |
+
_BytesCodes as _BytesCodes,
|
| 145 |
+
_VoidCodes as _VoidCodes,
|
| 146 |
+
_ObjectCodes as _ObjectCodes,
|
| 147 |
+
)
|
| 148 |
+
from ._scalars import (
|
| 149 |
+
_CharLike_co as _CharLike_co,
|
| 150 |
+
_BoolLike_co as _BoolLike_co,
|
| 151 |
+
_UIntLike_co as _UIntLike_co,
|
| 152 |
+
_IntLike_co as _IntLike_co,
|
| 153 |
+
_FloatLike_co as _FloatLike_co,
|
| 154 |
+
_ComplexLike_co as _ComplexLike_co,
|
| 155 |
+
_TD64Like_co as _TD64Like_co,
|
| 156 |
+
_NumberLike_co as _NumberLike_co,
|
| 157 |
+
_ScalarLike_co as _ScalarLike_co,
|
| 158 |
+
_VoidLike_co as _VoidLike_co,
|
| 159 |
+
)
|
| 160 |
+
from ._shape import (
|
| 161 |
+
_Shape as _Shape,
|
| 162 |
+
_ShapeLike as _ShapeLike,
|
| 163 |
+
)
|
| 164 |
+
from ._dtype_like import (
|
| 165 |
+
DTypeLike as DTypeLike,
|
| 166 |
+
_DTypeLike as _DTypeLike,
|
| 167 |
+
_SupportsDType as _SupportsDType,
|
| 168 |
+
_VoidDTypeLike as _VoidDTypeLike,
|
| 169 |
+
_DTypeLikeBool as _DTypeLikeBool,
|
| 170 |
+
_DTypeLikeUInt as _DTypeLikeUInt,
|
| 171 |
+
_DTypeLikeInt as _DTypeLikeInt,
|
| 172 |
+
_DTypeLikeFloat as _DTypeLikeFloat,
|
| 173 |
+
_DTypeLikeComplex as _DTypeLikeComplex,
|
| 174 |
+
_DTypeLikeTD64 as _DTypeLikeTD64,
|
| 175 |
+
_DTypeLikeDT64 as _DTypeLikeDT64,
|
| 176 |
+
_DTypeLikeObject as _DTypeLikeObject,
|
| 177 |
+
_DTypeLikeVoid as _DTypeLikeVoid,
|
| 178 |
+
_DTypeLikeStr as _DTypeLikeStr,
|
| 179 |
+
_DTypeLikeBytes as _DTypeLikeBytes,
|
| 180 |
+
_DTypeLikeComplex_co as _DTypeLikeComplex_co,
|
| 181 |
+
)
|
| 182 |
+
from ._array_like import (
|
| 183 |
+
NDArray as NDArray,
|
| 184 |
+
ArrayLike as ArrayLike,
|
| 185 |
+
_ArrayLike as _ArrayLike,
|
| 186 |
+
_FiniteNestedSequence as _FiniteNestedSequence,
|
| 187 |
+
_SupportsArray as _SupportsArray,
|
| 188 |
+
_SupportsArrayFunc as _SupportsArrayFunc,
|
| 189 |
+
_ArrayLikeInt as _ArrayLikeInt,
|
| 190 |
+
_ArrayLikeBool_co as _ArrayLikeBool_co,
|
| 191 |
+
_ArrayLikeUInt_co as _ArrayLikeUInt_co,
|
| 192 |
+
_ArrayLikeInt_co as _ArrayLikeInt_co,
|
| 193 |
+
_ArrayLikeFloat_co as _ArrayLikeFloat_co,
|
| 194 |
+
_ArrayLikeComplex_co as _ArrayLikeComplex_co,
|
| 195 |
+
_ArrayLikeNumber_co as _ArrayLikeNumber_co,
|
| 196 |
+
_ArrayLikeTD64_co as _ArrayLikeTD64_co,
|
| 197 |
+
_ArrayLikeDT64_co as _ArrayLikeDT64_co,
|
| 198 |
+
_ArrayLikeObject_co as _ArrayLikeObject_co,
|
| 199 |
+
_ArrayLikeVoid_co as _ArrayLikeVoid_co,
|
| 200 |
+
_ArrayLikeStr_co as _ArrayLikeStr_co,
|
| 201 |
+
_ArrayLikeBytes_co as _ArrayLikeBytes_co,
|
| 202 |
+
_ArrayLikeUnknown as _ArrayLikeUnknown,
|
| 203 |
+
_UnknownType as _UnknownType,
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
if TYPE_CHECKING:
|
| 207 |
+
from ._ufunc import (
|
| 208 |
+
_UFunc_Nin1_Nout1 as _UFunc_Nin1_Nout1,
|
| 209 |
+
_UFunc_Nin2_Nout1 as _UFunc_Nin2_Nout1,
|
| 210 |
+
_UFunc_Nin1_Nout2 as _UFunc_Nin1_Nout2,
|
| 211 |
+
_UFunc_Nin2_Nout2 as _UFunc_Nin2_Nout2,
|
| 212 |
+
_GUFunc_Nin2_Nout1 as _GUFunc_Nin2_Nout1,
|
| 213 |
+
)
|
| 214 |
+
else:
|
| 215 |
+
# Declare the (type-check-only) ufunc subclasses as ufunc aliases during
|
| 216 |
+
# runtime; this helps autocompletion tools such as Jedi (numpy/numpy#19834)
|
| 217 |
+
_UFunc_Nin1_Nout1 = ufunc
|
| 218 |
+
_UFunc_Nin2_Nout1 = ufunc
|
| 219 |
+
_UFunc_Nin1_Nout2 = ufunc
|
| 220 |
+
_UFunc_Nin2_Nout2 = ufunc
|
| 221 |
+
_GUFunc_Nin2_Nout1 = ufunc
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_add_docstring.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A module for creating docstrings for sphinx ``data`` domains."""
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import textwrap
|
| 5 |
+
|
| 6 |
+
from ._array_like import NDArray
|
| 7 |
+
|
| 8 |
+
_docstrings_list = []
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def add_newdoc(name: str, value: str, doc: str) -> None:
|
| 12 |
+
"""Append ``_docstrings_list`` with a docstring for `name`.
|
| 13 |
+
|
| 14 |
+
Parameters
|
| 15 |
+
----------
|
| 16 |
+
name : str
|
| 17 |
+
The name of the object.
|
| 18 |
+
value : str
|
| 19 |
+
A string-representation of the object.
|
| 20 |
+
doc : str
|
| 21 |
+
The docstring of the object.
|
| 22 |
+
|
| 23 |
+
"""
|
| 24 |
+
_docstrings_list.append((name, value, doc))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def _parse_docstrings() -> str:
|
| 28 |
+
"""Convert all docstrings in ``_docstrings_list`` into a single
|
| 29 |
+
sphinx-legible text block.
|
| 30 |
+
|
| 31 |
+
"""
|
| 32 |
+
type_list_ret = []
|
| 33 |
+
for name, value, doc in _docstrings_list:
|
| 34 |
+
s = textwrap.dedent(doc).replace("\n", "\n ")
|
| 35 |
+
|
| 36 |
+
# Replace sections by rubrics
|
| 37 |
+
lines = s.split("\n")
|
| 38 |
+
new_lines = []
|
| 39 |
+
indent = ""
|
| 40 |
+
for line in lines:
|
| 41 |
+
m = re.match(r'^(\s+)[-=]+\s*$', line)
|
| 42 |
+
if m and new_lines:
|
| 43 |
+
prev = textwrap.dedent(new_lines.pop())
|
| 44 |
+
if prev == "Examples":
|
| 45 |
+
indent = ""
|
| 46 |
+
new_lines.append(f'{m.group(1)}.. rubric:: {prev}')
|
| 47 |
+
else:
|
| 48 |
+
indent = 4 * " "
|
| 49 |
+
new_lines.append(f'{m.group(1)}.. admonition:: {prev}')
|
| 50 |
+
new_lines.append("")
|
| 51 |
+
else:
|
| 52 |
+
new_lines.append(f"{indent}{line}")
|
| 53 |
+
|
| 54 |
+
s = "\n".join(new_lines)
|
| 55 |
+
s_block = f""".. data:: {name}\n :value: {value}\n {s}"""
|
| 56 |
+
type_list_ret.append(s_block)
|
| 57 |
+
return "\n".join(type_list_ret)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
add_newdoc('ArrayLike', 'typing.Union[...]',
|
| 61 |
+
"""
|
| 62 |
+
A `~typing.Union` representing objects that can be coerced
|
| 63 |
+
into an `~numpy.ndarray`.
|
| 64 |
+
|
| 65 |
+
Among others this includes the likes of:
|
| 66 |
+
|
| 67 |
+
* Scalars.
|
| 68 |
+
* (Nested) sequences.
|
| 69 |
+
* Objects implementing the `~class.__array__` protocol.
|
| 70 |
+
|
| 71 |
+
.. versionadded:: 1.20
|
| 72 |
+
|
| 73 |
+
See Also
|
| 74 |
+
--------
|
| 75 |
+
:term:`array_like`:
|
| 76 |
+
Any scalar or sequence that can be interpreted as an ndarray.
|
| 77 |
+
|
| 78 |
+
Examples
|
| 79 |
+
--------
|
| 80 |
+
.. code-block:: python
|
| 81 |
+
|
| 82 |
+
>>> import numpy as np
|
| 83 |
+
>>> import numpy.typing as npt
|
| 84 |
+
|
| 85 |
+
>>> def as_array(a: npt.ArrayLike) -> np.ndarray:
|
| 86 |
+
... return np.array(a)
|
| 87 |
+
|
| 88 |
+
""")
|
| 89 |
+
|
| 90 |
+
add_newdoc('DTypeLike', 'typing.Union[...]',
|
| 91 |
+
"""
|
| 92 |
+
A `~typing.Union` representing objects that can be coerced
|
| 93 |
+
into a `~numpy.dtype`.
|
| 94 |
+
|
| 95 |
+
Among others this includes the likes of:
|
| 96 |
+
|
| 97 |
+
* :class:`type` objects.
|
| 98 |
+
* Character codes or the names of :class:`type` objects.
|
| 99 |
+
* Objects with the ``.dtype`` attribute.
|
| 100 |
+
|
| 101 |
+
.. versionadded:: 1.20
|
| 102 |
+
|
| 103 |
+
See Also
|
| 104 |
+
--------
|
| 105 |
+
:ref:`Specifying and constructing data types <arrays.dtypes.constructing>`
|
| 106 |
+
A comprehensive overview of all objects that can be coerced
|
| 107 |
+
into data types.
|
| 108 |
+
|
| 109 |
+
Examples
|
| 110 |
+
--------
|
| 111 |
+
.. code-block:: python
|
| 112 |
+
|
| 113 |
+
>>> import numpy as np
|
| 114 |
+
>>> import numpy.typing as npt
|
| 115 |
+
|
| 116 |
+
>>> def as_dtype(d: npt.DTypeLike) -> np.dtype:
|
| 117 |
+
... return np.dtype(d)
|
| 118 |
+
|
| 119 |
+
""")
|
| 120 |
+
|
| 121 |
+
add_newdoc('NDArray', repr(NDArray),
|
| 122 |
+
"""
|
| 123 |
+
A :term:`generic <generic type>` version of
|
| 124 |
+
`np.ndarray[Any, np.dtype[+ScalarType]] <numpy.ndarray>`.
|
| 125 |
+
|
| 126 |
+
Can be used during runtime for typing arrays with a given dtype
|
| 127 |
+
and unspecified shape.
|
| 128 |
+
|
| 129 |
+
.. versionadded:: 1.21
|
| 130 |
+
|
| 131 |
+
Examples
|
| 132 |
+
--------
|
| 133 |
+
.. code-block:: python
|
| 134 |
+
|
| 135 |
+
>>> import numpy as np
|
| 136 |
+
>>> import numpy.typing as npt
|
| 137 |
+
|
| 138 |
+
>>> print(npt.NDArray)
|
| 139 |
+
numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]]
|
| 140 |
+
|
| 141 |
+
>>> print(npt.NDArray[np.float64])
|
| 142 |
+
numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]
|
| 143 |
+
|
| 144 |
+
>>> NDArrayInt = npt.NDArray[np.int_]
|
| 145 |
+
>>> a: NDArrayInt = np.arange(10)
|
| 146 |
+
|
| 147 |
+
>>> def func(a: npt.ArrayLike) -> npt.NDArray[Any]:
|
| 148 |
+
... return np.array(a)
|
| 149 |
+
|
| 150 |
+
""")
|
| 151 |
+
|
| 152 |
+
_docstrings = _parse_docstrings()
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_array_like.py
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
from collections.abc import Collection, Callable, Sequence
|
| 5 |
+
from typing import Any, Protocol, Union, TypeVar, runtime_checkable
|
| 6 |
+
|
| 7 |
+
from numpy import (
|
| 8 |
+
ndarray,
|
| 9 |
+
dtype,
|
| 10 |
+
generic,
|
| 11 |
+
bool_,
|
| 12 |
+
unsignedinteger,
|
| 13 |
+
integer,
|
| 14 |
+
floating,
|
| 15 |
+
complexfloating,
|
| 16 |
+
number,
|
| 17 |
+
timedelta64,
|
| 18 |
+
datetime64,
|
| 19 |
+
object_,
|
| 20 |
+
void,
|
| 21 |
+
str_,
|
| 22 |
+
bytes_,
|
| 23 |
+
)
|
| 24 |
+
from ._nested_sequence import _NestedSequence
|
| 25 |
+
|
| 26 |
+
_T = TypeVar("_T")
|
| 27 |
+
_ScalarType = TypeVar("_ScalarType", bound=generic)
|
| 28 |
+
_ScalarType_co = TypeVar("_ScalarType_co", bound=generic, covariant=True)
|
| 29 |
+
_DType = TypeVar("_DType", bound=dtype[Any])
|
| 30 |
+
_DType_co = TypeVar("_DType_co", covariant=True, bound=dtype[Any])
|
| 31 |
+
|
| 32 |
+
NDArray = ndarray[Any, dtype[_ScalarType_co]]
|
| 33 |
+
|
| 34 |
+
# The `_SupportsArray` protocol only cares about the default dtype
|
| 35 |
+
# (i.e. `dtype=None` or no `dtype` parameter at all) of the to-be returned
|
| 36 |
+
# array.
|
| 37 |
+
# Concrete implementations of the protocol are responsible for adding
|
| 38 |
+
# any and all remaining overloads
|
| 39 |
+
@runtime_checkable
|
| 40 |
+
class _SupportsArray(Protocol[_DType_co]):
|
| 41 |
+
def __array__(self) -> ndarray[Any, _DType_co]: ...
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
@runtime_checkable
|
| 45 |
+
class _SupportsArrayFunc(Protocol):
|
| 46 |
+
"""A protocol class representing `~class.__array_function__`."""
|
| 47 |
+
def __array_function__(
|
| 48 |
+
self,
|
| 49 |
+
func: Callable[..., Any],
|
| 50 |
+
types: Collection[type[Any]],
|
| 51 |
+
args: tuple[Any, ...],
|
| 52 |
+
kwargs: dict[str, Any],
|
| 53 |
+
) -> object: ...
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
# TODO: Wait until mypy supports recursive objects in combination with typevars
|
| 57 |
+
_FiniteNestedSequence = Union[
|
| 58 |
+
_T,
|
| 59 |
+
Sequence[_T],
|
| 60 |
+
Sequence[Sequence[_T]],
|
| 61 |
+
Sequence[Sequence[Sequence[_T]]],
|
| 62 |
+
Sequence[Sequence[Sequence[Sequence[_T]]]],
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
# A subset of `npt.ArrayLike` that can be parametrized w.r.t. `np.generic`
|
| 66 |
+
_ArrayLike = Union[
|
| 67 |
+
_SupportsArray[dtype[_ScalarType]],
|
| 68 |
+
_NestedSequence[_SupportsArray[dtype[_ScalarType]]],
|
| 69 |
+
]
|
| 70 |
+
|
| 71 |
+
# A union representing array-like objects; consists of two typevars:
|
| 72 |
+
# One representing types that can be parametrized w.r.t. `np.dtype`
|
| 73 |
+
# and another one for the rest
|
| 74 |
+
_DualArrayLike = Union[
|
| 75 |
+
_SupportsArray[_DType],
|
| 76 |
+
_NestedSequence[_SupportsArray[_DType]],
|
| 77 |
+
_T,
|
| 78 |
+
_NestedSequence[_T],
|
| 79 |
+
]
|
| 80 |
+
|
| 81 |
+
if sys.version_info >= (3, 12):
|
| 82 |
+
from collections.abc import Buffer
|
| 83 |
+
|
| 84 |
+
ArrayLike = Buffer | _DualArrayLike[
|
| 85 |
+
dtype[Any],
|
| 86 |
+
Union[bool, int, float, complex, str, bytes],
|
| 87 |
+
]
|
| 88 |
+
else:
|
| 89 |
+
ArrayLike = _DualArrayLike[
|
| 90 |
+
dtype[Any],
|
| 91 |
+
Union[bool, int, float, complex, str, bytes],
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
# `ArrayLike<X>_co`: array-like objects that can be coerced into `X`
|
| 95 |
+
# given the casting rules `same_kind`
|
| 96 |
+
_ArrayLikeBool_co = _DualArrayLike[
|
| 97 |
+
dtype[bool_],
|
| 98 |
+
bool,
|
| 99 |
+
]
|
| 100 |
+
_ArrayLikeUInt_co = _DualArrayLike[
|
| 101 |
+
dtype[Union[bool_, unsignedinteger[Any]]],
|
| 102 |
+
bool,
|
| 103 |
+
]
|
| 104 |
+
_ArrayLikeInt_co = _DualArrayLike[
|
| 105 |
+
dtype[Union[bool_, integer[Any]]],
|
| 106 |
+
Union[bool, int],
|
| 107 |
+
]
|
| 108 |
+
_ArrayLikeFloat_co = _DualArrayLike[
|
| 109 |
+
dtype[Union[bool_, integer[Any], floating[Any]]],
|
| 110 |
+
Union[bool, int, float],
|
| 111 |
+
]
|
| 112 |
+
_ArrayLikeComplex_co = _DualArrayLike[
|
| 113 |
+
dtype[Union[
|
| 114 |
+
bool_,
|
| 115 |
+
integer[Any],
|
| 116 |
+
floating[Any],
|
| 117 |
+
complexfloating[Any, Any],
|
| 118 |
+
]],
|
| 119 |
+
Union[bool, int, float, complex],
|
| 120 |
+
]
|
| 121 |
+
_ArrayLikeNumber_co = _DualArrayLike[
|
| 122 |
+
dtype[Union[bool_, number[Any]]],
|
| 123 |
+
Union[bool, int, float, complex],
|
| 124 |
+
]
|
| 125 |
+
_ArrayLikeTD64_co = _DualArrayLike[
|
| 126 |
+
dtype[Union[bool_, integer[Any], timedelta64]],
|
| 127 |
+
Union[bool, int],
|
| 128 |
+
]
|
| 129 |
+
_ArrayLikeDT64_co = Union[
|
| 130 |
+
_SupportsArray[dtype[datetime64]],
|
| 131 |
+
_NestedSequence[_SupportsArray[dtype[datetime64]]],
|
| 132 |
+
]
|
| 133 |
+
_ArrayLikeObject_co = Union[
|
| 134 |
+
_SupportsArray[dtype[object_]],
|
| 135 |
+
_NestedSequence[_SupportsArray[dtype[object_]]],
|
| 136 |
+
]
|
| 137 |
+
|
| 138 |
+
_ArrayLikeVoid_co = Union[
|
| 139 |
+
_SupportsArray[dtype[void]],
|
| 140 |
+
_NestedSequence[_SupportsArray[dtype[void]]],
|
| 141 |
+
]
|
| 142 |
+
_ArrayLikeStr_co = _DualArrayLike[
|
| 143 |
+
dtype[str_],
|
| 144 |
+
str,
|
| 145 |
+
]
|
| 146 |
+
_ArrayLikeBytes_co = _DualArrayLike[
|
| 147 |
+
dtype[bytes_],
|
| 148 |
+
bytes,
|
| 149 |
+
]
|
| 150 |
+
|
| 151 |
+
_ArrayLikeInt = _DualArrayLike[
|
| 152 |
+
dtype[integer[Any]],
|
| 153 |
+
int,
|
| 154 |
+
]
|
| 155 |
+
|
| 156 |
+
# Extra ArrayLike type so that pyright can deal with NDArray[Any]
|
| 157 |
+
# Used as the first overload, should only match NDArray[Any],
|
| 158 |
+
# not any actual types.
|
| 159 |
+
# https://github.com/numpy/numpy/pull/22193
|
| 160 |
+
class _UnknownType:
|
| 161 |
+
...
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
_ArrayLikeUnknown = _DualArrayLike[
|
| 165 |
+
dtype[_UnknownType],
|
| 166 |
+
_UnknownType,
|
| 167 |
+
]
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_callable.pyi
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
A module with various ``typing.Protocol`` subclasses that implement
|
| 3 |
+
the ``__call__`` magic method.
|
| 4 |
+
|
| 5 |
+
See the `Mypy documentation`_ on protocols for more details.
|
| 6 |
+
|
| 7 |
+
.. _`Mypy documentation`: https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols
|
| 8 |
+
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
from typing import (
|
| 14 |
+
TypeVar,
|
| 15 |
+
overload,
|
| 16 |
+
Any,
|
| 17 |
+
NoReturn,
|
| 18 |
+
Protocol,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
from numpy import (
|
| 22 |
+
ndarray,
|
| 23 |
+
dtype,
|
| 24 |
+
generic,
|
| 25 |
+
bool_,
|
| 26 |
+
timedelta64,
|
| 27 |
+
number,
|
| 28 |
+
integer,
|
| 29 |
+
unsignedinteger,
|
| 30 |
+
signedinteger,
|
| 31 |
+
int8,
|
| 32 |
+
int_,
|
| 33 |
+
floating,
|
| 34 |
+
float64,
|
| 35 |
+
complexfloating,
|
| 36 |
+
complex128,
|
| 37 |
+
)
|
| 38 |
+
from ._nbit import _NBitInt, _NBitDouble
|
| 39 |
+
from ._scalars import (
|
| 40 |
+
_BoolLike_co,
|
| 41 |
+
_IntLike_co,
|
| 42 |
+
_FloatLike_co,
|
| 43 |
+
_NumberLike_co,
|
| 44 |
+
)
|
| 45 |
+
from . import NBitBase
|
| 46 |
+
from ._array_like import NDArray
|
| 47 |
+
from ._nested_sequence import _NestedSequence
|
| 48 |
+
|
| 49 |
+
_T1 = TypeVar("_T1")
|
| 50 |
+
_T2 = TypeVar("_T2")
|
| 51 |
+
_T1_contra = TypeVar("_T1_contra", contravariant=True)
|
| 52 |
+
_T2_contra = TypeVar("_T2_contra", contravariant=True)
|
| 53 |
+
_2Tuple = tuple[_T1, _T1]
|
| 54 |
+
|
| 55 |
+
_NBit1 = TypeVar("_NBit1", bound=NBitBase)
|
| 56 |
+
_NBit2 = TypeVar("_NBit2", bound=NBitBase)
|
| 57 |
+
|
| 58 |
+
_IntType = TypeVar("_IntType", bound=integer)
|
| 59 |
+
_FloatType = TypeVar("_FloatType", bound=floating)
|
| 60 |
+
_NumberType = TypeVar("_NumberType", bound=number)
|
| 61 |
+
_NumberType_co = TypeVar("_NumberType_co", covariant=True, bound=number)
|
| 62 |
+
_GenericType_co = TypeVar("_GenericType_co", covariant=True, bound=generic)
|
| 63 |
+
|
| 64 |
+
class _BoolOp(Protocol[_GenericType_co]):
|
| 65 |
+
@overload
|
| 66 |
+
def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
|
| 67 |
+
@overload # platform dependent
|
| 68 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 69 |
+
@overload
|
| 70 |
+
def __call__(self, other: float, /) -> float64: ...
|
| 71 |
+
@overload
|
| 72 |
+
def __call__(self, other: complex, /) -> complex128: ...
|
| 73 |
+
@overload
|
| 74 |
+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
|
| 75 |
+
|
| 76 |
+
class _BoolBitOp(Protocol[_GenericType_co]):
|
| 77 |
+
@overload
|
| 78 |
+
def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
|
| 79 |
+
@overload # platform dependent
|
| 80 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 81 |
+
@overload
|
| 82 |
+
def __call__(self, other: _IntType, /) -> _IntType: ...
|
| 83 |
+
|
| 84 |
+
class _BoolSub(Protocol):
|
| 85 |
+
# Note that `other: bool_` is absent here
|
| 86 |
+
@overload
|
| 87 |
+
def __call__(self, other: bool, /) -> NoReturn: ...
|
| 88 |
+
@overload # platform dependent
|
| 89 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 90 |
+
@overload
|
| 91 |
+
def __call__(self, other: float, /) -> float64: ...
|
| 92 |
+
@overload
|
| 93 |
+
def __call__(self, other: complex, /) -> complex128: ...
|
| 94 |
+
@overload
|
| 95 |
+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
|
| 96 |
+
|
| 97 |
+
class _BoolTrueDiv(Protocol):
|
| 98 |
+
@overload
|
| 99 |
+
def __call__(self, other: float | _IntLike_co, /) -> float64: ...
|
| 100 |
+
@overload
|
| 101 |
+
def __call__(self, other: complex, /) -> complex128: ...
|
| 102 |
+
@overload
|
| 103 |
+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
|
| 104 |
+
|
| 105 |
+
class _BoolMod(Protocol):
|
| 106 |
+
@overload
|
| 107 |
+
def __call__(self, other: _BoolLike_co, /) -> int8: ...
|
| 108 |
+
@overload # platform dependent
|
| 109 |
+
def __call__(self, other: int, /) -> int_: ...
|
| 110 |
+
@overload
|
| 111 |
+
def __call__(self, other: float, /) -> float64: ...
|
| 112 |
+
@overload
|
| 113 |
+
def __call__(self, other: _IntType, /) -> _IntType: ...
|
| 114 |
+
@overload
|
| 115 |
+
def __call__(self, other: _FloatType, /) -> _FloatType: ...
|
| 116 |
+
|
| 117 |
+
class _BoolDivMod(Protocol):
|
| 118 |
+
@overload
|
| 119 |
+
def __call__(self, other: _BoolLike_co, /) -> _2Tuple[int8]: ...
|
| 120 |
+
@overload # platform dependent
|
| 121 |
+
def __call__(self, other: int, /) -> _2Tuple[int_]: ...
|
| 122 |
+
@overload
|
| 123 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 124 |
+
@overload
|
| 125 |
+
def __call__(self, other: _IntType, /) -> _2Tuple[_IntType]: ...
|
| 126 |
+
@overload
|
| 127 |
+
def __call__(self, other: _FloatType, /) -> _2Tuple[_FloatType]: ...
|
| 128 |
+
|
| 129 |
+
class _TD64Div(Protocol[_NumberType_co]):
|
| 130 |
+
@overload
|
| 131 |
+
def __call__(self, other: timedelta64, /) -> _NumberType_co: ...
|
| 132 |
+
@overload
|
| 133 |
+
def __call__(self, other: _BoolLike_co, /) -> NoReturn: ...
|
| 134 |
+
@overload
|
| 135 |
+
def __call__(self, other: _FloatLike_co, /) -> timedelta64: ...
|
| 136 |
+
|
| 137 |
+
class _IntTrueDiv(Protocol[_NBit1]):
|
| 138 |
+
@overload
|
| 139 |
+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
|
| 140 |
+
@overload
|
| 141 |
+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
|
| 142 |
+
@overload
|
| 143 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 144 |
+
@overload
|
| 145 |
+
def __call__(
|
| 146 |
+
self, other: complex, /,
|
| 147 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 148 |
+
@overload
|
| 149 |
+
def __call__(self, other: integer[_NBit2], /) -> floating[_NBit1 | _NBit2]: ...
|
| 150 |
+
|
| 151 |
+
class _UnsignedIntOp(Protocol[_NBit1]):
|
| 152 |
+
# NOTE: `uint64 + signedinteger -> float64`
|
| 153 |
+
@overload
|
| 154 |
+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
|
| 155 |
+
@overload
|
| 156 |
+
def __call__(
|
| 157 |
+
self, other: int | signedinteger[Any], /
|
| 158 |
+
) -> Any: ...
|
| 159 |
+
@overload
|
| 160 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 161 |
+
@overload
|
| 162 |
+
def __call__(
|
| 163 |
+
self, other: complex, /,
|
| 164 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 165 |
+
@overload
|
| 166 |
+
def __call__(
|
| 167 |
+
self, other: unsignedinteger[_NBit2], /
|
| 168 |
+
) -> unsignedinteger[_NBit1 | _NBit2]: ...
|
| 169 |
+
|
| 170 |
+
class _UnsignedIntBitOp(Protocol[_NBit1]):
|
| 171 |
+
@overload
|
| 172 |
+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
|
| 173 |
+
@overload
|
| 174 |
+
def __call__(self, other: int, /) -> signedinteger[Any]: ...
|
| 175 |
+
@overload
|
| 176 |
+
def __call__(self, other: signedinteger[Any], /) -> signedinteger[Any]: ...
|
| 177 |
+
@overload
|
| 178 |
+
def __call__(
|
| 179 |
+
self, other: unsignedinteger[_NBit2], /
|
| 180 |
+
) -> unsignedinteger[_NBit1 | _NBit2]: ...
|
| 181 |
+
|
| 182 |
+
class _UnsignedIntMod(Protocol[_NBit1]):
|
| 183 |
+
@overload
|
| 184 |
+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
|
| 185 |
+
@overload
|
| 186 |
+
def __call__(
|
| 187 |
+
self, other: int | signedinteger[Any], /
|
| 188 |
+
) -> Any: ...
|
| 189 |
+
@overload
|
| 190 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 191 |
+
@overload
|
| 192 |
+
def __call__(
|
| 193 |
+
self, other: unsignedinteger[_NBit2], /
|
| 194 |
+
) -> unsignedinteger[_NBit1 | _NBit2]: ...
|
| 195 |
+
|
| 196 |
+
class _UnsignedIntDivMod(Protocol[_NBit1]):
|
| 197 |
+
@overload
|
| 198 |
+
def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
|
| 199 |
+
@overload
|
| 200 |
+
def __call__(
|
| 201 |
+
self, other: int | signedinteger[Any], /
|
| 202 |
+
) -> _2Tuple[Any]: ...
|
| 203 |
+
@overload
|
| 204 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 205 |
+
@overload
|
| 206 |
+
def __call__(
|
| 207 |
+
self, other: unsignedinteger[_NBit2], /
|
| 208 |
+
) -> _2Tuple[unsignedinteger[_NBit1 | _NBit2]]: ...
|
| 209 |
+
|
| 210 |
+
class _SignedIntOp(Protocol[_NBit1]):
|
| 211 |
+
@overload
|
| 212 |
+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
|
| 213 |
+
@overload
|
| 214 |
+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
|
| 215 |
+
@overload
|
| 216 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 217 |
+
@overload
|
| 218 |
+
def __call__(
|
| 219 |
+
self, other: complex, /,
|
| 220 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 221 |
+
@overload
|
| 222 |
+
def __call__(
|
| 223 |
+
self, other: signedinteger[_NBit2], /,
|
| 224 |
+
) -> signedinteger[_NBit1 | _NBit2]: ...
|
| 225 |
+
|
| 226 |
+
class _SignedIntBitOp(Protocol[_NBit1]):
|
| 227 |
+
@overload
|
| 228 |
+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
|
| 229 |
+
@overload
|
| 230 |
+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
|
| 231 |
+
@overload
|
| 232 |
+
def __call__(
|
| 233 |
+
self, other: signedinteger[_NBit2], /,
|
| 234 |
+
) -> signedinteger[_NBit1 | _NBit2]: ...
|
| 235 |
+
|
| 236 |
+
class _SignedIntMod(Protocol[_NBit1]):
|
| 237 |
+
@overload
|
| 238 |
+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
|
| 239 |
+
@overload
|
| 240 |
+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
|
| 241 |
+
@overload
|
| 242 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 243 |
+
@overload
|
| 244 |
+
def __call__(
|
| 245 |
+
self, other: signedinteger[_NBit2], /,
|
| 246 |
+
) -> signedinteger[_NBit1 | _NBit2]: ...
|
| 247 |
+
|
| 248 |
+
class _SignedIntDivMod(Protocol[_NBit1]):
|
| 249 |
+
@overload
|
| 250 |
+
def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
|
| 251 |
+
@overload
|
| 252 |
+
def __call__(self, other: int, /) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ...
|
| 253 |
+
@overload
|
| 254 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 255 |
+
@overload
|
| 256 |
+
def __call__(
|
| 257 |
+
self, other: signedinteger[_NBit2], /,
|
| 258 |
+
) -> _2Tuple[signedinteger[_NBit1 | _NBit2]]: ...
|
| 259 |
+
|
| 260 |
+
class _FloatOp(Protocol[_NBit1]):
|
| 261 |
+
@overload
|
| 262 |
+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
|
| 263 |
+
@overload
|
| 264 |
+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
|
| 265 |
+
@overload
|
| 266 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 267 |
+
@overload
|
| 268 |
+
def __call__(
|
| 269 |
+
self, other: complex, /,
|
| 270 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 271 |
+
@overload
|
| 272 |
+
def __call__(
|
| 273 |
+
self, other: integer[_NBit2] | floating[_NBit2], /
|
| 274 |
+
) -> floating[_NBit1 | _NBit2]: ...
|
| 275 |
+
|
| 276 |
+
class _FloatMod(Protocol[_NBit1]):
|
| 277 |
+
@overload
|
| 278 |
+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
|
| 279 |
+
@overload
|
| 280 |
+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
|
| 281 |
+
@overload
|
| 282 |
+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
|
| 283 |
+
@overload
|
| 284 |
+
def __call__(
|
| 285 |
+
self, other: integer[_NBit2] | floating[_NBit2], /
|
| 286 |
+
) -> floating[_NBit1 | _NBit2]: ...
|
| 287 |
+
|
| 288 |
+
class _FloatDivMod(Protocol[_NBit1]):
|
| 289 |
+
@overload
|
| 290 |
+
def __call__(self, other: bool, /) -> _2Tuple[floating[_NBit1]]: ...
|
| 291 |
+
@overload
|
| 292 |
+
def __call__(self, other: int, /) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ...
|
| 293 |
+
@overload
|
| 294 |
+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
|
| 295 |
+
@overload
|
| 296 |
+
def __call__(
|
| 297 |
+
self, other: integer[_NBit2] | floating[_NBit2], /
|
| 298 |
+
) -> _2Tuple[floating[_NBit1 | _NBit2]]: ...
|
| 299 |
+
|
| 300 |
+
class _ComplexOp(Protocol[_NBit1]):
|
| 301 |
+
@overload
|
| 302 |
+
def __call__(self, other: bool, /) -> complexfloating[_NBit1, _NBit1]: ...
|
| 303 |
+
@overload
|
| 304 |
+
def __call__(self, other: int, /) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ...
|
| 305 |
+
@overload
|
| 306 |
+
def __call__(
|
| 307 |
+
self, other: complex, /,
|
| 308 |
+
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
|
| 309 |
+
@overload
|
| 310 |
+
def __call__(
|
| 311 |
+
self,
|
| 312 |
+
other: (
|
| 313 |
+
integer[_NBit2]
|
| 314 |
+
| floating[_NBit2]
|
| 315 |
+
| complexfloating[_NBit2, _NBit2]
|
| 316 |
+
), /,
|
| 317 |
+
) -> complexfloating[_NBit1 | _NBit2, _NBit1 | _NBit2]: ...
|
| 318 |
+
|
| 319 |
+
class _NumberOp(Protocol):
|
| 320 |
+
def __call__(self, other: _NumberLike_co, /) -> Any: ...
|
| 321 |
+
|
| 322 |
+
class _SupportsLT(Protocol):
|
| 323 |
+
def __lt__(self, other: Any, /) -> object: ...
|
| 324 |
+
|
| 325 |
+
class _SupportsGT(Protocol):
|
| 326 |
+
def __gt__(self, other: Any, /) -> object: ...
|
| 327 |
+
|
| 328 |
+
class _ComparisonOp(Protocol[_T1_contra, _T2_contra]):
|
| 329 |
+
@overload
|
| 330 |
+
def __call__(self, other: _T1_contra, /) -> bool_: ...
|
| 331 |
+
@overload
|
| 332 |
+
def __call__(self, other: _T2_contra, /) -> NDArray[bool_]: ...
|
| 333 |
+
@overload
|
| 334 |
+
def __call__(
|
| 335 |
+
self,
|
| 336 |
+
other: _SupportsLT | _SupportsGT | _NestedSequence[_SupportsLT | _SupportsGT],
|
| 337 |
+
/,
|
| 338 |
+
) -> Any: ...
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_char_codes.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal
|
| 2 |
+
|
| 3 |
+
_BoolCodes = Literal["?", "=?", "<?", ">?", "bool", "bool_", "bool8"]
|
| 4 |
+
|
| 5 |
+
_UInt8Codes = Literal["uint8", "u1", "=u1", "<u1", ">u1"]
|
| 6 |
+
_UInt16Codes = Literal["uint16", "u2", "=u2", "<u2", ">u2"]
|
| 7 |
+
_UInt32Codes = Literal["uint32", "u4", "=u4", "<u4", ">u4"]
|
| 8 |
+
_UInt64Codes = Literal["uint64", "u8", "=u8", "<u8", ">u8"]
|
| 9 |
+
|
| 10 |
+
_Int8Codes = Literal["int8", "i1", "=i1", "<i1", ">i1"]
|
| 11 |
+
_Int16Codes = Literal["int16", "i2", "=i2", "<i2", ">i2"]
|
| 12 |
+
_Int32Codes = Literal["int32", "i4", "=i4", "<i4", ">i4"]
|
| 13 |
+
_Int64Codes = Literal["int64", "i8", "=i8", "<i8", ">i8"]
|
| 14 |
+
|
| 15 |
+
_Float16Codes = Literal["float16", "f2", "=f2", "<f2", ">f2"]
|
| 16 |
+
_Float32Codes = Literal["float32", "f4", "=f4", "<f4", ">f4"]
|
| 17 |
+
_Float64Codes = Literal["float64", "f8", "=f8", "<f8", ">f8"]
|
| 18 |
+
|
| 19 |
+
_Complex64Codes = Literal["complex64", "c8", "=c8", "<c8", ">c8"]
|
| 20 |
+
_Complex128Codes = Literal["complex128", "c16", "=c16", "<c16", ">c16"]
|
| 21 |
+
|
| 22 |
+
_ByteCodes = Literal["byte", "b", "=b", "<b", ">b"]
|
| 23 |
+
_ShortCodes = Literal["short", "h", "=h", "<h", ">h"]
|
| 24 |
+
_IntCCodes = Literal["intc", "i", "=i", "<i", ">i"]
|
| 25 |
+
_IntPCodes = Literal["intp", "int0", "p", "=p", "<p", ">p"]
|
| 26 |
+
_IntCodes = Literal["long", "int", "int_", "l", "=l", "<l", ">l"]
|
| 27 |
+
_LongLongCodes = Literal["longlong", "q", "=q", "<q", ">q"]
|
| 28 |
+
|
| 29 |
+
_UByteCodes = Literal["ubyte", "B", "=B", "<B", ">B"]
|
| 30 |
+
_UShortCodes = Literal["ushort", "H", "=H", "<H", ">H"]
|
| 31 |
+
_UIntCCodes = Literal["uintc", "I", "=I", "<I", ">I"]
|
| 32 |
+
_UIntPCodes = Literal["uintp", "uint0", "P", "=P", "<P", ">P"]
|
| 33 |
+
_UIntCodes = Literal["ulong", "uint", "L", "=L", "<L", ">L"]
|
| 34 |
+
_ULongLongCodes = Literal["ulonglong", "Q", "=Q", "<Q", ">Q"]
|
| 35 |
+
|
| 36 |
+
_HalfCodes = Literal["half", "e", "=e", "<e", ">e"]
|
| 37 |
+
_SingleCodes = Literal["single", "f", "=f", "<f", ">f"]
|
| 38 |
+
_DoubleCodes = Literal["double", "float", "float_", "d", "=d", "<d", ">d"]
|
| 39 |
+
_LongDoubleCodes = Literal["longdouble", "longfloat", "g", "=g", "<g", ">g"]
|
| 40 |
+
|
| 41 |
+
_CSingleCodes = Literal["csingle", "singlecomplex", "F", "=F", "<F", ">F"]
|
| 42 |
+
_CDoubleCodes = Literal["cdouble", "complex", "complex_", "cfloat", "D", "=D", "<D", ">D"]
|
| 43 |
+
_CLongDoubleCodes = Literal["clongdouble", "clongfloat", "longcomplex", "G", "=G", "<G", ">G"]
|
| 44 |
+
|
| 45 |
+
_StrCodes = Literal["str", "str_", "str0", "unicode", "unicode_", "U", "=U", "<U", ">U"]
|
| 46 |
+
_BytesCodes = Literal["bytes", "bytes_", "bytes0", "S", "=S", "<S", ">S"]
|
| 47 |
+
_VoidCodes = Literal["void", "void0", "V", "=V", "<V", ">V"]
|
| 48 |
+
_ObjectCodes = Literal["object", "object_", "O", "=O", "<O", ">O"]
|
| 49 |
+
|
| 50 |
+
_DT64Codes = Literal[
|
| 51 |
+
"datetime64", "=datetime64", "<datetime64", ">datetime64",
|
| 52 |
+
"datetime64[Y]", "=datetime64[Y]", "<datetime64[Y]", ">datetime64[Y]",
|
| 53 |
+
"datetime64[M]", "=datetime64[M]", "<datetime64[M]", ">datetime64[M]",
|
| 54 |
+
"datetime64[W]", "=datetime64[W]", "<datetime64[W]", ">datetime64[W]",
|
| 55 |
+
"datetime64[D]", "=datetime64[D]", "<datetime64[D]", ">datetime64[D]",
|
| 56 |
+
"datetime64[h]", "=datetime64[h]", "<datetime64[h]", ">datetime64[h]",
|
| 57 |
+
"datetime64[m]", "=datetime64[m]", "<datetime64[m]", ">datetime64[m]",
|
| 58 |
+
"datetime64[s]", "=datetime64[s]", "<datetime64[s]", ">datetime64[s]",
|
| 59 |
+
"datetime64[ms]", "=datetime64[ms]", "<datetime64[ms]", ">datetime64[ms]",
|
| 60 |
+
"datetime64[us]", "=datetime64[us]", "<datetime64[us]", ">datetime64[us]",
|
| 61 |
+
"datetime64[ns]", "=datetime64[ns]", "<datetime64[ns]", ">datetime64[ns]",
|
| 62 |
+
"datetime64[ps]", "=datetime64[ps]", "<datetime64[ps]", ">datetime64[ps]",
|
| 63 |
+
"datetime64[fs]", "=datetime64[fs]", "<datetime64[fs]", ">datetime64[fs]",
|
| 64 |
+
"datetime64[as]", "=datetime64[as]", "<datetime64[as]", ">datetime64[as]",
|
| 65 |
+
"M", "=M", "<M", ">M",
|
| 66 |
+
"M8", "=M8", "<M8", ">M8",
|
| 67 |
+
"M8[Y]", "=M8[Y]", "<M8[Y]", ">M8[Y]",
|
| 68 |
+
"M8[M]", "=M8[M]", "<M8[M]", ">M8[M]",
|
| 69 |
+
"M8[W]", "=M8[W]", "<M8[W]", ">M8[W]",
|
| 70 |
+
"M8[D]", "=M8[D]", "<M8[D]", ">M8[D]",
|
| 71 |
+
"M8[h]", "=M8[h]", "<M8[h]", ">M8[h]",
|
| 72 |
+
"M8[m]", "=M8[m]", "<M8[m]", ">M8[m]",
|
| 73 |
+
"M8[s]", "=M8[s]", "<M8[s]", ">M8[s]",
|
| 74 |
+
"M8[ms]", "=M8[ms]", "<M8[ms]", ">M8[ms]",
|
| 75 |
+
"M8[us]", "=M8[us]", "<M8[us]", ">M8[us]",
|
| 76 |
+
"M8[ns]", "=M8[ns]", "<M8[ns]", ">M8[ns]",
|
| 77 |
+
"M8[ps]", "=M8[ps]", "<M8[ps]", ">M8[ps]",
|
| 78 |
+
"M8[fs]", "=M8[fs]", "<M8[fs]", ">M8[fs]",
|
| 79 |
+
"M8[as]", "=M8[as]", "<M8[as]", ">M8[as]",
|
| 80 |
+
]
|
| 81 |
+
_TD64Codes = Literal[
|
| 82 |
+
"timedelta64", "=timedelta64", "<timedelta64", ">timedelta64",
|
| 83 |
+
"timedelta64[Y]", "=timedelta64[Y]", "<timedelta64[Y]", ">timedelta64[Y]",
|
| 84 |
+
"timedelta64[M]", "=timedelta64[M]", "<timedelta64[M]", ">timedelta64[M]",
|
| 85 |
+
"timedelta64[W]", "=timedelta64[W]", "<timedelta64[W]", ">timedelta64[W]",
|
| 86 |
+
"timedelta64[D]", "=timedelta64[D]", "<timedelta64[D]", ">timedelta64[D]",
|
| 87 |
+
"timedelta64[h]", "=timedelta64[h]", "<timedelta64[h]", ">timedelta64[h]",
|
| 88 |
+
"timedelta64[m]", "=timedelta64[m]", "<timedelta64[m]", ">timedelta64[m]",
|
| 89 |
+
"timedelta64[s]", "=timedelta64[s]", "<timedelta64[s]", ">timedelta64[s]",
|
| 90 |
+
"timedelta64[ms]", "=timedelta64[ms]", "<timedelta64[ms]", ">timedelta64[ms]",
|
| 91 |
+
"timedelta64[us]", "=timedelta64[us]", "<timedelta64[us]", ">timedelta64[us]",
|
| 92 |
+
"timedelta64[ns]", "=timedelta64[ns]", "<timedelta64[ns]", ">timedelta64[ns]",
|
| 93 |
+
"timedelta64[ps]", "=timedelta64[ps]", "<timedelta64[ps]", ">timedelta64[ps]",
|
| 94 |
+
"timedelta64[fs]", "=timedelta64[fs]", "<timedelta64[fs]", ">timedelta64[fs]",
|
| 95 |
+
"timedelta64[as]", "=timedelta64[as]", "<timedelta64[as]", ">timedelta64[as]",
|
| 96 |
+
"m", "=m", "<m", ">m",
|
| 97 |
+
"m8", "=m8", "<m8", ">m8",
|
| 98 |
+
"m8[Y]", "=m8[Y]", "<m8[Y]", ">m8[Y]",
|
| 99 |
+
"m8[M]", "=m8[M]", "<m8[M]", ">m8[M]",
|
| 100 |
+
"m8[W]", "=m8[W]", "<m8[W]", ">m8[W]",
|
| 101 |
+
"m8[D]", "=m8[D]", "<m8[D]", ">m8[D]",
|
| 102 |
+
"m8[h]", "=m8[h]", "<m8[h]", ">m8[h]",
|
| 103 |
+
"m8[m]", "=m8[m]", "<m8[m]", ">m8[m]",
|
| 104 |
+
"m8[s]", "=m8[s]", "<m8[s]", ">m8[s]",
|
| 105 |
+
"m8[ms]", "=m8[ms]", "<m8[ms]", ">m8[ms]",
|
| 106 |
+
"m8[us]", "=m8[us]", "<m8[us]", ">m8[us]",
|
| 107 |
+
"m8[ns]", "=m8[ns]", "<m8[ns]", ">m8[ns]",
|
| 108 |
+
"m8[ps]", "=m8[ps]", "<m8[ps]", ">m8[ps]",
|
| 109 |
+
"m8[fs]", "=m8[fs]", "<m8[fs]", ">m8[fs]",
|
| 110 |
+
"m8[as]", "=m8[as]", "<m8[as]", ">m8[as]",
|
| 111 |
+
]
|
Prism/LLaDA/LLaDA_Prism/.venv/lib/python3.12/site-packages/numpy/_typing/_dtype_like.py
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Sequence
|
| 2 |
+
from typing import (
|
| 3 |
+
Any,
|
| 4 |
+
Sequence,
|
| 5 |
+
Union,
|
| 6 |
+
TypeVar,
|
| 7 |
+
Protocol,
|
| 8 |
+
TypedDict,
|
| 9 |
+
runtime_checkable,
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
|
| 14 |
+
from ._shape import _ShapeLike
|
| 15 |
+
|
| 16 |
+
from ._char_codes import (
|
| 17 |
+
_BoolCodes,
|
| 18 |
+
_UInt8Codes,
|
| 19 |
+
_UInt16Codes,
|
| 20 |
+
_UInt32Codes,
|
| 21 |
+
_UInt64Codes,
|
| 22 |
+
_Int8Codes,
|
| 23 |
+
_Int16Codes,
|
| 24 |
+
_Int32Codes,
|
| 25 |
+
_Int64Codes,
|
| 26 |
+
_Float16Codes,
|
| 27 |
+
_Float32Codes,
|
| 28 |
+
_Float64Codes,
|
| 29 |
+
_Complex64Codes,
|
| 30 |
+
_Complex128Codes,
|
| 31 |
+
_ByteCodes,
|
| 32 |
+
_ShortCodes,
|
| 33 |
+
_IntCCodes,
|
| 34 |
+
_IntPCodes,
|
| 35 |
+
_IntCodes,
|
| 36 |
+
_LongLongCodes,
|
| 37 |
+
_UByteCodes,
|
| 38 |
+
_UShortCodes,
|
| 39 |
+
_UIntCCodes,
|
| 40 |
+
_UIntPCodes,
|
| 41 |
+
_UIntCodes,
|
| 42 |
+
_ULongLongCodes,
|
| 43 |
+
_HalfCodes,
|
| 44 |
+
_SingleCodes,
|
| 45 |
+
_DoubleCodes,
|
| 46 |
+
_LongDoubleCodes,
|
| 47 |
+
_CSingleCodes,
|
| 48 |
+
_CDoubleCodes,
|
| 49 |
+
_CLongDoubleCodes,
|
| 50 |
+
_DT64Codes,
|
| 51 |
+
_TD64Codes,
|
| 52 |
+
_StrCodes,
|
| 53 |
+
_BytesCodes,
|
| 54 |
+
_VoidCodes,
|
| 55 |
+
_ObjectCodes,
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
_SCT = TypeVar("_SCT", bound=np.generic)
|
| 59 |
+
_DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype[Any])
|
| 60 |
+
|
| 61 |
+
_DTypeLikeNested = Any # TODO: wait for support for recursive types
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
# Mandatory keys
|
| 65 |
+
class _DTypeDictBase(TypedDict):
|
| 66 |
+
names: Sequence[str]
|
| 67 |
+
formats: Sequence[_DTypeLikeNested]
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# Mandatory + optional keys
|
| 71 |
+
class _DTypeDict(_DTypeDictBase, total=False):
|
| 72 |
+
# Only `str` elements are usable as indexing aliases,
|
| 73 |
+
# but `titles` can in principle accept any object
|
| 74 |
+
offsets: Sequence[int]
|
| 75 |
+
titles: Sequence[Any]
|
| 76 |
+
itemsize: int
|
| 77 |
+
aligned: bool
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# A protocol for anything with the dtype attribute
|
| 81 |
+
@runtime_checkable
|
| 82 |
+
class _SupportsDType(Protocol[_DType_co]):
|
| 83 |
+
@property
|
| 84 |
+
def dtype(self) -> _DType_co: ...
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# A subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic`
|
| 88 |
+
_DTypeLike = Union[
|
| 89 |
+
np.dtype[_SCT],
|
| 90 |
+
type[_SCT],
|
| 91 |
+
_SupportsDType[np.dtype[_SCT]],
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
# Would create a dtype[np.void]
|
| 96 |
+
_VoidDTypeLike = Union[
|
| 97 |
+
# (flexible_dtype, itemsize)
|
| 98 |
+
tuple[_DTypeLikeNested, int],
|
| 99 |
+
# (fixed_dtype, shape)
|
| 100 |
+
tuple[_DTypeLikeNested, _ShapeLike],
|
| 101 |
+
# [(field_name, field_dtype, field_shape), ...]
|
| 102 |
+
#
|
| 103 |
+
# The type here is quite broad because NumPy accepts quite a wide
|
| 104 |
+
# range of inputs inside the list; see the tests for some
|
| 105 |
+
# examples.
|
| 106 |
+
list[Any],
|
| 107 |
+
# {'names': ..., 'formats': ..., 'offsets': ..., 'titles': ...,
|
| 108 |
+
# 'itemsize': ...}
|
| 109 |
+
_DTypeDict,
|
| 110 |
+
# (base_dtype, new_dtype)
|
| 111 |
+
tuple[_DTypeLikeNested, _DTypeLikeNested],
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
# Anything that can be coerced into numpy.dtype.
|
| 115 |
+
# Reference: https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html
|
| 116 |
+
DTypeLike = Union[
|
| 117 |
+
np.dtype[Any],
|
| 118 |
+
# default data type (float64)
|
| 119 |
+
None,
|
| 120 |
+
# array-scalar types and generic types
|
| 121 |
+
type[Any], # NOTE: We're stuck with `type[Any]` due to object dtypes
|
| 122 |
+
# anything with a dtype attribute
|
| 123 |
+
_SupportsDType[np.dtype[Any]],
|
| 124 |
+
# character codes, type strings or comma-separated fields, e.g., 'float64'
|
| 125 |
+
str,
|
| 126 |
+
_VoidDTypeLike,
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
# NOTE: while it is possible to provide the dtype as a dict of
|
| 130 |
+
# dtype-like objects (e.g. `{'field1': ..., 'field2': ..., ...}`),
|
| 131 |
+
# this syntax is officially discourged and
|
| 132 |
+
# therefore not included in the Union defining `DTypeLike`.
|
| 133 |
+
#
|
| 134 |
+
# See https://github.com/numpy/numpy/issues/16891 for more details.
|
| 135 |
+
|
| 136 |
+
# Aliases for commonly used dtype-like objects.
|
| 137 |
+
# Note that the precision of `np.number` subclasses is ignored herein.
|
| 138 |
+
_DTypeLikeBool = Union[
|
| 139 |
+
type[bool],
|
| 140 |
+
type[np.bool_],
|
| 141 |
+
np.dtype[np.bool_],
|
| 142 |
+
_SupportsDType[np.dtype[np.bool_]],
|
| 143 |
+
_BoolCodes,
|
| 144 |
+
]
|
| 145 |
+
_DTypeLikeUInt = Union[
|
| 146 |
+
type[np.unsignedinteger],
|
| 147 |
+
np.dtype[np.unsignedinteger],
|
| 148 |
+
_SupportsDType[np.dtype[np.unsignedinteger]],
|
| 149 |
+
_UInt8Codes,
|
| 150 |
+
_UInt16Codes,
|
| 151 |
+
_UInt32Codes,
|
| 152 |
+
_UInt64Codes,
|
| 153 |
+
_UByteCodes,
|
| 154 |
+
_UShortCodes,
|
| 155 |
+
_UIntCCodes,
|
| 156 |
+
_UIntPCodes,
|
| 157 |
+
_UIntCodes,
|
| 158 |
+
_ULongLongCodes,
|
| 159 |
+
]
|
| 160 |
+
_DTypeLikeInt = Union[
|
| 161 |
+
type[int],
|
| 162 |
+
type[np.signedinteger],
|
| 163 |
+
np.dtype[np.signedinteger],
|
| 164 |
+
_SupportsDType[np.dtype[np.signedinteger]],
|
| 165 |
+
_Int8Codes,
|
| 166 |
+
_Int16Codes,
|
| 167 |
+
_Int32Codes,
|
| 168 |
+
_Int64Codes,
|
| 169 |
+
_ByteCodes,
|
| 170 |
+
_ShortCodes,
|
| 171 |
+
_IntCCodes,
|
| 172 |
+
_IntPCodes,
|
| 173 |
+
_IntCodes,
|
| 174 |
+
_LongLongCodes,
|
| 175 |
+
]
|
| 176 |
+
_DTypeLikeFloat = Union[
|
| 177 |
+
type[float],
|
| 178 |
+
type[np.floating],
|
| 179 |
+
np.dtype[np.floating],
|
| 180 |
+
_SupportsDType[np.dtype[np.floating]],
|
| 181 |
+
_Float16Codes,
|
| 182 |
+
_Float32Codes,
|
| 183 |
+
_Float64Codes,
|
| 184 |
+
_HalfCodes,
|
| 185 |
+
_SingleCodes,
|
| 186 |
+
_DoubleCodes,
|
| 187 |
+
_LongDoubleCodes,
|
| 188 |
+
]
|
| 189 |
+
_DTypeLikeComplex = Union[
|
| 190 |
+
type[complex],
|
| 191 |
+
type[np.complexfloating],
|
| 192 |
+
np.dtype[np.complexfloating],
|
| 193 |
+
_SupportsDType[np.dtype[np.complexfloating]],
|
| 194 |
+
_Complex64Codes,
|
| 195 |
+
_Complex128Codes,
|
| 196 |
+
_CSingleCodes,
|
| 197 |
+
_CDoubleCodes,
|
| 198 |
+
_CLongDoubleCodes,
|
| 199 |
+
]
|
| 200 |
+
_DTypeLikeDT64 = Union[
|
| 201 |
+
type[np.timedelta64],
|
| 202 |
+
np.dtype[np.timedelta64],
|
| 203 |
+
_SupportsDType[np.dtype[np.timedelta64]],
|
| 204 |
+
_TD64Codes,
|
| 205 |
+
]
|
| 206 |
+
_DTypeLikeTD64 = Union[
|
| 207 |
+
type[np.datetime64],
|
| 208 |
+
np.dtype[np.datetime64],
|
| 209 |
+
_SupportsDType[np.dtype[np.datetime64]],
|
| 210 |
+
_DT64Codes,
|
| 211 |
+
]
|
| 212 |
+
_DTypeLikeStr = Union[
|
| 213 |
+
type[str],
|
| 214 |
+
type[np.str_],
|
| 215 |
+
np.dtype[np.str_],
|
| 216 |
+
_SupportsDType[np.dtype[np.str_]],
|
| 217 |
+
_StrCodes,
|
| 218 |
+
]
|
| 219 |
+
_DTypeLikeBytes = Union[
|
| 220 |
+
type[bytes],
|
| 221 |
+
type[np.bytes_],
|
| 222 |
+
np.dtype[np.bytes_],
|
| 223 |
+
_SupportsDType[np.dtype[np.bytes_]],
|
| 224 |
+
_BytesCodes,
|
| 225 |
+
]
|
| 226 |
+
_DTypeLikeVoid = Union[
|
| 227 |
+
type[np.void],
|
| 228 |
+
np.dtype[np.void],
|
| 229 |
+
_SupportsDType[np.dtype[np.void]],
|
| 230 |
+
_VoidCodes,
|
| 231 |
+
_VoidDTypeLike,
|
| 232 |
+
]
|
| 233 |
+
_DTypeLikeObject = Union[
|
| 234 |
+
type,
|
| 235 |
+
np.dtype[np.object_],
|
| 236 |
+
_SupportsDType[np.dtype[np.object_]],
|
| 237 |
+
_ObjectCodes,
|
| 238 |
+
]
|
| 239 |
+
|
| 240 |
+
_DTypeLikeComplex_co = Union[
|
| 241 |
+
_DTypeLikeBool,
|
| 242 |
+
_DTypeLikeUInt,
|
| 243 |
+
_DTypeLikeInt,
|
| 244 |
+
_DTypeLikeFloat,
|
| 245 |
+
_DTypeLikeComplex,
|
| 246 |
+
]
|