Instructions to use elichen-skymizer/GAP-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use elichen-skymizer/GAP-models with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf elichen-skymizer/GAP-models:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf elichen-skymizer/GAP-models:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf elichen-skymizer/GAP-models:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf elichen-skymizer/GAP-models:UD-Q4_K_XL
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf elichen-skymizer/GAP-models:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama cli -hf elichen-skymizer/GAP-models:UD-Q4_K_XL
Use Docker
docker model run hf.co/elichen-skymizer/GAP-models:UD-Q4_K_XL
- Llama new
- LM Studio
- Jan
- Ollama
How to use elichen-skymizer/GAP-models with Ollama:
ollama run hf.co/elichen-skymizer/GAP-models:UD-Q4_K_XL
- Unsloth Desktop
- Pi
How to use elichen-skymizer/GAP-models with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf elichen-skymizer/GAP-models:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "elichen-skymizer/GAP-models:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use elichen-skymizer/GAP-models with Docker Model Runner:
docker model run hf.co/elichen-skymizer/GAP-models:UD-Q4_K_XL
- Lemonade
How to use elichen-skymizer/GAP-models with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull elichen-skymizer/GAP-models:UD-Q4_K_XL
Run and chat with the model
lemonade run user.GAP-models-UD-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use elichen-skymizer/GAP-models with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf elichen-skymizer/GAP-models:UD-Q4_K_XL
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default elichen-skymizer/GAP-models:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use elichen-skymizer/GAP-models with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf elichen-skymizer/GAP-models:UD-Q4_K_XL
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "elichen-skymizer/GAP-models:UD-Q4_K_XL" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Add files using upload-large-folder tool
Browse files- qwen3.8-27b/.venv/.gitignore +1 -0
- qwen3.8-27b/.venv/.lock +0 -0
- qwen3.8-27b/.venv/CACHEDIR.TAG +1 -0
- qwen3.8-27b/.venv/bin/activate +130 -0
- qwen3.8-27b/.venv/bin/activate.bat +71 -0
- qwen3.8-27b/.venv/bin/activate.csh +76 -0
- qwen3.8-27b/.venv/bin/activate.fish +127 -0
- qwen3.8-27b/.venv/bin/activate.nu +104 -0
- qwen3.8-27b/.venv/bin/activate.ps1 +82 -0
- qwen3.8-27b/.venv/bin/activate.xsh +102 -0
- qwen3.8-27b/.venv/bin/activate_this.py +59 -0
- qwen3.8-27b/.venv/bin/deactivate.bat +39 -0
- qwen3.8-27b/.venv/bin/f2py +10 -0
- qwen3.8-27b/.venv/bin/hf +10 -0
- qwen3.8-27b/.venv/bin/httpx +10 -0
- qwen3.8-27b/.venv/bin/huggingface-cli +10 -0
- qwen3.8-27b/.venv/bin/idna +10 -0
- qwen3.8-27b/.venv/bin/markdown-it +10 -0
- qwen3.8-27b/.venv/bin/numpy-config +10 -0
- qwen3.8-27b/.venv/bin/pydoc.bat +22 -0
- qwen3.8-27b/.venv/bin/pygmentize +10 -0
- qwen3.8-27b/.venv/bin/tiny-agents +10 -0
- qwen3.8-27b/.venv/bin/tqdm +10 -0
- qwen3.8-27b/.venv/bin/transformers +10 -0
- qwen3.8-27b/.venv/bin/typer +10 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/__pycache__/_virtualenv.cpython-312.pyc +0 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/_virtualenv.py +121 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__config__.py +170 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__config__.pyi +108 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd +1312 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.pxd +12 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.py +926 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.pyi +0 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_array_api_info.py +349 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_array_api_info.pyi +177 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_configtool.py +39 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_configtool.pyi +1 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_distributor_init.py +15 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_distributor_init.pyi +1 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_expired_attrs_2_0.py +78 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_expired_attrs_2_0.pyi +61 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_globals.py +121 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_globals.pyi +17 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_pytesttester.py +186 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_pytesttester.pyi +18 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/conftest.py +249 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/dtypes.py +86 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/dtypes.pyi +627 -0
- qwen3.8-27b/.venv/lib/python3.12/site-packages/typing_extensions.py +0 -0
- qwen3.8-27b/.venv/pyvenv.cfg +6 -0
qwen3.8-27b/.venv/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*
|
qwen3.8-27b/.venv/.lock
ADDED
|
File without changes
|
qwen3.8-27b/.venv/CACHEDIR.TAG
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
qwen3.8-27b/.venv/bin/activate
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# This file must be used with "source bin/activate" *from bash*
|
| 23 |
+
# you cannot run it directly
|
| 24 |
+
|
| 25 |
+
if ! [ -z "${SCRIPT_PATH+_}" ] ; then
|
| 26 |
+
_OLD_SCRIPT_PATH="$SCRIPT_PATH"
|
| 27 |
+
fi
|
| 28 |
+
|
| 29 |
+
# Get script path (only used if environment is relocatable).
|
| 30 |
+
if [ -n "${BASH_VERSION:+x}" ] ; then
|
| 31 |
+
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
| 32 |
+
if [ "$SCRIPT_PATH" = "$0" ]; then
|
| 33 |
+
# Only bash has a reasonably robust check for source'dness.
|
| 34 |
+
echo "You must source this script: \$ source $0" >&2
|
| 35 |
+
exit 33
|
| 36 |
+
fi
|
| 37 |
+
elif [ -n "${ZSH_VERSION:+x}" ] ; then
|
| 38 |
+
SCRIPT_PATH="${(%):-%x}"
|
| 39 |
+
elif [ -n "${KSH_VERSION:+x}" ] ; then
|
| 40 |
+
SCRIPT_PATH="${.sh.file}"
|
| 41 |
+
fi
|
| 42 |
+
|
| 43 |
+
deactivate () {
|
| 44 |
+
unset -f pydoc >/dev/null 2>&1 || true
|
| 45 |
+
|
| 46 |
+
# reset old environment variables
|
| 47 |
+
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
|
| 48 |
+
if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
|
| 49 |
+
PATH="$_OLD_VIRTUAL_PATH"
|
| 50 |
+
export PATH
|
| 51 |
+
unset _OLD_VIRTUAL_PATH
|
| 52 |
+
fi
|
| 53 |
+
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
|
| 54 |
+
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
|
| 55 |
+
export PYTHONHOME
|
| 56 |
+
unset _OLD_VIRTUAL_PYTHONHOME
|
| 57 |
+
fi
|
| 58 |
+
|
| 59 |
+
# The hash command must be called to get it to forget past
|
| 60 |
+
# commands. Without forgetting past commands the $PATH changes
|
| 61 |
+
# we made may not be respected
|
| 62 |
+
hash -r 2>/dev/null
|
| 63 |
+
|
| 64 |
+
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
|
| 65 |
+
PS1="$_OLD_VIRTUAL_PS1"
|
| 66 |
+
export PS1
|
| 67 |
+
unset _OLD_VIRTUAL_PS1
|
| 68 |
+
fi
|
| 69 |
+
|
| 70 |
+
unset VIRTUAL_ENV
|
| 71 |
+
unset VIRTUAL_ENV_PROMPT
|
| 72 |
+
if [ ! "${1-}" = "nondestructive" ] ; then
|
| 73 |
+
# Self destruct!
|
| 74 |
+
unset -f deactivate
|
| 75 |
+
fi
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
# unset irrelevant variables
|
| 79 |
+
deactivate nondestructive
|
| 80 |
+
|
| 81 |
+
VIRTUAL_ENV='/workspace/models/qwen3.8-27b/.venv'
|
| 82 |
+
if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
|
| 83 |
+
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
|
| 84 |
+
fi
|
| 85 |
+
export VIRTUAL_ENV
|
| 86 |
+
|
| 87 |
+
# Unset the `SCRIPT_PATH` variable, now that the `VIRTUAL_ENV` variable
|
| 88 |
+
# has been set. This is important for relocatable environments.
|
| 89 |
+
if ! [ -z "${_OLD_SCRIPT_PATH+_}" ] ; then
|
| 90 |
+
SCRIPT_PATH="$_OLD_SCRIPT_PATH"
|
| 91 |
+
export SCRIPT_PATH
|
| 92 |
+
unset _OLD_SCRIPT_PATH
|
| 93 |
+
else
|
| 94 |
+
unset SCRIPT_PATH
|
| 95 |
+
fi
|
| 96 |
+
|
| 97 |
+
_OLD_VIRTUAL_PATH="$PATH"
|
| 98 |
+
PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 99 |
+
export PATH
|
| 100 |
+
|
| 101 |
+
if [ "xqwen3.8-27b" != x ] ; then
|
| 102 |
+
VIRTUAL_ENV_PROMPT="qwen3.8-27b"
|
| 103 |
+
else
|
| 104 |
+
VIRTUAL_ENV_PROMPT=$(basename "$VIRTUAL_ENV")
|
| 105 |
+
fi
|
| 106 |
+
export VIRTUAL_ENV_PROMPT
|
| 107 |
+
|
| 108 |
+
# unset PYTHONHOME if set
|
| 109 |
+
if ! [ -z "${PYTHONHOME+_}" ] ; then
|
| 110 |
+
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
|
| 111 |
+
unset PYTHONHOME
|
| 112 |
+
fi
|
| 113 |
+
|
| 114 |
+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
|
| 115 |
+
_OLD_VIRTUAL_PS1="${PS1-}"
|
| 116 |
+
PS1="(${VIRTUAL_ENV_PROMPT}) ${PS1-}"
|
| 117 |
+
export PS1
|
| 118 |
+
fi
|
| 119 |
+
|
| 120 |
+
# Make sure to unalias pydoc if it's already there
|
| 121 |
+
alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
|
| 122 |
+
|
| 123 |
+
pydoc () {
|
| 124 |
+
python -m pydoc "$@"
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
# The hash command must be called to get it to forget past
|
| 128 |
+
# commands. Without forgetting past commands the $PATH changes
|
| 129 |
+
# we made may not be respected
|
| 130 |
+
hash -r 2>/dev/null || true
|
qwen3.8-27b/.venv/bin/activate.bat
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@REM Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
@REM
|
| 3 |
+
@REM Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
@REM a copy of this software and associated documentation files (the
|
| 5 |
+
@REM "Software"), to deal in the Software without restriction, including
|
| 6 |
+
@REM without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
@REM distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
@REM permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
@REM the following conditions:
|
| 10 |
+
@REM
|
| 11 |
+
@REM The above copyright notice and this permission notice shall be
|
| 12 |
+
@REM included in all copies or substantial portions of the Software.
|
| 13 |
+
@REM
|
| 14 |
+
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
@REM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
@REM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
@REM NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
@REM LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
@REM OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
@REM WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
@REM This file is UTF-8 encoded, so we need to update the current code page while executing it
|
| 23 |
+
@for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do @set _OLD_CODEPAGE=%%a
|
| 24 |
+
|
| 25 |
+
@if defined _OLD_CODEPAGE (
|
| 26 |
+
"%SystemRoot%\System32\chcp.com" 65001 > nul
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
@for %%i in ("/workspace/models/qwen3.8-27b/.venv") do @set "VIRTUAL_ENV=%%~fi"
|
| 30 |
+
|
| 31 |
+
@set "VIRTUAL_ENV_PROMPT=qwen3.8-27b"
|
| 32 |
+
@if NOT DEFINED VIRTUAL_ENV_PROMPT (
|
| 33 |
+
@for %%d in ("%VIRTUAL_ENV%") do @set "VIRTUAL_ENV_PROMPT=%%~nxd"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
@if defined _OLD_VIRTUAL_PROMPT (
|
| 37 |
+
@set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
| 38 |
+
) else (
|
| 39 |
+
@if not defined PROMPT (
|
| 40 |
+
@set "PROMPT=$P$G"
|
| 41 |
+
)
|
| 42 |
+
@if not defined VIRTUAL_ENV_DISABLE_PROMPT (
|
| 43 |
+
@set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
|
| 44 |
+
)
|
| 45 |
+
)
|
| 46 |
+
@if not defined VIRTUAL_ENV_DISABLE_PROMPT (
|
| 47 |
+
@set "PROMPT=(%VIRTUAL_ENV_PROMPT%) %PROMPT%"
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
@REM Don't use () to avoid problems with them in %PATH%
|
| 51 |
+
@if defined _OLD_VIRTUAL_PYTHONHOME @goto ENDIFVHOME
|
| 52 |
+
@set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
|
| 53 |
+
:ENDIFVHOME
|
| 54 |
+
|
| 55 |
+
@set PYTHONHOME=
|
| 56 |
+
|
| 57 |
+
@REM if defined _OLD_VIRTUAL_PATH (
|
| 58 |
+
@if not defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH1
|
| 59 |
+
@set "PATH=%_OLD_VIRTUAL_PATH%"
|
| 60 |
+
:ENDIFVPATH1
|
| 61 |
+
@REM ) else (
|
| 62 |
+
@if defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH2
|
| 63 |
+
@set "_OLD_VIRTUAL_PATH=%PATH%"
|
| 64 |
+
:ENDIFVPATH2
|
| 65 |
+
|
| 66 |
+
@set "PATH=%VIRTUAL_ENV%\bin;%PATH%"
|
| 67 |
+
|
| 68 |
+
@if defined _OLD_CODEPAGE (
|
| 69 |
+
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
|
| 70 |
+
@set _OLD_CODEPAGE=
|
| 71 |
+
)
|
qwen3.8-27b/.venv/bin/activate.csh
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# This file must be used with "source bin/activate.csh" *from csh*.
|
| 23 |
+
# You cannot run it directly.
|
| 24 |
+
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
| 25 |
+
|
| 26 |
+
set newline='\
|
| 27 |
+
'
|
| 28 |
+
|
| 29 |
+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
|
| 30 |
+
|
| 31 |
+
# Unset irrelevant variables.
|
| 32 |
+
deactivate nondestructive
|
| 33 |
+
|
| 34 |
+
setenv VIRTUAL_ENV '/workspace/models/qwen3.8-27b/.venv'
|
| 35 |
+
|
| 36 |
+
set _OLD_VIRTUAL_PATH="$PATH:q"
|
| 37 |
+
setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if ('qwen3.8-27b' != "") then
|
| 42 |
+
setenv VIRTUAL_ENV_PROMPT 'qwen3.8-27b'
|
| 43 |
+
else
|
| 44 |
+
setenv VIRTUAL_ENV_PROMPT "$VIRTUAL_ENV:t:q"
|
| 45 |
+
endif
|
| 46 |
+
|
| 47 |
+
if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
|
| 48 |
+
if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
|
| 49 |
+
set do_prompt = "1"
|
| 50 |
+
else
|
| 51 |
+
set do_prompt = "0"
|
| 52 |
+
endif
|
| 53 |
+
else
|
| 54 |
+
set do_prompt = "1"
|
| 55 |
+
endif
|
| 56 |
+
|
| 57 |
+
if ( $do_prompt == "1" ) then
|
| 58 |
+
# Could be in a non-interactive environment,
|
| 59 |
+
# in which case, $prompt is undefined and we wouldn't
|
| 60 |
+
# care about the prompt anyway.
|
| 61 |
+
if ( $?prompt ) then
|
| 62 |
+
set _OLD_VIRTUAL_PROMPT="$prompt:q"
|
| 63 |
+
if ( "$prompt:q" =~ *"$newline:q"* ) then
|
| 64 |
+
:
|
| 65 |
+
else
|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 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
|
| 23 |
+
# Do not run it directly.
|
| 24 |
+
|
| 25 |
+
function _bashify_path -d "Converts a fish path to something bash can recognize"
|
| 26 |
+
set fishy_path $argv
|
| 27 |
+
set bashy_path $fishy_path[1]
|
| 28 |
+
for path_part in $fishy_path[2..-1]
|
| 29 |
+
set bashy_path "$bashy_path:$path_part"
|
| 30 |
+
end
|
| 31 |
+
echo $bashy_path
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
function _fishify_path -d "Converts a bash path to something fish can recognize"
|
| 35 |
+
echo $argv | tr ':' '\n'
|
| 36 |
+
end
|
| 37 |
+
|
| 38 |
+
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
|
| 39 |
+
# reset old environment variables
|
| 40 |
+
if test -n "$_OLD_VIRTUAL_PATH"
|
| 41 |
+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
|
| 42 |
+
if test (string sub -s 1 -l 1 $FISH_VERSION) -lt 3
|
| 43 |
+
set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
|
| 44 |
+
else
|
| 45 |
+
set -gx PATH $_OLD_VIRTUAL_PATH
|
| 46 |
+
end
|
| 47 |
+
set -e _OLD_VIRTUAL_PATH
|
| 48 |
+
end
|
| 49 |
+
|
| 50 |
+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
| 51 |
+
set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
|
| 52 |
+
set -e _OLD_VIRTUAL_PYTHONHOME
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
| 56 |
+
and functions -q _old_fish_prompt
|
| 57 |
+
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
|
| 58 |
+
set -l fish_function_path
|
| 59 |
+
|
| 60 |
+
# Erase virtualenv's `fish_prompt` and restore the original.
|
| 61 |
+
functions -e fish_prompt
|
| 62 |
+
functions -c _old_fish_prompt fish_prompt
|
| 63 |
+
functions -e _old_fish_prompt
|
| 64 |
+
set -e _OLD_FISH_PROMPT_OVERRIDE
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
set -e VIRTUAL_ENV
|
| 68 |
+
set -e VIRTUAL_ENV_PROMPT
|
| 69 |
+
|
| 70 |
+
if test "$argv[1]" != 'nondestructive'
|
| 71 |
+
# Self-destruct!
|
| 72 |
+
functions -e pydoc
|
| 73 |
+
functions -e deactivate
|
| 74 |
+
functions -e _bashify_path
|
| 75 |
+
functions -e _fishify_path
|
| 76 |
+
end
|
| 77 |
+
end
|
| 78 |
+
|
| 79 |
+
# Unset irrelevant variables.
|
| 80 |
+
deactivate nondestructive
|
| 81 |
+
|
| 82 |
+
set -gx VIRTUAL_ENV '/workspace/models/qwen3.8-27b/.venv'
|
| 83 |
+
if string match -qr 'CYGWIN|MSYS|MINGW' (uname); and command -s cygpath >/dev/null
|
| 84 |
+
set -gx VIRTUAL_ENV (cygpath -u "$VIRTUAL_ENV")
|
| 85 |
+
end
|
| 86 |
+
|
| 87 |
+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
|
| 88 |
+
if test (string sub -s 1 -l 1 $FISH_VERSION) -lt 3
|
| 89 |
+
set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
|
| 90 |
+
else
|
| 91 |
+
set -gx _OLD_VIRTUAL_PATH $PATH
|
| 92 |
+
end
|
| 93 |
+
set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH
|
| 94 |
+
|
| 95 |
+
# Prompt override provided?
|
| 96 |
+
# If not, just use the environment name.
|
| 97 |
+
if test -n 'qwen3.8-27b'
|
| 98 |
+
set -gx VIRTUAL_ENV_PROMPT 'qwen3.8-27b'
|
| 99 |
+
else
|
| 100 |
+
set -gx VIRTUAL_ENV_PROMPT (basename "$VIRTUAL_ENV")
|
| 101 |
+
end
|
| 102 |
+
|
| 103 |
+
# Unset `$PYTHONHOME` if set.
|
| 104 |
+
if set -q PYTHONHOME
|
| 105 |
+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
| 106 |
+
set -e PYTHONHOME
|
| 107 |
+
end
|
| 108 |
+
|
| 109 |
+
function pydoc
|
| 110 |
+
python -m pydoc $argv
|
| 111 |
+
end
|
| 112 |
+
|
| 113 |
+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
| 114 |
+
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
|
| 115 |
+
functions -c fish_prompt _old_fish_prompt
|
| 116 |
+
|
| 117 |
+
function fish_prompt
|
| 118 |
+
# Run the user's prompt first; it might depend on (pipe)status.
|
| 119 |
+
set -l prompt (_old_fish_prompt)
|
| 120 |
+
|
| 121 |
+
printf '(%s) ' $VIRTUAL_ENV_PROMPT
|
| 122 |
+
|
| 123 |
+
string join -- \n $prompt # handle multi-line prompts
|
| 124 |
+
end
|
| 125 |
+
|
| 126 |
+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
| 127 |
+
end
|
qwen3.8-27b/.venv/bin/activate.nu
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# virtualenv activation module:
|
| 23 |
+
# - Activate with `overlay use activate.nu`
|
| 24 |
+
# - Deactivate with `deactivate`, as usual
|
| 25 |
+
#
|
| 26 |
+
# To customize the overlay name, call `overlay use activate.nu as foo`, but then `deactivate` won't work -
|
| 27 |
+
# you'd need to run `overlay hide foo` manually. Do not activate with `use activate.nu *`; that does not
|
| 28 |
+
# create an overlay and deactivation will fail.
|
| 29 |
+
|
| 30 |
+
module warning {
|
| 31 |
+
export-env {
|
| 32 |
+
const file = path self
|
| 33 |
+
error make -u {
|
| 34 |
+
msg: $"`($file | path basename)` is meant to be used with `overlay use`, not `source`"
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
use warning
|
| 41 |
+
|
| 42 |
+
export-env {
|
| 43 |
+
|
| 44 |
+
let nu_ver = (version | get version | split row '.' | take 2 | each { into int })
|
| 45 |
+
if $nu_ver.0 == 0 and $nu_ver.1 < 106 {
|
| 46 |
+
error make {
|
| 47 |
+
msg: 'virtualenv Nushell activation requires Nushell 0.106 or greater.'
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
def is-string [x] {
|
| 52 |
+
($x | describe) == 'string'
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
def has-env [...names] {
|
| 56 |
+
$names | each {|n| $n in $env } | all {|i| $i }
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
def is-env-true [name: string] {
|
| 60 |
+
if (has-env $name) {
|
| 61 |
+
let val = ($env | get --optional $name)
|
| 62 |
+
if ($val | describe) == 'bool' {
|
| 63 |
+
$val
|
| 64 |
+
} else {
|
| 65 |
+
not ($val | is-empty)
|
| 66 |
+
}
|
| 67 |
+
} else {
|
| 68 |
+
false
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
let virtual_env = '/workspace/models/qwen3.8-27b/.venv'
|
| 73 |
+
let bin = 'bin'
|
| 74 |
+
let path_name = if (has-env 'Path') { 'Path' } else { 'PATH' }
|
| 75 |
+
let venv_path = ([$virtual_env $bin] | path join)
|
| 76 |
+
let new_path = ($env | get $path_name | prepend $venv_path)
|
| 77 |
+
let virtual_env_prompt = if ('qwen3.8-27b' | is-empty) {
|
| 78 |
+
($virtual_env | path basename)
|
| 79 |
+
} else {
|
| 80 |
+
'qwen3.8-27b'
|
| 81 |
+
}
|
| 82 |
+
let new_env = { $path_name: $new_path VIRTUAL_ENV: $virtual_env VIRTUAL_ENV_PROMPT: $virtual_env_prompt }
|
| 83 |
+
let old_prompt_command = if (has-env 'PROMPT_COMMAND') { $env.PROMPT_COMMAND } else { '' }
|
| 84 |
+
let new_env = if (is-env-true 'VIRTUAL_ENV_DISABLE_PROMPT') {
|
| 85 |
+
$new_env
|
| 86 |
+
} else {
|
| 87 |
+
let virtual_prefix = $'(char lparen)($virtual_env_prompt)(char rparen) '
|
| 88 |
+
let new_prompt = if (has-env 'PROMPT_COMMAND') {
|
| 89 |
+
if ('closure' in ($old_prompt_command | describe)) {
|
| 90 |
+
{|| $'($virtual_prefix)(do $old_prompt_command)' }
|
| 91 |
+
} else {
|
| 92 |
+
{|| $'($virtual_prefix)($old_prompt_command)' }
|
| 93 |
+
}
|
| 94 |
+
} else {
|
| 95 |
+
{|| $'($virtual_prefix)' }
|
| 96 |
+
}
|
| 97 |
+
$new_env | merge { PROMPT_COMMAND: $new_prompt VIRTUAL_PREFIX: $virtual_prefix }
|
| 98 |
+
}
|
| 99 |
+
load-env $new_env
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
export alias pydoc = python -m pydoc
|
| 103 |
+
# If deactivate errors "not an active overlay": activate with `overlay use activate.nu` not `use activate.nu *`; for custom names use `overlay hide NAME`
|
| 104 |
+
export alias deactivate = overlay hide activate
|
qwen3.8-27b/.venv/bin/activate.ps1
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
$script:THIS_PATH = $myinvocation.mycommand.path
|
| 23 |
+
$script:BASE_DIR = Split-Path -Parent (Split-Path -Parent $THIS_PATH)
|
| 24 |
+
|
| 25 |
+
function global:deactivate([switch] $NonDestructive) {
|
| 26 |
+
if (Test-Path variable:_OLD_VIRTUAL_PATH) {
|
| 27 |
+
$env:PATH = $variable:_OLD_VIRTUAL_PATH
|
| 28 |
+
Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if (Test-Path function:_old_virtual_prompt) {
|
| 32 |
+
$function:prompt = $function:_old_virtual_prompt
|
| 33 |
+
Remove-Item function:\_old_virtual_prompt
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if ($env:VIRTUAL_ENV) {
|
| 37 |
+
Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
if ($env:VIRTUAL_ENV_PROMPT) {
|
| 41 |
+
Remove-Item env:VIRTUAL_ENV_PROMPT -ErrorAction SilentlyContinue
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if (!$NonDestructive) {
|
| 45 |
+
# Self destruct!
|
| 46 |
+
Remove-Item function:deactivate
|
| 47 |
+
Remove-Item function:pydoc
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function global:pydoc {
|
| 52 |
+
& python -m pydoc $args
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
# unset irrelevant variables
|
| 56 |
+
deactivate -nondestructive
|
| 57 |
+
|
| 58 |
+
$VIRTUAL_ENV = $BASE_DIR
|
| 59 |
+
$env:VIRTUAL_ENV = $VIRTUAL_ENV
|
| 60 |
+
|
| 61 |
+
if ("qwen3.8-27b" -ne "") {
|
| 62 |
+
$env:VIRTUAL_ENV_PROMPT = "qwen3.8-27b"
|
| 63 |
+
}
|
| 64 |
+
else {
|
| 65 |
+
$env:VIRTUAL_ENV_PROMPT = $( Split-Path $env:VIRTUAL_ENV -Leaf )
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH
|
| 69 |
+
|
| 70 |
+
$env:PATH = "$env:VIRTUAL_ENV/bin:" + $env:PATH
|
| 71 |
+
if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
| 72 |
+
function global:_old_virtual_prompt {
|
| 73 |
+
""
|
| 74 |
+
}
|
| 75 |
+
$function:_old_virtual_prompt = $function:prompt
|
| 76 |
+
|
| 77 |
+
function global:prompt {
|
| 78 |
+
# Add the custom prefix to the existing prompt
|
| 79 |
+
$previous_prompt_value = & $function:_old_virtual_prompt
|
| 80 |
+
("(" + $env:VIRTUAL_ENV_PROMPT + ") " + $previous_prompt_value)
|
| 81 |
+
}
|
| 82 |
+
}
|
qwen3.8-27b/.venv/bin/activate.xsh
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# This file must be used with "source bin/activate.xsh" *from xonsh*.
|
| 23 |
+
# You cannot run it directly.
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class _VirtualEnvActivator:
|
| 27 |
+
"""xonsh activation for virtualenv."""
|
| 28 |
+
|
| 29 |
+
# Stashed in _OLD_VIRTUAL_{name} when the variable was not set before
|
| 30 |
+
# activation. deactivate treats this as "unset" rather than "restore to
|
| 31 |
+
# this string".
|
| 32 |
+
_UNSET_SENTINEL = "__virtualenv_was_not_set__"
|
| 33 |
+
|
| 34 |
+
def __init__(self):
|
| 35 |
+
from os.path import dirname, realpath
|
| 36 |
+
|
| 37 |
+
self.env = __xonsh__.env
|
| 38 |
+
self.embedded_virtual_env = dirname(dirname(realpath(__file__)))
|
| 39 |
+
self.embedded_virtual_prompt = b"qwen3.8-27b".decode("utf-8")
|
| 40 |
+
self.embedded_bin_name = __import__("os").fsdecode(b"bin")
|
| 41 |
+
self.managed_vars = ("PATH", "PYTHONHOME")
|
| 42 |
+
|
| 43 |
+
def _backup_name(self, name):
|
| 44 |
+
return f"_OLD_VIRTUAL_{name}"
|
| 45 |
+
|
| 46 |
+
def _save(self, name):
|
| 47 |
+
backup = self._backup_name(name)
|
| 48 |
+
self.env[backup] = self.env[name] if name in self.env else self._UNSET_SENTINEL
|
| 49 |
+
|
| 50 |
+
def _override(self, name, value):
|
| 51 |
+
self._save(name)
|
| 52 |
+
self.env[name] = value
|
| 53 |
+
|
| 54 |
+
def _drop(self, name):
|
| 55 |
+
self._save(name)
|
| 56 |
+
self.env.pop(name, None)
|
| 57 |
+
|
| 58 |
+
def register_pydoc(self):
|
| 59 |
+
aliases["pydoc"] = ["python", "-m", "pydoc"]
|
| 60 |
+
|
| 61 |
+
def unregister_pydoc(self):
|
| 62 |
+
aliases.pop("pydoc", None)
|
| 63 |
+
|
| 64 |
+
def activate(self):
|
| 65 |
+
from os.path import basename, join
|
| 66 |
+
|
| 67 |
+
aliases["deactivate"] = self.deactivate
|
| 68 |
+
self.deactivate(["nondestructive"]) # wipe any stale state from a prior activation
|
| 69 |
+
|
| 70 |
+
$VIRTUAL_ENV = self.embedded_virtual_env
|
| 71 |
+
$VIRTUAL_ENV_PROMPT = self.embedded_virtual_prompt or basename($VIRTUAL_ENV)
|
| 72 |
+
|
| 73 |
+
self._override("PATH", [join($VIRTUAL_ENV, self.embedded_bin_name), *$PATH])
|
| 74 |
+
self._drop("PYTHONHOME")
|
| 75 |
+
self.register_pydoc()
|
| 76 |
+
|
| 77 |
+
def deactivate(self, args=None):
|
| 78 |
+
for name in self.managed_vars:
|
| 79 |
+
backup = self._backup_name(name)
|
| 80 |
+
if backup not in self.env:
|
| 81 |
+
continue
|
| 82 |
+
previous = self.env[backup]
|
| 83 |
+
del self.env[backup]
|
| 84 |
+
if previous == self._UNSET_SENTINEL:
|
| 85 |
+
self.env.pop(name, None)
|
| 86 |
+
else:
|
| 87 |
+
self.env[name] = previous
|
| 88 |
+
for name in ("VIRTUAL_ENV", "VIRTUAL_ENV_PROMPT"):
|
| 89 |
+
self.env.pop(name, None)
|
| 90 |
+
self.unregister_pydoc()
|
| 91 |
+
if args is None or "nondestructive" not in args:
|
| 92 |
+
del aliases["deactivate"]
|
| 93 |
+
try:
|
| 94 |
+
del __xonsh__.xontrib.virtualenv
|
| 95 |
+
except AttributeError:
|
| 96 |
+
pass
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
if not hasattr(__xonsh__, "xontrib"):
|
| 100 |
+
__xonsh__.xontrib = __xonsh__.imp.types.SimpleNamespace()
|
| 101 |
+
__xonsh__.xontrib.virtualenv = _VirtualEnvActivator()
|
| 102 |
+
__xonsh__.xontrib.virtualenv.activate()
|
qwen3.8-27b/.venv/bin/activate_this.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
"""
|
| 23 |
+
Activate virtualenv for current interpreter:
|
| 24 |
+
|
| 25 |
+
import runpy
|
| 26 |
+
runpy.run_path(this_file)
|
| 27 |
+
|
| 28 |
+
This can be used when you must use an existing Python interpreter, not the virtualenv bin/python.
|
| 29 |
+
""" # noqa: D415
|
| 30 |
+
|
| 31 |
+
from __future__ import annotations
|
| 32 |
+
|
| 33 |
+
import os
|
| 34 |
+
import site
|
| 35 |
+
import sys
|
| 36 |
+
|
| 37 |
+
try:
|
| 38 |
+
abs_file = os.path.abspath(__file__)
|
| 39 |
+
except NameError as exc:
|
| 40 |
+
msg = "You must use import runpy; runpy.run_path(this_file)"
|
| 41 |
+
raise AssertionError(msg) from exc
|
| 42 |
+
|
| 43 |
+
bin_dir = os.path.dirname(abs_file)
|
| 44 |
+
base = bin_dir[: -len("bin") - 1] # strip away the bin part from the __file__, plus the path separator
|
| 45 |
+
|
| 46 |
+
# prepend bin to PATH (this file is inside the bin directory)
|
| 47 |
+
os.environ["PATH"] = os.pathsep.join([bin_dir, *os.environ.get("PATH", "").split(os.pathsep)])
|
| 48 |
+
os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory
|
| 49 |
+
os.environ["VIRTUAL_ENV_PROMPT"] = "qwen3.8-27b" or os.path.basename(base) # noqa: SIM222
|
| 50 |
+
|
| 51 |
+
# add the virtual environments libraries to the host python import mechanism
|
| 52 |
+
prev_length = len(sys.path)
|
| 53 |
+
for lib in "../lib/python3.12/site-packages".split(os.pathsep):
|
| 54 |
+
path = os.path.realpath(os.path.join(bin_dir, lib))
|
| 55 |
+
site.addsitedir(path)
|
| 56 |
+
sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
|
| 57 |
+
|
| 58 |
+
sys.real_prefix = sys.prefix
|
| 59 |
+
sys.prefix = base
|
qwen3.8-27b/.venv/bin/deactivate.bat
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@REM Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
@REM
|
| 3 |
+
@REM Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
@REM a copy of this software and associated documentation files (the
|
| 5 |
+
@REM "Software"), to deal in the Software without restriction, including
|
| 6 |
+
@REM without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
@REM distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
@REM permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
@REM the following conditions:
|
| 10 |
+
@REM
|
| 11 |
+
@REM The above copyright notice and this permission notice shall be
|
| 12 |
+
@REM included in all copies or substantial portions of the Software.
|
| 13 |
+
@REM
|
| 14 |
+
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
@REM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
@REM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
@REM NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
@REM LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
@REM OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
@REM WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
@set VIRTUAL_ENV=
|
| 23 |
+
@set VIRTUAL_ENV_PROMPT=
|
| 24 |
+
|
| 25 |
+
@REM Don't use () to avoid problems with them in %PATH%
|
| 26 |
+
@if not defined _OLD_VIRTUAL_PROMPT @goto ENDIFVPROMPT
|
| 27 |
+
@set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
| 28 |
+
@set _OLD_VIRTUAL_PROMPT=
|
| 29 |
+
:ENDIFVPROMPT
|
| 30 |
+
|
| 31 |
+
@if not defined _OLD_VIRTUAL_PYTHONHOME @goto ENDIFVHOME
|
| 32 |
+
@set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
|
| 33 |
+
@set _OLD_VIRTUAL_PYTHONHOME=
|
| 34 |
+
:ENDIFVHOME
|
| 35 |
+
|
| 36 |
+
@if not defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH
|
| 37 |
+
@set "PATH=%_OLD_VIRTUAL_PATH%"
|
| 38 |
+
@set _OLD_VIRTUAL_PATH=
|
| 39 |
+
:ENDIFVPATH
|
qwen3.8-27b/.venv/bin/f2py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from numpy.f2py.f2py2e import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/hf
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from huggingface_hub.cli.hf import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/httpx
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from httpx import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/huggingface-cli
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from huggingface_hub.cli.deprecated_cli import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/idna
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from idna.cli import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/markdown-it
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from markdown_it.cli.parse import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/numpy-config
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from numpy._configtool import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/pydoc.bat
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@REM Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
@REM
|
| 3 |
+
@REM Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
@REM a copy of this software and associated documentation files (the
|
| 5 |
+
@REM "Software"), to deal in the Software without restriction, including
|
| 6 |
+
@REM without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
@REM distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
@REM permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
@REM the following conditions:
|
| 10 |
+
@REM
|
| 11 |
+
@REM The above copyright notice and this permission notice shall be
|
| 12 |
+
@REM included in all copies or substantial portions of the Software.
|
| 13 |
+
@REM
|
| 14 |
+
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
@REM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
@REM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
@REM NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
@REM LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
@REM OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
@REM WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
"python.exe" -m pydoc %*
|
qwen3.8-27b/.venv/bin/pygmentize
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from pygments.cmdline import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/tiny-agents
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from huggingface_hub.inference._mcp.cli import app
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(app())
|
qwen3.8-27b/.venv/bin/tqdm
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from tqdm.cli import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/transformers
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from transformers.cli.transformers import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/bin/typer
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/workspace/models/qwen3.8-27b/.venv/bin/python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from typer.cli import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/__pycache__/_virtualenv.cpython-312.pyc
ADDED
|
Binary file (4.76 kB). View file
|
|
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/_virtualenv.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Patches that are applied at runtime to the virtual environment."""
|
| 2 |
+
|
| 3 |
+
import contextlib
|
| 4 |
+
import os
|
| 5 |
+
import sys
|
| 6 |
+
|
| 7 |
+
VIRTUALENV_PATCH_FILE = os.path.abspath(__file__)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def patch_dist(dist):
|
| 11 |
+
"""
|
| 12 |
+
Distutils allows user to configure some arguments via a configuration file:
|
| 13 |
+
https://docs.python.org/3.11/install/index.html#distutils-configuration-files.
|
| 14 |
+
|
| 15 |
+
Some of this arguments though don't make sense in context of the virtual environment files, let's fix them up.
|
| 16 |
+
""" # noqa: D205
|
| 17 |
+
# we cannot allow some install config as that would get packages installed outside of the virtual environment
|
| 18 |
+
old_parse_config_files = dist.Distribution.parse_config_files
|
| 19 |
+
|
| 20 |
+
def parse_config_files(self, *args, **kwargs):
|
| 21 |
+
result = old_parse_config_files(self, *args, **kwargs)
|
| 22 |
+
install = self.get_option_dict("install")
|
| 23 |
+
|
| 24 |
+
if "prefix" in install: # the prefix governs where to install the libraries
|
| 25 |
+
install["prefix"] = VIRTUALENV_PATCH_FILE, os.path.abspath(sys.prefix)
|
| 26 |
+
for base in ("purelib", "platlib", "headers", "scripts", "data"):
|
| 27 |
+
key = f"install_{base}"
|
| 28 |
+
if key in install: # do not allow global configs to hijack venv paths
|
| 29 |
+
install.pop(key, None)
|
| 30 |
+
return result
|
| 31 |
+
|
| 32 |
+
dist.Distribution.parse_config_files = parse_config_files
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
# Import hook that patches some modules to ignore configuration values that break package installation in case
|
| 36 |
+
# of virtual environments.
|
| 37 |
+
_DISTUTILS_PATCH = "distutils.dist", "setuptools.dist"
|
| 38 |
+
# https://docs.python.org/3/library/importlib.html#setting-up-an-importer
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class _Finder:
|
| 42 |
+
"""A meta path finder that allows patching the imported distutils modules."""
|
| 43 |
+
|
| 44 |
+
fullname = None
|
| 45 |
+
|
| 46 |
+
# lock[0] is threading.Lock(), but initialized lazily to avoid importing threading very early at startup,
|
| 47 |
+
# because there are gevent-based applications that need to be first to import threading by themselves.
|
| 48 |
+
# See https://github.com/pypa/virtualenv/issues/1895 for details.
|
| 49 |
+
lock = [] # noqa: RUF012
|
| 50 |
+
|
| 51 |
+
def find_spec(self, fullname, path, target=None): # noqa: ARG002
|
| 52 |
+
# Guard against race conditions during file rewrite by checking if _DISTUTILS_PATCH is defined.
|
| 53 |
+
# This can happen when the file is being overwritten while it's being imported by another process.
|
| 54 |
+
# See https://github.com/pypa/virtualenv/issues/2969 for details.
|
| 55 |
+
try:
|
| 56 |
+
distutils_patch = _DISTUTILS_PATCH
|
| 57 |
+
except NameError:
|
| 58 |
+
return None
|
| 59 |
+
if fullname in distutils_patch and self.fullname is None:
|
| 60 |
+
# initialize lock[0] lazily
|
| 61 |
+
if len(self.lock) == 0:
|
| 62 |
+
import threading
|
| 63 |
+
|
| 64 |
+
lock = threading.Lock()
|
| 65 |
+
# there is possibility that two threads T1 and T2 are simultaneously running into find_spec,
|
| 66 |
+
# observing .lock as empty, and further going into hereby initialization. However due to the GIL,
|
| 67 |
+
# list.append() operation is atomic and this way only one of the threads will "win" to put the lock
|
| 68 |
+
# - that every thread will use - into .lock[0].
|
| 69 |
+
# https://docs.python.org/3/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe
|
| 70 |
+
self.lock.append(lock)
|
| 71 |
+
|
| 72 |
+
from functools import partial
|
| 73 |
+
from importlib.util import find_spec
|
| 74 |
+
|
| 75 |
+
with self.lock[0]:
|
| 76 |
+
self.fullname = fullname
|
| 77 |
+
try:
|
| 78 |
+
spec = find_spec(fullname, path)
|
| 79 |
+
if spec is not None:
|
| 80 |
+
# https://www.python.org/dev/peps/pep-0451/#how-loading-will-work
|
| 81 |
+
is_new_api = hasattr(spec.loader, "exec_module")
|
| 82 |
+
func_name = "exec_module" if is_new_api else "load_module"
|
| 83 |
+
old = getattr(spec.loader, func_name)
|
| 84 |
+
func = self.exec_module if is_new_api else self.load_module
|
| 85 |
+
if old is not func:
|
| 86 |
+
try: # noqa: SIM105
|
| 87 |
+
setattr(spec.loader, func_name, partial(func, old))
|
| 88 |
+
except AttributeError:
|
| 89 |
+
pass # C-Extension loaders are r/o such as zipimporter with <3.7
|
| 90 |
+
return spec
|
| 91 |
+
finally:
|
| 92 |
+
self.fullname = None
|
| 93 |
+
return None
|
| 94 |
+
|
| 95 |
+
@staticmethod
|
| 96 |
+
def exec_module(old, module):
|
| 97 |
+
old(module)
|
| 98 |
+
try:
|
| 99 |
+
distutils_patch = _DISTUTILS_PATCH
|
| 100 |
+
except NameError:
|
| 101 |
+
return
|
| 102 |
+
if module.__name__ in distutils_patch:
|
| 103 |
+
# patch_dist or its dependencies may not be defined during file rewrite
|
| 104 |
+
with contextlib.suppress(NameError):
|
| 105 |
+
patch_dist(module)
|
| 106 |
+
|
| 107 |
+
@staticmethod
|
| 108 |
+
def load_module(old, name):
|
| 109 |
+
module = old(name)
|
| 110 |
+
try:
|
| 111 |
+
distutils_patch = _DISTUTILS_PATCH
|
| 112 |
+
except NameError:
|
| 113 |
+
return module
|
| 114 |
+
if module.__name__ in distutils_patch:
|
| 115 |
+
# patch_dist or its dependencies may not be defined during file rewrite
|
| 116 |
+
with contextlib.suppress(NameError):
|
| 117 |
+
patch_dist(module)
|
| 118 |
+
return module
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
sys.meta_path.insert(0, _Finder())
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__config__.py
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is generated by numpy's build process
|
| 2 |
+
# It contains system_info results at the time of building this package.
|
| 3 |
+
from enum import Enum
|
| 4 |
+
from numpy._core._multiarray_umath import (
|
| 5 |
+
__cpu_features__,
|
| 6 |
+
__cpu_baseline__,
|
| 7 |
+
__cpu_dispatch__,
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
__all__ = ["show_config"]
|
| 11 |
+
_built_with_meson = True
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class DisplayModes(Enum):
|
| 15 |
+
stdout = "stdout"
|
| 16 |
+
dicts = "dicts"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def _cleanup(d):
|
| 20 |
+
"""
|
| 21 |
+
Removes empty values in a `dict` recursively
|
| 22 |
+
This ensures we remove values that Meson could not provide to CONFIG
|
| 23 |
+
"""
|
| 24 |
+
if isinstance(d, dict):
|
| 25 |
+
return {k: _cleanup(v) for k, v in d.items() if v and _cleanup(v)}
|
| 26 |
+
else:
|
| 27 |
+
return d
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
CONFIG = _cleanup(
|
| 31 |
+
{
|
| 32 |
+
"Compilers": {
|
| 33 |
+
"c": {
|
| 34 |
+
"name": "gcc",
|
| 35 |
+
"linker": r"ld.bfd",
|
| 36 |
+
"version": "14.2.1",
|
| 37 |
+
"commands": r"cc",
|
| 38 |
+
"args": r"",
|
| 39 |
+
"linker args": r"",
|
| 40 |
+
},
|
| 41 |
+
"cython": {
|
| 42 |
+
"name": "cython",
|
| 43 |
+
"linker": r"cython",
|
| 44 |
+
"version": "3.3.0",
|
| 45 |
+
"commands": r"cython",
|
| 46 |
+
"args": r"",
|
| 47 |
+
"linker args": r"",
|
| 48 |
+
},
|
| 49 |
+
"c++": {
|
| 50 |
+
"name": "gcc",
|
| 51 |
+
"linker": r"ld.bfd",
|
| 52 |
+
"version": "14.2.1",
|
| 53 |
+
"commands": r"c++",
|
| 54 |
+
"args": r"",
|
| 55 |
+
"linker args": r"",
|
| 56 |
+
},
|
| 57 |
+
},
|
| 58 |
+
"Machine Information": {
|
| 59 |
+
"host": {
|
| 60 |
+
"cpu": "x86_64",
|
| 61 |
+
"family": "x86_64",
|
| 62 |
+
"endian": "little",
|
| 63 |
+
"system": "linux",
|
| 64 |
+
},
|
| 65 |
+
"build": {
|
| 66 |
+
"cpu": "x86_64",
|
| 67 |
+
"family": "x86_64",
|
| 68 |
+
"endian": "little",
|
| 69 |
+
"system": "linux",
|
| 70 |
+
},
|
| 71 |
+
"cross-compiled": False,
|
| 72 |
+
},
|
| 73 |
+
"Build Dependencies": {
|
| 74 |
+
"blas": {
|
| 75 |
+
"name": "scipy-openblas",
|
| 76 |
+
"found": True,
|
| 77 |
+
"version": "0.3.34.106.0",
|
| 78 |
+
"detection method": "pkgconfig",
|
| 79 |
+
"include directory": r"/opt/_internal/cpython-3.12.13/lib/python3.12/site-packages/scipy_openblas64/include",
|
| 80 |
+
"lib directory": r"/opt/_internal/cpython-3.12.13/lib/python3.12/site-packages/scipy_openblas64/lib",
|
| 81 |
+
"openblas configuration": r"OpenBLAS 0.3.34.106.0 USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=64",
|
| 82 |
+
"pc file directory": r"/project/.openblas",
|
| 83 |
+
},
|
| 84 |
+
"lapack": {
|
| 85 |
+
"name": "scipy-openblas",
|
| 86 |
+
"found": True,
|
| 87 |
+
"version": "0.3.34.106.0",
|
| 88 |
+
"detection method": "pkgconfig",
|
| 89 |
+
"include directory": r"/opt/_internal/cpython-3.12.13/lib/python3.12/site-packages/scipy_openblas64/include",
|
| 90 |
+
"lib directory": r"/opt/_internal/cpython-3.12.13/lib/python3.12/site-packages/scipy_openblas64/lib",
|
| 91 |
+
"openblas configuration": r"OpenBLAS 0.3.34.106.0 USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=64",
|
| 92 |
+
"pc file directory": r"/project/.openblas",
|
| 93 |
+
},
|
| 94 |
+
},
|
| 95 |
+
"Python Information": {
|
| 96 |
+
"path": r"/tmp/build-env-kabtnrrv/bin/python",
|
| 97 |
+
"version": "3.12",
|
| 98 |
+
},
|
| 99 |
+
"SIMD Extensions": {
|
| 100 |
+
"baseline": __cpu_baseline__,
|
| 101 |
+
"found": [
|
| 102 |
+
feature for feature in __cpu_dispatch__ if __cpu_features__[feature]
|
| 103 |
+
],
|
| 104 |
+
"not found": [
|
| 105 |
+
feature for feature in __cpu_dispatch__ if not __cpu_features__[feature]
|
| 106 |
+
],
|
| 107 |
+
},
|
| 108 |
+
}
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def _check_pyyaml():
|
| 113 |
+
import yaml
|
| 114 |
+
|
| 115 |
+
return yaml
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def show(mode=DisplayModes.stdout.value):
|
| 119 |
+
"""
|
| 120 |
+
Show libraries and system information on which NumPy was built
|
| 121 |
+
and is being used
|
| 122 |
+
|
| 123 |
+
Parameters
|
| 124 |
+
----------
|
| 125 |
+
mode : {`'stdout'`, `'dicts'`}, optional.
|
| 126 |
+
Indicates how to display the config information.
|
| 127 |
+
`'stdout'` prints to console, `'dicts'` returns a dictionary
|
| 128 |
+
of the configuration.
|
| 129 |
+
|
| 130 |
+
Returns
|
| 131 |
+
-------
|
| 132 |
+
out : {`dict`, `None`}
|
| 133 |
+
If mode is `'dicts'`, a dict is returned, else None
|
| 134 |
+
|
| 135 |
+
See Also
|
| 136 |
+
--------
|
| 137 |
+
get_include : Returns the directory containing NumPy C
|
| 138 |
+
header files.
|
| 139 |
+
|
| 140 |
+
Notes
|
| 141 |
+
-----
|
| 142 |
+
1. The `'stdout'` mode will give more readable
|
| 143 |
+
output if ``pyyaml`` is installed
|
| 144 |
+
|
| 145 |
+
"""
|
| 146 |
+
if mode == DisplayModes.stdout.value:
|
| 147 |
+
try: # Non-standard library, check import
|
| 148 |
+
yaml = _check_pyyaml()
|
| 149 |
+
|
| 150 |
+
print(yaml.dump(CONFIG))
|
| 151 |
+
except ModuleNotFoundError:
|
| 152 |
+
import warnings
|
| 153 |
+
import json
|
| 154 |
+
|
| 155 |
+
warnings.warn("Install `pyyaml` for better output", stacklevel=1)
|
| 156 |
+
print(json.dumps(CONFIG, indent=2))
|
| 157 |
+
elif mode == DisplayModes.dicts.value:
|
| 158 |
+
return CONFIG
|
| 159 |
+
else:
|
| 160 |
+
raise AttributeError(
|
| 161 |
+
f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}"
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
def show_config(mode=DisplayModes.stdout.value):
|
| 166 |
+
return show(mode)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
show_config.__doc__ = show.__doc__
|
| 170 |
+
show_config.__module__ = "numpy"
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__config__.pyi
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from enum import Enum
|
| 2 |
+
from types import ModuleType
|
| 3 |
+
from typing import (
|
| 4 |
+
Final,
|
| 5 |
+
Literal as L,
|
| 6 |
+
NotRequired,
|
| 7 |
+
TypedDict,
|
| 8 |
+
overload,
|
| 9 |
+
type_check_only,
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
_CompilerConfigDictValue = TypedDict(
|
| 13 |
+
"_CompilerConfigDictValue",
|
| 14 |
+
{
|
| 15 |
+
"name": str,
|
| 16 |
+
"linker": str,
|
| 17 |
+
"version": str,
|
| 18 |
+
"commands": str,
|
| 19 |
+
"args": str,
|
| 20 |
+
"linker args": str,
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
_CompilerConfigDict = TypedDict(
|
| 24 |
+
"_CompilerConfigDict",
|
| 25 |
+
{
|
| 26 |
+
"c": _CompilerConfigDictValue,
|
| 27 |
+
"cython": _CompilerConfigDictValue,
|
| 28 |
+
"c++": _CompilerConfigDictValue,
|
| 29 |
+
},
|
| 30 |
+
)
|
| 31 |
+
_MachineInformationDict = TypedDict(
|
| 32 |
+
"_MachineInformationDict",
|
| 33 |
+
{
|
| 34 |
+
"host": _MachineInformationDictValue,
|
| 35 |
+
"build": _MachineInformationDictValue,
|
| 36 |
+
"cross-compiled": NotRequired[L[True]],
|
| 37 |
+
},
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
@type_check_only
|
| 41 |
+
class _MachineInformationDictValue(TypedDict):
|
| 42 |
+
cpu: str
|
| 43 |
+
family: str
|
| 44 |
+
endian: L["little", "big"]
|
| 45 |
+
system: str
|
| 46 |
+
|
| 47 |
+
_BuildDependenciesDictValue = TypedDict(
|
| 48 |
+
"_BuildDependenciesDictValue",
|
| 49 |
+
{
|
| 50 |
+
"name": str,
|
| 51 |
+
"found": NotRequired[L[True]],
|
| 52 |
+
"version": str,
|
| 53 |
+
"include directory": str,
|
| 54 |
+
"lib directory": str,
|
| 55 |
+
"openblas configuration": str,
|
| 56 |
+
"pc file directory": str,
|
| 57 |
+
},
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
class _BuildDependenciesDict(TypedDict):
|
| 61 |
+
blas: _BuildDependenciesDictValue
|
| 62 |
+
lapack: _BuildDependenciesDictValue
|
| 63 |
+
|
| 64 |
+
class _PythonInformationDict(TypedDict):
|
| 65 |
+
path: str
|
| 66 |
+
version: str
|
| 67 |
+
|
| 68 |
+
_SIMDExtensionsDict = TypedDict(
|
| 69 |
+
"_SIMDExtensionsDict",
|
| 70 |
+
{
|
| 71 |
+
"baseline": list[str],
|
| 72 |
+
"found": list[str],
|
| 73 |
+
"not found": list[str],
|
| 74 |
+
},
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
_ConfigDict = TypedDict(
|
| 78 |
+
"_ConfigDict",
|
| 79 |
+
{
|
| 80 |
+
"Compilers": _CompilerConfigDict,
|
| 81 |
+
"Machine Information": _MachineInformationDict,
|
| 82 |
+
"Build Dependencies": _BuildDependenciesDict,
|
| 83 |
+
"Python Information": _PythonInformationDict,
|
| 84 |
+
"SIMD Extensions": _SIMDExtensionsDict,
|
| 85 |
+
},
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
###
|
| 89 |
+
|
| 90 |
+
__all__ = ["show_config"]
|
| 91 |
+
|
| 92 |
+
CONFIG: Final[_ConfigDict] = ...
|
| 93 |
+
|
| 94 |
+
class DisplayModes(Enum):
|
| 95 |
+
stdout = "stdout"
|
| 96 |
+
dicts = "dicts"
|
| 97 |
+
|
| 98 |
+
def _check_pyyaml() -> ModuleType: ...
|
| 99 |
+
|
| 100 |
+
@overload
|
| 101 |
+
def show(mode: L["stdout"] = "stdout") -> None: ...
|
| 102 |
+
@overload
|
| 103 |
+
def show(mode: L["dicts"]) -> _ConfigDict: ...
|
| 104 |
+
|
| 105 |
+
@overload
|
| 106 |
+
def show_config(mode: L["stdout"] = "stdout") -> None: ...
|
| 107 |
+
@overload
|
| 108 |
+
def show_config(mode: L["dicts"]) -> _ConfigDict: ...
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.cython-30.pxd
ADDED
|
@@ -0,0 +1,1312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NumPy static imports for Cython >= 3.0
|
| 2 |
+
#
|
| 3 |
+
# If any of the PyArray_* functions are called, import_array must be
|
| 4 |
+
# called first. This is done automatically by Cython 3.0+ if a call
|
| 5 |
+
# is not detected inside of the module.
|
| 6 |
+
#
|
| 7 |
+
# Author: Dag Sverre Seljebotn
|
| 8 |
+
#
|
| 9 |
+
|
| 10 |
+
from cpython.ref cimport Py_INCREF
|
| 11 |
+
from cpython.object cimport PyObject, PyTypeObject, PyObject_TypeCheck
|
| 12 |
+
cimport libc.stdio as stdio
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
cdef extern from *:
|
| 16 |
+
# Leave a marker that the NumPy declarations came from NumPy itself and not from Cython.
|
| 17 |
+
# See https://github.com/cython/cython/issues/3573
|
| 18 |
+
"""
|
| 19 |
+
/* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
cdef extern from "numpy/arrayobject.h":
|
| 24 |
+
# It would be nice to use size_t and ssize_t, but ssize_t has special
|
| 25 |
+
# implicit conversion rules, so just use "long".
|
| 26 |
+
# Note: The actual type only matters for Cython promotion, so long
|
| 27 |
+
# is closer than int, but could lead to incorrect promotion.
|
| 28 |
+
# (Not to worrying, and always the status-quo.)
|
| 29 |
+
ctypedef signed long npy_intp
|
| 30 |
+
ctypedef unsigned long npy_uintp
|
| 31 |
+
|
| 32 |
+
ctypedef unsigned char npy_bool
|
| 33 |
+
|
| 34 |
+
ctypedef signed char npy_byte
|
| 35 |
+
ctypedef signed short npy_short
|
| 36 |
+
ctypedef signed int npy_int
|
| 37 |
+
ctypedef signed long npy_long
|
| 38 |
+
ctypedef signed long long npy_longlong
|
| 39 |
+
|
| 40 |
+
ctypedef unsigned char npy_ubyte
|
| 41 |
+
ctypedef unsigned short npy_ushort
|
| 42 |
+
ctypedef unsigned int npy_uint
|
| 43 |
+
ctypedef unsigned long npy_ulong
|
| 44 |
+
ctypedef unsigned long long npy_ulonglong
|
| 45 |
+
|
| 46 |
+
ctypedef float npy_float
|
| 47 |
+
ctypedef double npy_double
|
| 48 |
+
ctypedef long double npy_longdouble
|
| 49 |
+
|
| 50 |
+
ctypedef signed char npy_int8
|
| 51 |
+
ctypedef signed short npy_int16
|
| 52 |
+
ctypedef signed int npy_int32
|
| 53 |
+
ctypedef signed long long npy_int64
|
| 54 |
+
|
| 55 |
+
ctypedef unsigned char npy_uint8
|
| 56 |
+
ctypedef unsigned short npy_uint16
|
| 57 |
+
ctypedef unsigned int npy_uint32
|
| 58 |
+
ctypedef unsigned long long npy_uint64
|
| 59 |
+
|
| 60 |
+
ctypedef float npy_float32
|
| 61 |
+
ctypedef double npy_float64
|
| 62 |
+
ctypedef long double npy_float80
|
| 63 |
+
ctypedef long double npy_float96
|
| 64 |
+
ctypedef long double npy_float128
|
| 65 |
+
|
| 66 |
+
ctypedef struct npy_cfloat:
|
| 67 |
+
pass
|
| 68 |
+
|
| 69 |
+
ctypedef struct npy_cdouble:
|
| 70 |
+
pass
|
| 71 |
+
|
| 72 |
+
ctypedef struct npy_clongdouble:
|
| 73 |
+
pass
|
| 74 |
+
|
| 75 |
+
ctypedef struct npy_complex64:
|
| 76 |
+
pass
|
| 77 |
+
|
| 78 |
+
ctypedef struct npy_complex128:
|
| 79 |
+
pass
|
| 80 |
+
|
| 81 |
+
ctypedef struct npy_complex160:
|
| 82 |
+
pass
|
| 83 |
+
|
| 84 |
+
ctypedef struct npy_complex192:
|
| 85 |
+
pass
|
| 86 |
+
|
| 87 |
+
ctypedef struct npy_complex256:
|
| 88 |
+
pass
|
| 89 |
+
|
| 90 |
+
ctypedef struct PyArray_Dims:
|
| 91 |
+
npy_intp *ptr
|
| 92 |
+
int len
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
cdef enum NPY_TYPES:
|
| 96 |
+
NPY_BOOL
|
| 97 |
+
NPY_BYTE
|
| 98 |
+
NPY_UBYTE
|
| 99 |
+
NPY_SHORT
|
| 100 |
+
NPY_USHORT
|
| 101 |
+
NPY_INT
|
| 102 |
+
NPY_UINT
|
| 103 |
+
NPY_LONG
|
| 104 |
+
NPY_ULONG
|
| 105 |
+
NPY_LONGLONG
|
| 106 |
+
NPY_ULONGLONG
|
| 107 |
+
NPY_FLOAT
|
| 108 |
+
NPY_DOUBLE
|
| 109 |
+
NPY_LONGDOUBLE
|
| 110 |
+
NPY_CFLOAT
|
| 111 |
+
NPY_CDOUBLE
|
| 112 |
+
NPY_CLONGDOUBLE
|
| 113 |
+
NPY_OBJECT
|
| 114 |
+
NPY_STRING
|
| 115 |
+
NPY_UNICODE
|
| 116 |
+
NPY_VSTRING
|
| 117 |
+
NPY_VOID
|
| 118 |
+
NPY_DATETIME
|
| 119 |
+
NPY_TIMEDELTA
|
| 120 |
+
NPY_NTYPES_LEGACY
|
| 121 |
+
NPY_NOTYPE
|
| 122 |
+
|
| 123 |
+
NPY_INT8
|
| 124 |
+
NPY_INT16
|
| 125 |
+
NPY_INT32
|
| 126 |
+
NPY_INT64
|
| 127 |
+
NPY_UINT8
|
| 128 |
+
NPY_UINT16
|
| 129 |
+
NPY_UINT32
|
| 130 |
+
NPY_UINT64
|
| 131 |
+
NPY_FLOAT16
|
| 132 |
+
NPY_FLOAT32
|
| 133 |
+
NPY_FLOAT64
|
| 134 |
+
NPY_FLOAT80
|
| 135 |
+
NPY_FLOAT96
|
| 136 |
+
NPY_FLOAT128
|
| 137 |
+
NPY_COMPLEX64
|
| 138 |
+
NPY_COMPLEX128
|
| 139 |
+
NPY_COMPLEX160
|
| 140 |
+
NPY_COMPLEX192
|
| 141 |
+
NPY_COMPLEX256
|
| 142 |
+
|
| 143 |
+
NPY_INTP
|
| 144 |
+
NPY_UINTP
|
| 145 |
+
NPY_DEFAULT_INT # Not a compile time constant (normally)!
|
| 146 |
+
|
| 147 |
+
ctypedef enum NPY_ORDER:
|
| 148 |
+
NPY_ANYORDER
|
| 149 |
+
NPY_CORDER
|
| 150 |
+
NPY_FORTRANORDER
|
| 151 |
+
NPY_KEEPORDER
|
| 152 |
+
|
| 153 |
+
ctypedef enum NPY_CASTING:
|
| 154 |
+
NPY_NO_CASTING
|
| 155 |
+
NPY_EQUIV_CASTING
|
| 156 |
+
NPY_SAFE_CASTING
|
| 157 |
+
NPY_SAME_KIND_CASTING
|
| 158 |
+
NPY_UNSAFE_CASTING
|
| 159 |
+
NPY_SAME_VALUE_CASTING
|
| 160 |
+
|
| 161 |
+
ctypedef enum NPY_CLIPMODE:
|
| 162 |
+
NPY_CLIP
|
| 163 |
+
NPY_WRAP
|
| 164 |
+
NPY_RAISE
|
| 165 |
+
|
| 166 |
+
ctypedef enum NPY_SCALARKIND:
|
| 167 |
+
NPY_NOSCALAR,
|
| 168 |
+
NPY_BOOL_SCALAR,
|
| 169 |
+
NPY_INTPOS_SCALAR,
|
| 170 |
+
NPY_INTNEG_SCALAR,
|
| 171 |
+
NPY_FLOAT_SCALAR,
|
| 172 |
+
NPY_COMPLEX_SCALAR,
|
| 173 |
+
NPY_OBJECT_SCALAR
|
| 174 |
+
|
| 175 |
+
ctypedef enum NPY_SORTKIND:
|
| 176 |
+
NPY_QUICKSORT
|
| 177 |
+
NPY_HEAPSORT
|
| 178 |
+
NPY_MERGESORT
|
| 179 |
+
|
| 180 |
+
ctypedef enum NPY_SEARCHSIDE:
|
| 181 |
+
NPY_SEARCHLEFT
|
| 182 |
+
NPY_SEARCHRIGHT
|
| 183 |
+
|
| 184 |
+
enum:
|
| 185 |
+
NPY_ARRAY_C_CONTIGUOUS
|
| 186 |
+
NPY_ARRAY_F_CONTIGUOUS
|
| 187 |
+
NPY_ARRAY_OWNDATA
|
| 188 |
+
NPY_ARRAY_FORCECAST
|
| 189 |
+
NPY_ARRAY_ENSURECOPY
|
| 190 |
+
NPY_ARRAY_ENSUREARRAY
|
| 191 |
+
NPY_ARRAY_ELEMENTSTRIDES
|
| 192 |
+
NPY_ARRAY_ALIGNED
|
| 193 |
+
NPY_ARRAY_NOTSWAPPED
|
| 194 |
+
NPY_ARRAY_WRITEABLE
|
| 195 |
+
NPY_ARRAY_WRITEBACKIFCOPY
|
| 196 |
+
|
| 197 |
+
NPY_ARRAY_BEHAVED
|
| 198 |
+
NPY_ARRAY_BEHAVED_NS
|
| 199 |
+
NPY_ARRAY_CARRAY
|
| 200 |
+
NPY_ARRAY_CARRAY_RO
|
| 201 |
+
NPY_ARRAY_FARRAY
|
| 202 |
+
NPY_ARRAY_FARRAY_RO
|
| 203 |
+
NPY_ARRAY_DEFAULT
|
| 204 |
+
|
| 205 |
+
NPY_ARRAY_IN_ARRAY
|
| 206 |
+
NPY_ARRAY_OUT_ARRAY
|
| 207 |
+
NPY_ARRAY_INOUT_ARRAY
|
| 208 |
+
NPY_ARRAY_IN_FARRAY
|
| 209 |
+
NPY_ARRAY_OUT_FARRAY
|
| 210 |
+
NPY_ARRAY_INOUT_FARRAY
|
| 211 |
+
|
| 212 |
+
NPY_ARRAY_UPDATE_ALL
|
| 213 |
+
|
| 214 |
+
cdef enum:
|
| 215 |
+
NPY_MAXDIMS # 64 on NumPy 2.x and 32 on NumPy 1.x
|
| 216 |
+
NPY_RAVEL_AXIS # Used for functions like PyArray_Mean
|
| 217 |
+
|
| 218 |
+
ctypedef void (*PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *)
|
| 219 |
+
|
| 220 |
+
ctypedef struct PyArray_ArrayDescr:
|
| 221 |
+
# shape is a tuple, but Cython doesn't support "tuple shape"
|
| 222 |
+
# inside a non-PyObject declaration, so we have to declare it
|
| 223 |
+
# as just a PyObject*.
|
| 224 |
+
PyObject* shape
|
| 225 |
+
|
| 226 |
+
ctypedef struct PyArray_Descr:
|
| 227 |
+
pass
|
| 228 |
+
|
| 229 |
+
ctypedef class numpy.dtype [object PyArray_Descr, check_size ignore]:
|
| 230 |
+
@property
|
| 231 |
+
cdef inline PyTypeObject* typeobj(self) noexcept nogil:
|
| 232 |
+
return PyDataType_TYPEOBJ(self)
|
| 233 |
+
|
| 234 |
+
@property
|
| 235 |
+
cdef inline char kind(self) noexcept nogil:
|
| 236 |
+
return PyDataType_KIND(self)
|
| 237 |
+
|
| 238 |
+
@property
|
| 239 |
+
cdef inline char type(self) noexcept nogil:
|
| 240 |
+
return PyDataType_TYPE(self)
|
| 241 |
+
|
| 242 |
+
# Numpy sometimes mutates this without warning (e.g. it'll
|
| 243 |
+
# sometimes change "|" to "<" in shared dtype objects on
|
| 244 |
+
# little-endian machines). If this matters to you, use
|
| 245 |
+
# PyArray_IsNativeByteOrder(dtype.byteorder) instead of
|
| 246 |
+
# directly accessing this field.
|
| 247 |
+
@property
|
| 248 |
+
cdef inline char byteorder(self) noexcept nogil:
|
| 249 |
+
return PyDataType_BYTEORDER(self)
|
| 250 |
+
|
| 251 |
+
@property
|
| 252 |
+
cdef inline int type_num(self) noexcept nogil:
|
| 253 |
+
return PyDataType_TYPENUM(self)
|
| 254 |
+
|
| 255 |
+
@property
|
| 256 |
+
cdef inline npy_intp itemsize(self) noexcept nogil:
|
| 257 |
+
return PyDataType_ELSIZE(self)
|
| 258 |
+
|
| 259 |
+
@property
|
| 260 |
+
cdef inline npy_intp alignment(self) noexcept nogil:
|
| 261 |
+
return PyDataType_ALIGNMENT(self)
|
| 262 |
+
|
| 263 |
+
# Use fields/names with care as they may be NULL. You must check
|
| 264 |
+
# for this using PyDataType_HASFIELDS.
|
| 265 |
+
@property
|
| 266 |
+
cdef inline object fields(self):
|
| 267 |
+
return <object>PyDataType_FIELDS(self)
|
| 268 |
+
|
| 269 |
+
@property
|
| 270 |
+
cdef inline tuple names(self):
|
| 271 |
+
return <tuple>PyDataType_NAMES(self)
|
| 272 |
+
|
| 273 |
+
# Use PyDataType_HASSUBARRAY to test whether this field is
|
| 274 |
+
# valid (the pointer can be NULL). Most users should access
|
| 275 |
+
# this field via the inline helper method PyDataType_SHAPE.
|
| 276 |
+
@property
|
| 277 |
+
cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
|
| 278 |
+
return PyDataType_SUBARRAY(self)
|
| 279 |
+
|
| 280 |
+
@property
|
| 281 |
+
cdef inline npy_uint64 flags(self) noexcept nogil:
|
| 282 |
+
"""The data types flags."""
|
| 283 |
+
return PyDataType_FLAGS(self)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
ctypedef class numpy.flatiter [object PyArrayIterObject, check_size ignore]:
|
| 287 |
+
# Use through macros
|
| 288 |
+
pass
|
| 289 |
+
|
| 290 |
+
ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
|
| 291 |
+
|
| 292 |
+
@property
|
| 293 |
+
cdef inline int numiter(self) noexcept nogil:
|
| 294 |
+
"""The number of arrays that need to be broadcast to the same shape."""
|
| 295 |
+
return PyArray_MultiIter_NUMITER(self)
|
| 296 |
+
|
| 297 |
+
@property
|
| 298 |
+
cdef inline npy_intp size(self) noexcept nogil:
|
| 299 |
+
"""The total broadcasted size."""
|
| 300 |
+
return PyArray_MultiIter_SIZE(self)
|
| 301 |
+
|
| 302 |
+
@property
|
| 303 |
+
cdef inline npy_intp index(self) noexcept nogil:
|
| 304 |
+
"""The current (1-d) index into the broadcasted result."""
|
| 305 |
+
return PyArray_MultiIter_INDEX(self)
|
| 306 |
+
|
| 307 |
+
@property
|
| 308 |
+
cdef inline int nd(self) noexcept nogil:
|
| 309 |
+
"""The number of dimensions in the broadcasted result."""
|
| 310 |
+
return PyArray_MultiIter_NDIM(self)
|
| 311 |
+
|
| 312 |
+
@property
|
| 313 |
+
cdef inline npy_intp* dimensions(self) noexcept nogil:
|
| 314 |
+
"""The shape of the broadcasted result."""
|
| 315 |
+
return PyArray_MultiIter_DIMS(self)
|
| 316 |
+
|
| 317 |
+
@property
|
| 318 |
+
cdef inline void** iters(self) noexcept nogil:
|
| 319 |
+
"""An array of iterator objects that holds the iterators for the arrays to be broadcast together.
|
| 320 |
+
On return, the iterators are adjusted for broadcasting."""
|
| 321 |
+
return PyArray_MultiIter_ITERS(self)
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
ctypedef struct PyArrayObject:
|
| 325 |
+
# For use in situations where ndarray can't replace PyArrayObject*,
|
| 326 |
+
# like PyArrayObject**.
|
| 327 |
+
pass
|
| 328 |
+
|
| 329 |
+
ctypedef class numpy.ndarray [object PyArrayObject, check_size ignore]:
|
| 330 |
+
cdef __cythonbufferdefaults__ = {"mode": "strided"}
|
| 331 |
+
|
| 332 |
+
# NOTE: no field declarations since direct access is deprecated since NumPy 1.7
|
| 333 |
+
# Instead, we use properties that map to the corresponding C-API functions.
|
| 334 |
+
|
| 335 |
+
@property
|
| 336 |
+
cdef inline PyObject* base(self) noexcept nogil:
|
| 337 |
+
"""Returns a borrowed reference to the object owning the data/memory.
|
| 338 |
+
"""
|
| 339 |
+
return PyArray_BASE(self)
|
| 340 |
+
|
| 341 |
+
@property
|
| 342 |
+
cdef inline dtype descr(self):
|
| 343 |
+
"""Returns an owned reference to the dtype of the array.
|
| 344 |
+
"""
|
| 345 |
+
return <dtype>PyArray_DESCR(self)
|
| 346 |
+
|
| 347 |
+
@property
|
| 348 |
+
cdef inline int ndim(self) noexcept nogil:
|
| 349 |
+
"""Returns the number of dimensions in the array.
|
| 350 |
+
"""
|
| 351 |
+
return PyArray_NDIM(self)
|
| 352 |
+
|
| 353 |
+
@property
|
| 354 |
+
cdef inline npy_intp *shape(self) noexcept nogil:
|
| 355 |
+
"""Returns a pointer to the dimensions/shape of the array.
|
| 356 |
+
The number of elements matches the number of dimensions of the array (ndim).
|
| 357 |
+
Can return NULL for 0-dimensional arrays.
|
| 358 |
+
"""
|
| 359 |
+
return PyArray_DIMS(self)
|
| 360 |
+
|
| 361 |
+
@property
|
| 362 |
+
cdef inline npy_intp *strides(self) noexcept nogil:
|
| 363 |
+
"""Returns a pointer to the strides of the array.
|
| 364 |
+
The number of elements matches the number of dimensions of the array (ndim).
|
| 365 |
+
"""
|
| 366 |
+
return PyArray_STRIDES(self)
|
| 367 |
+
|
| 368 |
+
@property
|
| 369 |
+
cdef inline npy_intp size(self) noexcept nogil:
|
| 370 |
+
"""Returns the total size (in number of elements) of the array.
|
| 371 |
+
"""
|
| 372 |
+
return PyArray_SIZE(self)
|
| 373 |
+
|
| 374 |
+
@property
|
| 375 |
+
cdef inline char* data(self) noexcept nogil:
|
| 376 |
+
"""The pointer to the data buffer as a char*.
|
| 377 |
+
This is provided for legacy reasons to avoid direct struct field access.
|
| 378 |
+
For new code that needs this access, you probably want to cast the result
|
| 379 |
+
of `PyArray_DATA()` instead, which returns a 'void*'.
|
| 380 |
+
"""
|
| 381 |
+
return PyArray_BYTES(self)
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
int _import_array() except -1
|
| 385 |
+
# A second definition so _import_array isn't marked as used when we use it here.
|
| 386 |
+
# Do not use - subject to change any time.
|
| 387 |
+
int __pyx_import_array "_import_array"() except -1
|
| 388 |
+
|
| 389 |
+
#
|
| 390 |
+
# Macros from ndarrayobject.h
|
| 391 |
+
#
|
| 392 |
+
bint PyArray_CHKFLAGS(ndarray m, int flags) nogil
|
| 393 |
+
bint PyArray_IS_C_CONTIGUOUS(ndarray arr) nogil
|
| 394 |
+
bint PyArray_IS_F_CONTIGUOUS(ndarray arr) nogil
|
| 395 |
+
bint PyArray_ISCONTIGUOUS(ndarray m) nogil
|
| 396 |
+
bint PyArray_ISWRITEABLE(ndarray m) nogil
|
| 397 |
+
bint PyArray_ISALIGNED(ndarray m) nogil
|
| 398 |
+
|
| 399 |
+
int PyArray_NDIM(ndarray) nogil
|
| 400 |
+
bint PyArray_ISONESEGMENT(ndarray) nogil
|
| 401 |
+
bint PyArray_ISFORTRAN(ndarray) nogil
|
| 402 |
+
int PyArray_FORTRANIF(ndarray) nogil
|
| 403 |
+
|
| 404 |
+
void* PyArray_DATA(ndarray) nogil
|
| 405 |
+
char* PyArray_BYTES(ndarray) nogil
|
| 406 |
+
|
| 407 |
+
npy_intp* PyArray_DIMS(ndarray) nogil
|
| 408 |
+
npy_intp* PyArray_STRIDES(ndarray) nogil
|
| 409 |
+
npy_intp PyArray_DIM(ndarray, size_t) nogil
|
| 410 |
+
npy_intp PyArray_STRIDE(ndarray, size_t) nogil
|
| 411 |
+
|
| 412 |
+
PyObject *PyArray_BASE(ndarray) nogil # returns borrowed reference!
|
| 413 |
+
PyArray_Descr *PyArray_DESCR(ndarray) nogil # returns borrowed reference to dtype!
|
| 414 |
+
PyArray_Descr *PyArray_DTYPE(ndarray) nogil # returns borrowed reference to dtype! NP 1.7+ alias for descr.
|
| 415 |
+
int PyArray_FLAGS(ndarray) nogil
|
| 416 |
+
void PyArray_CLEARFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
|
| 417 |
+
void PyArray_ENABLEFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
|
| 418 |
+
npy_intp PyArray_ITEMSIZE(ndarray) nogil
|
| 419 |
+
int PyArray_TYPE(ndarray arr) nogil
|
| 420 |
+
|
| 421 |
+
object PyArray_GETITEM(ndarray arr, void *itemptr)
|
| 422 |
+
int PyArray_SETITEM(ndarray arr, void *itemptr, object obj) except -1
|
| 423 |
+
|
| 424 |
+
bint PyTypeNum_ISBOOL(int) nogil
|
| 425 |
+
bint PyTypeNum_ISUNSIGNED(int) nogil
|
| 426 |
+
bint PyTypeNum_ISSIGNED(int) nogil
|
| 427 |
+
bint PyTypeNum_ISINTEGER(int) nogil
|
| 428 |
+
bint PyTypeNum_ISFLOAT(int) nogil
|
| 429 |
+
bint PyTypeNum_ISNUMBER(int) nogil
|
| 430 |
+
bint PyTypeNum_ISSTRING(int) nogil
|
| 431 |
+
bint PyTypeNum_ISCOMPLEX(int) nogil
|
| 432 |
+
bint PyTypeNum_ISFLEXIBLE(int) nogil
|
| 433 |
+
bint PyTypeNum_ISUSERDEF(int) nogil
|
| 434 |
+
bint PyTypeNum_ISEXTENDED(int) nogil
|
| 435 |
+
bint PyTypeNum_ISOBJECT(int) nogil
|
| 436 |
+
|
| 437 |
+
npy_intp PyDataType_ELSIZE(dtype) nogil
|
| 438 |
+
npy_intp PyDataType_ALIGNMENT(dtype) nogil
|
| 439 |
+
PyObject* PyDataType_METADATA(dtype) nogil
|
| 440 |
+
PyArray_ArrayDescr* PyDataType_SUBARRAY(dtype) nogil
|
| 441 |
+
PyObject* PyDataType_NAMES(dtype) nogil
|
| 442 |
+
PyObject* PyDataType_FIELDS(dtype) nogil
|
| 443 |
+
char PyDataType_TYPE(dtype) nogil
|
| 444 |
+
char PyDataType_KIND(dtype) nogil
|
| 445 |
+
int PyDataType_TYPENUM(dtype) nogil
|
| 446 |
+
char PyDataType_BYTEORDER(dtype) nogil
|
| 447 |
+
PyTypeObject* PyDataType_TYPEOBJ(dtype) nogil
|
| 448 |
+
|
| 449 |
+
bint PyDataType_ISBOOL(dtype) nogil
|
| 450 |
+
bint PyDataType_ISUNSIGNED(dtype) nogil
|
| 451 |
+
bint PyDataType_ISSIGNED(dtype) nogil
|
| 452 |
+
bint PyDataType_ISINTEGER(dtype) nogil
|
| 453 |
+
bint PyDataType_ISFLOAT(dtype) nogil
|
| 454 |
+
bint PyDataType_ISNUMBER(dtype) nogil
|
| 455 |
+
bint PyDataType_ISSTRING(dtype) nogil
|
| 456 |
+
bint PyDataType_ISCOMPLEX(dtype) nogil
|
| 457 |
+
bint PyDataType_ISFLEXIBLE(dtype) nogil
|
| 458 |
+
bint PyDataType_ISUSERDEF(dtype) nogil
|
| 459 |
+
bint PyDataType_ISEXTENDED(dtype) nogil
|
| 460 |
+
bint PyDataType_ISOBJECT(dtype) nogil
|
| 461 |
+
bint PyDataType_HASFIELDS(dtype) nogil
|
| 462 |
+
bint PyDataType_HASSUBARRAY(dtype) nogil
|
| 463 |
+
npy_uint64 PyDataType_FLAGS(dtype) nogil
|
| 464 |
+
|
| 465 |
+
bint PyArray_ISBOOL(ndarray) nogil
|
| 466 |
+
bint PyArray_ISUNSIGNED(ndarray) nogil
|
| 467 |
+
bint PyArray_ISSIGNED(ndarray) nogil
|
| 468 |
+
bint PyArray_ISINTEGER(ndarray) nogil
|
| 469 |
+
bint PyArray_ISFLOAT(ndarray) nogil
|
| 470 |
+
bint PyArray_ISNUMBER(ndarray) nogil
|
| 471 |
+
bint PyArray_ISSTRING(ndarray) nogil
|
| 472 |
+
bint PyArray_ISCOMPLEX(ndarray) nogil
|
| 473 |
+
bint PyArray_ISFLEXIBLE(ndarray) nogil
|
| 474 |
+
bint PyArray_ISUSERDEF(ndarray) nogil
|
| 475 |
+
bint PyArray_ISEXTENDED(ndarray) nogil
|
| 476 |
+
bint PyArray_ISOBJECT(ndarray) nogil
|
| 477 |
+
bint PyArray_HASFIELDS(ndarray) nogil
|
| 478 |
+
|
| 479 |
+
bint PyArray_ISVARIABLE(ndarray) nogil
|
| 480 |
+
|
| 481 |
+
bint PyArray_SAFEALIGNEDCOPY(ndarray) nogil
|
| 482 |
+
bint PyArray_ISNBO(char) nogil # works on ndarray.byteorder
|
| 483 |
+
bint PyArray_IsNativeByteOrder(char) nogil # works on ndarray.byteorder
|
| 484 |
+
bint PyArray_ISNOTSWAPPED(ndarray) nogil
|
| 485 |
+
bint PyArray_ISBYTESWAPPED(ndarray) nogil
|
| 486 |
+
|
| 487 |
+
bint PyArray_FLAGSWAP(ndarray, int) nogil
|
| 488 |
+
|
| 489 |
+
bint PyArray_ISCARRAY(ndarray) nogil
|
| 490 |
+
bint PyArray_ISCARRAY_RO(ndarray) nogil
|
| 491 |
+
bint PyArray_ISFARRAY(ndarray) nogil
|
| 492 |
+
bint PyArray_ISFARRAY_RO(ndarray) nogil
|
| 493 |
+
bint PyArray_ISBEHAVED(ndarray) nogil
|
| 494 |
+
bint PyArray_ISBEHAVED_RO(ndarray) nogil
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
bint PyDataType_ISNOTSWAPPED(dtype) nogil
|
| 498 |
+
bint PyDataType_ISBYTESWAPPED(dtype) nogil
|
| 499 |
+
|
| 500 |
+
bint PyArray_DescrCheck(object)
|
| 501 |
+
|
| 502 |
+
bint PyArray_Check(object)
|
| 503 |
+
bint PyArray_CheckExact(object)
|
| 504 |
+
|
| 505 |
+
# Cannot be supported due to out arg:
|
| 506 |
+
# bint PyArray_HasArrayInterfaceType(object, dtype, object, object&)
|
| 507 |
+
# bint PyArray_HasArrayInterface(op, out)
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
bint PyArray_IsZeroDim(object)
|
| 511 |
+
# Cannot be supported due to ## ## in macro:
|
| 512 |
+
# bint PyArray_IsScalar(object, verbatim work)
|
| 513 |
+
bint PyArray_CheckScalar(object)
|
| 514 |
+
bint PyArray_IsPythonNumber(object)
|
| 515 |
+
bint PyArray_IsPythonScalar(object)
|
| 516 |
+
bint PyArray_IsAnyScalar(object)
|
| 517 |
+
bint PyArray_CheckAnyScalar(object)
|
| 518 |
+
|
| 519 |
+
ndarray PyArray_GETCONTIGUOUS(ndarray)
|
| 520 |
+
bint PyArray_SAMESHAPE(ndarray, ndarray) nogil
|
| 521 |
+
npy_intp PyArray_SIZE(ndarray) nogil
|
| 522 |
+
npy_intp PyArray_NBYTES(ndarray) nogil
|
| 523 |
+
|
| 524 |
+
object PyArray_FROM_O(object)
|
| 525 |
+
object PyArray_FROM_OF(object m, int flags)
|
| 526 |
+
object PyArray_FROM_OT(object m, int type)
|
| 527 |
+
object PyArray_FROM_OTF(object m, int type, int flags)
|
| 528 |
+
object PyArray_FROMANY(object m, int type, int min, int max, int flags)
|
| 529 |
+
object PyArray_ZEROS(int nd, npy_intp* dims, int type, int fortran)
|
| 530 |
+
object PyArray_EMPTY(int nd, npy_intp* dims, int type, int fortran)
|
| 531 |
+
void PyArray_FILLWBYTE(ndarray, int val)
|
| 532 |
+
object PyArray_ContiguousFromAny(op, int, int min_depth, int max_depth)
|
| 533 |
+
unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2)
|
| 534 |
+
bint PyArray_EquivByteorders(int b1, int b2) nogil
|
| 535 |
+
object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum)
|
| 536 |
+
object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data)
|
| 537 |
+
#object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr)
|
| 538 |
+
object PyArray_ToScalar(void* data, ndarray arr)
|
| 539 |
+
|
| 540 |
+
void* PyArray_GETPTR1(ndarray m, npy_intp i) nogil
|
| 541 |
+
void* PyArray_GETPTR2(ndarray m, npy_intp i, npy_intp j) nogil
|
| 542 |
+
void* PyArray_GETPTR3(ndarray m, npy_intp i, npy_intp j, npy_intp k) nogil
|
| 543 |
+
void* PyArray_GETPTR4(ndarray m, npy_intp i, npy_intp j, npy_intp k, npy_intp l) nogil
|
| 544 |
+
|
| 545 |
+
# Cannot be supported due to out arg
|
| 546 |
+
# void PyArray_DESCR_REPLACE(descr)
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
object PyArray_Copy(ndarray)
|
| 550 |
+
object PyArray_FromObject(object op, int type, int min_depth, int max_depth)
|
| 551 |
+
object PyArray_ContiguousFromObject(object op, int type, int min_depth, int max_depth)
|
| 552 |
+
object PyArray_CopyFromObject(object op, int type, int min_depth, int max_depth)
|
| 553 |
+
|
| 554 |
+
object PyArray_Cast(ndarray mp, int type_num)
|
| 555 |
+
object PyArray_Take(ndarray ap, object items, int axis)
|
| 556 |
+
object PyArray_Put(ndarray ap, object items, object values)
|
| 557 |
+
|
| 558 |
+
void PyArray_ITER_RESET(flatiter it) nogil
|
| 559 |
+
void PyArray_ITER_NEXT(flatiter it) nogil
|
| 560 |
+
void PyArray_ITER_GOTO(flatiter it, npy_intp* destination) nogil
|
| 561 |
+
void PyArray_ITER_GOTO1D(flatiter it, npy_intp ind) nogil
|
| 562 |
+
void* PyArray_ITER_DATA(flatiter it) nogil
|
| 563 |
+
bint PyArray_ITER_NOTDONE(flatiter it) nogil
|
| 564 |
+
|
| 565 |
+
void PyArray_MultiIter_RESET(broadcast multi) nogil
|
| 566 |
+
void PyArray_MultiIter_NEXT(broadcast multi) nogil
|
| 567 |
+
void PyArray_MultiIter_GOTO(broadcast multi, npy_intp dest) nogil
|
| 568 |
+
void PyArray_MultiIter_GOTO1D(broadcast multi, npy_intp ind) nogil
|
| 569 |
+
void* PyArray_MultiIter_DATA(broadcast multi, npy_intp i) nogil
|
| 570 |
+
void PyArray_MultiIter_NEXTi(broadcast multi, npy_intp i) nogil
|
| 571 |
+
bint PyArray_MultiIter_NOTDONE(broadcast multi) nogil
|
| 572 |
+
npy_intp PyArray_MultiIter_SIZE(broadcast multi) nogil
|
| 573 |
+
int PyArray_MultiIter_NDIM(broadcast multi) nogil
|
| 574 |
+
npy_intp PyArray_MultiIter_INDEX(broadcast multi) nogil
|
| 575 |
+
int PyArray_MultiIter_NUMITER(broadcast multi) nogil
|
| 576 |
+
npy_intp* PyArray_MultiIter_DIMS(broadcast multi) nogil
|
| 577 |
+
void** PyArray_MultiIter_ITERS(broadcast multi) nogil
|
| 578 |
+
|
| 579 |
+
# Functions from __multiarray_api.h
|
| 580 |
+
|
| 581 |
+
# Functions taking dtype and returning object/ndarray are disabled
|
| 582 |
+
# for now as they steal dtype references. I'm conservative and disable
|
| 583 |
+
# more than is probably needed until it can be checked further.
|
| 584 |
+
int PyArray_INCREF (ndarray) except * # uses PyArray_Item_INCREF...
|
| 585 |
+
int PyArray_XDECREF (ndarray) except * # uses PyArray_Item_DECREF...
|
| 586 |
+
dtype PyArray_DescrFromType (int)
|
| 587 |
+
object PyArray_TypeObjectFromType (int)
|
| 588 |
+
char * PyArray_Zero (ndarray)
|
| 589 |
+
char * PyArray_One (ndarray)
|
| 590 |
+
#object PyArray_CastToType (ndarray, dtype, int)
|
| 591 |
+
int PyArray_CanCastSafely (int, int) # writes errors
|
| 592 |
+
npy_bool PyArray_CanCastTo (dtype, dtype) # writes errors
|
| 593 |
+
int PyArray_ObjectType (object, int) except 0
|
| 594 |
+
dtype PyArray_DescrFromObject (object, dtype)
|
| 595 |
+
#ndarray* PyArray_ConvertToCommonType (object, int *)
|
| 596 |
+
dtype PyArray_DescrFromScalar (object)
|
| 597 |
+
dtype PyArray_DescrFromTypeObject (object)
|
| 598 |
+
npy_intp PyArray_Size (object)
|
| 599 |
+
#object PyArray_Scalar (void *, dtype, object)
|
| 600 |
+
#object PyArray_FromScalar (object, dtype)
|
| 601 |
+
void PyArray_ScalarAsCtype (object, void *)
|
| 602 |
+
#int PyArray_CastScalarToCtype (object, void *, dtype)
|
| 603 |
+
#int PyArray_CastScalarDirect (object, dtype, void *, int)
|
| 604 |
+
#PyArray_VectorUnaryFunc * PyArray_GetCastFunc (dtype, int)
|
| 605 |
+
#object PyArray_FromAny (object, dtype, int, int, int, object)
|
| 606 |
+
object PyArray_EnsureArray (object)
|
| 607 |
+
object PyArray_EnsureAnyArray (object)
|
| 608 |
+
#object PyArray_FromFile (stdio.FILE *, dtype, npy_intp, char *)
|
| 609 |
+
#object PyArray_FromString (char *, npy_intp, dtype, npy_intp, char *)
|
| 610 |
+
#object PyArray_FromBuffer (object, dtype, npy_intp, npy_intp)
|
| 611 |
+
#object PyArray_FromIter (object, dtype, npy_intp)
|
| 612 |
+
object PyArray_Return (ndarray)
|
| 613 |
+
#object PyArray_GetField (ndarray, dtype, int)
|
| 614 |
+
#int PyArray_SetField (ndarray, dtype, int, object) except -1
|
| 615 |
+
object PyArray_Byteswap (ndarray, npy_bool)
|
| 616 |
+
object PyArray_Resize (ndarray, PyArray_Dims *, int, NPY_ORDER)
|
| 617 |
+
int PyArray_CopyInto (ndarray, ndarray) except -1
|
| 618 |
+
int PyArray_CopyAnyInto (ndarray, ndarray) except -1
|
| 619 |
+
int PyArray_CopyObject (ndarray, object) except -1
|
| 620 |
+
object PyArray_NewCopy (ndarray, NPY_ORDER)
|
| 621 |
+
object PyArray_ToList (ndarray)
|
| 622 |
+
object PyArray_ToString (ndarray, NPY_ORDER)
|
| 623 |
+
int PyArray_ToFile (ndarray, stdio.FILE *, char *, char *) except -1
|
| 624 |
+
int PyArray_Dump (object, object, int) except -1
|
| 625 |
+
object PyArray_Dumps (object, int)
|
| 626 |
+
int PyArray_ValidType (int) # Cannot error
|
| 627 |
+
void PyArray_UpdateFlags (ndarray, int)
|
| 628 |
+
object PyArray_New (type, int, npy_intp *, int, npy_intp *, void *, int, int, object)
|
| 629 |
+
#object PyArray_NewFromDescr (type, dtype, int, npy_intp *, npy_intp *, void *, int, object)
|
| 630 |
+
#dtype PyArray_DescrNew (dtype)
|
| 631 |
+
dtype PyArray_DescrNewFromType (int)
|
| 632 |
+
double PyArray_GetPriority (object, double) # clears errors as of 1.25
|
| 633 |
+
object PyArray_IterNew (object)
|
| 634 |
+
object PyArray_MultiIterNew (int, ...)
|
| 635 |
+
|
| 636 |
+
int PyArray_PyIntAsInt (object) except? -1
|
| 637 |
+
npy_intp PyArray_PyIntAsIntp (object)
|
| 638 |
+
int PyArray_Broadcast (broadcast) except -1
|
| 639 |
+
int PyArray_FillWithScalar (ndarray, object) except -1
|
| 640 |
+
npy_bool PyArray_CheckStrides (int, int, npy_intp, npy_intp, npy_intp *, npy_intp *)
|
| 641 |
+
dtype PyArray_DescrNewByteorder (dtype, char)
|
| 642 |
+
object PyArray_IterAllButAxis (object, int *)
|
| 643 |
+
#object PyArray_CheckFromAny (object, dtype, int, int, int, object)
|
| 644 |
+
#object PyArray_FromArray (ndarray, dtype, int)
|
| 645 |
+
object PyArray_FromInterface (object)
|
| 646 |
+
object PyArray_FromStructInterface (object)
|
| 647 |
+
#object PyArray_FromArrayAttr (object, dtype, object)
|
| 648 |
+
#NPY_SCALARKIND PyArray_ScalarKind (int, ndarray*)
|
| 649 |
+
int PyArray_CanCoerceScalar (int, int, NPY_SCALARKIND)
|
| 650 |
+
npy_bool PyArray_CanCastScalar (type, type)
|
| 651 |
+
int PyArray_RemoveSmallest (broadcast) except -1
|
| 652 |
+
int PyArray_ElementStrides (object)
|
| 653 |
+
void PyArray_Item_INCREF (char *, dtype) except *
|
| 654 |
+
void PyArray_Item_XDECREF (char *, dtype) except *
|
| 655 |
+
object PyArray_Transpose (ndarray, PyArray_Dims *)
|
| 656 |
+
object PyArray_TakeFrom (ndarray, object, int, ndarray, NPY_CLIPMODE)
|
| 657 |
+
object PyArray_PutTo (ndarray, object, object, NPY_CLIPMODE)
|
| 658 |
+
object PyArray_PutMask (ndarray, object, object)
|
| 659 |
+
object PyArray_Repeat (ndarray, object, int)
|
| 660 |
+
object PyArray_Choose (ndarray, object, ndarray, NPY_CLIPMODE)
|
| 661 |
+
int PyArray_Sort (ndarray, int, NPY_SORTKIND) except -1
|
| 662 |
+
object PyArray_ArgSort (ndarray, int, NPY_SORTKIND)
|
| 663 |
+
object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE, PyObject *)
|
| 664 |
+
object PyArray_ArgMax (ndarray, int, ndarray)
|
| 665 |
+
object PyArray_ArgMin (ndarray, int, ndarray)
|
| 666 |
+
object PyArray_Reshape (ndarray, object)
|
| 667 |
+
object PyArray_Newshape (ndarray, PyArray_Dims *, NPY_ORDER)
|
| 668 |
+
object PyArray_Squeeze (ndarray)
|
| 669 |
+
#object PyArray_View (ndarray, dtype, type)
|
| 670 |
+
object PyArray_SwapAxes (ndarray, int, int)
|
| 671 |
+
object PyArray_Max (ndarray, int, ndarray)
|
| 672 |
+
object PyArray_Min (ndarray, int, ndarray)
|
| 673 |
+
object PyArray_Ptp (ndarray, int, ndarray)
|
| 674 |
+
object PyArray_Mean (ndarray, int, int, ndarray)
|
| 675 |
+
object PyArray_Trace (ndarray, int, int, int, int, ndarray)
|
| 676 |
+
object PyArray_Diagonal (ndarray, int, int, int)
|
| 677 |
+
object PyArray_Clip (ndarray, object, object, ndarray)
|
| 678 |
+
object PyArray_Conjugate (ndarray, ndarray)
|
| 679 |
+
object PyArray_Nonzero (ndarray)
|
| 680 |
+
object PyArray_Std (ndarray, int, int, ndarray, int)
|
| 681 |
+
object PyArray_Sum (ndarray, int, int, ndarray)
|
| 682 |
+
object PyArray_CumSum (ndarray, int, int, ndarray)
|
| 683 |
+
object PyArray_Prod (ndarray, int, int, ndarray)
|
| 684 |
+
object PyArray_CumProd (ndarray, int, int, ndarray)
|
| 685 |
+
object PyArray_All (ndarray, int, ndarray)
|
| 686 |
+
object PyArray_Any (ndarray, int, ndarray)
|
| 687 |
+
object PyArray_Compress (ndarray, object, int, ndarray)
|
| 688 |
+
object PyArray_Flatten (ndarray, NPY_ORDER)
|
| 689 |
+
object PyArray_Ravel (ndarray, NPY_ORDER)
|
| 690 |
+
npy_intp PyArray_MultiplyList (npy_intp *, int)
|
| 691 |
+
int PyArray_MultiplyIntList (int *, int)
|
| 692 |
+
void * PyArray_GetPtr (ndarray, npy_intp*)
|
| 693 |
+
int PyArray_CompareLists (npy_intp *, npy_intp *, int)
|
| 694 |
+
#int PyArray_AsCArray (object*, void *, npy_intp *, int, dtype)
|
| 695 |
+
int PyArray_Free (object, void *)
|
| 696 |
+
#int PyArray_Converter (object, object*)
|
| 697 |
+
int PyArray_IntpFromSequence (object, npy_intp *, int) except -1
|
| 698 |
+
object PyArray_Concatenate (object, int)
|
| 699 |
+
object PyArray_InnerProduct (object, object)
|
| 700 |
+
object PyArray_MatrixProduct (object, object)
|
| 701 |
+
object PyArray_Correlate (object, object, int)
|
| 702 |
+
#int PyArray_DescrConverter (object, dtype*) except 0
|
| 703 |
+
#int PyArray_DescrConverter2 (object, dtype*) except 0
|
| 704 |
+
int PyArray_IntpConverter (object, PyArray_Dims *) except 0
|
| 705 |
+
#int PyArray_BufferConverter (object, chunk) except 0
|
| 706 |
+
int PyArray_AxisConverter (object, int *) except 0
|
| 707 |
+
int PyArray_BoolConverter (object, npy_bool *) except 0
|
| 708 |
+
int PyArray_ByteorderConverter (object, char *) except 0
|
| 709 |
+
int PyArray_OrderConverter (object, NPY_ORDER *) except 0
|
| 710 |
+
unsigned char PyArray_EquivTypes (dtype, dtype) # clears errors
|
| 711 |
+
#object PyArray_Zeros (int, npy_intp *, dtype, int)
|
| 712 |
+
#object PyArray_Empty (int, npy_intp *, dtype, int)
|
| 713 |
+
object PyArray_Where (object, object, object)
|
| 714 |
+
object PyArray_Arange (double, double, double, int)
|
| 715 |
+
#object PyArray_ArangeObj (object, object, object, dtype)
|
| 716 |
+
int PyArray_SortkindConverter (object, NPY_SORTKIND *) except 0
|
| 717 |
+
object PyArray_LexSort (object, int)
|
| 718 |
+
object PyArray_Round (ndarray, int, ndarray)
|
| 719 |
+
unsigned char PyArray_EquivTypenums (int, int)
|
| 720 |
+
int PyArray_RegisterDataType (dtype) except -1
|
| 721 |
+
int PyArray_RegisterCastFunc (dtype, int, PyArray_VectorUnaryFunc *) except -1
|
| 722 |
+
int PyArray_RegisterCanCast (dtype, int, NPY_SCALARKIND) except -1
|
| 723 |
+
#void PyArray_InitArrFuncs (PyArray_ArrFuncs *)
|
| 724 |
+
object PyArray_IntTupleFromIntp (int, npy_intp *)
|
| 725 |
+
int PyArray_ClipmodeConverter (object, NPY_CLIPMODE *) except 0
|
| 726 |
+
#int PyArray_OutputConverter (object, ndarray*) except 0
|
| 727 |
+
object PyArray_BroadcastToShape (object, npy_intp *, int)
|
| 728 |
+
#int PyArray_DescrAlignConverter (object, dtype*) except 0
|
| 729 |
+
#int PyArray_DescrAlignConverter2 (object, dtype*) except 0
|
| 730 |
+
int PyArray_SearchsideConverter (object, void *) except 0
|
| 731 |
+
object PyArray_CheckAxis (ndarray, int *, int)
|
| 732 |
+
npy_intp PyArray_OverflowMultiplyList (npy_intp *, int)
|
| 733 |
+
int PyArray_SetBaseObject(ndarray, base) except -1 # NOTE: steals a reference to base! Use "set_array_base()" instead.
|
| 734 |
+
|
| 735 |
+
# The memory handler functions require the NumPy 1.22 API
|
| 736 |
+
# and may require defining NPY_TARGET_VERSION
|
| 737 |
+
ctypedef struct PyDataMemAllocator:
|
| 738 |
+
void *ctx
|
| 739 |
+
void* (*malloc) (void *ctx, size_t size)
|
| 740 |
+
void* (*calloc) (void *ctx, size_t nelem, size_t elsize)
|
| 741 |
+
void* (*realloc) (void *ctx, void *ptr, size_t new_size)
|
| 742 |
+
void (*free) (void *ctx, void *ptr, size_t size)
|
| 743 |
+
|
| 744 |
+
ctypedef struct PyDataMem_Handler:
|
| 745 |
+
char* name
|
| 746 |
+
npy_uint8 version
|
| 747 |
+
PyDataMemAllocator allocator
|
| 748 |
+
|
| 749 |
+
object PyDataMem_SetHandler(object handler)
|
| 750 |
+
object PyDataMem_GetHandler()
|
| 751 |
+
|
| 752 |
+
# additional datetime related functions are defined below
|
| 753 |
+
|
| 754 |
+
|
| 755 |
+
# Typedefs that matches the runtime dtype objects in
|
| 756 |
+
# the numpy module.
|
| 757 |
+
|
| 758 |
+
# The ones that are commented out needs an IFDEF function
|
| 759 |
+
# in Cython to enable them only on the right systems.
|
| 760 |
+
|
| 761 |
+
ctypedef npy_int8 int8_t
|
| 762 |
+
ctypedef npy_int16 int16_t
|
| 763 |
+
ctypedef npy_int32 int32_t
|
| 764 |
+
ctypedef npy_int64 int64_t
|
| 765 |
+
|
| 766 |
+
ctypedef npy_uint8 uint8_t
|
| 767 |
+
ctypedef npy_uint16 uint16_t
|
| 768 |
+
ctypedef npy_uint32 uint32_t
|
| 769 |
+
ctypedef npy_uint64 uint64_t
|
| 770 |
+
|
| 771 |
+
ctypedef npy_float32 float32_t
|
| 772 |
+
ctypedef npy_float64 float64_t
|
| 773 |
+
#ctypedef npy_float80 float80_t
|
| 774 |
+
#ctypedef npy_float128 float128_t
|
| 775 |
+
|
| 776 |
+
ctypedef float complex complex64_t
|
| 777 |
+
ctypedef double complex complex128_t
|
| 778 |
+
|
| 779 |
+
ctypedef npy_longlong longlong_t
|
| 780 |
+
ctypedef npy_ulonglong ulonglong_t
|
| 781 |
+
|
| 782 |
+
ctypedef npy_intp intp_t
|
| 783 |
+
ctypedef npy_uintp uintp_t
|
| 784 |
+
|
| 785 |
+
ctypedef npy_double float_t
|
| 786 |
+
ctypedef npy_double double_t
|
| 787 |
+
ctypedef npy_longdouble longdouble_t
|
| 788 |
+
|
| 789 |
+
ctypedef float complex cfloat_t
|
| 790 |
+
ctypedef double complex cdouble_t
|
| 791 |
+
ctypedef double complex complex_t
|
| 792 |
+
ctypedef long double complex clongdouble_t
|
| 793 |
+
|
| 794 |
+
cdef inline object PyArray_MultiIterNew1(a):
|
| 795 |
+
return PyArray_MultiIterNew(1, <void*>a)
|
| 796 |
+
|
| 797 |
+
cdef inline object PyArray_MultiIterNew2(a, b):
|
| 798 |
+
return PyArray_MultiIterNew(2, <void*>a, <void*>b)
|
| 799 |
+
|
| 800 |
+
cdef inline object PyArray_MultiIterNew3(a, b, c):
|
| 801 |
+
return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
|
| 802 |
+
|
| 803 |
+
cdef inline object PyArray_MultiIterNew4(a, b, c, d):
|
| 804 |
+
return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
|
| 805 |
+
|
| 806 |
+
cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
|
| 807 |
+
return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
|
| 808 |
+
|
| 809 |
+
cdef inline tuple PyDataType_SHAPE(dtype d):
|
| 810 |
+
if PyDataType_HASSUBARRAY(d):
|
| 811 |
+
return <tuple>d.subarray.shape
|
| 812 |
+
else:
|
| 813 |
+
return ()
|
| 814 |
+
|
| 815 |
+
|
| 816 |
+
cdef extern from "numpy/ndarrayobject.h":
|
| 817 |
+
PyTypeObject PyTimedeltaArrType_Type
|
| 818 |
+
PyTypeObject PyDatetimeArrType_Type
|
| 819 |
+
ctypedef int64_t npy_timedelta
|
| 820 |
+
ctypedef int64_t npy_datetime
|
| 821 |
+
|
| 822 |
+
cdef extern from "numpy/ndarraytypes.h":
|
| 823 |
+
ctypedef struct PyArray_DatetimeMetaData:
|
| 824 |
+
NPY_DATETIMEUNIT base
|
| 825 |
+
int64_t num
|
| 826 |
+
|
| 827 |
+
ctypedef struct npy_datetimestruct:
|
| 828 |
+
int64_t year
|
| 829 |
+
int32_t month, day, hour, min, sec, us, ps, as
|
| 830 |
+
|
| 831 |
+
# Iterator API added in v1.6
|
| 832 |
+
#
|
| 833 |
+
# These don't match the definition in the C API because Cython can't wrap
|
| 834 |
+
# function pointers that return functions.
|
| 835 |
+
# https://github.com/cython/cython/issues/6720
|
| 836 |
+
ctypedef int (*NpyIter_IterNextFunc "NpyIter_IterNextFunc *")(NpyIter* it) noexcept nogil
|
| 837 |
+
ctypedef void (*NpyIter_GetMultiIndexFunc "NpyIter_GetMultiIndexFunc *")(NpyIter* it, npy_intp* outcoords) noexcept nogil
|
| 838 |
+
|
| 839 |
+
PyArray_DatetimeMetaData _PyDatetimeScalarObject_GetMetadata(object) noexcept nogil
|
| 840 |
+
PyArray_DatetimeMetaData _PyTimedeltaScalarObject_GetMetadata(object) noexcept nogil
|
| 841 |
+
npy_datetime _PyDatetimeScalarObject_GetValue(object) noexcept nogil
|
| 842 |
+
npy_timedelta _PyTimedeltaScalarObject_GetValue(object) noexcept nogil
|
| 843 |
+
|
| 844 |
+
cdef extern from "numpy/arrayscalars.h":
|
| 845 |
+
|
| 846 |
+
# abstract types
|
| 847 |
+
ctypedef class numpy.generic [object PyObject]:
|
| 848 |
+
pass
|
| 849 |
+
ctypedef class numpy.number [object PyObject]:
|
| 850 |
+
pass
|
| 851 |
+
ctypedef class numpy.integer [object PyObject]:
|
| 852 |
+
pass
|
| 853 |
+
ctypedef class numpy.signedinteger [object PyObject]:
|
| 854 |
+
pass
|
| 855 |
+
ctypedef class numpy.unsignedinteger [object PyObject]:
|
| 856 |
+
pass
|
| 857 |
+
ctypedef class numpy.inexact [object PyObject]:
|
| 858 |
+
pass
|
| 859 |
+
ctypedef class numpy.floating [object PyObject]:
|
| 860 |
+
pass
|
| 861 |
+
ctypedef class numpy.complexfloating [object PyObject]:
|
| 862 |
+
pass
|
| 863 |
+
ctypedef class numpy.flexible [object PyObject]:
|
| 864 |
+
pass
|
| 865 |
+
ctypedef class numpy.character [object PyObject]:
|
| 866 |
+
pass
|
| 867 |
+
|
| 868 |
+
ctypedef struct PyDatetimeScalarObject:
|
| 869 |
+
# PyObject_HEAD
|
| 870 |
+
npy_datetime obval
|
| 871 |
+
PyArray_DatetimeMetaData obmeta
|
| 872 |
+
|
| 873 |
+
ctypedef struct PyTimedeltaScalarObject:
|
| 874 |
+
# PyObject_HEAD
|
| 875 |
+
npy_timedelta obval
|
| 876 |
+
PyArray_DatetimeMetaData obmeta
|
| 877 |
+
|
| 878 |
+
ctypedef enum NPY_DATETIMEUNIT:
|
| 879 |
+
NPY_FR_Y
|
| 880 |
+
NPY_FR_M
|
| 881 |
+
NPY_FR_W
|
| 882 |
+
NPY_FR_D
|
| 883 |
+
NPY_FR_B
|
| 884 |
+
NPY_FR_h
|
| 885 |
+
NPY_FR_m
|
| 886 |
+
NPY_FR_s
|
| 887 |
+
NPY_FR_ms
|
| 888 |
+
NPY_FR_us
|
| 889 |
+
NPY_FR_ns
|
| 890 |
+
NPY_FR_ps
|
| 891 |
+
NPY_FR_fs
|
| 892 |
+
NPY_FR_as
|
| 893 |
+
NPY_FR_GENERIC
|
| 894 |
+
|
| 895 |
+
|
| 896 |
+
cdef extern from "numpy/arrayobject.h":
|
| 897 |
+
# These are part of the C-API defined in `__multiarray_api.h`
|
| 898 |
+
|
| 899 |
+
# NumPy internal definitions in datetime_strings.c:
|
| 900 |
+
int get_datetime_iso_8601_strlen "NpyDatetime_GetDatetimeISO8601StrLen" (
|
| 901 |
+
int local, NPY_DATETIMEUNIT base)
|
| 902 |
+
int make_iso_8601_datetime "NpyDatetime_MakeISO8601Datetime" (
|
| 903 |
+
npy_datetimestruct *dts, char *outstr, npy_intp outlen,
|
| 904 |
+
int local, int utc, NPY_DATETIMEUNIT base, int tzoffset,
|
| 905 |
+
NPY_CASTING casting) except -1
|
| 906 |
+
|
| 907 |
+
# NumPy internal definition in datetime.c:
|
| 908 |
+
# May return 1 to indicate that object does not appear to be a datetime
|
| 909 |
+
# (returns 0 on success).
|
| 910 |
+
int convert_pydatetime_to_datetimestruct "NpyDatetime_ConvertPyDateTimeToDatetimeStruct" (
|
| 911 |
+
PyObject *obj, npy_datetimestruct *out,
|
| 912 |
+
NPY_DATETIMEUNIT *out_bestunit, int apply_tzinfo) except -1
|
| 913 |
+
int convert_datetime64_to_datetimestruct "NpyDatetime_ConvertDatetime64ToDatetimeStruct" (
|
| 914 |
+
PyArray_DatetimeMetaData *meta, npy_datetime dt,
|
| 915 |
+
npy_datetimestruct *out) except -1
|
| 916 |
+
int convert_datetimestruct_to_datetime64 "NpyDatetime_ConvertDatetimeStructToDatetime64"(
|
| 917 |
+
PyArray_DatetimeMetaData *meta, const npy_datetimestruct *dts,
|
| 918 |
+
npy_datetime *out) except -1
|
| 919 |
+
|
| 920 |
+
|
| 921 |
+
#
|
| 922 |
+
# ufunc API
|
| 923 |
+
#
|
| 924 |
+
|
| 925 |
+
cdef extern from "numpy/ufuncobject.h":
|
| 926 |
+
|
| 927 |
+
ctypedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *, void *)
|
| 928 |
+
|
| 929 |
+
ctypedef struct PyUFuncObject_fields:
|
| 930 |
+
int nin, nout, nargs
|
| 931 |
+
int identity
|
| 932 |
+
PyUFuncGenericFunction *functions
|
| 933 |
+
void **data
|
| 934 |
+
int ntypes
|
| 935 |
+
int check_return
|
| 936 |
+
char *name
|
| 937 |
+
char *types
|
| 938 |
+
char *doc
|
| 939 |
+
void *ptr
|
| 940 |
+
PyObject *obj
|
| 941 |
+
PyObject *userloops
|
| 942 |
+
|
| 943 |
+
ctypedef struct PyUFuncObject:
|
| 944 |
+
pass
|
| 945 |
+
|
| 946 |
+
ctypedef class numpy.ufunc [object PyUFuncObject, check_size ignore]:
|
| 947 |
+
@property
|
| 948 |
+
cdef inline int nin(self) noexcept nogil:
|
| 949 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).nin
|
| 950 |
+
|
| 951 |
+
@property
|
| 952 |
+
cdef inline int nout(self) noexcept nogil:
|
| 953 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).nout
|
| 954 |
+
|
| 955 |
+
@property
|
| 956 |
+
cdef inline int nargs(self) noexcept nogil:
|
| 957 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).nargs
|
| 958 |
+
|
| 959 |
+
@property
|
| 960 |
+
cdef inline PyUFuncGenericFunction* functions(self) noexcept nogil:
|
| 961 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).functions
|
| 962 |
+
|
| 963 |
+
@property
|
| 964 |
+
cdef inline void ** data(self) noexcept nogil:
|
| 965 |
+
return <void **>_PyUFuncObject_GET_ITEM_DATA(self).data
|
| 966 |
+
|
| 967 |
+
@property
|
| 968 |
+
cdef inline int ntypes(self) noexcept nogil:
|
| 969 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).ntypes
|
| 970 |
+
|
| 971 |
+
@property
|
| 972 |
+
cdef inline const char* name(self) noexcept nogil:
|
| 973 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).name
|
| 974 |
+
|
| 975 |
+
@property
|
| 976 |
+
cdef inline const char* doc(self) noexcept nogil:
|
| 977 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).doc
|
| 978 |
+
|
| 979 |
+
@property
|
| 980 |
+
cdef inline void* ptr(self) noexcept nogil:
|
| 981 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).ptr
|
| 982 |
+
|
| 983 |
+
@property
|
| 984 |
+
cdef inline PyObject* obj(self) noexcept nogil:
|
| 985 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).obj
|
| 986 |
+
|
| 987 |
+
@property
|
| 988 |
+
cdef inline PyObject* userloops(self) noexcept nogil:
|
| 989 |
+
return _PyUFuncObject_GET_ITEM_DATA(self).userloops
|
| 990 |
+
|
| 991 |
+
PyUFuncObject_fields *_PyUFuncObject_GET_ITEM_DATA(ufunc) nogil
|
| 992 |
+
|
| 993 |
+
cdef enum:
|
| 994 |
+
PyUFunc_Zero
|
| 995 |
+
PyUFunc_One
|
| 996 |
+
PyUFunc_None
|
| 997 |
+
# deprecated
|
| 998 |
+
UFUNC_FPE_DIVIDEBYZERO
|
| 999 |
+
UFUNC_FPE_OVERFLOW
|
| 1000 |
+
UFUNC_FPE_UNDERFLOW
|
| 1001 |
+
UFUNC_FPE_INVALID
|
| 1002 |
+
# use these instead
|
| 1003 |
+
NPY_FPE_DIVIDEBYZERO
|
| 1004 |
+
NPY_FPE_OVERFLOW
|
| 1005 |
+
NPY_FPE_UNDERFLOW
|
| 1006 |
+
NPY_FPE_INVALID
|
| 1007 |
+
|
| 1008 |
+
|
| 1009 |
+
object PyUFunc_FromFuncAndData(PyUFuncGenericFunction *,
|
| 1010 |
+
void **, char *, int, int, int, int, char *, char *, int)
|
| 1011 |
+
int PyUFunc_RegisterLoopForType(ufunc, int,
|
| 1012 |
+
PyUFuncGenericFunction, int *, void *) except -1
|
| 1013 |
+
void PyUFunc_f_f_As_d_d \
|
| 1014 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1015 |
+
void PyUFunc_d_d \
|
| 1016 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1017 |
+
void PyUFunc_f_f \
|
| 1018 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1019 |
+
void PyUFunc_g_g \
|
| 1020 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1021 |
+
void PyUFunc_F_F_As_D_D \
|
| 1022 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1023 |
+
void PyUFunc_F_F \
|
| 1024 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1025 |
+
void PyUFunc_D_D \
|
| 1026 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1027 |
+
void PyUFunc_G_G \
|
| 1028 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1029 |
+
void PyUFunc_O_O \
|
| 1030 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1031 |
+
void PyUFunc_ff_f_As_dd_d \
|
| 1032 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1033 |
+
void PyUFunc_ff_f \
|
| 1034 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1035 |
+
void PyUFunc_dd_d \
|
| 1036 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1037 |
+
void PyUFunc_gg_g \
|
| 1038 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1039 |
+
void PyUFunc_FF_F_As_DD_D \
|
| 1040 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1041 |
+
void PyUFunc_DD_D \
|
| 1042 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1043 |
+
void PyUFunc_FF_F \
|
| 1044 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1045 |
+
void PyUFunc_GG_G \
|
| 1046 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1047 |
+
void PyUFunc_OO_O \
|
| 1048 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1049 |
+
void PyUFunc_O_O_method \
|
| 1050 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1051 |
+
void PyUFunc_OO_O_method \
|
| 1052 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1053 |
+
void PyUFunc_On_Om \
|
| 1054 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 1055 |
+
void PyUFunc_clearfperr()
|
| 1056 |
+
int PyUFunc_getfperr()
|
| 1057 |
+
int PyUFunc_ReplaceLoopBySignature \
|
| 1058 |
+
(ufunc, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)
|
| 1059 |
+
object PyUFunc_FromFuncAndDataAndSignature \
|
| 1060 |
+
(PyUFuncGenericFunction *, void **, char *, int, int, int,
|
| 1061 |
+
int, char *, char *, int, char *)
|
| 1062 |
+
|
| 1063 |
+
int _import_umath() except -1
|
| 1064 |
+
|
| 1065 |
+
cdef inline void set_array_base(ndarray arr, object base) except *:
|
| 1066 |
+
Py_INCREF(base) # important to do this before stealing the reference below!
|
| 1067 |
+
PyArray_SetBaseObject(arr, base)
|
| 1068 |
+
|
| 1069 |
+
cdef inline object get_array_base(ndarray arr):
|
| 1070 |
+
base = PyArray_BASE(arr)
|
| 1071 |
+
if base is NULL:
|
| 1072 |
+
return None
|
| 1073 |
+
return <object>base
|
| 1074 |
+
|
| 1075 |
+
# Versions of the import_* functions which are more suitable for
|
| 1076 |
+
# Cython code.
|
| 1077 |
+
cdef inline int import_array() except -1:
|
| 1078 |
+
try:
|
| 1079 |
+
__pyx_import_array()
|
| 1080 |
+
except Exception:
|
| 1081 |
+
raise ImportError("numpy._core.multiarray failed to import")
|
| 1082 |
+
|
| 1083 |
+
cdef inline int import_umath() except -1:
|
| 1084 |
+
try:
|
| 1085 |
+
_import_umath()
|
| 1086 |
+
except Exception:
|
| 1087 |
+
raise ImportError("numpy._core.umath failed to import")
|
| 1088 |
+
|
| 1089 |
+
cdef inline int import_ufunc() except -1:
|
| 1090 |
+
try:
|
| 1091 |
+
_import_umath()
|
| 1092 |
+
except Exception:
|
| 1093 |
+
raise ImportError("numpy._core.umath failed to import")
|
| 1094 |
+
|
| 1095 |
+
|
| 1096 |
+
cdef inline bint is_timedelta64_object(object obj) noexcept:
|
| 1097 |
+
"""
|
| 1098 |
+
Cython equivalent of `isinstance(obj, np.timedelta64)`
|
| 1099 |
+
|
| 1100 |
+
Parameters
|
| 1101 |
+
----------
|
| 1102 |
+
obj : object
|
| 1103 |
+
|
| 1104 |
+
Returns
|
| 1105 |
+
-------
|
| 1106 |
+
bool
|
| 1107 |
+
"""
|
| 1108 |
+
return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)
|
| 1109 |
+
|
| 1110 |
+
|
| 1111 |
+
cdef inline bint is_datetime64_object(object obj) noexcept:
|
| 1112 |
+
"""
|
| 1113 |
+
Cython equivalent of `isinstance(obj, np.datetime64)`
|
| 1114 |
+
|
| 1115 |
+
Parameters
|
| 1116 |
+
----------
|
| 1117 |
+
obj : object
|
| 1118 |
+
|
| 1119 |
+
Returns
|
| 1120 |
+
-------
|
| 1121 |
+
bool
|
| 1122 |
+
"""
|
| 1123 |
+
return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)
|
| 1124 |
+
|
| 1125 |
+
|
| 1126 |
+
cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:
|
| 1127 |
+
"""
|
| 1128 |
+
returns the int64 value underlying scalar numpy datetime64 object
|
| 1129 |
+
|
| 1130 |
+
Note that to interpret this as a datetime, the corresponding unit is
|
| 1131 |
+
also needed. That can be found using `get_datetime64_unit`.
|
| 1132 |
+
"""
|
| 1133 |
+
return _PyDatetimeScalarObject_GetValue(obj)
|
| 1134 |
+
|
| 1135 |
+
|
| 1136 |
+
cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:
|
| 1137 |
+
"""
|
| 1138 |
+
returns the int64 value underlying scalar numpy timedelta64 object
|
| 1139 |
+
"""
|
| 1140 |
+
return _PyTimedeltaScalarObject_GetValue(obj)
|
| 1141 |
+
|
| 1142 |
+
|
| 1143 |
+
cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:
|
| 1144 |
+
"""
|
| 1145 |
+
returns the unit part of the dtype for a numpy datetime64 object.
|
| 1146 |
+
"""
|
| 1147 |
+
return _PyDatetimeScalarObject_GetMetadata(obj).base
|
| 1148 |
+
|
| 1149 |
+
|
| 1150 |
+
cdef extern from "numpy/arrayobject.h":
|
| 1151 |
+
|
| 1152 |
+
ctypedef struct NpyIter:
|
| 1153 |
+
pass
|
| 1154 |
+
|
| 1155 |
+
cdef enum:
|
| 1156 |
+
NPY_FAIL
|
| 1157 |
+
NPY_SUCCEED
|
| 1158 |
+
|
| 1159 |
+
cdef enum:
|
| 1160 |
+
# Track an index representing C order
|
| 1161 |
+
NPY_ITER_C_INDEX
|
| 1162 |
+
# Track an index representing Fortran order
|
| 1163 |
+
NPY_ITER_F_INDEX
|
| 1164 |
+
# Track a multi-index
|
| 1165 |
+
NPY_ITER_MULTI_INDEX
|
| 1166 |
+
# User code external to the iterator does the 1-dimensional innermost loop
|
| 1167 |
+
NPY_ITER_EXTERNAL_LOOP
|
| 1168 |
+
# Convert all the operands to a common data type
|
| 1169 |
+
NPY_ITER_COMMON_DTYPE
|
| 1170 |
+
# Operands may hold references, requiring API access during iteration
|
| 1171 |
+
NPY_ITER_REFS_OK
|
| 1172 |
+
# Zero-sized operands should be permitted, iteration checks IterSize for 0
|
| 1173 |
+
NPY_ITER_ZEROSIZE_OK
|
| 1174 |
+
# Permits reductions (size-0 stride with dimension size > 1)
|
| 1175 |
+
NPY_ITER_REDUCE_OK
|
| 1176 |
+
# Enables sub-range iteration
|
| 1177 |
+
NPY_ITER_RANGED
|
| 1178 |
+
# Enables buffering
|
| 1179 |
+
NPY_ITER_BUFFERED
|
| 1180 |
+
# When buffering is enabled, grows the inner loop if possible
|
| 1181 |
+
NPY_ITER_GROWINNER
|
| 1182 |
+
# Delay allocation of buffers until first Reset* call
|
| 1183 |
+
NPY_ITER_DELAY_BUFALLOC
|
| 1184 |
+
# When NPY_KEEPORDER is specified, disable reversing negative-stride axes
|
| 1185 |
+
NPY_ITER_DONT_NEGATE_STRIDES
|
| 1186 |
+
NPY_ITER_COPY_IF_OVERLAP
|
| 1187 |
+
# The operand will be read from and written to
|
| 1188 |
+
NPY_ITER_READWRITE
|
| 1189 |
+
# The operand will only be read from
|
| 1190 |
+
NPY_ITER_READONLY
|
| 1191 |
+
# The operand will only be written to
|
| 1192 |
+
NPY_ITER_WRITEONLY
|
| 1193 |
+
# The operand's data must be in native byte order
|
| 1194 |
+
NPY_ITER_NBO
|
| 1195 |
+
# The operand's data must be aligned
|
| 1196 |
+
NPY_ITER_ALIGNED
|
| 1197 |
+
# The operand's data must be contiguous (within the inner loop)
|
| 1198 |
+
NPY_ITER_CONTIG
|
| 1199 |
+
# The operand may be copied to satisfy requirements
|
| 1200 |
+
NPY_ITER_COPY
|
| 1201 |
+
# The operand may be copied with WRITEBACKIFCOPY to satisfy requirements
|
| 1202 |
+
NPY_ITER_UPDATEIFCOPY
|
| 1203 |
+
# Allocate the operand if it is NULL
|
| 1204 |
+
NPY_ITER_ALLOCATE
|
| 1205 |
+
# If an operand is allocated, don't use any subtype
|
| 1206 |
+
NPY_ITER_NO_SUBTYPE
|
| 1207 |
+
# This is a virtual array slot, operand is NULL but temporary data is there
|
| 1208 |
+
NPY_ITER_VIRTUAL
|
| 1209 |
+
# Require that the dimension match the iterator dimensions exactly
|
| 1210 |
+
NPY_ITER_NO_BROADCAST
|
| 1211 |
+
# A mask is being used on this array, affects buffer -> array copy
|
| 1212 |
+
NPY_ITER_WRITEMASKED
|
| 1213 |
+
# This array is the mask for all WRITEMASKED operands
|
| 1214 |
+
NPY_ITER_ARRAYMASK
|
| 1215 |
+
# Assume iterator order data access for COPY_IF_OVERLAP
|
| 1216 |
+
NPY_ITER_OVERLAP_ASSUME_ELEMENTWISE
|
| 1217 |
+
|
| 1218 |
+
# construction and destruction functions
|
| 1219 |
+
NpyIter* NpyIter_New(ndarray arr, npy_uint32 flags, NPY_ORDER order,
|
| 1220 |
+
NPY_CASTING casting, dtype datatype) except NULL
|
| 1221 |
+
NpyIter* NpyIter_MultiNew(npy_intp nop, PyArrayObject** op, npy_uint32 flags,
|
| 1222 |
+
NPY_ORDER order, NPY_CASTING casting, npy_uint32*
|
| 1223 |
+
op_flags, PyArray_Descr** op_dtypes) except NULL
|
| 1224 |
+
NpyIter* NpyIter_AdvancedNew(npy_intp nop, PyArrayObject** op,
|
| 1225 |
+
npy_uint32 flags, NPY_ORDER order,
|
| 1226 |
+
NPY_CASTING casting, npy_uint32* op_flags,
|
| 1227 |
+
PyArray_Descr** op_dtypes, int oa_ndim,
|
| 1228 |
+
int** op_axes, const npy_intp* itershape,
|
| 1229 |
+
npy_intp buffersize) except NULL
|
| 1230 |
+
NpyIter* NpyIter_Copy(NpyIter* it) except NULL
|
| 1231 |
+
int NpyIter_RemoveAxis(NpyIter* it, int axis) except NPY_FAIL
|
| 1232 |
+
int NpyIter_RemoveMultiIndex(NpyIter* it) except NPY_FAIL
|
| 1233 |
+
int NpyIter_EnableExternalLoop(NpyIter* it) except NPY_FAIL
|
| 1234 |
+
int NpyIter_Deallocate(NpyIter* it) except NPY_FAIL
|
| 1235 |
+
int NpyIter_Reset(NpyIter* it, char** errmsg) except NPY_FAIL
|
| 1236 |
+
int NpyIter_ResetToIterIndexRange(NpyIter* it, npy_intp istart,
|
| 1237 |
+
npy_intp iend, char** errmsg) except NPY_FAIL
|
| 1238 |
+
int NpyIter_ResetBasePointers(NpyIter* it, char** baseptrs, char** errmsg) except NPY_FAIL
|
| 1239 |
+
int NpyIter_GotoMultiIndex(NpyIter* it, const npy_intp* multi_index) except NPY_FAIL
|
| 1240 |
+
int NpyIter_GotoIndex(NpyIter* it, npy_intp index) except NPY_FAIL
|
| 1241 |
+
npy_intp NpyIter_GetIterSize(NpyIter* it) nogil
|
| 1242 |
+
npy_intp NpyIter_GetIterIndex(NpyIter* it) nogil
|
| 1243 |
+
void NpyIter_GetIterIndexRange(NpyIter* it, npy_intp* istart,
|
| 1244 |
+
npy_intp* iend) nogil
|
| 1245 |
+
int NpyIter_GotoIterIndex(NpyIter* it, npy_intp iterindex) except NPY_FAIL
|
| 1246 |
+
npy_bool NpyIter_HasDelayedBufAlloc(NpyIter* it) nogil
|
| 1247 |
+
npy_bool NpyIter_HasExternalLoop(NpyIter* it) nogil
|
| 1248 |
+
npy_bool NpyIter_HasMultiIndex(NpyIter* it) nogil
|
| 1249 |
+
npy_bool NpyIter_HasIndex(NpyIter* it) nogil
|
| 1250 |
+
npy_bool NpyIter_RequiresBuffering(NpyIter* it) nogil
|
| 1251 |
+
npy_bool NpyIter_IsBuffered(NpyIter* it) nogil
|
| 1252 |
+
npy_bool NpyIter_IsGrowInner(NpyIter* it) nogil
|
| 1253 |
+
npy_intp NpyIter_GetBufferSize(NpyIter* it) nogil
|
| 1254 |
+
int NpyIter_GetNDim(NpyIter* it) nogil
|
| 1255 |
+
int NpyIter_GetNOp(NpyIter* it) nogil
|
| 1256 |
+
npy_intp* NpyIter_GetAxisStrideArray(NpyIter* it, int axis) except NULL
|
| 1257 |
+
int NpyIter_GetShape(NpyIter* it, npy_intp* outshape) nogil
|
| 1258 |
+
PyArray_Descr** NpyIter_GetDescrArray(NpyIter* it)
|
| 1259 |
+
PyArrayObject** NpyIter_GetOperandArray(NpyIter* it)
|
| 1260 |
+
ndarray NpyIter_GetIterView(NpyIter* it, npy_intp i)
|
| 1261 |
+
void NpyIter_GetReadFlags(NpyIter* it, char* outreadflags)
|
| 1262 |
+
void NpyIter_GetWriteFlags(NpyIter* it, char* outwriteflags)
|
| 1263 |
+
int NpyIter_CreateCompatibleStrides(NpyIter* it, npy_intp itemsize,
|
| 1264 |
+
npy_intp* outstrides) except NPY_FAIL
|
| 1265 |
+
npy_bool NpyIter_IsFirstVisit(NpyIter* it, int iop) nogil
|
| 1266 |
+
# functions for iterating an NpyIter object
|
| 1267 |
+
#
|
| 1268 |
+
# These don't match the definition in the C API because Cython can't wrap
|
| 1269 |
+
# function pointers that return functions.
|
| 1270 |
+
NpyIter_IterNextFunc NpyIter_GetIterNext(NpyIter* it, char** errmsg) except NULL
|
| 1271 |
+
NpyIter_GetMultiIndexFunc NpyIter_GetGetMultiIndex(NpyIter* it,
|
| 1272 |
+
char** errmsg) except NULL
|
| 1273 |
+
char** NpyIter_GetDataPtrArray(NpyIter* it) nogil
|
| 1274 |
+
char** NpyIter_GetInitialDataPtrArray(NpyIter* it) nogil
|
| 1275 |
+
npy_intp* NpyIter_GetIndexPtr(NpyIter* it)
|
| 1276 |
+
npy_intp* NpyIter_GetInnerStrideArray(NpyIter* it) nogil
|
| 1277 |
+
npy_intp* NpyIter_GetInnerLoopSizePtr(NpyIter* it) nogil
|
| 1278 |
+
void NpyIter_GetInnerFixedStrideArray(NpyIter* it, npy_intp* outstrides) nogil
|
| 1279 |
+
npy_bool NpyIter_IterationNeedsAPI(NpyIter* it) nogil
|
| 1280 |
+
void NpyIter_DebugPrint(NpyIter* it)
|
| 1281 |
+
|
| 1282 |
+
# NpyString API
|
| 1283 |
+
cdef extern from "numpy/ndarraytypes.h":
|
| 1284 |
+
ctypedef struct npy_string_allocator:
|
| 1285 |
+
pass
|
| 1286 |
+
|
| 1287 |
+
ctypedef struct npy_packed_static_string:
|
| 1288 |
+
pass
|
| 1289 |
+
|
| 1290 |
+
ctypedef struct npy_static_string:
|
| 1291 |
+
size_t size
|
| 1292 |
+
const char *buf
|
| 1293 |
+
|
| 1294 |
+
ctypedef struct PyArray_StringDTypeObject:
|
| 1295 |
+
PyArray_Descr base
|
| 1296 |
+
PyObject *na_object
|
| 1297 |
+
char coerce
|
| 1298 |
+
char has_nan_na
|
| 1299 |
+
char has_string_na
|
| 1300 |
+
char array_owned
|
| 1301 |
+
npy_static_string default_string
|
| 1302 |
+
npy_static_string na_name
|
| 1303 |
+
npy_string_allocator *allocator
|
| 1304 |
+
|
| 1305 |
+
cdef extern from "numpy/arrayobject.h":
|
| 1306 |
+
npy_string_allocator *NpyString_acquire_allocator(const PyArray_StringDTypeObject *descr)
|
| 1307 |
+
void NpyString_acquire_allocators(size_t n_descriptors, PyArray_Descr *const descrs[], npy_string_allocator *allocators[])
|
| 1308 |
+
void NpyString_release_allocator(npy_string_allocator *allocator)
|
| 1309 |
+
void NpyString_release_allocators(size_t length, npy_string_allocator *allocators[])
|
| 1310 |
+
int NpyString_load(npy_string_allocator *allocator, const npy_packed_static_string *packed_string, npy_static_string *unpacked_string)
|
| 1311 |
+
int NpyString_pack_null(npy_string_allocator *allocator, npy_packed_static_string *packed_string)
|
| 1312 |
+
int NpyString_pack(npy_string_allocator *allocator, npy_packed_static_string *packed_string, const char *buf, size_t size)
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.pxd
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NumPy static imports for Cython < 3.0
|
| 2 |
+
#
|
| 3 |
+
# DO NOT USE OR REFER TO THIS HEADER
|
| 4 |
+
#
|
| 5 |
+
# This is provided only to generate an error message on older Cython
|
| 6 |
+
# versions.
|
| 7 |
+
#
|
| 8 |
+
# See __init__.cython-30.pxd for the real Cython header
|
| 9 |
+
#
|
| 10 |
+
|
| 11 |
+
# intentionally created compiler error that only triggers on Cython < 3.0.0
|
| 12 |
+
DEF err = int('Build aborted: the NumPy Cython headers require Cython 3.0.0 or newer.')
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.py
ADDED
|
@@ -0,0 +1,926 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
NumPy
|
| 3 |
+
=====
|
| 4 |
+
|
| 5 |
+
Provides
|
| 6 |
+
1. An array object of arbitrary homogeneous items
|
| 7 |
+
2. Fast mathematical operations over arrays
|
| 8 |
+
3. Linear Algebra, Fourier Transforms, Random Number Generation
|
| 9 |
+
|
| 10 |
+
How to use the documentation
|
| 11 |
+
----------------------------
|
| 12 |
+
Documentation is available in two forms: docstrings provided
|
| 13 |
+
with the code, and a loose standing reference guide, available from
|
| 14 |
+
`the NumPy homepage <https://numpy.org>`_.
|
| 15 |
+
|
| 16 |
+
We recommend exploring the docstrings using
|
| 17 |
+
`IPython <https://ipython.org>`_, an advanced Python shell with
|
| 18 |
+
TAB-completion and introspection capabilities. See below for further
|
| 19 |
+
instructions.
|
| 20 |
+
|
| 21 |
+
The docstring examples assume that `numpy` has been imported as ``np``::
|
| 22 |
+
|
| 23 |
+
>>> import numpy as np
|
| 24 |
+
|
| 25 |
+
Code snippets are indicated by three greater-than signs::
|
| 26 |
+
|
| 27 |
+
>>> x = 42
|
| 28 |
+
>>> x = x + 1
|
| 29 |
+
|
| 30 |
+
Use the built-in ``help`` function to view a function's docstring::
|
| 31 |
+
|
| 32 |
+
>>> help(np.sort)
|
| 33 |
+
... # doctest: +SKIP
|
| 34 |
+
|
| 35 |
+
For some objects, ``np.info(obj)`` may provide additional help. This is
|
| 36 |
+
particularly true if you see the line "Help on ufunc object:" at the top
|
| 37 |
+
of the help() page. Ufuncs are implemented in C, not Python, for speed.
|
| 38 |
+
The native Python help() does not know how to view their help, but our
|
| 39 |
+
np.info() function does.
|
| 40 |
+
|
| 41 |
+
Available subpackages
|
| 42 |
+
---------------------
|
| 43 |
+
lib
|
| 44 |
+
Basic functions used by several sub-packages.
|
| 45 |
+
random
|
| 46 |
+
Core Random Tools
|
| 47 |
+
linalg
|
| 48 |
+
Core Linear Algebra Tools
|
| 49 |
+
fft
|
| 50 |
+
Core FFT routines
|
| 51 |
+
polynomial
|
| 52 |
+
Polynomial tools
|
| 53 |
+
testing
|
| 54 |
+
NumPy testing tools
|
| 55 |
+
|
| 56 |
+
Utilities
|
| 57 |
+
---------
|
| 58 |
+
test
|
| 59 |
+
Run numpy unittests
|
| 60 |
+
show_config
|
| 61 |
+
Show numpy build configuration
|
| 62 |
+
__version__
|
| 63 |
+
NumPy version string
|
| 64 |
+
|
| 65 |
+
Viewing documentation using IPython
|
| 66 |
+
-----------------------------------
|
| 67 |
+
|
| 68 |
+
Start IPython and import `numpy` usually under the alias ``np``: `import
|
| 69 |
+
numpy as np`. Then, directly past or use the ``%cpaste`` magic to paste
|
| 70 |
+
examples into the shell. To see which functions are available in `numpy`,
|
| 71 |
+
type ``np.<TAB>`` (where ``<TAB>`` refers to the TAB key), or use
|
| 72 |
+
``np.*cos*?<ENTER>`` (where ``<ENTER>`` refers to the ENTER key) to narrow
|
| 73 |
+
down the list. To view the docstring for a function, use
|
| 74 |
+
``np.cos?<ENTER>`` (to view the docstring) and ``np.cos??<ENTER>`` (to view
|
| 75 |
+
the source code).
|
| 76 |
+
|
| 77 |
+
Copies vs. in-place operation
|
| 78 |
+
-----------------------------
|
| 79 |
+
Most of the functions in `numpy` return a copy of the array argument
|
| 80 |
+
(e.g., `np.sort`). In-place versions of these functions are often
|
| 81 |
+
available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``.
|
| 82 |
+
Exceptions to this rule are documented.
|
| 83 |
+
|
| 84 |
+
"""
|
| 85 |
+
import os
|
| 86 |
+
import sys
|
| 87 |
+
import warnings
|
| 88 |
+
|
| 89 |
+
# If a version with git hash was stored, use that instead
|
| 90 |
+
from . import version
|
| 91 |
+
from ._expired_attrs_2_0 import __expired_attributes__
|
| 92 |
+
from ._globals import _CopyMode, _NoValue
|
| 93 |
+
from .version import __version__
|
| 94 |
+
|
| 95 |
+
# We first need to detect if we're being called as part of the numpy setup
|
| 96 |
+
# procedure itself in a reliable manner.
|
| 97 |
+
try:
|
| 98 |
+
__NUMPY_SETUP__ # noqa: B018
|
| 99 |
+
except NameError:
|
| 100 |
+
__NUMPY_SETUP__ = False
|
| 101 |
+
|
| 102 |
+
if __NUMPY_SETUP__:
|
| 103 |
+
sys.stderr.write('Running from numpy source directory.\n')
|
| 104 |
+
else:
|
| 105 |
+
# Allow distributors to run custom init code before importing numpy._core
|
| 106 |
+
from . import _distributor_init
|
| 107 |
+
|
| 108 |
+
try:
|
| 109 |
+
from numpy.__config__ import show_config
|
| 110 |
+
except ImportError as e:
|
| 111 |
+
if isinstance(e, ModuleNotFoundError) and e.name == "numpy.__config__":
|
| 112 |
+
# The __config__ module itself was not found, so add this info:
|
| 113 |
+
msg = """Error importing numpy: you should not try to import numpy from
|
| 114 |
+
its source directory; please exit the numpy source tree, and relaunch
|
| 115 |
+
your python interpreter from there."""
|
| 116 |
+
raise ImportError(msg) from e
|
| 117 |
+
raise
|
| 118 |
+
|
| 119 |
+
from . import _core
|
| 120 |
+
from ._core import (
|
| 121 |
+
False_,
|
| 122 |
+
ScalarType,
|
| 123 |
+
True_,
|
| 124 |
+
abs,
|
| 125 |
+
absolute,
|
| 126 |
+
acos,
|
| 127 |
+
acosh,
|
| 128 |
+
add,
|
| 129 |
+
all,
|
| 130 |
+
allclose,
|
| 131 |
+
amax,
|
| 132 |
+
amin,
|
| 133 |
+
any,
|
| 134 |
+
arange,
|
| 135 |
+
arccos,
|
| 136 |
+
arccosh,
|
| 137 |
+
arcsin,
|
| 138 |
+
arcsinh,
|
| 139 |
+
arctan,
|
| 140 |
+
arctan2,
|
| 141 |
+
arctanh,
|
| 142 |
+
argmax,
|
| 143 |
+
argmin,
|
| 144 |
+
argpartition,
|
| 145 |
+
argsort,
|
| 146 |
+
argwhere,
|
| 147 |
+
around,
|
| 148 |
+
array,
|
| 149 |
+
array2string,
|
| 150 |
+
array_equal,
|
| 151 |
+
array_equiv,
|
| 152 |
+
array_repr,
|
| 153 |
+
array_str,
|
| 154 |
+
asanyarray,
|
| 155 |
+
asarray,
|
| 156 |
+
ascontiguousarray,
|
| 157 |
+
asfortranarray,
|
| 158 |
+
asin,
|
| 159 |
+
asinh,
|
| 160 |
+
astype,
|
| 161 |
+
atan,
|
| 162 |
+
atan2,
|
| 163 |
+
atanh,
|
| 164 |
+
atleast_1d,
|
| 165 |
+
atleast_2d,
|
| 166 |
+
atleast_3d,
|
| 167 |
+
base_repr,
|
| 168 |
+
binary_repr,
|
| 169 |
+
bitwise_and,
|
| 170 |
+
bitwise_count,
|
| 171 |
+
bitwise_invert,
|
| 172 |
+
bitwise_left_shift,
|
| 173 |
+
bitwise_not,
|
| 174 |
+
bitwise_or,
|
| 175 |
+
bitwise_right_shift,
|
| 176 |
+
bitwise_xor,
|
| 177 |
+
block,
|
| 178 |
+
bool,
|
| 179 |
+
bool_,
|
| 180 |
+
broadcast,
|
| 181 |
+
busday_count,
|
| 182 |
+
busday_offset,
|
| 183 |
+
busdaycalendar,
|
| 184 |
+
byte,
|
| 185 |
+
bytes_,
|
| 186 |
+
can_cast,
|
| 187 |
+
cbrt,
|
| 188 |
+
cdouble,
|
| 189 |
+
ceil,
|
| 190 |
+
character,
|
| 191 |
+
choose,
|
| 192 |
+
clip,
|
| 193 |
+
clongdouble,
|
| 194 |
+
complex64,
|
| 195 |
+
complex128,
|
| 196 |
+
complexfloating,
|
| 197 |
+
compress,
|
| 198 |
+
concat,
|
| 199 |
+
concatenate,
|
| 200 |
+
conj,
|
| 201 |
+
conjugate,
|
| 202 |
+
convolve,
|
| 203 |
+
copysign,
|
| 204 |
+
copyto,
|
| 205 |
+
correlate,
|
| 206 |
+
cos,
|
| 207 |
+
cosh,
|
| 208 |
+
count_nonzero,
|
| 209 |
+
cross,
|
| 210 |
+
csingle,
|
| 211 |
+
cumprod,
|
| 212 |
+
cumsum,
|
| 213 |
+
cumulative_prod,
|
| 214 |
+
cumulative_sum,
|
| 215 |
+
datetime64,
|
| 216 |
+
datetime_as_string,
|
| 217 |
+
datetime_data,
|
| 218 |
+
deg2rad,
|
| 219 |
+
degrees,
|
| 220 |
+
diagonal,
|
| 221 |
+
divide,
|
| 222 |
+
divmod,
|
| 223 |
+
dot,
|
| 224 |
+
double,
|
| 225 |
+
dtype,
|
| 226 |
+
e,
|
| 227 |
+
einsum,
|
| 228 |
+
einsum_path,
|
| 229 |
+
empty,
|
| 230 |
+
empty_like,
|
| 231 |
+
equal,
|
| 232 |
+
errstate,
|
| 233 |
+
euler_gamma,
|
| 234 |
+
exp,
|
| 235 |
+
exp2,
|
| 236 |
+
expm1,
|
| 237 |
+
fabs,
|
| 238 |
+
finfo,
|
| 239 |
+
flatiter,
|
| 240 |
+
flatnonzero,
|
| 241 |
+
flexible,
|
| 242 |
+
float16,
|
| 243 |
+
float32,
|
| 244 |
+
float64,
|
| 245 |
+
float_power,
|
| 246 |
+
floating,
|
| 247 |
+
floor,
|
| 248 |
+
floor_divide,
|
| 249 |
+
fmax,
|
| 250 |
+
fmin,
|
| 251 |
+
fmod,
|
| 252 |
+
format_float_positional,
|
| 253 |
+
format_float_scientific,
|
| 254 |
+
frexp,
|
| 255 |
+
from_dlpack,
|
| 256 |
+
frombuffer,
|
| 257 |
+
fromfile,
|
| 258 |
+
fromfunction,
|
| 259 |
+
fromiter,
|
| 260 |
+
frompyfunc,
|
| 261 |
+
fromstring,
|
| 262 |
+
full,
|
| 263 |
+
full_like,
|
| 264 |
+
gcd,
|
| 265 |
+
generic,
|
| 266 |
+
geomspace,
|
| 267 |
+
get_printoptions,
|
| 268 |
+
getbufsize,
|
| 269 |
+
geterr,
|
| 270 |
+
geterrcall,
|
| 271 |
+
greater,
|
| 272 |
+
greater_equal,
|
| 273 |
+
half,
|
| 274 |
+
heaviside,
|
| 275 |
+
hstack,
|
| 276 |
+
hypot,
|
| 277 |
+
identity,
|
| 278 |
+
iinfo,
|
| 279 |
+
indices,
|
| 280 |
+
inexact,
|
| 281 |
+
inf,
|
| 282 |
+
inner,
|
| 283 |
+
int8,
|
| 284 |
+
int16,
|
| 285 |
+
int32,
|
| 286 |
+
int64,
|
| 287 |
+
int_,
|
| 288 |
+
intc,
|
| 289 |
+
integer,
|
| 290 |
+
intp,
|
| 291 |
+
invert,
|
| 292 |
+
is_busday,
|
| 293 |
+
isclose,
|
| 294 |
+
isdtype,
|
| 295 |
+
isfinite,
|
| 296 |
+
isfortran,
|
| 297 |
+
isinf,
|
| 298 |
+
isnan,
|
| 299 |
+
isnat,
|
| 300 |
+
isscalar,
|
| 301 |
+
issubdtype,
|
| 302 |
+
lcm,
|
| 303 |
+
ldexp,
|
| 304 |
+
left_shift,
|
| 305 |
+
less,
|
| 306 |
+
less_equal,
|
| 307 |
+
lexsort,
|
| 308 |
+
linspace,
|
| 309 |
+
little_endian,
|
| 310 |
+
log,
|
| 311 |
+
log1p,
|
| 312 |
+
log2,
|
| 313 |
+
log10,
|
| 314 |
+
logaddexp,
|
| 315 |
+
logaddexp2,
|
| 316 |
+
logical_and,
|
| 317 |
+
logical_not,
|
| 318 |
+
logical_or,
|
| 319 |
+
logical_xor,
|
| 320 |
+
logspace,
|
| 321 |
+
long,
|
| 322 |
+
longdouble,
|
| 323 |
+
longlong,
|
| 324 |
+
matmul,
|
| 325 |
+
matrix_transpose,
|
| 326 |
+
matvec,
|
| 327 |
+
max,
|
| 328 |
+
maximum,
|
| 329 |
+
may_share_memory,
|
| 330 |
+
mean,
|
| 331 |
+
memmap,
|
| 332 |
+
min,
|
| 333 |
+
min_scalar_type,
|
| 334 |
+
minimum,
|
| 335 |
+
mod,
|
| 336 |
+
modf,
|
| 337 |
+
moveaxis,
|
| 338 |
+
multiply,
|
| 339 |
+
nan,
|
| 340 |
+
ndarray,
|
| 341 |
+
ndim,
|
| 342 |
+
nditer,
|
| 343 |
+
negative,
|
| 344 |
+
nested_iters,
|
| 345 |
+
newaxis,
|
| 346 |
+
nextafter,
|
| 347 |
+
nonzero,
|
| 348 |
+
not_equal,
|
| 349 |
+
number,
|
| 350 |
+
object_,
|
| 351 |
+
ones,
|
| 352 |
+
ones_like,
|
| 353 |
+
outer,
|
| 354 |
+
partition,
|
| 355 |
+
permute_dims,
|
| 356 |
+
pi,
|
| 357 |
+
positive,
|
| 358 |
+
pow,
|
| 359 |
+
power,
|
| 360 |
+
printoptions,
|
| 361 |
+
prod,
|
| 362 |
+
promote_types,
|
| 363 |
+
ptp,
|
| 364 |
+
put,
|
| 365 |
+
putmask,
|
| 366 |
+
rad2deg,
|
| 367 |
+
radians,
|
| 368 |
+
ravel,
|
| 369 |
+
recarray,
|
| 370 |
+
reciprocal,
|
| 371 |
+
record,
|
| 372 |
+
remainder,
|
| 373 |
+
repeat,
|
| 374 |
+
require,
|
| 375 |
+
reshape,
|
| 376 |
+
resize,
|
| 377 |
+
result_type,
|
| 378 |
+
right_shift,
|
| 379 |
+
rint,
|
| 380 |
+
roll,
|
| 381 |
+
rollaxis,
|
| 382 |
+
round,
|
| 383 |
+
sctypeDict,
|
| 384 |
+
searchsorted,
|
| 385 |
+
set_printoptions,
|
| 386 |
+
setbufsize,
|
| 387 |
+
seterr,
|
| 388 |
+
seterrcall,
|
| 389 |
+
shape,
|
| 390 |
+
shares_memory,
|
| 391 |
+
short,
|
| 392 |
+
sign,
|
| 393 |
+
signbit,
|
| 394 |
+
signedinteger,
|
| 395 |
+
sin,
|
| 396 |
+
single,
|
| 397 |
+
sinh,
|
| 398 |
+
size,
|
| 399 |
+
sort,
|
| 400 |
+
spacing,
|
| 401 |
+
sqrt,
|
| 402 |
+
square,
|
| 403 |
+
squeeze,
|
| 404 |
+
stack,
|
| 405 |
+
std,
|
| 406 |
+
str_,
|
| 407 |
+
subtract,
|
| 408 |
+
sum,
|
| 409 |
+
swapaxes,
|
| 410 |
+
take,
|
| 411 |
+
tan,
|
| 412 |
+
tanh,
|
| 413 |
+
tensordot,
|
| 414 |
+
timedelta64,
|
| 415 |
+
trace,
|
| 416 |
+
transpose,
|
| 417 |
+
true_divide,
|
| 418 |
+
trunc,
|
| 419 |
+
typecodes,
|
| 420 |
+
ubyte,
|
| 421 |
+
ufunc,
|
| 422 |
+
uint,
|
| 423 |
+
uint8,
|
| 424 |
+
uint16,
|
| 425 |
+
uint32,
|
| 426 |
+
uint64,
|
| 427 |
+
uintc,
|
| 428 |
+
uintp,
|
| 429 |
+
ulong,
|
| 430 |
+
ulonglong,
|
| 431 |
+
unsignedinteger,
|
| 432 |
+
unstack,
|
| 433 |
+
ushort,
|
| 434 |
+
var,
|
| 435 |
+
vdot,
|
| 436 |
+
vecdot,
|
| 437 |
+
vecmat,
|
| 438 |
+
void,
|
| 439 |
+
vstack,
|
| 440 |
+
where,
|
| 441 |
+
zeros,
|
| 442 |
+
zeros_like,
|
| 443 |
+
)
|
| 444 |
+
|
| 445 |
+
# NOTE: It's still under discussion whether these aliases
|
| 446 |
+
# should be removed.
|
| 447 |
+
for ta in ["float96", "float128", "complex192", "complex256"]:
|
| 448 |
+
try:
|
| 449 |
+
globals()[ta] = getattr(_core, ta)
|
| 450 |
+
except AttributeError:
|
| 451 |
+
pass
|
| 452 |
+
del ta
|
| 453 |
+
|
| 454 |
+
from . import lib, matrixlib as _mat
|
| 455 |
+
from .lib import scimath as emath
|
| 456 |
+
from .lib._arraypad_impl import pad
|
| 457 |
+
from .lib._arraysetops_impl import (
|
| 458 |
+
ediff1d,
|
| 459 |
+
intersect1d,
|
| 460 |
+
isin,
|
| 461 |
+
setdiff1d,
|
| 462 |
+
setxor1d,
|
| 463 |
+
union1d,
|
| 464 |
+
unique,
|
| 465 |
+
unique_all,
|
| 466 |
+
unique_counts,
|
| 467 |
+
unique_inverse,
|
| 468 |
+
unique_values,
|
| 469 |
+
)
|
| 470 |
+
from .lib._function_base_impl import (
|
| 471 |
+
angle,
|
| 472 |
+
append,
|
| 473 |
+
asarray_chkfinite,
|
| 474 |
+
average,
|
| 475 |
+
bartlett,
|
| 476 |
+
bincount,
|
| 477 |
+
blackman,
|
| 478 |
+
copy,
|
| 479 |
+
corrcoef,
|
| 480 |
+
cov,
|
| 481 |
+
delete,
|
| 482 |
+
diff,
|
| 483 |
+
digitize,
|
| 484 |
+
extract,
|
| 485 |
+
flip,
|
| 486 |
+
gradient,
|
| 487 |
+
hamming,
|
| 488 |
+
hanning,
|
| 489 |
+
i0,
|
| 490 |
+
insert,
|
| 491 |
+
interp,
|
| 492 |
+
iterable,
|
| 493 |
+
kaiser,
|
| 494 |
+
median,
|
| 495 |
+
meshgrid,
|
| 496 |
+
percentile,
|
| 497 |
+
piecewise,
|
| 498 |
+
place,
|
| 499 |
+
quantile,
|
| 500 |
+
rot90,
|
| 501 |
+
select,
|
| 502 |
+
sinc,
|
| 503 |
+
sort_complex,
|
| 504 |
+
trapezoid,
|
| 505 |
+
trim_zeros,
|
| 506 |
+
unwrap,
|
| 507 |
+
vectorize,
|
| 508 |
+
)
|
| 509 |
+
from .lib._histograms_impl import histogram, histogram_bin_edges, histogramdd
|
| 510 |
+
from .lib._index_tricks_impl import (
|
| 511 |
+
c_,
|
| 512 |
+
diag_indices,
|
| 513 |
+
diag_indices_from,
|
| 514 |
+
fill_diagonal,
|
| 515 |
+
index_exp,
|
| 516 |
+
ix_,
|
| 517 |
+
mgrid,
|
| 518 |
+
ndenumerate,
|
| 519 |
+
ndindex,
|
| 520 |
+
ogrid,
|
| 521 |
+
r_,
|
| 522 |
+
ravel_multi_index,
|
| 523 |
+
s_,
|
| 524 |
+
unravel_index,
|
| 525 |
+
)
|
| 526 |
+
from .lib._nanfunctions_impl import (
|
| 527 |
+
nanargmax,
|
| 528 |
+
nanargmin,
|
| 529 |
+
nancumprod,
|
| 530 |
+
nancumsum,
|
| 531 |
+
nanmax,
|
| 532 |
+
nanmean,
|
| 533 |
+
nanmedian,
|
| 534 |
+
nanmin,
|
| 535 |
+
nanpercentile,
|
| 536 |
+
nanprod,
|
| 537 |
+
nanquantile,
|
| 538 |
+
nanstd,
|
| 539 |
+
nansum,
|
| 540 |
+
nanvar,
|
| 541 |
+
)
|
| 542 |
+
from .lib._npyio_impl import (
|
| 543 |
+
fromregex,
|
| 544 |
+
genfromtxt,
|
| 545 |
+
load,
|
| 546 |
+
loadtxt,
|
| 547 |
+
packbits,
|
| 548 |
+
save,
|
| 549 |
+
savetxt,
|
| 550 |
+
savez,
|
| 551 |
+
savez_compressed,
|
| 552 |
+
unpackbits,
|
| 553 |
+
)
|
| 554 |
+
from .lib._polynomial_impl import (
|
| 555 |
+
poly,
|
| 556 |
+
poly1d,
|
| 557 |
+
polyadd,
|
| 558 |
+
polyder,
|
| 559 |
+
polydiv,
|
| 560 |
+
polyfit,
|
| 561 |
+
polyint,
|
| 562 |
+
polymul,
|
| 563 |
+
polysub,
|
| 564 |
+
polyval,
|
| 565 |
+
roots,
|
| 566 |
+
)
|
| 567 |
+
from .lib._shape_base_impl import (
|
| 568 |
+
apply_along_axis,
|
| 569 |
+
apply_over_axes,
|
| 570 |
+
array_split,
|
| 571 |
+
column_stack,
|
| 572 |
+
dsplit,
|
| 573 |
+
dstack,
|
| 574 |
+
expand_dims,
|
| 575 |
+
hsplit,
|
| 576 |
+
kron,
|
| 577 |
+
put_along_axis,
|
| 578 |
+
split,
|
| 579 |
+
take_along_axis,
|
| 580 |
+
tile,
|
| 581 |
+
vsplit,
|
| 582 |
+
)
|
| 583 |
+
from .lib._stride_tricks_impl import (
|
| 584 |
+
broadcast_arrays,
|
| 585 |
+
broadcast_shapes,
|
| 586 |
+
broadcast_to,
|
| 587 |
+
)
|
| 588 |
+
from .lib._twodim_base_impl import (
|
| 589 |
+
diag,
|
| 590 |
+
diagflat,
|
| 591 |
+
eye,
|
| 592 |
+
fliplr,
|
| 593 |
+
flipud,
|
| 594 |
+
histogram2d,
|
| 595 |
+
mask_indices,
|
| 596 |
+
tri,
|
| 597 |
+
tril,
|
| 598 |
+
tril_indices,
|
| 599 |
+
tril_indices_from,
|
| 600 |
+
triu,
|
| 601 |
+
triu_indices,
|
| 602 |
+
triu_indices_from,
|
| 603 |
+
vander,
|
| 604 |
+
)
|
| 605 |
+
from .lib._type_check_impl import (
|
| 606 |
+
common_type,
|
| 607 |
+
imag,
|
| 608 |
+
iscomplex,
|
| 609 |
+
iscomplexobj,
|
| 610 |
+
isreal,
|
| 611 |
+
isrealobj,
|
| 612 |
+
mintypecode,
|
| 613 |
+
nan_to_num,
|
| 614 |
+
real,
|
| 615 |
+
real_if_close,
|
| 616 |
+
typename,
|
| 617 |
+
)
|
| 618 |
+
from .lib._ufunclike_impl import fix, isneginf, isposinf
|
| 619 |
+
from .lib._utils_impl import get_include, info, show_runtime
|
| 620 |
+
from .matrixlib import asmatrix, bmat, matrix
|
| 621 |
+
|
| 622 |
+
# public submodules are imported lazily, therefore are accessible from
|
| 623 |
+
# __getattr__. Note that `array_api`
|
| 624 |
+
# (experimental label) is not added here, because `from numpy import *`
|
| 625 |
+
# must not raise any warnings - that's too disruptive.
|
| 626 |
+
__numpy_submodules__ = {
|
| 627 |
+
"linalg", "fft", "dtypes", "random", "polynomial", "ma",
|
| 628 |
+
"exceptions", "lib", "ctypeslib", "testing", "typing",
|
| 629 |
+
"f2py", "test", "rec", "char", "core", "strings",
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
# We build warning messages for former attributes
|
| 633 |
+
_msg = (
|
| 634 |
+
"module 'numpy' has no attribute '{n}'.\n"
|
| 635 |
+
"`np.{n}` was a deprecated alias for the builtin `{n}`. "
|
| 636 |
+
"To avoid this error in existing code, use `{n}` by itself. "
|
| 637 |
+
"Doing this will not modify any behavior and is safe. {extended_msg}\n"
|
| 638 |
+
"The aliases was originally deprecated in NumPy 1.20; for more "
|
| 639 |
+
"details and guidance see the original release note at:\n"
|
| 640 |
+
" https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations")
|
| 641 |
+
|
| 642 |
+
_specific_msg = (
|
| 643 |
+
"If you specifically wanted the numpy scalar type, use `np.{}` here.")
|
| 644 |
+
|
| 645 |
+
_int_extended_msg = (
|
| 646 |
+
"When replacing `np.{}`, you may wish to use e.g. `np.int64` "
|
| 647 |
+
"or `np.int32` to specify the precision. If you wish to review "
|
| 648 |
+
"your current use, check the release note link for "
|
| 649 |
+
"additional information.")
|
| 650 |
+
|
| 651 |
+
_type_info = [
|
| 652 |
+
("object", ""), # The NumPy scalar only exists by name.
|
| 653 |
+
("float", _specific_msg.format("float64")),
|
| 654 |
+
("complex", _specific_msg.format("complex128")),
|
| 655 |
+
("str", _specific_msg.format("str_")),
|
| 656 |
+
("int", _int_extended_msg.format("int"))]
|
| 657 |
+
|
| 658 |
+
__former_attrs__ = {
|
| 659 |
+
n: _msg.format(n=n, extended_msg=extended_msg)
|
| 660 |
+
for n, extended_msg in _type_info
|
| 661 |
+
}
|
| 662 |
+
|
| 663 |
+
# Some of these could be defined right away, but most were aliases to
|
| 664 |
+
# the Python objects and only removed in NumPy 1.24. Defining them should
|
| 665 |
+
# probably wait for NumPy 1.26 or 2.0.
|
| 666 |
+
# When defined, these should possibly not be added to `__all__` to avoid
|
| 667 |
+
# import with `from numpy import *`.
|
| 668 |
+
__future_scalars__ = {"str", "bytes", "object"}
|
| 669 |
+
|
| 670 |
+
__array_api_version__ = "2025.12"
|
| 671 |
+
|
| 672 |
+
from ._array_api_info import __array_namespace_info__
|
| 673 |
+
|
| 674 |
+
__all__ = list(
|
| 675 |
+
__numpy_submodules__ |
|
| 676 |
+
set(_core.__all__) |
|
| 677 |
+
set(_mat.__all__) |
|
| 678 |
+
set(lib._histograms_impl.__all__) |
|
| 679 |
+
set(lib._nanfunctions_impl.__all__) |
|
| 680 |
+
set(lib._function_base_impl.__all__) |
|
| 681 |
+
set(lib._twodim_base_impl.__all__) |
|
| 682 |
+
set(lib._shape_base_impl.__all__) |
|
| 683 |
+
set(lib._type_check_impl.__all__) |
|
| 684 |
+
set(lib._arraysetops_impl.__all__) |
|
| 685 |
+
set(lib._ufunclike_impl.__all__) |
|
| 686 |
+
set(lib._arraypad_impl.__all__) |
|
| 687 |
+
set(lib._utils_impl.__all__) |
|
| 688 |
+
set(lib._stride_tricks_impl.__all__) |
|
| 689 |
+
set(lib._polynomial_impl.__all__) |
|
| 690 |
+
set(lib._npyio_impl.__all__) |
|
| 691 |
+
set(lib._index_tricks_impl.__all__) |
|
| 692 |
+
{"emath", "show_config", "__version__", "__array_namespace_info__"}
|
| 693 |
+
)
|
| 694 |
+
|
| 695 |
+
# Filter out Cython harmless warnings
|
| 696 |
+
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
|
| 697 |
+
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
|
| 698 |
+
warnings.filterwarnings("ignore", message="numpy.ndarray size changed")
|
| 699 |
+
|
| 700 |
+
def __getattr__(attr):
|
| 701 |
+
# Warn for expired attributes
|
| 702 |
+
import warnings
|
| 703 |
+
|
| 704 |
+
if attr == "linalg":
|
| 705 |
+
import numpy.linalg as linalg
|
| 706 |
+
return linalg
|
| 707 |
+
elif attr == "fft":
|
| 708 |
+
import numpy.fft as fft
|
| 709 |
+
return fft
|
| 710 |
+
elif attr == "dtypes":
|
| 711 |
+
import numpy.dtypes as dtypes
|
| 712 |
+
return dtypes
|
| 713 |
+
elif attr == "random":
|
| 714 |
+
import numpy.random as random
|
| 715 |
+
return random
|
| 716 |
+
elif attr == "polynomial":
|
| 717 |
+
import numpy.polynomial as polynomial
|
| 718 |
+
return polynomial
|
| 719 |
+
elif attr == "ma":
|
| 720 |
+
import numpy.ma as ma
|
| 721 |
+
return ma
|
| 722 |
+
elif attr == "ctypeslib":
|
| 723 |
+
import numpy.ctypeslib as ctypeslib
|
| 724 |
+
return ctypeslib
|
| 725 |
+
elif attr == "exceptions":
|
| 726 |
+
import numpy.exceptions as exceptions
|
| 727 |
+
return exceptions
|
| 728 |
+
elif attr == "testing":
|
| 729 |
+
import numpy.testing as testing
|
| 730 |
+
return testing
|
| 731 |
+
elif attr == "matlib":
|
| 732 |
+
import numpy.matlib as matlib
|
| 733 |
+
return matlib
|
| 734 |
+
elif attr == "f2py":
|
| 735 |
+
import numpy.f2py as f2py
|
| 736 |
+
return f2py
|
| 737 |
+
elif attr == "typing":
|
| 738 |
+
import numpy.typing as typing
|
| 739 |
+
return typing
|
| 740 |
+
elif attr == "rec":
|
| 741 |
+
import numpy.rec as rec
|
| 742 |
+
return rec
|
| 743 |
+
elif attr == "char":
|
| 744 |
+
import numpy.char as char
|
| 745 |
+
return char
|
| 746 |
+
elif attr == "core":
|
| 747 |
+
import numpy.core as core
|
| 748 |
+
return core
|
| 749 |
+
elif attr == "strings":
|
| 750 |
+
import numpy.strings as strings
|
| 751 |
+
return strings
|
| 752 |
+
if attr in __future_scalars__:
|
| 753 |
+
# And future warnings for those that will change, but also give
|
| 754 |
+
# the AttributeError
|
| 755 |
+
warnings.warn(
|
| 756 |
+
f"In the future `np.{attr}` will be defined as the "
|
| 757 |
+
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
|
| 758 |
+
|
| 759 |
+
if attr in __former_attrs__:
|
| 760 |
+
raise AttributeError(__former_attrs__[attr], name=None)
|
| 761 |
+
|
| 762 |
+
if attr in __expired_attributes__:
|
| 763 |
+
raise AttributeError(
|
| 764 |
+
f"`np.{attr}` was removed in the NumPy 2.0 release. "
|
| 765 |
+
f"{__expired_attributes__[attr]}",
|
| 766 |
+
name=None
|
| 767 |
+
)
|
| 768 |
+
|
| 769 |
+
raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
|
| 770 |
+
|
| 771 |
+
def __dir__():
|
| 772 |
+
public_symbols = (
|
| 773 |
+
globals().keys() | __numpy_submodules__
|
| 774 |
+
)
|
| 775 |
+
public_symbols -= {
|
| 776 |
+
"matrixlib", "matlib", "tests", "conftest", "version",
|
| 777 |
+
"array_api"
|
| 778 |
+
}
|
| 779 |
+
return list(public_symbols)
|
| 780 |
+
|
| 781 |
+
# Pytest testing
|
| 782 |
+
from numpy._pytesttester import PytestTester
|
| 783 |
+
test = PytestTester(__name__)
|
| 784 |
+
del PytestTester
|
| 785 |
+
|
| 786 |
+
def _sanity_check():
|
| 787 |
+
"""
|
| 788 |
+
Quick sanity checks for common bugs caused by environment.
|
| 789 |
+
There are some cases e.g. with wrong BLAS ABI that cause wrong
|
| 790 |
+
results under specific runtime conditions that are not necessarily
|
| 791 |
+
achieved during test suite runs, and it is useful to catch those early.
|
| 792 |
+
|
| 793 |
+
See https://github.com/numpy/numpy/issues/8577 and other
|
| 794 |
+
similar bug reports.
|
| 795 |
+
|
| 796 |
+
"""
|
| 797 |
+
try:
|
| 798 |
+
x = ones(2, dtype=float32)
|
| 799 |
+
if not abs(x.dot(x) - float32(2.0)) < 1e-5:
|
| 800 |
+
raise AssertionError
|
| 801 |
+
except AssertionError:
|
| 802 |
+
msg = ("The current Numpy installation ({!r}) fails to "
|
| 803 |
+
"pass simple sanity checks. This can be caused for example "
|
| 804 |
+
"by incorrect BLAS library being linked in, or by mixing "
|
| 805 |
+
"package managers (pip, conda, apt, ...). Search closed "
|
| 806 |
+
"numpy issues for similar problems.")
|
| 807 |
+
raise RuntimeError(msg.format(__file__)) from None
|
| 808 |
+
|
| 809 |
+
_sanity_check()
|
| 810 |
+
del _sanity_check
|
| 811 |
+
|
| 812 |
+
def _mac_os_check():
|
| 813 |
+
"""
|
| 814 |
+
Quick Sanity check for Mac OS look for accelerate build bugs.
|
| 815 |
+
Testing numpy polyfit calls init_dgelsd(LAPACK)
|
| 816 |
+
"""
|
| 817 |
+
try:
|
| 818 |
+
c = array([3., 2., 1.])
|
| 819 |
+
x = linspace(0, 2, 5)
|
| 820 |
+
y = polyval(c, x)
|
| 821 |
+
_ = polyfit(x, y, 2, cov=True)
|
| 822 |
+
except ValueError:
|
| 823 |
+
pass
|
| 824 |
+
|
| 825 |
+
if sys.platform == "darwin":
|
| 826 |
+
from . import exceptions
|
| 827 |
+
with warnings.catch_warnings(record=True) as w:
|
| 828 |
+
_mac_os_check()
|
| 829 |
+
# Throw runtime error, if the test failed
|
| 830 |
+
# Check for warning and report the error_message
|
| 831 |
+
if len(w) > 0:
|
| 832 |
+
for _wn in w:
|
| 833 |
+
if _wn.category is exceptions.RankWarning:
|
| 834 |
+
# Ignore other warnings, they may not be relevant (see gh-25433)
|
| 835 |
+
error_message = (
|
| 836 |
+
f"{_wn.category.__name__}: {_wn.message}"
|
| 837 |
+
)
|
| 838 |
+
msg = (
|
| 839 |
+
"Polyfit sanity test emitted a warning, most likely due "
|
| 840 |
+
"to using a buggy Accelerate backend."
|
| 841 |
+
"\nIf you compiled yourself, more information is available at:" # noqa: E501
|
| 842 |
+
"\nhttps://numpy.org/devdocs/building/index.html"
|
| 843 |
+
"\nOtherwise report this to the vendor "
|
| 844 |
+
f"that provided NumPy.\n\n{error_message}\n")
|
| 845 |
+
raise RuntimeError(msg)
|
| 846 |
+
del _wn
|
| 847 |
+
del w
|
| 848 |
+
del _mac_os_check
|
| 849 |
+
|
| 850 |
+
def blas_fpe_check():
|
| 851 |
+
if sys.platform != "darwin":
|
| 852 |
+
# We currently assume this is limited to MacOS as downstream NumPy
|
| 853 |
+
# import during dlopen caused a deadlock regression: gh-31284
|
| 854 |
+
return
|
| 855 |
+
|
| 856 |
+
# Check if BLAS adds spurious FPEs, seen on M4 arms with Accelerate.
|
| 857 |
+
# In this case we disable FPE reporting since the use of SME poisons
|
| 858 |
+
# it and Accelerate doesn't sanitize them.
|
| 859 |
+
with errstate(all='raise'):
|
| 860 |
+
x = ones((20, 20))
|
| 861 |
+
try:
|
| 862 |
+
x @ x
|
| 863 |
+
except FloatingPointError:
|
| 864 |
+
res = _core._multiarray_umath._blas_supports_fpe(False)
|
| 865 |
+
if res: # res was not modified (hardcoded to True for now)
|
| 866 |
+
warnings.warn(
|
| 867 |
+
"Spurious warnings given by blas but suppression not "
|
| 868 |
+
"set up on this platform. Please open a NumPy issue.",
|
| 869 |
+
UserWarning, stacklevel=2)
|
| 870 |
+
|
| 871 |
+
blas_fpe_check()
|
| 872 |
+
del blas_fpe_check
|
| 873 |
+
|
| 874 |
+
def hugepage_setup():
|
| 875 |
+
"""
|
| 876 |
+
We usually use madvise hugepages support, but on some old kernels it
|
| 877 |
+
is slow and thus better avoided. Specifically kernel version 4.6
|
| 878 |
+
had a bug fix which probably fixed this:
|
| 879 |
+
https://github.com/torvalds/linux/commit/7cf91a98e607c2f935dbcc177d70011e95b8faff
|
| 880 |
+
"""
|
| 881 |
+
use_hugepage = os.environ.get("NUMPY_MADVISE_HUGEPAGE", None)
|
| 882 |
+
if sys.platform == "linux" and use_hugepage is None:
|
| 883 |
+
# If there is an issue with parsing the kernel version,
|
| 884 |
+
# set use_hugepage to 0. Usage of LooseVersion will handle
|
| 885 |
+
# the kernel version parsing better, but avoided since it
|
| 886 |
+
# will increase the import time.
|
| 887 |
+
# See: #16679 for related discussion.
|
| 888 |
+
try:
|
| 889 |
+
use_hugepage = 1
|
| 890 |
+
kernel_version = os.uname().release.split(".")[:2]
|
| 891 |
+
kernel_version = tuple(int(v) for v in kernel_version)
|
| 892 |
+
if kernel_version < (4, 6):
|
| 893 |
+
use_hugepage = 0
|
| 894 |
+
except ValueError:
|
| 895 |
+
use_hugepage = 0
|
| 896 |
+
elif use_hugepage is None:
|
| 897 |
+
# This is not Linux, so it should not matter, just enable anyway
|
| 898 |
+
use_hugepage = 1
|
| 899 |
+
else:
|
| 900 |
+
use_hugepage = int(use_hugepage)
|
| 901 |
+
return use_hugepage
|
| 902 |
+
|
| 903 |
+
# Note that this will currently only make a difference on Linux
|
| 904 |
+
_core.multiarray._set_madvise_hugepage(hugepage_setup())
|
| 905 |
+
del hugepage_setup
|
| 906 |
+
|
| 907 |
+
# Give a warning if NumPy is reloaded or imported on a sub-interpreter
|
| 908 |
+
# We do this from python, since the C-module may not be reloaded and
|
| 909 |
+
# it is tidier organized.
|
| 910 |
+
_core.multiarray._multiarray_umath._reload_guard()
|
| 911 |
+
|
| 912 |
+
# TODO: Remove the environment variable entirely now that it is "weak"
|
| 913 |
+
if (os.environ.get("NPY_PROMOTION_STATE", "weak") != "weak"):
|
| 914 |
+
warnings.warn(
|
| 915 |
+
"NPY_PROMOTION_STATE was a temporary feature for NumPy 2.0 "
|
| 916 |
+
"transition and is ignored after NumPy 2.2.",
|
| 917 |
+
UserWarning, stacklevel=2)
|
| 918 |
+
|
| 919 |
+
# Tell PyInstaller where to find hook-numpy.py
|
| 920 |
+
def _pyinstaller_hooks_dir():
|
| 921 |
+
from pathlib import Path
|
| 922 |
+
return [str(Path(__file__).with_name("_pyinstaller").resolve())]
|
| 923 |
+
|
| 924 |
+
|
| 925 |
+
# Remove symbols imported for internal use
|
| 926 |
+
del os, sys, warnings
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/__init__.pyi
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_array_api_info.py
ADDED
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Array API Inspection namespace
|
| 3 |
+
|
| 4 |
+
This is the namespace for inspection functions as defined by the array API
|
| 5 |
+
standard. See
|
| 6 |
+
https://data-apis.org/array-api/latest/API_specification/inspection.html for
|
| 7 |
+
more details.
|
| 8 |
+
|
| 9 |
+
"""
|
| 10 |
+
from numpy._core import (
|
| 11 |
+
bool,
|
| 12 |
+
complex64,
|
| 13 |
+
complex128,
|
| 14 |
+
dtype,
|
| 15 |
+
float32,
|
| 16 |
+
float64,
|
| 17 |
+
int8,
|
| 18 |
+
int16,
|
| 19 |
+
int32,
|
| 20 |
+
int64,
|
| 21 |
+
intp,
|
| 22 |
+
uint8,
|
| 23 |
+
uint16,
|
| 24 |
+
uint32,
|
| 25 |
+
uint64,
|
| 26 |
+
)
|
| 27 |
+
from numpy._utils import set_module
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
@set_module('numpy')
|
| 31 |
+
class __array_namespace_info__:
|
| 32 |
+
"""
|
| 33 |
+
Get the array API inspection namespace for NumPy.
|
| 34 |
+
|
| 35 |
+
The array API inspection namespace defines the following functions:
|
| 36 |
+
|
| 37 |
+
- capabilities()
|
| 38 |
+
- default_device()
|
| 39 |
+
- default_dtypes()
|
| 40 |
+
- dtypes()
|
| 41 |
+
- devices()
|
| 42 |
+
|
| 43 |
+
See
|
| 44 |
+
https://data-apis.org/array-api/latest/API_specification/inspection.html
|
| 45 |
+
for more details.
|
| 46 |
+
|
| 47 |
+
Returns
|
| 48 |
+
-------
|
| 49 |
+
info : ModuleType
|
| 50 |
+
The array API inspection namespace for NumPy.
|
| 51 |
+
|
| 52 |
+
Examples
|
| 53 |
+
--------
|
| 54 |
+
>>> info = np.__array_namespace_info__()
|
| 55 |
+
>>> info.default_dtypes()
|
| 56 |
+
{'real floating': numpy.float64,
|
| 57 |
+
'complex floating': numpy.complex128,
|
| 58 |
+
'integral': numpy.int64,
|
| 59 |
+
'indexing': numpy.int64}
|
| 60 |
+
|
| 61 |
+
"""
|
| 62 |
+
|
| 63 |
+
def capabilities(self):
|
| 64 |
+
"""
|
| 65 |
+
Return a dictionary of array API library capabilities.
|
| 66 |
+
|
| 67 |
+
The resulting dictionary has the following keys:
|
| 68 |
+
|
| 69 |
+
- **"boolean indexing"**: boolean indicating whether an array library
|
| 70 |
+
supports boolean indexing. Always ``True`` for NumPy.
|
| 71 |
+
|
| 72 |
+
- **"data-dependent shapes"**: boolean indicating whether an array
|
| 73 |
+
library supports data-dependent output shapes. Always ``True`` for
|
| 74 |
+
NumPy.
|
| 75 |
+
|
| 76 |
+
- **"max dimensions"**: integer indicating maximum number of supported
|
| 77 |
+
dimensions. Always ``64`` for NumPy.
|
| 78 |
+
|
| 79 |
+
See
|
| 80 |
+
https://data-apis.org/array-api/latest/API_specification/generated/array_api.info.capabilities.html
|
| 81 |
+
for more details.
|
| 82 |
+
|
| 83 |
+
See Also
|
| 84 |
+
--------
|
| 85 |
+
__array_namespace_info__.default_device,
|
| 86 |
+
__array_namespace_info__.default_dtypes,
|
| 87 |
+
__array_namespace_info__.dtypes,
|
| 88 |
+
__array_namespace_info__.devices
|
| 89 |
+
|
| 90 |
+
Returns
|
| 91 |
+
-------
|
| 92 |
+
capabilities : dict
|
| 93 |
+
A dictionary of array API library capabilities.
|
| 94 |
+
|
| 95 |
+
Examples
|
| 96 |
+
--------
|
| 97 |
+
>>> info = np.__array_namespace_info__()
|
| 98 |
+
>>> info.capabilities()
|
| 99 |
+
{'boolean indexing': True,
|
| 100 |
+
'data-dependent shapes': True,
|
| 101 |
+
'max dimensions': 64}
|
| 102 |
+
|
| 103 |
+
"""
|
| 104 |
+
return {
|
| 105 |
+
"boolean indexing": True,
|
| 106 |
+
"data-dependent shapes": True,
|
| 107 |
+
"max dimensions": 64,
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
def default_device(self):
|
| 111 |
+
"""
|
| 112 |
+
The default device used for new NumPy arrays.
|
| 113 |
+
|
| 114 |
+
For NumPy, this always returns ``'cpu'``.
|
| 115 |
+
|
| 116 |
+
See Also
|
| 117 |
+
--------
|
| 118 |
+
__array_namespace_info__.capabilities,
|
| 119 |
+
__array_namespace_info__.default_dtypes,
|
| 120 |
+
__array_namespace_info__.dtypes,
|
| 121 |
+
__array_namespace_info__.devices
|
| 122 |
+
|
| 123 |
+
Returns
|
| 124 |
+
-------
|
| 125 |
+
device : str
|
| 126 |
+
The default device used for new NumPy arrays.
|
| 127 |
+
|
| 128 |
+
Examples
|
| 129 |
+
--------
|
| 130 |
+
>>> info = np.__array_namespace_info__()
|
| 131 |
+
>>> info.default_device()
|
| 132 |
+
'cpu'
|
| 133 |
+
|
| 134 |
+
"""
|
| 135 |
+
return "cpu"
|
| 136 |
+
|
| 137 |
+
def default_dtypes(self, *, device=None):
|
| 138 |
+
"""
|
| 139 |
+
The default data types used for new NumPy arrays.
|
| 140 |
+
|
| 141 |
+
For NumPy, this always returns the following dictionary:
|
| 142 |
+
|
| 143 |
+
- **"real floating"**: ``numpy.float64``
|
| 144 |
+
- **"complex floating"**: ``numpy.complex128``
|
| 145 |
+
- **"integral"**: ``numpy.intp``
|
| 146 |
+
- **"indexing"**: ``numpy.intp``
|
| 147 |
+
|
| 148 |
+
Parameters
|
| 149 |
+
----------
|
| 150 |
+
device : str, optional
|
| 151 |
+
The device to get the default data types for. For NumPy, only
|
| 152 |
+
``'cpu'`` is allowed.
|
| 153 |
+
|
| 154 |
+
Returns
|
| 155 |
+
-------
|
| 156 |
+
dtypes : dict
|
| 157 |
+
A dictionary describing the default data types used for new NumPy
|
| 158 |
+
arrays.
|
| 159 |
+
|
| 160 |
+
See Also
|
| 161 |
+
--------
|
| 162 |
+
__array_namespace_info__.capabilities,
|
| 163 |
+
__array_namespace_info__.default_device,
|
| 164 |
+
__array_namespace_info__.dtypes,
|
| 165 |
+
__array_namespace_info__.devices
|
| 166 |
+
|
| 167 |
+
Examples
|
| 168 |
+
--------
|
| 169 |
+
>>> info = np.__array_namespace_info__()
|
| 170 |
+
>>> info.default_dtypes()
|
| 171 |
+
{'real floating': numpy.float64,
|
| 172 |
+
'complex floating': numpy.complex128,
|
| 173 |
+
'integral': numpy.int64,
|
| 174 |
+
'indexing': numpy.int64}
|
| 175 |
+
|
| 176 |
+
"""
|
| 177 |
+
if device not in ["cpu", None]:
|
| 178 |
+
raise ValueError(
|
| 179 |
+
'Device not understood. Only "cpu" is allowed, but received:'
|
| 180 |
+
f' {device}'
|
| 181 |
+
)
|
| 182 |
+
return {
|
| 183 |
+
"real floating": dtype(float64),
|
| 184 |
+
"complex floating": dtype(complex128),
|
| 185 |
+
"integral": dtype(intp),
|
| 186 |
+
"indexing": dtype(intp),
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
def dtypes(self, *, device=None, kind=None):
|
| 190 |
+
"""
|
| 191 |
+
The array API data types supported by NumPy.
|
| 192 |
+
|
| 193 |
+
Note that this function only returns data types that are defined by
|
| 194 |
+
the array API.
|
| 195 |
+
|
| 196 |
+
Parameters
|
| 197 |
+
----------
|
| 198 |
+
device : str, optional
|
| 199 |
+
The device to get the data types for. For NumPy, only ``'cpu'`` is
|
| 200 |
+
allowed.
|
| 201 |
+
kind : str or tuple of str, optional
|
| 202 |
+
The kind of data types to return. If ``None``, all data types are
|
| 203 |
+
returned. If a string, only data types of that kind are returned.
|
| 204 |
+
If a tuple, a dictionary containing the union of the given kinds
|
| 205 |
+
is returned. The following kinds are supported:
|
| 206 |
+
|
| 207 |
+
- ``'bool'``: boolean data types (i.e., ``bool``).
|
| 208 |
+
- ``'signed integer'``: signed integer data types (i.e., ``int8``,
|
| 209 |
+
``int16``, ``int32``, ``int64``).
|
| 210 |
+
- ``'unsigned integer'``: unsigned integer data types (i.e.,
|
| 211 |
+
``uint8``, ``uint16``, ``uint32``, ``uint64``).
|
| 212 |
+
- ``'integral'``: integer data types. Shorthand for ``('signed
|
| 213 |
+
integer', 'unsigned integer')``.
|
| 214 |
+
- ``'real floating'``: real-valued floating-point data types
|
| 215 |
+
(i.e., ``float32``, ``float64``).
|
| 216 |
+
- ``'complex floating'``: complex floating-point data types (i.e.,
|
| 217 |
+
``complex64``, ``complex128``).
|
| 218 |
+
- ``'numeric'``: numeric data types. Shorthand for ``('integral',
|
| 219 |
+
'real floating', 'complex floating')``.
|
| 220 |
+
|
| 221 |
+
Returns
|
| 222 |
+
-------
|
| 223 |
+
dtypes : dict
|
| 224 |
+
A dictionary mapping the names of data types to the corresponding
|
| 225 |
+
NumPy data types.
|
| 226 |
+
|
| 227 |
+
See Also
|
| 228 |
+
--------
|
| 229 |
+
__array_namespace_info__.capabilities,
|
| 230 |
+
__array_namespace_info__.default_device,
|
| 231 |
+
__array_namespace_info__.default_dtypes,
|
| 232 |
+
__array_namespace_info__.devices
|
| 233 |
+
|
| 234 |
+
Examples
|
| 235 |
+
--------
|
| 236 |
+
>>> info = np.__array_namespace_info__()
|
| 237 |
+
>>> info.dtypes(kind='signed integer')
|
| 238 |
+
{'int8': numpy.int8,
|
| 239 |
+
'int16': numpy.int16,
|
| 240 |
+
'int32': numpy.int32,
|
| 241 |
+
'int64': numpy.int64}
|
| 242 |
+
|
| 243 |
+
"""
|
| 244 |
+
if device not in ["cpu", None]:
|
| 245 |
+
raise ValueError(
|
| 246 |
+
'Device not understood. Only "cpu" is allowed, but received:'
|
| 247 |
+
f' {device}'
|
| 248 |
+
)
|
| 249 |
+
if kind is None:
|
| 250 |
+
return {
|
| 251 |
+
"bool": dtype(bool),
|
| 252 |
+
"int8": dtype(int8),
|
| 253 |
+
"int16": dtype(int16),
|
| 254 |
+
"int32": dtype(int32),
|
| 255 |
+
"int64": dtype(int64),
|
| 256 |
+
"uint8": dtype(uint8),
|
| 257 |
+
"uint16": dtype(uint16),
|
| 258 |
+
"uint32": dtype(uint32),
|
| 259 |
+
"uint64": dtype(uint64),
|
| 260 |
+
"float32": dtype(float32),
|
| 261 |
+
"float64": dtype(float64),
|
| 262 |
+
"complex64": dtype(complex64),
|
| 263 |
+
"complex128": dtype(complex128),
|
| 264 |
+
}
|
| 265 |
+
if kind == "bool":
|
| 266 |
+
return {"bool": bool}
|
| 267 |
+
if kind == "signed integer":
|
| 268 |
+
return {
|
| 269 |
+
"int8": dtype(int8),
|
| 270 |
+
"int16": dtype(int16),
|
| 271 |
+
"int32": dtype(int32),
|
| 272 |
+
"int64": dtype(int64),
|
| 273 |
+
}
|
| 274 |
+
if kind == "unsigned integer":
|
| 275 |
+
return {
|
| 276 |
+
"uint8": dtype(uint8),
|
| 277 |
+
"uint16": dtype(uint16),
|
| 278 |
+
"uint32": dtype(uint32),
|
| 279 |
+
"uint64": dtype(uint64),
|
| 280 |
+
}
|
| 281 |
+
if kind == "integral":
|
| 282 |
+
return {
|
| 283 |
+
"int8": dtype(int8),
|
| 284 |
+
"int16": dtype(int16),
|
| 285 |
+
"int32": dtype(int32),
|
| 286 |
+
"int64": dtype(int64),
|
| 287 |
+
"uint8": dtype(uint8),
|
| 288 |
+
"uint16": dtype(uint16),
|
| 289 |
+
"uint32": dtype(uint32),
|
| 290 |
+
"uint64": dtype(uint64),
|
| 291 |
+
}
|
| 292 |
+
if kind == "real floating":
|
| 293 |
+
return {
|
| 294 |
+
"float32": dtype(float32),
|
| 295 |
+
"float64": dtype(float64),
|
| 296 |
+
}
|
| 297 |
+
if kind == "complex floating":
|
| 298 |
+
return {
|
| 299 |
+
"complex64": dtype(complex64),
|
| 300 |
+
"complex128": dtype(complex128),
|
| 301 |
+
}
|
| 302 |
+
if kind == "numeric":
|
| 303 |
+
return {
|
| 304 |
+
"int8": dtype(int8),
|
| 305 |
+
"int16": dtype(int16),
|
| 306 |
+
"int32": dtype(int32),
|
| 307 |
+
"int64": dtype(int64),
|
| 308 |
+
"uint8": dtype(uint8),
|
| 309 |
+
"uint16": dtype(uint16),
|
| 310 |
+
"uint32": dtype(uint32),
|
| 311 |
+
"uint64": dtype(uint64),
|
| 312 |
+
"float32": dtype(float32),
|
| 313 |
+
"float64": dtype(float64),
|
| 314 |
+
"complex64": dtype(complex64),
|
| 315 |
+
"complex128": dtype(complex128),
|
| 316 |
+
}
|
| 317 |
+
if isinstance(kind, tuple):
|
| 318 |
+
res = {}
|
| 319 |
+
for k in kind:
|
| 320 |
+
res.update(self.dtypes(kind=k))
|
| 321 |
+
return res
|
| 322 |
+
raise ValueError(f"unsupported kind: {kind!r}")
|
| 323 |
+
|
| 324 |
+
def devices(self):
|
| 325 |
+
"""
|
| 326 |
+
The devices supported by NumPy.
|
| 327 |
+
|
| 328 |
+
For NumPy, this always returns ``('cpu',)``.
|
| 329 |
+
|
| 330 |
+
Returns
|
| 331 |
+
-------
|
| 332 |
+
devices : list of str
|
| 333 |
+
The devices supported by NumPy.
|
| 334 |
+
|
| 335 |
+
See Also
|
| 336 |
+
--------
|
| 337 |
+
__array_namespace_info__.capabilities,
|
| 338 |
+
__array_namespace_info__.default_device,
|
| 339 |
+
__array_namespace_info__.default_dtypes,
|
| 340 |
+
__array_namespace_info__.dtypes
|
| 341 |
+
|
| 342 |
+
Examples
|
| 343 |
+
--------
|
| 344 |
+
>>> info = np.__array_namespace_info__()
|
| 345 |
+
>>> info.devices()
|
| 346 |
+
('cpu',)
|
| 347 |
+
|
| 348 |
+
"""
|
| 349 |
+
return ("cpu",)
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_array_api_info.pyi
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal, Never, TypedDict, final, overload, type_check_only
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
type _Device = Literal["cpu"]
|
| 6 |
+
type _DeviceLike = _Device | None
|
| 7 |
+
|
| 8 |
+
_Capabilities = TypedDict(
|
| 9 |
+
"_Capabilities",
|
| 10 |
+
{
|
| 11 |
+
"boolean indexing": Literal[True],
|
| 12 |
+
"data-dependent shapes": Literal[True],
|
| 13 |
+
"max dimensions": Literal[64],
|
| 14 |
+
},
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
_DefaultDTypes = TypedDict(
|
| 18 |
+
"_DefaultDTypes",
|
| 19 |
+
{
|
| 20 |
+
"real floating": np.dtype[np.float64],
|
| 21 |
+
"complex floating": np.dtype[np.complex128],
|
| 22 |
+
"integral": np.dtype[np.intp],
|
| 23 |
+
"indexing": np.dtype[np.intp],
|
| 24 |
+
},
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
type _KindBool = Literal["bool"]
|
| 28 |
+
type _KindInt = Literal["signed integer"]
|
| 29 |
+
type _KindUInt = Literal["unsigned integer"]
|
| 30 |
+
type _KindInteger = Literal["integral"]
|
| 31 |
+
type _KindFloat = Literal["real floating"]
|
| 32 |
+
type _KindComplex = Literal["complex floating"]
|
| 33 |
+
type _KindNumber = Literal["numeric"]
|
| 34 |
+
type _Kind = _KindBool | _KindInt | _KindUInt | _KindInteger | _KindFloat | _KindComplex | _KindNumber
|
| 35 |
+
|
| 36 |
+
type _Permute1[T1] = T1 | tuple[T1]
|
| 37 |
+
type _Permute2[T1, T2] = tuple[T1, T2] | tuple[T2, T1]
|
| 38 |
+
type _Permute3[T1, T2, T3] = (
|
| 39 |
+
tuple[T1, T2, T3] | tuple[T1, T3, T2]
|
| 40 |
+
| tuple[T2, T1, T3] | tuple[T2, T3, T1]
|
| 41 |
+
| tuple[T3, T1, T2] | tuple[T3, T2, T1]
|
| 42 |
+
) # fmt: skip
|
| 43 |
+
|
| 44 |
+
@type_check_only
|
| 45 |
+
class _DTypesBool(TypedDict):
|
| 46 |
+
bool: np.dtype[np.bool]
|
| 47 |
+
|
| 48 |
+
@type_check_only
|
| 49 |
+
class _DTypesInt(TypedDict):
|
| 50 |
+
int8: np.dtype[np.int8]
|
| 51 |
+
int16: np.dtype[np.int16]
|
| 52 |
+
int32: np.dtype[np.int32]
|
| 53 |
+
int64: np.dtype[np.int64]
|
| 54 |
+
|
| 55 |
+
@type_check_only
|
| 56 |
+
class _DTypesUInt(TypedDict):
|
| 57 |
+
uint8: np.dtype[np.uint8]
|
| 58 |
+
uint16: np.dtype[np.uint16]
|
| 59 |
+
uint32: np.dtype[np.uint32]
|
| 60 |
+
uint64: np.dtype[np.uint64]
|
| 61 |
+
|
| 62 |
+
@type_check_only
|
| 63 |
+
class _DTypesInteger(_DTypesInt, _DTypesUInt): ...
|
| 64 |
+
|
| 65 |
+
@type_check_only
|
| 66 |
+
class _DTypesFloat(TypedDict):
|
| 67 |
+
float32: np.dtype[np.float32]
|
| 68 |
+
float64: np.dtype[np.float64]
|
| 69 |
+
|
| 70 |
+
@type_check_only
|
| 71 |
+
class _DTypesComplex(TypedDict):
|
| 72 |
+
complex64: np.dtype[np.complex64]
|
| 73 |
+
complex128: np.dtype[np.complex128]
|
| 74 |
+
|
| 75 |
+
@type_check_only
|
| 76 |
+
class _DTypesNumber(_DTypesInteger, _DTypesFloat, _DTypesComplex): ...
|
| 77 |
+
|
| 78 |
+
@type_check_only
|
| 79 |
+
class _DTypes(_DTypesBool, _DTypesNumber): ...
|
| 80 |
+
|
| 81 |
+
@type_check_only
|
| 82 |
+
class _DTypesUnion(TypedDict, total=False):
|
| 83 |
+
bool: np.dtype[np.bool]
|
| 84 |
+
int8: np.dtype[np.int8]
|
| 85 |
+
int16: np.dtype[np.int16]
|
| 86 |
+
int32: np.dtype[np.int32]
|
| 87 |
+
int64: np.dtype[np.int64]
|
| 88 |
+
uint8: np.dtype[np.uint8]
|
| 89 |
+
uint16: np.dtype[np.uint16]
|
| 90 |
+
uint32: np.dtype[np.uint32]
|
| 91 |
+
uint64: np.dtype[np.uint64]
|
| 92 |
+
float32: np.dtype[np.float32]
|
| 93 |
+
float64: np.dtype[np.float64]
|
| 94 |
+
complex64: np.dtype[np.complex64]
|
| 95 |
+
complex128: np.dtype[np.complex128]
|
| 96 |
+
|
| 97 |
+
type _EmptyDict = dict[Never, Never]
|
| 98 |
+
|
| 99 |
+
@final
|
| 100 |
+
class __array_namespace_info__:
|
| 101 |
+
__module__: Literal["numpy"] = "numpy" # pyrefly: ignore[bad-override]
|
| 102 |
+
|
| 103 |
+
def capabilities(self) -> _Capabilities: ...
|
| 104 |
+
def default_device(self) -> _Device: ...
|
| 105 |
+
def default_dtypes(self, *, device: _DeviceLike = None) -> _DefaultDTypes: ...
|
| 106 |
+
def devices(self) -> list[_Device]: ...
|
| 107 |
+
|
| 108 |
+
@overload
|
| 109 |
+
def dtypes(
|
| 110 |
+
self,
|
| 111 |
+
*,
|
| 112 |
+
device: _DeviceLike = None,
|
| 113 |
+
kind: None = None,
|
| 114 |
+
) -> _DTypes: ...
|
| 115 |
+
@overload
|
| 116 |
+
def dtypes(
|
| 117 |
+
self,
|
| 118 |
+
*,
|
| 119 |
+
device: _DeviceLike = None,
|
| 120 |
+
kind: _Permute1[_KindBool],
|
| 121 |
+
) -> _DTypesBool: ...
|
| 122 |
+
@overload
|
| 123 |
+
def dtypes(
|
| 124 |
+
self,
|
| 125 |
+
*,
|
| 126 |
+
device: _DeviceLike = None,
|
| 127 |
+
kind: _Permute1[_KindInt],
|
| 128 |
+
) -> _DTypesInt: ...
|
| 129 |
+
@overload
|
| 130 |
+
def dtypes(
|
| 131 |
+
self,
|
| 132 |
+
*,
|
| 133 |
+
device: _DeviceLike = None,
|
| 134 |
+
kind: _Permute1[_KindUInt],
|
| 135 |
+
) -> _DTypesUInt: ...
|
| 136 |
+
@overload
|
| 137 |
+
def dtypes(
|
| 138 |
+
self,
|
| 139 |
+
*,
|
| 140 |
+
device: _DeviceLike = None,
|
| 141 |
+
kind: _Permute1[_KindFloat],
|
| 142 |
+
) -> _DTypesFloat: ...
|
| 143 |
+
@overload
|
| 144 |
+
def dtypes(
|
| 145 |
+
self,
|
| 146 |
+
*,
|
| 147 |
+
device: _DeviceLike = None,
|
| 148 |
+
kind: _Permute1[_KindComplex],
|
| 149 |
+
) -> _DTypesComplex: ...
|
| 150 |
+
@overload
|
| 151 |
+
def dtypes(
|
| 152 |
+
self,
|
| 153 |
+
*,
|
| 154 |
+
device: _DeviceLike = None,
|
| 155 |
+
kind: _Permute1[_KindInteger] | _Permute2[_KindInt, _KindUInt],
|
| 156 |
+
) -> _DTypesInteger: ...
|
| 157 |
+
@overload
|
| 158 |
+
def dtypes(
|
| 159 |
+
self,
|
| 160 |
+
*,
|
| 161 |
+
device: _DeviceLike = None,
|
| 162 |
+
kind: _Permute1[_KindNumber] | _Permute3[_KindInteger, _KindFloat, _KindComplex],
|
| 163 |
+
) -> _DTypesNumber: ...
|
| 164 |
+
@overload
|
| 165 |
+
def dtypes(
|
| 166 |
+
self,
|
| 167 |
+
*,
|
| 168 |
+
device: _DeviceLike = None,
|
| 169 |
+
kind: tuple[()],
|
| 170 |
+
) -> _EmptyDict: ...
|
| 171 |
+
@overload
|
| 172 |
+
def dtypes(
|
| 173 |
+
self,
|
| 174 |
+
*,
|
| 175 |
+
device: _DeviceLike = None,
|
| 176 |
+
kind: tuple[_Kind, ...],
|
| 177 |
+
) -> _DTypesUnion: ...
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_configtool.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
import sys
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
from .lib._utils_impl import get_include
|
| 6 |
+
from .version import __version__
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def main() -> None:
|
| 10 |
+
parser = argparse.ArgumentParser()
|
| 11 |
+
parser.add_argument(
|
| 12 |
+
"--version",
|
| 13 |
+
action="version",
|
| 14 |
+
version=__version__,
|
| 15 |
+
help="Print the version and exit.",
|
| 16 |
+
)
|
| 17 |
+
parser.add_argument(
|
| 18 |
+
"--cflags",
|
| 19 |
+
action="store_true",
|
| 20 |
+
help="Compile flag needed when using the NumPy headers.",
|
| 21 |
+
)
|
| 22 |
+
parser.add_argument(
|
| 23 |
+
"--pkgconfigdir",
|
| 24 |
+
action="store_true",
|
| 25 |
+
help=("Print the pkgconfig directory in which `numpy.pc` is stored "
|
| 26 |
+
"(useful for setting $PKG_CONFIG_PATH)."),
|
| 27 |
+
)
|
| 28 |
+
args = parser.parse_args()
|
| 29 |
+
if not sys.argv[1:]:
|
| 30 |
+
parser.print_help()
|
| 31 |
+
if args.cflags:
|
| 32 |
+
print("-I" + get_include())
|
| 33 |
+
if args.pkgconfigdir:
|
| 34 |
+
_path = Path(get_include()) / '..' / 'lib' / 'pkgconfig'
|
| 35 |
+
print(_path.resolve())
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if __name__ == "__main__":
|
| 39 |
+
main()
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_configtool.pyi
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
def main() -> None: ...
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_distributor_init.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
""" Distributor init file
|
| 2 |
+
|
| 3 |
+
Distributors: you can add custom code here to support particular distributions
|
| 4 |
+
of numpy.
|
| 5 |
+
|
| 6 |
+
For example, this is a good place to put any BLAS/LAPACK initialization code.
|
| 7 |
+
|
| 8 |
+
The numpy standard source distribution will not put code in this file, so you
|
| 9 |
+
can safely replace this file with your own version.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
try:
|
| 13 |
+
from . import _distributor_init_local # noqa: F401
|
| 14 |
+
except ImportError:
|
| 15 |
+
pass
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_distributor_init.pyi
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# intentionally left blank
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_expired_attrs_2_0.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Dict of expired attributes that are discontinued since 2.0 release.
|
| 3 |
+
Each item is associated with a migration note.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
__expired_attributes__ = {
|
| 7 |
+
"geterrobj": "Use the np.errstate context manager instead.",
|
| 8 |
+
"seterrobj": "Use the np.errstate context manager instead.",
|
| 9 |
+
"cast": "Use `np.asarray(arr, dtype=dtype)` instead.",
|
| 10 |
+
"source": "Use `inspect.getsource` instead.",
|
| 11 |
+
"lookfor": "Search NumPy's documentation directly.",
|
| 12 |
+
"who": "Use an IDE variable explorer or `locals()` instead.",
|
| 13 |
+
"fastCopyAndTranspose": "Use `arr.T.copy()` instead.",
|
| 14 |
+
"set_numeric_ops":
|
| 15 |
+
"For the general case, use `PyUFunc_ReplaceLoopBySignature`. "
|
| 16 |
+
"For ndarray subclasses, define the ``__array_ufunc__`` method "
|
| 17 |
+
"and override the relevant ufunc.",
|
| 18 |
+
"NINF": "Use `-np.inf` instead.",
|
| 19 |
+
"PINF": "Use `np.inf` instead.",
|
| 20 |
+
"NZERO": "Use `-0.0` instead.",
|
| 21 |
+
"PZERO": "Use `0.0` instead.",
|
| 22 |
+
"add_newdoc":
|
| 23 |
+
"It's still available as `np.lib.add_newdoc`.",
|
| 24 |
+
"add_docstring":
|
| 25 |
+
"It's still available as `np.lib.add_docstring`.",
|
| 26 |
+
"add_newdoc_ufunc":
|
| 27 |
+
"It's an internal function and doesn't have a replacement.",
|
| 28 |
+
"safe_eval": "Use `ast.literal_eval` instead.",
|
| 29 |
+
"float_": "Use `np.float64` instead.",
|
| 30 |
+
"complex_": "Use `np.complex128` instead.",
|
| 31 |
+
"longfloat": "Use `np.longdouble` instead.",
|
| 32 |
+
"singlecomplex": "Use `np.complex64` instead.",
|
| 33 |
+
"cfloat": "Use `np.complex128` instead.",
|
| 34 |
+
"longcomplex": "Use `np.clongdouble` instead.",
|
| 35 |
+
"clongfloat": "Use `np.clongdouble` instead.",
|
| 36 |
+
"string_": "Use `np.bytes_` instead.",
|
| 37 |
+
"unicode_": "Use `np.str_` instead.",
|
| 38 |
+
"Inf": "Use `np.inf` instead.",
|
| 39 |
+
"Infinity": "Use `np.inf` instead.",
|
| 40 |
+
"NaN": "Use `np.nan` instead.",
|
| 41 |
+
"infty": "Use `np.inf` instead.",
|
| 42 |
+
"issctype": "Use `issubclass(rep, np.generic)` instead.",
|
| 43 |
+
"maximum_sctype":
|
| 44 |
+
"Use a specific dtype instead. You should avoid relying "
|
| 45 |
+
"on any implicit mechanism and select the largest dtype of "
|
| 46 |
+
"a kind explicitly in the code.",
|
| 47 |
+
"obj2sctype": "Use `np.dtype(obj).type` instead.",
|
| 48 |
+
"sctype2char": "Use `np.dtype(obj).char` instead.",
|
| 49 |
+
"sctypes": "Access dtypes explicitly instead.",
|
| 50 |
+
"issubsctype": "Use `np.issubdtype` instead.",
|
| 51 |
+
"set_string_function":
|
| 52 |
+
"Use `np.set_printoptions` instead with a formatter for "
|
| 53 |
+
"custom printing of NumPy objects.",
|
| 54 |
+
"asfarray": "Use `np.asarray` with a proper dtype instead.",
|
| 55 |
+
"issubclass_": "Use `issubclass` builtin instead.",
|
| 56 |
+
"tracemalloc_domain": "It's now available from `np.lib`.",
|
| 57 |
+
"mat": "Use `np.asmatrix` instead.",
|
| 58 |
+
"recfromcsv": "Use `np.genfromtxt` with comma delimiter instead.",
|
| 59 |
+
"recfromtxt": "Use `np.genfromtxt` instead.",
|
| 60 |
+
"deprecate": "Emit `DeprecationWarning` with `warnings.warn` directly, "
|
| 61 |
+
"or use `warnings.deprecated`.",
|
| 62 |
+
"deprecate_with_doc": "Emit `DeprecationWarning` with `warnings.warn` "
|
| 63 |
+
"directly, or use `warnings.deprecated`.",
|
| 64 |
+
"find_common_type":
|
| 65 |
+
"Use `numpy.promote_types` or `numpy.result_type` instead. "
|
| 66 |
+
"To achieve semantics for the `scalar_types` argument, use "
|
| 67 |
+
"`numpy.result_type` and pass the Python values `0`, `0.0`, or `0j`.",
|
| 68 |
+
"round_": "Use `np.round` instead.",
|
| 69 |
+
"get_array_wrap": "",
|
| 70 |
+
"DataSource": "It's still available as `np.lib.npyio.DataSource`.",
|
| 71 |
+
"nbytes": "Use `np.dtype(<dtype>).itemsize` instead.",
|
| 72 |
+
"byte_bounds": "Now it's available under `np.lib.array_utils.byte_bounds`",
|
| 73 |
+
"compare_chararrays":
|
| 74 |
+
"It's still available as `np.char.compare_chararrays`.",
|
| 75 |
+
"format_parser": "It's still available as `np.rec.format_parser`.",
|
| 76 |
+
"alltrue": "Use `np.all` instead.",
|
| 77 |
+
"sometrue": "Use `np.any` instead.",
|
| 78 |
+
}
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_expired_attrs_2_0.pyi
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Final, TypedDict, final, type_check_only
|
| 2 |
+
|
| 3 |
+
@final
|
| 4 |
+
@type_check_only
|
| 5 |
+
class _ExpiredAttributesType(TypedDict):
|
| 6 |
+
geterrobj: str
|
| 7 |
+
seterrobj: str
|
| 8 |
+
cast: str
|
| 9 |
+
source: str
|
| 10 |
+
lookfor: str
|
| 11 |
+
who: str
|
| 12 |
+
fastCopyAndTranspose: str
|
| 13 |
+
set_numeric_ops: str
|
| 14 |
+
NINF: str
|
| 15 |
+
PINF: str
|
| 16 |
+
NZERO: str
|
| 17 |
+
PZERO: str
|
| 18 |
+
add_newdoc: str
|
| 19 |
+
add_docstring: str
|
| 20 |
+
add_newdoc_ufunc: str
|
| 21 |
+
safe_eval: str
|
| 22 |
+
float_: str
|
| 23 |
+
complex_: str
|
| 24 |
+
longfloat: str
|
| 25 |
+
singlecomplex: str
|
| 26 |
+
cfloat: str
|
| 27 |
+
longcomplex: str
|
| 28 |
+
clongfloat: str
|
| 29 |
+
string_: str
|
| 30 |
+
unicode_: str
|
| 31 |
+
Inf: str
|
| 32 |
+
Infinity: str
|
| 33 |
+
NaN: str
|
| 34 |
+
infty: str
|
| 35 |
+
issctype: str
|
| 36 |
+
maximum_sctype: str
|
| 37 |
+
obj2sctype: str
|
| 38 |
+
sctype2char: str
|
| 39 |
+
sctypes: str
|
| 40 |
+
issubsctype: str
|
| 41 |
+
set_string_function: str
|
| 42 |
+
asfarray: str
|
| 43 |
+
issubclass_: str
|
| 44 |
+
tracemalloc_domain: str
|
| 45 |
+
mat: str
|
| 46 |
+
recfromcsv: str
|
| 47 |
+
recfromtxt: str
|
| 48 |
+
deprecate: str
|
| 49 |
+
deprecate_with_doc: str
|
| 50 |
+
find_common_type: str
|
| 51 |
+
round_: str
|
| 52 |
+
get_array_wrap: str
|
| 53 |
+
DataSource: str
|
| 54 |
+
nbytes: str
|
| 55 |
+
byte_bounds: str
|
| 56 |
+
compare_chararrays: str
|
| 57 |
+
format_parser: str
|
| 58 |
+
alltrue: str
|
| 59 |
+
sometrue: str
|
| 60 |
+
|
| 61 |
+
__expired_attributes__: Final[_ExpiredAttributesType] = ...
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_globals.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Module defining global singleton classes.
|
| 3 |
+
|
| 4 |
+
This module raises a RuntimeError if an attempt to reload it is made. In that
|
| 5 |
+
way the identities of the classes defined here are fixed and will remain so
|
| 6 |
+
even if numpy itself is reloaded. In particular, a function like the following
|
| 7 |
+
will still work correctly after numpy is reloaded::
|
| 8 |
+
|
| 9 |
+
def foo(arg=np._NoValue):
|
| 10 |
+
if arg is np._NoValue:
|
| 11 |
+
...
|
| 12 |
+
|
| 13 |
+
That was not the case when the singleton classes were defined in the numpy
|
| 14 |
+
``__init__.py`` file. See gh-7844 for a discussion of the reload problem that
|
| 15 |
+
motivated this module.
|
| 16 |
+
|
| 17 |
+
"""
|
| 18 |
+
import enum
|
| 19 |
+
|
| 20 |
+
from ._utils import set_module as _set_module
|
| 21 |
+
|
| 22 |
+
__all__ = ['_NoValue', '_CopyMode']
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Disallow reloading this module so as to preserve the identities of the
|
| 26 |
+
# classes defined here.
|
| 27 |
+
if '_is_loaded' in globals():
|
| 28 |
+
raise RuntimeError('Reloading numpy._globals is not allowed')
|
| 29 |
+
_is_loaded = True
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class _NoValueType:
|
| 33 |
+
"""Special keyword value.
|
| 34 |
+
|
| 35 |
+
The instance of this class may be used as the default value assigned to a
|
| 36 |
+
keyword if no other obvious default (e.g., `None`) is suitable,
|
| 37 |
+
|
| 38 |
+
Common reasons for using this keyword are:
|
| 39 |
+
|
| 40 |
+
- A new keyword is added to a function, and that function forwards its
|
| 41 |
+
inputs to another function or method which can be defined outside of
|
| 42 |
+
NumPy. For example, ``np.std(x)`` calls ``x.std``, so when a ``keepdims``
|
| 43 |
+
keyword was added that could only be forwarded if the user explicitly
|
| 44 |
+
specified ``keepdims``; downstream array libraries may not have added
|
| 45 |
+
the same keyword, so adding ``x.std(..., keepdims=keepdims)``
|
| 46 |
+
unconditionally could have broken previously working code.
|
| 47 |
+
- A keyword is being deprecated, and a deprecation warning must only be
|
| 48 |
+
emitted when the keyword is used.
|
| 49 |
+
|
| 50 |
+
"""
|
| 51 |
+
__instance = None
|
| 52 |
+
|
| 53 |
+
def __new__(cls):
|
| 54 |
+
# ensure that only one instance exists
|
| 55 |
+
if not cls.__instance:
|
| 56 |
+
cls.__instance = super().__new__(cls)
|
| 57 |
+
return cls.__instance
|
| 58 |
+
|
| 59 |
+
def __repr__(self):
|
| 60 |
+
return "<no value>"
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
_NoValue = _NoValueType()
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
@_set_module("numpy")
|
| 67 |
+
class _CopyMode(enum.Enum):
|
| 68 |
+
"""
|
| 69 |
+
An enumeration for the copy modes supported
|
| 70 |
+
by numpy.copy() and numpy.array(). The following three modes are supported,
|
| 71 |
+
|
| 72 |
+
- ALWAYS: This means that a deep copy of the input
|
| 73 |
+
array will always be taken.
|
| 74 |
+
- IF_NEEDED: This means that a deep copy of the input
|
| 75 |
+
array will be taken only if necessary.
|
| 76 |
+
- NEVER: This means that the deep copy will never be taken.
|
| 77 |
+
If a copy cannot be avoided then a `ValueError` will be
|
| 78 |
+
raised.
|
| 79 |
+
|
| 80 |
+
Note that the buffer-protocol could in theory do copies. NumPy currently
|
| 81 |
+
assumes an object exporting the buffer protocol will never do this.
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
ALWAYS = True
|
| 85 |
+
NEVER = False
|
| 86 |
+
IF_NEEDED = 2
|
| 87 |
+
|
| 88 |
+
def __bool__(self):
|
| 89 |
+
# For backwards compatibility
|
| 90 |
+
if self == _CopyMode.ALWAYS:
|
| 91 |
+
return True
|
| 92 |
+
|
| 93 |
+
if self == _CopyMode.NEVER:
|
| 94 |
+
return False
|
| 95 |
+
|
| 96 |
+
raise ValueError(f"{self} is neither True nor False.")
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
class _SignatureDescriptor:
|
| 100 |
+
# A descriptor to store on the ufunc __dict__ that avoids defining a
|
| 101 |
+
# signature for the ufunc class/type but allows the instance to have one.
|
| 102 |
+
# This is needed because inspect.signature() chokes on normal properties
|
| 103 |
+
# (as of 3.14 at least).
|
| 104 |
+
# We could also set __signature__ on the instance but this allows deferred
|
| 105 |
+
# computation of the signature.
|
| 106 |
+
def __get__(self, obj, objtype=None):
|
| 107 |
+
# Delay import, not a critical path but need to avoid circular import.
|
| 108 |
+
from numpy._core._internal import _ufunc_inspect_signature_builder
|
| 109 |
+
|
| 110 |
+
if obj is None:
|
| 111 |
+
# could also return None, which is accepted as "not set" by
|
| 112 |
+
# inspect.signature().
|
| 113 |
+
raise AttributeError(
|
| 114 |
+
"type object 'numpy.ufunc' has no attribute '__signature__'")
|
| 115 |
+
|
| 116 |
+
# Store on the instance, after this the descriptor won't be used.
|
| 117 |
+
obj.__signature__ = _ufunc_inspect_signature_builder(obj)
|
| 118 |
+
return obj.__signature__
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
_signature_descriptor = _SignatureDescriptor()
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_globals.pyi
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = ["_CopyMode", "_NoValue"]
|
| 2 |
+
|
| 3 |
+
import enum
|
| 4 |
+
from typing import Final, final
|
| 5 |
+
|
| 6 |
+
@final
|
| 7 |
+
class _CopyMode(enum.Enum):
|
| 8 |
+
ALWAYS = True
|
| 9 |
+
NEVER = False
|
| 10 |
+
IF_NEEDED = 2
|
| 11 |
+
|
| 12 |
+
def __bool__(self, /) -> bool: ...
|
| 13 |
+
|
| 14 |
+
@final
|
| 15 |
+
class _NoValueType: ...
|
| 16 |
+
|
| 17 |
+
_NoValue: Final[_NoValueType] = ...
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_pytesttester.py
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pytest test running.
|
| 3 |
+
|
| 4 |
+
This module implements the ``test()`` function for NumPy modules. The usual
|
| 5 |
+
boiler plate for doing that is to put the following in the module
|
| 6 |
+
``__init__.py`` file::
|
| 7 |
+
|
| 8 |
+
from numpy._pytesttester import PytestTester
|
| 9 |
+
test = PytestTester(__name__)
|
| 10 |
+
del PytestTester
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
Warnings filtering and other runtime settings should be dealt with in the
|
| 14 |
+
``pytest.ini`` file in the numpy repo root. The behavior of the test depends on
|
| 15 |
+
whether or not that file is found as follows:
|
| 16 |
+
|
| 17 |
+
* ``pytest.ini`` is present (develop mode)
|
| 18 |
+
All warnings except those explicitly filtered out are raised as error.
|
| 19 |
+
* ``pytest.ini`` is absent (release mode)
|
| 20 |
+
DeprecationWarnings and PendingDeprecationWarnings are ignored, other
|
| 21 |
+
warnings are passed through.
|
| 22 |
+
|
| 23 |
+
In practice, tests run from the numpy repo are run in development mode with
|
| 24 |
+
``spin``, through the standard ``spin test`` invocation or from an inplace
|
| 25 |
+
build with ``pytest numpy``.
|
| 26 |
+
|
| 27 |
+
This module is imported by every numpy subpackage, so lies at the top level to
|
| 28 |
+
simplify circular import issues. For the same reason, it contains no numpy
|
| 29 |
+
imports at module scope, instead importing numpy within function calls.
|
| 30 |
+
"""
|
| 31 |
+
import os
|
| 32 |
+
import sys
|
| 33 |
+
|
| 34 |
+
__all__ = ['PytestTester']
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def _show_numpy_info():
|
| 38 |
+
import numpy as np
|
| 39 |
+
|
| 40 |
+
print(f"NumPy version {np.__version__}")
|
| 41 |
+
info = np.lib._utils_impl._opt_info()
|
| 42 |
+
print("NumPy CPU features: ", (info or 'nothing enabled'))
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class PytestTester:
|
| 46 |
+
"""
|
| 47 |
+
Pytest test runner.
|
| 48 |
+
|
| 49 |
+
A test function is typically added to a package's __init__.py like so::
|
| 50 |
+
|
| 51 |
+
from numpy._pytesttester import PytestTester
|
| 52 |
+
test = PytestTester(__name__).test
|
| 53 |
+
del PytestTester
|
| 54 |
+
|
| 55 |
+
Calling this test function finds and runs all tests associated with the
|
| 56 |
+
module and all its sub-modules.
|
| 57 |
+
|
| 58 |
+
Attributes
|
| 59 |
+
----------
|
| 60 |
+
module_name : str
|
| 61 |
+
Full path to the package to test.
|
| 62 |
+
|
| 63 |
+
Parameters
|
| 64 |
+
----------
|
| 65 |
+
module_name : module name
|
| 66 |
+
The name of the module to test.
|
| 67 |
+
|
| 68 |
+
Notes
|
| 69 |
+
-----
|
| 70 |
+
Unlike the previous ``nose``-based implementation, this class is not
|
| 71 |
+
publicly exposed as it performs some ``numpy``-specific warning
|
| 72 |
+
suppression.
|
| 73 |
+
|
| 74 |
+
"""
|
| 75 |
+
def __init__(self, module_name):
|
| 76 |
+
self.module_name = module_name
|
| 77 |
+
self.__module__ = module_name
|
| 78 |
+
|
| 79 |
+
def __call__(self, label='fast', verbose=1, extra_argv=None,
|
| 80 |
+
doctests=False, coverage=False, durations=-1, tests=None):
|
| 81 |
+
"""
|
| 82 |
+
Run tests for module using pytest.
|
| 83 |
+
|
| 84 |
+
Parameters
|
| 85 |
+
----------
|
| 86 |
+
label : {'fast', 'full'}, optional
|
| 87 |
+
Identifies the tests to run. When set to 'fast', tests decorated
|
| 88 |
+
with `pytest.mark.slow` are skipped, when 'full', the slow marker
|
| 89 |
+
is ignored.
|
| 90 |
+
verbose : int, optional
|
| 91 |
+
Verbosity value for test outputs, in the range 1-3. Default is 1.
|
| 92 |
+
extra_argv : list, optional
|
| 93 |
+
List with any extra arguments to pass to pytests.
|
| 94 |
+
doctests : bool, optional
|
| 95 |
+
.. note:: Not supported
|
| 96 |
+
coverage : bool, optional
|
| 97 |
+
If True, report coverage of NumPy code. Default is False.
|
| 98 |
+
Requires installation of (pip) pytest-cov.
|
| 99 |
+
durations : int, optional
|
| 100 |
+
If < 0, do nothing, If 0, report time of all tests, if > 0,
|
| 101 |
+
report the time of the slowest `timer` tests. Default is -1.
|
| 102 |
+
tests : test or list of tests
|
| 103 |
+
Tests to be executed with pytest '--pyargs'
|
| 104 |
+
|
| 105 |
+
Returns
|
| 106 |
+
-------
|
| 107 |
+
result : bool
|
| 108 |
+
Return True on success, false otherwise.
|
| 109 |
+
|
| 110 |
+
Notes
|
| 111 |
+
-----
|
| 112 |
+
Each NumPy module exposes `test` in its namespace to run all tests for
|
| 113 |
+
it. For example, to run all tests for numpy.lib:
|
| 114 |
+
|
| 115 |
+
>>> np.lib.test() #doctest: +SKIP
|
| 116 |
+
|
| 117 |
+
Examples
|
| 118 |
+
--------
|
| 119 |
+
>>> result = np.lib.test() #doctest: +SKIP
|
| 120 |
+
...
|
| 121 |
+
1023 passed, 2 skipped, 6 deselected, 1 xfailed in 10.39 seconds
|
| 122 |
+
>>> result
|
| 123 |
+
True
|
| 124 |
+
|
| 125 |
+
"""
|
| 126 |
+
import pytest
|
| 127 |
+
|
| 128 |
+
module = sys.modules[self.module_name]
|
| 129 |
+
module_path = os.path.abspath(module.__path__[0])
|
| 130 |
+
|
| 131 |
+
# setup the pytest arguments
|
| 132 |
+
pytest_args = ["-l"]
|
| 133 |
+
|
| 134 |
+
# offset verbosity. The "-q" cancels a "-v".
|
| 135 |
+
pytest_args += ["-q"]
|
| 136 |
+
|
| 137 |
+
# Filter out annoying import messages. Want these in both develop and
|
| 138 |
+
# release mode.
|
| 139 |
+
pytest_args += [
|
| 140 |
+
"-W ignore:Not importing directory",
|
| 141 |
+
"-W ignore:numpy.dtype size changed",
|
| 142 |
+
"-W ignore:numpy.ufunc size changed",
|
| 143 |
+
"-W ignore::UserWarning:cpuinfo",
|
| 144 |
+
]
|
| 145 |
+
|
| 146 |
+
# When testing matrices, ignore their PendingDeprecationWarnings
|
| 147 |
+
pytest_args += [
|
| 148 |
+
"-W ignore:the matrix subclass is not",
|
| 149 |
+
"-W ignore:Importing from numpy.matlib is",
|
| 150 |
+
]
|
| 151 |
+
|
| 152 |
+
if doctests:
|
| 153 |
+
pytest_args += ["--doctest-modules"]
|
| 154 |
+
|
| 155 |
+
if extra_argv:
|
| 156 |
+
pytest_args += list(extra_argv)
|
| 157 |
+
|
| 158 |
+
if verbose > 1:
|
| 159 |
+
pytest_args += ["-" + "v" * (verbose - 1)]
|
| 160 |
+
|
| 161 |
+
if coverage:
|
| 162 |
+
pytest_args += ["--cov=" + module_path]
|
| 163 |
+
|
| 164 |
+
if label == "fast":
|
| 165 |
+
pytest_args += ["-m", "not slow"]
|
| 166 |
+
|
| 167 |
+
elif label != "full":
|
| 168 |
+
pytest_args += ["-m", label]
|
| 169 |
+
|
| 170 |
+
if durations >= 0:
|
| 171 |
+
pytest_args += [f"--durations={durations}"]
|
| 172 |
+
|
| 173 |
+
if tests is None:
|
| 174 |
+
tests = [self.module_name]
|
| 175 |
+
|
| 176 |
+
pytest_args += ["--pyargs"] + list(tests)
|
| 177 |
+
|
| 178 |
+
# run tests.
|
| 179 |
+
_show_numpy_info()
|
| 180 |
+
|
| 181 |
+
try:
|
| 182 |
+
code = pytest.main(pytest_args)
|
| 183 |
+
except SystemExit as exc:
|
| 184 |
+
code = exc.code
|
| 185 |
+
|
| 186 |
+
return code == 0
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/_pytesttester.pyi
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Iterable
|
| 2 |
+
from typing import Literal as L
|
| 3 |
+
|
| 4 |
+
__all__ = ["PytestTester"]
|
| 5 |
+
|
| 6 |
+
class PytestTester:
|
| 7 |
+
module_name: str
|
| 8 |
+
def __init__(self, module_name: str) -> None: ...
|
| 9 |
+
def __call__(
|
| 10 |
+
self,
|
| 11 |
+
label: L["fast", "full"] = "fast",
|
| 12 |
+
verbose: int = 1,
|
| 13 |
+
extra_argv: Iterable[str] | None = None,
|
| 14 |
+
doctests: L[False] = False,
|
| 15 |
+
coverage: bool = False,
|
| 16 |
+
durations: int = -1,
|
| 17 |
+
tests: Iterable[str] | None = None,
|
| 18 |
+
) -> bool: ...
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/conftest.py
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pytest configuration and fixtures for the Numpy test suite.
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
import sys
|
| 6 |
+
import tempfile
|
| 7 |
+
import warnings
|
| 8 |
+
from contextlib import contextmanager
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
import hypothesis
|
| 12 |
+
import pytest
|
| 13 |
+
|
| 14 |
+
import numpy
|
| 15 |
+
from numpy._core._multiarray_tests import get_fpu_mode
|
| 16 |
+
from numpy.testing._private.utils import NOGIL_BUILD
|
| 17 |
+
|
| 18 |
+
try:
|
| 19 |
+
from scipy_doctest.conftest import dt_config
|
| 20 |
+
HAVE_SCPDT = True
|
| 21 |
+
except ModuleNotFoundError:
|
| 22 |
+
HAVE_SCPDT = False
|
| 23 |
+
|
| 24 |
+
try:
|
| 25 |
+
import pytest_run_parallel # noqa: F401
|
| 26 |
+
PARALLEL_RUN_AVAILABLE = True
|
| 27 |
+
except ModuleNotFoundError:
|
| 28 |
+
PARALLEL_RUN_AVAILABLE = False
|
| 29 |
+
|
| 30 |
+
_old_fpu_mode = None
|
| 31 |
+
_collect_results = {}
|
| 32 |
+
|
| 33 |
+
# Use a known and persistent tmpdir for hypothesis' caches, which
|
| 34 |
+
# can be automatically cleared by the OS or user.
|
| 35 |
+
hypothesis.configuration.set_hypothesis_home_dir(
|
| 36 |
+
os.path.join(tempfile.gettempdir(), ".hypothesis")
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
# We register two custom profiles for Numpy - for details see
|
| 40 |
+
# https://hypothesis.readthedocs.io/en/latest/settings.html
|
| 41 |
+
# The first is designed for our own CI runs; the latter also
|
| 42 |
+
# forces determinism and is designed for use via np.test()
|
| 43 |
+
hypothesis.settings.register_profile(
|
| 44 |
+
name="numpy-profile", deadline=None, print_blob=True,
|
| 45 |
+
)
|
| 46 |
+
hypothesis.settings.register_profile(
|
| 47 |
+
name="np.test() profile",
|
| 48 |
+
deadline=None, print_blob=True, database=None, derandomize=True,
|
| 49 |
+
suppress_health_check=list(hypothesis.HealthCheck),
|
| 50 |
+
)
|
| 51 |
+
# Note that the default profile is chosen based on the presence
|
| 52 |
+
# of pytest.ini, but can be overridden by passing the
|
| 53 |
+
# --hypothesis-profile=NAME argument to pytest.
|
| 54 |
+
_pytest_ini = os.path.join(os.path.dirname(__file__), "..", "pytest.ini")
|
| 55 |
+
hypothesis.settings.load_profile(
|
| 56 |
+
"numpy-profile" if os.path.isfile(_pytest_ini) else "np.test() profile"
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
# The experimentalAPI is used in _umath_tests
|
| 60 |
+
os.environ["NUMPY_EXPERIMENTAL_DTYPE_API"] = "1"
|
| 61 |
+
|
| 62 |
+
def pytest_configure(config):
|
| 63 |
+
config.addinivalue_line("markers",
|
| 64 |
+
"valgrind_error: Tests that are known to error under valgrind.")
|
| 65 |
+
config.addinivalue_line("markers",
|
| 66 |
+
"leaks_references: Tests that are known to leak references.")
|
| 67 |
+
config.addinivalue_line("markers",
|
| 68 |
+
"slow: Tests that are very slow.")
|
| 69 |
+
if not PARALLEL_RUN_AVAILABLE:
|
| 70 |
+
config.addinivalue_line("markers",
|
| 71 |
+
"parallel_threads(n): run the given test function in parallel "
|
| 72 |
+
"using `n` threads.",
|
| 73 |
+
)
|
| 74 |
+
config.addinivalue_line("markers",
|
| 75 |
+
"iterations(n): run the given test function `n` times in each thread",
|
| 76 |
+
)
|
| 77 |
+
config.addinivalue_line("markers",
|
| 78 |
+
"thread_unsafe: mark the test function as single-threaded",
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def pytest_addoption(parser):
|
| 83 |
+
parser.addoption("--available-memory", action="store", default=None,
|
| 84 |
+
help=("Set amount of memory available for running the "
|
| 85 |
+
"test suite. This can result to tests requiring "
|
| 86 |
+
"especially large amounts of memory to be skipped. "
|
| 87 |
+
"Equivalent to setting environment variable "
|
| 88 |
+
"NPY_AVAILABLE_MEM. Default: determined "
|
| 89 |
+
"automatically."))
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
gil_enabled_at_start = True
|
| 93 |
+
if NOGIL_BUILD:
|
| 94 |
+
gil_enabled_at_start = sys._is_gil_enabled()
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def pytest_sessionstart(session):
|
| 98 |
+
available_mem = session.config.getoption('available_memory')
|
| 99 |
+
if available_mem is not None:
|
| 100 |
+
os.environ['NPY_AVAILABLE_MEM'] = available_mem
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def pytest_terminal_summary(terminalreporter, exitstatus, config):
|
| 104 |
+
if NOGIL_BUILD and not gil_enabled_at_start and sys._is_gil_enabled():
|
| 105 |
+
tr = terminalreporter
|
| 106 |
+
tr.ensure_newline()
|
| 107 |
+
tr.section("GIL re-enabled", sep="=", red=True, bold=True)
|
| 108 |
+
tr.line("The GIL was re-enabled at runtime during the tests.")
|
| 109 |
+
tr.line("This can happen with no test failures if the RuntimeWarning")
|
| 110 |
+
tr.line("raised by Python when this happens is filtered by a test.")
|
| 111 |
+
tr.line("")
|
| 112 |
+
tr.line("Please ensure all new C modules declare support for running")
|
| 113 |
+
tr.line("without the GIL. Any new tests that intentionally imports ")
|
| 114 |
+
tr.line("code that re-enables the GIL should do so in a subprocess.")
|
| 115 |
+
pytest.exit("GIL re-enabled during tests", returncode=1)
|
| 116 |
+
|
| 117 |
+
# FIXME when yield tests are gone.
|
| 118 |
+
@pytest.hookimpl(tryfirst=True)
|
| 119 |
+
def pytest_itemcollected(item):
|
| 120 |
+
"""
|
| 121 |
+
Check FPU precision mode was not changed during test collection.
|
| 122 |
+
|
| 123 |
+
The clumsy way we do it here is mainly necessary because numpy
|
| 124 |
+
still uses yield tests, which can execute code at test collection
|
| 125 |
+
time.
|
| 126 |
+
"""
|
| 127 |
+
global _old_fpu_mode
|
| 128 |
+
|
| 129 |
+
mode = get_fpu_mode()
|
| 130 |
+
|
| 131 |
+
if _old_fpu_mode is None:
|
| 132 |
+
_old_fpu_mode = mode
|
| 133 |
+
elif mode != _old_fpu_mode:
|
| 134 |
+
_collect_results[item] = (_old_fpu_mode, mode)
|
| 135 |
+
_old_fpu_mode = mode
|
| 136 |
+
|
| 137 |
+
# mark f2py tests as thread unsafe
|
| 138 |
+
if Path(item.fspath).parent == Path(__file__).parent / 'f2py' / 'tests':
|
| 139 |
+
item.add_marker(pytest.mark.thread_unsafe(
|
| 140 |
+
reason="f2py tests are thread-unsafe"))
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
@pytest.fixture(scope="function", autouse=True)
|
| 144 |
+
def check_fpu_mode(request):
|
| 145 |
+
"""
|
| 146 |
+
Check FPU precision mode was not changed during the test.
|
| 147 |
+
"""
|
| 148 |
+
old_mode = get_fpu_mode()
|
| 149 |
+
yield
|
| 150 |
+
new_mode = get_fpu_mode()
|
| 151 |
+
|
| 152 |
+
if old_mode != new_mode:
|
| 153 |
+
raise AssertionError(f"FPU precision mode changed from {old_mode:#x} to "
|
| 154 |
+
f"{new_mode:#x} during the test")
|
| 155 |
+
|
| 156 |
+
collect_result = _collect_results.get(request.node)
|
| 157 |
+
if collect_result is not None:
|
| 158 |
+
old_mode, new_mode = collect_result
|
| 159 |
+
raise AssertionError(f"FPU precision mode changed from {old_mode:#x} to "
|
| 160 |
+
f"{new_mode:#x} when collecting the test")
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
@pytest.fixture(autouse=True)
|
| 164 |
+
def add_np(doctest_namespace):
|
| 165 |
+
doctest_namespace['np'] = numpy
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
if HAVE_SCPDT:
|
| 169 |
+
|
| 170 |
+
@contextmanager
|
| 171 |
+
def warnings_errors_and_rng(test=None):
|
| 172 |
+
"""Filter out the wall of DeprecationWarnings.
|
| 173 |
+
"""
|
| 174 |
+
msgs = ["The numpy.linalg.linalg",
|
| 175 |
+
"The numpy.fft.helper",
|
| 176 |
+
"dep_util",
|
| 177 |
+
"pkg_resources",
|
| 178 |
+
"numpy.core.umath",
|
| 179 |
+
"msvccompiler",
|
| 180 |
+
"Deprecated call",
|
| 181 |
+
"numpy.core",
|
| 182 |
+
"Importing from numpy.matlib",
|
| 183 |
+
"This function is deprecated.", # random_integers
|
| 184 |
+
"Arrays of 2-dimensional vectors", # matlib.cross
|
| 185 |
+
"NumPy warning suppression and assertion utilities are deprecated.",
|
| 186 |
+
"numpy.fix is deprecated", # fix -> trunc
|
| 187 |
+
"The chararray class is deprecated", # char.chararray
|
| 188 |
+
"numpy.typename is deprecated", # typename -> dtype.name
|
| 189 |
+
"numpy.ma.round_ is deprecated", # ma.round_ -> ma.round
|
| 190 |
+
]
|
| 191 |
+
msg = "|".join(msgs)
|
| 192 |
+
|
| 193 |
+
msgs_r = [
|
| 194 |
+
"invalid value encountered",
|
| 195 |
+
"divide by zero encountered"
|
| 196 |
+
]
|
| 197 |
+
msg_r = "|".join(msgs_r)
|
| 198 |
+
|
| 199 |
+
with warnings.catch_warnings():
|
| 200 |
+
warnings.filterwarnings(
|
| 201 |
+
'ignore', category=DeprecationWarning, message=msg
|
| 202 |
+
)
|
| 203 |
+
warnings.filterwarnings(
|
| 204 |
+
'ignore', category=RuntimeWarning, message=msg_r
|
| 205 |
+
)
|
| 206 |
+
yield
|
| 207 |
+
|
| 208 |
+
# find and check doctests under this context manager
|
| 209 |
+
dt_config.user_context_mgr = warnings_errors_and_rng
|
| 210 |
+
|
| 211 |
+
# numpy specific tweaks from refguide-check
|
| 212 |
+
dt_config.rndm_markers.add('#uninitialized')
|
| 213 |
+
dt_config.rndm_markers.add('# uninitialized')
|
| 214 |
+
|
| 215 |
+
# make the checker pick on mismatched dtypes
|
| 216 |
+
dt_config.strict_check = True
|
| 217 |
+
|
| 218 |
+
import doctest
|
| 219 |
+
dt_config.optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
|
| 220 |
+
|
| 221 |
+
# recognize the StringDType repr
|
| 222 |
+
dt_config.check_namespace['StringDType'] = numpy.dtypes.StringDType
|
| 223 |
+
|
| 224 |
+
# temporary skips
|
| 225 |
+
dt_config.skiplist = {
|
| 226 |
+
'numpy.savez', # unclosed file
|
| 227 |
+
'numpy.matlib.savez',
|
| 228 |
+
'numpy.__array_namespace_info__',
|
| 229 |
+
'numpy.matlib.__array_namespace_info__',
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
# xfail problematic tutorials
|
| 233 |
+
dt_config.pytest_extra_xfail = {
|
| 234 |
+
'how-to-verify-bug.rst': '',
|
| 235 |
+
'c-info.ufunc-tutorial.rst': '',
|
| 236 |
+
'basics.interoperability.rst': 'needs pandas',
|
| 237 |
+
'basics.dispatch.rst': 'errors out in /testing/overrides.py',
|
| 238 |
+
'basics.subclassing.rst': '.. testcode:: admonitions not understood',
|
| 239 |
+
'misc.rst': 'manipulates warnings',
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
# ignores are for things fail doctest collection (optionals etc)
|
| 243 |
+
dt_config.pytest_extra_ignore = [
|
| 244 |
+
'numpy/distutils',
|
| 245 |
+
'numpy/_core/cversions.py',
|
| 246 |
+
'numpy/_pyinstaller',
|
| 247 |
+
'numpy/random/_examples',
|
| 248 |
+
'numpy/f2py/_backends/_distutils.py',
|
| 249 |
+
]
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/dtypes.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This module is home to specific dtypes related functionality and their classes.
|
| 3 |
+
For more general information about dtypes, also see `numpy.dtype` and
|
| 4 |
+
:ref:`arrays.dtypes`.
|
| 5 |
+
|
| 6 |
+
Similar to the builtin ``types`` module, this submodule defines types (classes)
|
| 7 |
+
that are not widely used directly.
|
| 8 |
+
|
| 9 |
+
.. versionadded:: NumPy 1.25
|
| 10 |
+
|
| 11 |
+
The dtypes module is new in NumPy 1.25. Previously DType classes were
|
| 12 |
+
only accessible indirectly.
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
DType classes
|
| 16 |
+
-------------
|
| 17 |
+
|
| 18 |
+
The following are the classes of the corresponding NumPy dtype instances and
|
| 19 |
+
NumPy scalar types. The classes can be used in ``isinstance`` checks and can
|
| 20 |
+
also be instantiated or used directly. Direct use of these classes is not
|
| 21 |
+
typical, since their scalar counterparts (e.g. ``np.float64``) or strings
|
| 22 |
+
like ``"float64"`` can be used.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
# See doc/source/reference/routines.dtypes.rst for module-level docs
|
| 26 |
+
__all__ = ["register_dlpack_dtype"]
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def register_dlpack_dtype(dlpack_key, dtype, /):
|
| 30 |
+
"""
|
| 31 |
+
Register a NumPy dtype for a DLPack ``(code, bits)`` pair so that
|
| 32 |
+
`numpy.from_dlpack` can import it and ``ndarray.__dlpack__`` can export
|
| 33 |
+
it. Built-in dtype mappings take priority on import.
|
| 34 |
+
|
| 35 |
+
If you think a conflict is possible but unproblematic you may wrap this
|
| 36 |
+
into a try/except block as NumPy will raise an error if another DType
|
| 37 |
+
is already registered for the same (code, bits) pair.
|
| 38 |
+
While an error is raised, the export is registered even on error.
|
| 39 |
+
|
| 40 |
+
Registering an identical (not equal) dtype multiple times is allowed but
|
| 41 |
+
normally registration should happen at import time.
|
| 42 |
+
|
| 43 |
+
.. warning::
|
| 44 |
+
It is the responsibility of the registering user to ensure that the
|
| 45 |
+
mapping is valid.
|
| 46 |
+
|
| 47 |
+
.. note::
|
| 48 |
+
This function was added primarily for ``ml_dtypes`` and may be
|
| 49 |
+
replaced with a different mechanism in the future. It is intended
|
| 50 |
+
to be used by authors of user-defined dtypes and not end-users.
|
| 51 |
+
|
| 52 |
+
Parameters
|
| 53 |
+
----------
|
| 54 |
+
dlpack_key : tuple of int
|
| 55 |
+
``(dl_dtype_code, dl_bits)`` matching the DLPack ``DLDataType``,
|
| 56 |
+
lanes is assumed to be always 1, currently.
|
| 57 |
+
dtype : dtype
|
| 58 |
+
A NumPy dtype instance.
|
| 59 |
+
|
| 60 |
+
Raises
|
| 61 |
+
------
|
| 62 |
+
ValueError : If a conflicting registration was already done.
|
| 63 |
+
|
| 64 |
+
See Also
|
| 65 |
+
--------
|
| 66 |
+
numpy.from_dlpack
|
| 67 |
+
|
| 68 |
+
"""
|
| 69 |
+
# Deferred to avoid circular import.
|
| 70 |
+
from numpy._core._multiarray_umath import _register_dlpack_dtype
|
| 71 |
+
|
| 72 |
+
return _register_dlpack_dtype(dlpack_key, dtype)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def _add_dtype_helper(DType, alias):
|
| 76 |
+
# Function to add DTypes a bit more conveniently without channeling them
|
| 77 |
+
# through `numpy._core._multiarray_umath` namespace or similar.
|
| 78 |
+
from numpy import dtypes
|
| 79 |
+
|
| 80 |
+
setattr(dtypes, DType.__name__, DType)
|
| 81 |
+
__all__.append(DType.__name__)
|
| 82 |
+
|
| 83 |
+
if alias:
|
| 84 |
+
alias = alias.removeprefix("numpy.dtypes.")
|
| 85 |
+
setattr(dtypes, alias, DType)
|
| 86 |
+
__all__.append(alias)
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/numpy/dtypes.pyi
ADDED
|
@@ -0,0 +1,627 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 3 |
+
from typing import (
|
| 4 |
+
Any,
|
| 5 |
+
Generic,
|
| 6 |
+
Literal as L,
|
| 7 |
+
LiteralString,
|
| 8 |
+
Never,
|
| 9 |
+
NoReturn,
|
| 10 |
+
Self,
|
| 11 |
+
final,
|
| 12 |
+
overload,
|
| 13 |
+
type_check_only,
|
| 14 |
+
)
|
| 15 |
+
from typing_extensions import TypeVar
|
| 16 |
+
|
| 17 |
+
import numpy as np
|
| 18 |
+
|
| 19 |
+
__all__ = [
|
| 20 |
+
"register_dlpack_dtype",
|
| 21 |
+
"BoolDType",
|
| 22 |
+
"Int8DType",
|
| 23 |
+
"ByteDType",
|
| 24 |
+
"UInt8DType",
|
| 25 |
+
"UByteDType",
|
| 26 |
+
"Int16DType",
|
| 27 |
+
"ShortDType",
|
| 28 |
+
"UInt16DType",
|
| 29 |
+
"UShortDType",
|
| 30 |
+
"Int32DType",
|
| 31 |
+
"IntDType",
|
| 32 |
+
"UInt32DType",
|
| 33 |
+
"UIntDType",
|
| 34 |
+
"Int64DType",
|
| 35 |
+
"LongDType",
|
| 36 |
+
"UInt64DType",
|
| 37 |
+
"ULongDType",
|
| 38 |
+
"LongLongDType",
|
| 39 |
+
"ULongLongDType",
|
| 40 |
+
"Float16DType",
|
| 41 |
+
"Float32DType",
|
| 42 |
+
"Float64DType",
|
| 43 |
+
"LongDoubleDType",
|
| 44 |
+
"Complex64DType",
|
| 45 |
+
"Complex128DType",
|
| 46 |
+
"CLongDoubleDType",
|
| 47 |
+
"ObjectDType",
|
| 48 |
+
"BytesDType",
|
| 49 |
+
"StrDType",
|
| 50 |
+
"VoidDType",
|
| 51 |
+
"DateTime64DType",
|
| 52 |
+
"TimeDelta64DType",
|
| 53 |
+
"StringDType",
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
# Type parameters
|
| 57 |
+
|
| 58 |
+
_ItemSizeT_co = TypeVar("_ItemSizeT_co", bound=int, default=int, covariant=True)
|
| 59 |
+
_NaObjectT_co = TypeVar("_NaObjectT_co", default=Never, covariant=True)
|
| 60 |
+
|
| 61 |
+
# Helper base classes (typing-only)
|
| 62 |
+
|
| 63 |
+
@type_check_only
|
| 64 |
+
class _SimpleDType[ScalarT: np.generic](np.dtype[ScalarT]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
| 65 |
+
names: None # pyright: ignore[reportIncompatibleVariableOverride] # pyrefly: ignore[bad-override]
|
| 66 |
+
def __new__(cls, /) -> Self: ...
|
| 67 |
+
def __getitem__(self, key: Any, /) -> NoReturn: ...
|
| 68 |
+
@property
|
| 69 |
+
def base(self) -> np.dtype[ScalarT]: ...
|
| 70 |
+
@property
|
| 71 |
+
def fields(self) -> None: ...
|
| 72 |
+
@property
|
| 73 |
+
def isalignedstruct(self) -> L[False]: ...
|
| 74 |
+
@property
|
| 75 |
+
def isnative(self) -> L[True]: ...
|
| 76 |
+
@property
|
| 77 |
+
def ndim(self) -> L[0]: ...
|
| 78 |
+
@property
|
| 79 |
+
def shape(self) -> tuple[()]: ...
|
| 80 |
+
@property
|
| 81 |
+
def subdtype(self) -> None: ...
|
| 82 |
+
|
| 83 |
+
@type_check_only
|
| 84 |
+
class _LiteralDType[ScalarT_co: np.generic](_SimpleDType[ScalarT_co]): # type: ignore[misc]
|
| 85 |
+
@property
|
| 86 |
+
def flags(self) -> L[0]: ...
|
| 87 |
+
@property
|
| 88 |
+
def hasobject(self) -> L[False]: ...
|
| 89 |
+
|
| 90 |
+
# Helper mixins (typing-only):
|
| 91 |
+
|
| 92 |
+
@type_check_only
|
| 93 |
+
class _TypeCodes[KindT: LiteralString, CharT: LiteralString, NumT: int]:
|
| 94 |
+
@final
|
| 95 |
+
@property
|
| 96 |
+
def kind(self) -> KindT: ...
|
| 97 |
+
@final
|
| 98 |
+
@property
|
| 99 |
+
def char(self) -> CharT: ...
|
| 100 |
+
@final
|
| 101 |
+
@property
|
| 102 |
+
def num(self) -> NumT: ...
|
| 103 |
+
|
| 104 |
+
@type_check_only
|
| 105 |
+
class _NoOrder:
|
| 106 |
+
@final
|
| 107 |
+
@property
|
| 108 |
+
def byteorder(self) -> L["|"]: ...
|
| 109 |
+
|
| 110 |
+
@type_check_only
|
| 111 |
+
class _NativeOrder:
|
| 112 |
+
@final
|
| 113 |
+
@property
|
| 114 |
+
def byteorder(self) -> L["="]: ...
|
| 115 |
+
|
| 116 |
+
@type_check_only
|
| 117 |
+
class _NBit[AlignmentT: int, ItemSizeT: int]:
|
| 118 |
+
@final
|
| 119 |
+
@property
|
| 120 |
+
def alignment(self) -> AlignmentT: ...
|
| 121 |
+
@final
|
| 122 |
+
@property
|
| 123 |
+
def itemsize(self) -> ItemSizeT: ...
|
| 124 |
+
|
| 125 |
+
@type_check_only
|
| 126 |
+
class _8Bit(_NoOrder, _NBit[L[1], L[1]]): ...
|
| 127 |
+
|
| 128 |
+
# Boolean:
|
| 129 |
+
|
| 130 |
+
@final
|
| 131 |
+
class BoolDType( # type: ignore[misc]
|
| 132 |
+
_TypeCodes[L["b"], L["?"], L[0]],
|
| 133 |
+
_8Bit,
|
| 134 |
+
_LiteralDType[np.bool],
|
| 135 |
+
):
|
| 136 |
+
@property
|
| 137 |
+
def name(self) -> L["bool"]: ...
|
| 138 |
+
@property
|
| 139 |
+
def str(self) -> L["|b1"]: ...
|
| 140 |
+
|
| 141 |
+
# Sized integers:
|
| 142 |
+
|
| 143 |
+
@final
|
| 144 |
+
class Int8DType( # type: ignore[misc]
|
| 145 |
+
_TypeCodes[L["i"], L["b"], L[1]],
|
| 146 |
+
_8Bit,
|
| 147 |
+
_LiteralDType[np.int8],
|
| 148 |
+
):
|
| 149 |
+
@property
|
| 150 |
+
def name(self) -> L["int8"]: ...
|
| 151 |
+
@property
|
| 152 |
+
def str(self) -> L["|i1"]: ...
|
| 153 |
+
|
| 154 |
+
@final
|
| 155 |
+
class UInt8DType( # type: ignore[misc]
|
| 156 |
+
_TypeCodes[L["u"], L["B"], L[2]],
|
| 157 |
+
_8Bit,
|
| 158 |
+
_LiteralDType[np.uint8],
|
| 159 |
+
):
|
| 160 |
+
@property
|
| 161 |
+
def name(self) -> L["uint8"]: ...
|
| 162 |
+
@property
|
| 163 |
+
def str(self) -> L["|u1"]: ...
|
| 164 |
+
|
| 165 |
+
@final
|
| 166 |
+
class Int16DType( # type: ignore[misc]
|
| 167 |
+
_TypeCodes[L["i"], L["h"], L[3]],
|
| 168 |
+
_NativeOrder,
|
| 169 |
+
_NBit[L[2], L[2]],
|
| 170 |
+
_LiteralDType[np.int16],
|
| 171 |
+
):
|
| 172 |
+
@property
|
| 173 |
+
def name(self) -> L["int16"]: ...
|
| 174 |
+
@property
|
| 175 |
+
def str(self) -> L["<i2", ">i2"]: ...
|
| 176 |
+
|
| 177 |
+
@final
|
| 178 |
+
class UInt16DType( # type: ignore[misc]
|
| 179 |
+
_TypeCodes[L["u"], L["H"], L[4]],
|
| 180 |
+
_NativeOrder,
|
| 181 |
+
_NBit[L[2], L[2]],
|
| 182 |
+
_LiteralDType[np.uint16],
|
| 183 |
+
):
|
| 184 |
+
@property
|
| 185 |
+
def name(self) -> L["uint16"]: ...
|
| 186 |
+
@property
|
| 187 |
+
def str(self) -> L["<u2", ">u2"]: ...
|
| 188 |
+
|
| 189 |
+
@final
|
| 190 |
+
class Int32DType( # type: ignore[misc]
|
| 191 |
+
_TypeCodes[L["i"], L["i", "l"], L[5, 7]],
|
| 192 |
+
_NativeOrder,
|
| 193 |
+
_NBit[L[4], L[4]],
|
| 194 |
+
_LiteralDType[np.int32],
|
| 195 |
+
):
|
| 196 |
+
@property
|
| 197 |
+
def name(self) -> L["int32"]: ...
|
| 198 |
+
@property
|
| 199 |
+
def str(self) -> L["<i4", ">i4"]: ...
|
| 200 |
+
|
| 201 |
+
@final
|
| 202 |
+
class UInt32DType( # type: ignore[misc]
|
| 203 |
+
_TypeCodes[L["u"], L["I", "L"], L[6, 8]],
|
| 204 |
+
_NativeOrder,
|
| 205 |
+
_NBit[L[4], L[4]],
|
| 206 |
+
_LiteralDType[np.uint32],
|
| 207 |
+
):
|
| 208 |
+
@property
|
| 209 |
+
def name(self) -> L["uint32"]: ...
|
| 210 |
+
@property
|
| 211 |
+
def str(self) -> L["<u4", ">u4"]: ...
|
| 212 |
+
|
| 213 |
+
@final
|
| 214 |
+
class Int64DType( # type: ignore[misc]
|
| 215 |
+
_TypeCodes[L["i"], L["l", "q"], L[7, 9]],
|
| 216 |
+
_NativeOrder,
|
| 217 |
+
_NBit[L[8], L[8]],
|
| 218 |
+
_LiteralDType[np.int64],
|
| 219 |
+
):
|
| 220 |
+
@property
|
| 221 |
+
def name(self) -> L["int64"]: ...
|
| 222 |
+
@property
|
| 223 |
+
def str(self) -> L["<i8", ">i8"]: ...
|
| 224 |
+
|
| 225 |
+
@final
|
| 226 |
+
class UInt64DType( # type: ignore[misc]
|
| 227 |
+
_TypeCodes[L["u"], L["L", "Q"], L[8, 10]],
|
| 228 |
+
_NativeOrder,
|
| 229 |
+
_NBit[L[8], L[8]],
|
| 230 |
+
_LiteralDType[np.uint64],
|
| 231 |
+
):
|
| 232 |
+
@property
|
| 233 |
+
def name(self) -> L["uint64"]: ...
|
| 234 |
+
@property
|
| 235 |
+
def str(self) -> L["<u8", ">u8"]: ...
|
| 236 |
+
|
| 237 |
+
# Standard C-named version/alias:
|
| 238 |
+
# NOTE: Don't make these `Final[_]` or a `type _` it will break stubtest
|
| 239 |
+
ByteDType = Int8DType
|
| 240 |
+
UByteDType = UInt8DType
|
| 241 |
+
ShortDType = Int16DType
|
| 242 |
+
UShortDType = UInt16DType
|
| 243 |
+
|
| 244 |
+
@final
|
| 245 |
+
class IntDType( # type: ignore[misc]
|
| 246 |
+
_TypeCodes[L["i"], L["i"], L[5]],
|
| 247 |
+
_NativeOrder,
|
| 248 |
+
_NBit[L[4], L[4]],
|
| 249 |
+
_LiteralDType[np.intc],
|
| 250 |
+
):
|
| 251 |
+
@property
|
| 252 |
+
def name(self) -> L["int32"]: ...
|
| 253 |
+
@property
|
| 254 |
+
def str(self) -> L["<i4", ">i4"]: ...
|
| 255 |
+
|
| 256 |
+
@final
|
| 257 |
+
class UIntDType( # type: ignore[misc]
|
| 258 |
+
_TypeCodes[L["u"], L["I"], L[6]],
|
| 259 |
+
_NativeOrder,
|
| 260 |
+
_NBit[L[4], L[4]],
|
| 261 |
+
_LiteralDType[np.uintc],
|
| 262 |
+
):
|
| 263 |
+
@property
|
| 264 |
+
def name(self) -> L["uint32"]: ...
|
| 265 |
+
@property
|
| 266 |
+
def str(self) -> L["<u4", ">u4"]: ...
|
| 267 |
+
|
| 268 |
+
@final
|
| 269 |
+
class LongDType( # type: ignore[misc]
|
| 270 |
+
_TypeCodes[L["i"], L["l"], L[7]],
|
| 271 |
+
_NativeOrder,
|
| 272 |
+
_NBit[L[4, 8], L[4, 8]],
|
| 273 |
+
_LiteralDType[np.long],
|
| 274 |
+
):
|
| 275 |
+
@property
|
| 276 |
+
def name(self) -> L["int32", "int64"]: ...
|
| 277 |
+
@property
|
| 278 |
+
def str(self) -> L["<i4", ">i4", "<i8", ">i8"]: ...
|
| 279 |
+
|
| 280 |
+
@final
|
| 281 |
+
class ULongDType( # type: ignore[misc]
|
| 282 |
+
_TypeCodes[L["u"], L["L"], L[8]],
|
| 283 |
+
_NativeOrder,
|
| 284 |
+
_NBit[L[4, 8], L[4, 8]],
|
| 285 |
+
_LiteralDType[np.ulong],
|
| 286 |
+
):
|
| 287 |
+
@property
|
| 288 |
+
def name(self) -> L["uint32", "uint64"]: ...
|
| 289 |
+
@property
|
| 290 |
+
def str(self) -> L["<u4", ">u4", "<u8", ">u8"]: ...
|
| 291 |
+
|
| 292 |
+
@final
|
| 293 |
+
class LongLongDType( # type: ignore[misc]
|
| 294 |
+
_TypeCodes[L["i"], L["q"], L[9]],
|
| 295 |
+
_NativeOrder,
|
| 296 |
+
_NBit[L[8], L[8]],
|
| 297 |
+
_LiteralDType[np.longlong],
|
| 298 |
+
):
|
| 299 |
+
@property
|
| 300 |
+
def name(self) -> L["int64"]: ...
|
| 301 |
+
@property
|
| 302 |
+
def str(self) -> L["<i8", ">i8"]: ...
|
| 303 |
+
|
| 304 |
+
@final
|
| 305 |
+
class ULongLongDType( # type: ignore[misc]
|
| 306 |
+
_TypeCodes[L["u"], L["Q"], L[10]],
|
| 307 |
+
_NativeOrder,
|
| 308 |
+
_NBit[L[8], L[8]],
|
| 309 |
+
_LiteralDType[np.ulonglong],
|
| 310 |
+
):
|
| 311 |
+
@property
|
| 312 |
+
def name(self) -> L["uint64"]: ...
|
| 313 |
+
@property
|
| 314 |
+
def str(self) -> L["<u8", ">u8"]: ...
|
| 315 |
+
|
| 316 |
+
# Floats:
|
| 317 |
+
|
| 318 |
+
@final
|
| 319 |
+
class Float16DType( # type: ignore[misc]
|
| 320 |
+
_TypeCodes[L["f"], L["e"], L[23]],
|
| 321 |
+
_NativeOrder,
|
| 322 |
+
_NBit[L[2], L[2]],
|
| 323 |
+
_LiteralDType[np.float16],
|
| 324 |
+
):
|
| 325 |
+
@property
|
| 326 |
+
def name(self) -> L["float16"]: ...
|
| 327 |
+
@property
|
| 328 |
+
def str(self) -> L["<f2", ">f2"]: ...
|
| 329 |
+
|
| 330 |
+
@final
|
| 331 |
+
class Float32DType( # type: ignore[misc]
|
| 332 |
+
_TypeCodes[L["f"], L["f"], L[11]],
|
| 333 |
+
_NativeOrder,
|
| 334 |
+
_NBit[L[4], L[4]],
|
| 335 |
+
_LiteralDType[np.float32],
|
| 336 |
+
):
|
| 337 |
+
@property
|
| 338 |
+
def name(self) -> L["float32"]: ...
|
| 339 |
+
@property
|
| 340 |
+
def str(self) -> L["<f4", ">f4"]: ...
|
| 341 |
+
|
| 342 |
+
@final
|
| 343 |
+
class Float64DType( # type: ignore[misc]
|
| 344 |
+
_TypeCodes[L["f"], L["d"], L[12]],
|
| 345 |
+
_NativeOrder,
|
| 346 |
+
_NBit[L[8], L[8]],
|
| 347 |
+
_LiteralDType[np.float64],
|
| 348 |
+
):
|
| 349 |
+
@property
|
| 350 |
+
def name(self) -> L["float64"]: ...
|
| 351 |
+
@property
|
| 352 |
+
def str(self) -> L["<f8", ">f8"]: ...
|
| 353 |
+
|
| 354 |
+
@final
|
| 355 |
+
class LongDoubleDType( # type: ignore[misc]
|
| 356 |
+
_TypeCodes[L["f"], L["g"], L[13]],
|
| 357 |
+
_NativeOrder,
|
| 358 |
+
_NBit[L[8, 12, 16], L[8, 12, 16]],
|
| 359 |
+
_LiteralDType[np.longdouble],
|
| 360 |
+
):
|
| 361 |
+
@property
|
| 362 |
+
def name(self) -> L["float64", "float96", "float128"]: ...
|
| 363 |
+
@property
|
| 364 |
+
def str(self) -> L["<f8", ">f8", "<f12", ">f12", "<f16", ">f16"]: ...
|
| 365 |
+
|
| 366 |
+
# Complex:
|
| 367 |
+
|
| 368 |
+
@final
|
| 369 |
+
class Complex64DType( # type: ignore[misc]
|
| 370 |
+
_TypeCodes[L["c"], L["F"], L[14]],
|
| 371 |
+
_NativeOrder,
|
| 372 |
+
_NBit[L[4], L[8]],
|
| 373 |
+
_LiteralDType[np.complex64],
|
| 374 |
+
):
|
| 375 |
+
@property
|
| 376 |
+
def name(self) -> L["complex64"]: ...
|
| 377 |
+
@property
|
| 378 |
+
def str(self) -> L["<c8", ">c8"]: ...
|
| 379 |
+
|
| 380 |
+
@final
|
| 381 |
+
class Complex128DType( # type: ignore[misc]
|
| 382 |
+
_TypeCodes[L["c"], L["D"], L[15]],
|
| 383 |
+
_NativeOrder,
|
| 384 |
+
_NBit[L[8], L[16]],
|
| 385 |
+
_LiteralDType[np.complex128],
|
| 386 |
+
):
|
| 387 |
+
@property
|
| 388 |
+
def name(self) -> L["complex128"]: ...
|
| 389 |
+
@property
|
| 390 |
+
def str(self) -> L["<c16", ">c16"]: ...
|
| 391 |
+
|
| 392 |
+
@final
|
| 393 |
+
class CLongDoubleDType( # type: ignore[misc]
|
| 394 |
+
_TypeCodes[L["c"], L["G"], L[16]],
|
| 395 |
+
_NativeOrder,
|
| 396 |
+
_NBit[L[8, 12, 16], L[16, 24, 32]],
|
| 397 |
+
_LiteralDType[np.clongdouble],
|
| 398 |
+
):
|
| 399 |
+
@property
|
| 400 |
+
def name(self) -> L["complex128", "complex192", "complex256"]: ...
|
| 401 |
+
@property
|
| 402 |
+
def str(self) -> L["<c16", ">c16", "<c24", ">c24", "<c32", ">c32"]: ...
|
| 403 |
+
|
| 404 |
+
# Python objects:
|
| 405 |
+
|
| 406 |
+
@final
|
| 407 |
+
class ObjectDType( # type: ignore[misc]
|
| 408 |
+
_TypeCodes[L["O"], L["O"], L[17]],
|
| 409 |
+
_NoOrder,
|
| 410 |
+
_NBit[L[8], L[8]],
|
| 411 |
+
_SimpleDType[np.object_],
|
| 412 |
+
):
|
| 413 |
+
@property
|
| 414 |
+
def hasobject(self) -> L[True]: ...
|
| 415 |
+
@property
|
| 416 |
+
def name(self) -> L["object"]: ...
|
| 417 |
+
@property
|
| 418 |
+
def str(self) -> L["|O"]: ...
|
| 419 |
+
|
| 420 |
+
# Flexible:
|
| 421 |
+
|
| 422 |
+
@final
|
| 423 |
+
class BytesDType( # type: ignore[misc]
|
| 424 |
+
_TypeCodes[L["S"], L["S"], L[18]],
|
| 425 |
+
_NoOrder,
|
| 426 |
+
_NBit[L[1], _ItemSizeT_co],
|
| 427 |
+
_SimpleDType[np.bytes_],
|
| 428 |
+
Generic[_ItemSizeT_co],
|
| 429 |
+
):
|
| 430 |
+
def __new__[ItemSizeT: int](cls, size: ItemSizeT, /) -> BytesDType[ItemSizeT]: ...
|
| 431 |
+
@property
|
| 432 |
+
def hasobject(self) -> L[False]: ...
|
| 433 |
+
@property
|
| 434 |
+
def name(self) -> LiteralString: ...
|
| 435 |
+
@property
|
| 436 |
+
def str(self) -> LiteralString: ...
|
| 437 |
+
|
| 438 |
+
@final
|
| 439 |
+
class StrDType( # type: ignore[misc]
|
| 440 |
+
_TypeCodes[L["U"], L["U"], L[19]],
|
| 441 |
+
_NativeOrder,
|
| 442 |
+
_NBit[L[4], _ItemSizeT_co],
|
| 443 |
+
_SimpleDType[np.str_],
|
| 444 |
+
Generic[_ItemSizeT_co],
|
| 445 |
+
):
|
| 446 |
+
def __new__[ItemSizeT: int](cls, size: ItemSizeT, /) -> StrDType[ItemSizeT]: ...
|
| 447 |
+
@property
|
| 448 |
+
def hasobject(self) -> L[False]: ...
|
| 449 |
+
@property
|
| 450 |
+
def name(self) -> LiteralString: ...
|
| 451 |
+
@property
|
| 452 |
+
def str(self) -> LiteralString: ...
|
| 453 |
+
|
| 454 |
+
@final
|
| 455 |
+
class VoidDType( # type: ignore[misc]
|
| 456 |
+
_TypeCodes[L["V"], L["V"], L[20]],
|
| 457 |
+
_NoOrder,
|
| 458 |
+
_NBit[L[1], _ItemSizeT_co],
|
| 459 |
+
np.dtype[np.void], # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore[invalid-inheritance]
|
| 460 |
+
Generic[_ItemSizeT_co],
|
| 461 |
+
):
|
| 462 |
+
# NOTE: `VoidDType(...)` raises a `TypeError` at the moment
|
| 463 |
+
def __new__(cls, length: _ItemSizeT_co, /) -> NoReturn: ...
|
| 464 |
+
@property
|
| 465 |
+
def base(self) -> Self: ...
|
| 466 |
+
@property
|
| 467 |
+
def isalignedstruct(self) -> L[False]: ...
|
| 468 |
+
@property
|
| 469 |
+
def isnative(self) -> L[True]: ...
|
| 470 |
+
@property
|
| 471 |
+
def ndim(self) -> L[0]: ...
|
| 472 |
+
@property
|
| 473 |
+
def shape(self) -> tuple[()]: ...
|
| 474 |
+
@property
|
| 475 |
+
def subdtype(self) -> None: ...
|
| 476 |
+
@property
|
| 477 |
+
def name(self) -> LiteralString: ...
|
| 478 |
+
@property
|
| 479 |
+
def str(self) -> LiteralString: ...
|
| 480 |
+
|
| 481 |
+
# Other:
|
| 482 |
+
|
| 483 |
+
type _DateUnit = L["Y", "M", "W", "D"]
|
| 484 |
+
type _TimeUnit = L["h", "m", "s", "ms", "us", "ns", "ps", "fs", "as"]
|
| 485 |
+
type _DateTimeUnit = _DateUnit | _TimeUnit
|
| 486 |
+
|
| 487 |
+
@final
|
| 488 |
+
class DateTime64DType( # type: ignore[misc]
|
| 489 |
+
_TypeCodes[L["M"], L["M"], L[21]],
|
| 490 |
+
_NativeOrder,
|
| 491 |
+
_NBit[L[8], L[8]],
|
| 492 |
+
_LiteralDType[np.datetime64],
|
| 493 |
+
):
|
| 494 |
+
# NOTE: `DateTime64DType(...)` raises a `TypeError` at the moment
|
| 495 |
+
# TODO: Once implemented, don't forget the`unit: L["μs"]` overload.
|
| 496 |
+
def __new__(cls, unit: _DateTimeUnit, /) -> NoReturn: ...
|
| 497 |
+
@property
|
| 498 |
+
def name(self) -> L[
|
| 499 |
+
"datetime64",
|
| 500 |
+
"datetime64[Y]",
|
| 501 |
+
"datetime64[M]",
|
| 502 |
+
"datetime64[W]",
|
| 503 |
+
"datetime64[D]",
|
| 504 |
+
"datetime64[h]",
|
| 505 |
+
"datetime64[m]",
|
| 506 |
+
"datetime64[s]",
|
| 507 |
+
"datetime64[ms]",
|
| 508 |
+
"datetime64[us]",
|
| 509 |
+
"datetime64[ns]",
|
| 510 |
+
"datetime64[ps]",
|
| 511 |
+
"datetime64[fs]",
|
| 512 |
+
"datetime64[as]",
|
| 513 |
+
]: ...
|
| 514 |
+
@property
|
| 515 |
+
def str(self) -> L[
|
| 516 |
+
"<M8", ">M8",
|
| 517 |
+
"<M8[Y]", ">M8[Y]",
|
| 518 |
+
"<M8[M]", ">M8[M]",
|
| 519 |
+
"<M8[W]", ">M8[W]",
|
| 520 |
+
"<M8[D]", ">M8[D]",
|
| 521 |
+
"<M8[h]", ">M8[h]",
|
| 522 |
+
"<M8[m]", ">M8[m]",
|
| 523 |
+
"<M8[s]", ">M8[s]",
|
| 524 |
+
"<M8[ms]", ">M8[ms]",
|
| 525 |
+
"<M8[us]", ">M8[us]",
|
| 526 |
+
"<M8[ns]", ">M8[ns]",
|
| 527 |
+
"<M8[ps]", ">M8[ps]",
|
| 528 |
+
"<M8[fs]", ">M8[fs]",
|
| 529 |
+
"<M8[as]", ">M8[as]",
|
| 530 |
+
]: ...
|
| 531 |
+
|
| 532 |
+
@final
|
| 533 |
+
class TimeDelta64DType( # type: ignore[misc]
|
| 534 |
+
_TypeCodes[L["m"], L["m"], L[22]],
|
| 535 |
+
_NativeOrder,
|
| 536 |
+
_NBit[L[8], L[8]],
|
| 537 |
+
_LiteralDType[np.timedelta64],
|
| 538 |
+
):
|
| 539 |
+
# NOTE: `TimeDelta64DType(...)` raises a `TypeError` at the moment
|
| 540 |
+
# TODO: Once implemented, don't forget to overload on `unit: L["μs"]`.
|
| 541 |
+
def __new__(cls, unit: _DateTimeUnit, /) -> NoReturn: ...
|
| 542 |
+
@property
|
| 543 |
+
def name(self) -> L[
|
| 544 |
+
"timedelta64",
|
| 545 |
+
"timedelta64[Y]",
|
| 546 |
+
"timedelta64[M]",
|
| 547 |
+
"timedelta64[W]",
|
| 548 |
+
"timedelta64[D]",
|
| 549 |
+
"timedelta64[h]",
|
| 550 |
+
"timedelta64[m]",
|
| 551 |
+
"timedelta64[s]",
|
| 552 |
+
"timedelta64[ms]",
|
| 553 |
+
"timedelta64[us]",
|
| 554 |
+
"timedelta64[ns]",
|
| 555 |
+
"timedelta64[ps]",
|
| 556 |
+
"timedelta64[fs]",
|
| 557 |
+
"timedelta64[as]",
|
| 558 |
+
]: ...
|
| 559 |
+
@property
|
| 560 |
+
def str(self) -> L[
|
| 561 |
+
"<m8", ">m8",
|
| 562 |
+
"<m8[Y]", ">m8[Y]",
|
| 563 |
+
"<m8[M]", ">m8[M]",
|
| 564 |
+
"<m8[W]", ">m8[W]",
|
| 565 |
+
"<m8[D]", ">m8[D]",
|
| 566 |
+
"<m8[h]", ">m8[h]",
|
| 567 |
+
"<m8[m]", ">m8[m]",
|
| 568 |
+
"<m8[s]", ">m8[s]",
|
| 569 |
+
"<m8[ms]", ">m8[ms]",
|
| 570 |
+
"<m8[us]", ">m8[us]",
|
| 571 |
+
"<m8[ns]", ">m8[ns]",
|
| 572 |
+
"<m8[ps]", ">m8[ps]",
|
| 573 |
+
"<m8[fs]", ">m8[fs]",
|
| 574 |
+
"<m8[as]", ">m8[as]",
|
| 575 |
+
]: ...
|
| 576 |
+
|
| 577 |
+
@final
|
| 578 |
+
class StringDType( # type: ignore[misc]
|
| 579 |
+
_TypeCodes[L["T"], L["T"], L[2056]],
|
| 580 |
+
_NativeOrder,
|
| 581 |
+
_NBit[L[8], L[16]],
|
| 582 |
+
# TODO(jorenham): change once we have a string scalar type:
|
| 583 |
+
# https://github.com/numpy/numpy/issues/28165
|
| 584 |
+
np.dtype[str], # type: ignore[type-var] # pyright: ignore[reportGeneralTypeIssues, reportInvalidTypeArguments]
|
| 585 |
+
Generic[_NaObjectT_co],
|
| 586 |
+
):
|
| 587 |
+
@property
|
| 588 |
+
def na_object(self) -> _NaObjectT_co: ...
|
| 589 |
+
@property
|
| 590 |
+
def coerce(self) -> L[True]: ...
|
| 591 |
+
|
| 592 |
+
#
|
| 593 |
+
@overload
|
| 594 |
+
def __new__(cls, /, *, coerce: bool = True) -> Self: ...
|
| 595 |
+
@overload
|
| 596 |
+
def __new__(cls, /, *, na_object: _NaObjectT_co, coerce: bool = True) -> Self: ...
|
| 597 |
+
|
| 598 |
+
#
|
| 599 |
+
def __getitem__(self, key: Never, /) -> NoReturn: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
|
| 600 |
+
@property
|
| 601 |
+
def fields(self) -> None: ...
|
| 602 |
+
@property
|
| 603 |
+
def base(self) -> Self: ...
|
| 604 |
+
@property
|
| 605 |
+
def ndim(self) -> L[0]: ...
|
| 606 |
+
@property
|
| 607 |
+
def shape(self) -> tuple[()]: ...
|
| 608 |
+
|
| 609 |
+
#
|
| 610 |
+
@property
|
| 611 |
+
def name(self) -> L["StringDType64", "StringDType128"]: ...
|
| 612 |
+
@property
|
| 613 |
+
def subdtype(self) -> None: ...
|
| 614 |
+
@property
|
| 615 |
+
def type(self) -> py_type[py_str]: ...
|
| 616 |
+
@property
|
| 617 |
+
def str(self) -> L["|T8", "|T16"]: ...
|
| 618 |
+
|
| 619 |
+
#
|
| 620 |
+
@property
|
| 621 |
+
def hasobject(self) -> L[True]: ...
|
| 622 |
+
@property
|
| 623 |
+
def isalignedstruct(self) -> L[False]: ...
|
| 624 |
+
@property
|
| 625 |
+
def isnative(self) -> L[True]: ...
|
| 626 |
+
|
| 627 |
+
def register_dlpack_dtype(dlpack_key: tuple[int, int], dtype: np.dtype, /) -> None: ...
|
qwen3.8-27b/.venv/lib/python3.12/site-packages/typing_extensions.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
qwen3.8-27b/.venv/pyvenv.cfg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
home = /usr/local/bin
|
| 2 |
+
implementation = CPython
|
| 3 |
+
uv = 0.12.12
|
| 4 |
+
version_info = 3.12.3
|
| 5 |
+
include-system-site-packages = false
|
| 6 |
+
prompt = qwen3.8-27b
|