content stringlengths 1 103k ⌀ | path stringlengths 8 216 | filename stringlengths 2 179 | language stringclasses 15
values | size_bytes int64 2 189k | quality_score float64 0.5 0.95 | complexity float64 0 1 | documentation_ratio float64 0 1 | repository stringclasses 5
values | stars int64 0 1k | created_date stringdate 2023-07-10 19:21:08 2025-07-09 19:11:45 | license stringclasses 4
values | is_test bool 2
classes | file_hash stringlengths 32 32 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
import sys\nfrom importlib.util import LazyLoader, find_spec, module_from_spec\n\nimport pytest\n\n\n# Warning raised by _reload_guard() in numpy/__init__.py\n@pytest.mark.filterwarnings("ignore:The NumPy module was reloaded")\ndef test_lazy_load():\n # gh-22045. lazyload doesn't import submodule names into the name... | .venv\Lib\site-packages\numpy\tests\test_lazyloading.py | test_lazyloading.py | Python | 1,198 | 0.95 | 0.131579 | 0.2 | python-kit | 560 | 2023-10-10T23:05:29.893450 | Apache-2.0 | true | c49d4e770bcddec6f081c309219c81ba |
import numpy as np\nimport numpy.matlib\nfrom numpy.testing import assert_, assert_array_equal\n\n\ndef test_empty():\n x = numpy.matlib.empty((2,))\n assert_(isinstance(x, np.matrix))\n assert_(x.shape, (1, 2))\n\ndef test_ones():\n assert_array_equal(numpy.matlib.ones((2, 3)),\n np.m... | .venv\Lib\site-packages\numpy\tests\test_matlib.py | test_matlib.py | Python | 1,913 | 0.95 | 0.135593 | 0.042553 | awesome-app | 404 | 2025-01-03T15:39:15.647146 | MIT | true | 40623a9126da8469057ba95676cf031c |
"""\nCheck the numpy config is valid.\n"""\nfrom unittest.mock import patch\n\nimport pytest\n\nimport numpy as np\n\npytestmark = pytest.mark.skipif(\n not hasattr(np.__config__, "_built_with_meson"),\n reason="Requires Meson builds",\n)\n\n\nclass TestNumPyConfigs:\n REQUIRED_CONFIG_KEYS = [\n "Compil... | .venv\Lib\site-packages\numpy\tests\test_numpy_config.py | test_numpy_config.py | Python | 1,281 | 0.85 | 0.152174 | 0 | vue-tools | 718 | 2024-03-11T04:34:09.952477 | GPL-3.0 | true | 7895d6cf39a5aee69d5b803a85413eb8 |
"""\nCheck the numpy version is valid.\n\nNote that a development version is marked by the presence of 'dev0' or '+'\nin the version string, all else is treated as a release. The version string\nitself is set from the output of ``git describe`` which relies on tags.\n\nExamples\n--------\n\nValid Development: 1.22.0.de... | .venv\Lib\site-packages\numpy\tests\test_numpy_version.py | test_numpy_version.py | Python | 1,798 | 0.95 | 0.12963 | 0.073171 | react-lib | 156 | 2024-11-13T04:53:26.294913 | BSD-3-Clause | true | 91bfaabddb43889846cb750251c97381 |
import functools\nimport importlib\nimport inspect\nimport pkgutil\nimport subprocess\nimport sys\nimport sysconfig\nimport types\nimport warnings\n\nimport pytest\n\nimport numpy\nimport numpy as np\nfrom numpy.testing import IS_WASM\n\ntry:\n import ctypes\nexcept ImportError:\n ctypes = None\n\n\ndef check_dir... | .venv\Lib\site-packages\numpy\tests\test_public_api.py | test_public_api.py | Python | 28,657 | 0.95 | 0.151365 | 0.090909 | react-lib | 628 | 2025-01-21T01:49:50.913852 | BSD-3-Clause | true | 2c39250d90bc692ba1f2f03049b7e236 |
import pickle\nimport subprocess\nimport sys\nimport textwrap\nfrom importlib import reload\n\nimport pytest\n\nimport numpy.exceptions as ex\nfrom numpy.testing import (\n IS_WASM,\n assert_,\n assert_equal,\n assert_raises,\n assert_warns,\n)\n\n\ndef test_numpy_reloading():\n # gh-7844. Also check ... | .venv\Lib\site-packages\numpy\tests\test_reloading.py | test_reloading.py | Python | 2,441 | 0.95 | 0.108108 | 0.064516 | vue-tools | 204 | 2024-03-10T12:58:25.869263 | GPL-3.0 | true | d30960347c8a5f68ca9acf1d7d64b697 |
""" Test scripts\n\nTest that we can run executable scripts that have been installed with numpy.\n"""\nimport os\nimport subprocess\nimport sys\nfrom os.path import dirname, isfile\nfrom os.path import join as pathjoin\n\nimport pytest\n\nimport numpy as np\nfrom numpy.testing import IS_WASM, assert_equal\n\nis_inplace... | .venv\Lib\site-packages\numpy\tests\test_scripts.py | test_scripts.py | Python | 1,714 | 0.95 | 0.122449 | 0.128205 | vue-tools | 558 | 2024-09-18T05:17:07.764769 | BSD-3-Clause | true | e3c8ab9e6975292cf41d34e355533896 |
"""\nTests which scan for certain occurrences in the code, they may not find\nall of these occurrences but should catch almost all.\n"""\nimport ast\nimport tokenize\nfrom pathlib import Path\n\nimport pytest\n\nimport numpy\n\n\nclass ParseCall(ast.NodeVisitor):\n def __init__(self):\n self.ls = []\n\n de... | .venv\Lib\site-packages\numpy\tests\test_warnings.py | test_warnings.py | Python | 2,406 | 0.95 | 0.294872 | 0.080645 | vue-tools | 9 | 2024-03-22T01:03:05.796554 | Apache-2.0 | true | 9cb657512c2bdfcd8d0878a6a1f70449 |
\nimport collections\n\nimport numpy as np\n\n\ndef test_no_duplicates_in_np__all__():\n # Regression test for gh-10198.\n dups = {k: v for k, v in collections.Counter(np.__all__).items() if v > 1}\n assert len(dups) == 0\n | .venv\Lib\site-packages\numpy\tests\test__all__.py | test__all__.py | Python | 232 | 0.95 | 0.4 | 0.166667 | react-lib | 156 | 2025-06-06T22:56:10.683755 | BSD-3-Clause | true | 1aae8a09cf4d5aae2db31e3807003c58 |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_configtool.cpython-313.pyc | test_configtool.cpython-313.pyc | Other | 3,790 | 0.95 | 0 | 0 | python-kit | 910 | 2025-01-09T21:16:10.581694 | BSD-3-Clause | true | cb03032798620e1da471293d856948fd |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_ctypeslib.cpython-313.pyc | test_ctypeslib.cpython-313.pyc | Other | 22,016 | 0.95 | 0 | 0 | react-lib | 573 | 2024-02-11T19:41:25.605600 | BSD-3-Clause | true | 63c3287691744d700c3796bfd747393b |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_lazyloading.cpython-313.pyc | test_lazyloading.cpython-313.pyc | Other | 1,774 | 0.95 | 0 | 0 | node-utils | 653 | 2023-12-01T19:00:40.334118 | Apache-2.0 | true | c7f732fc23f57e10eaed9b4a052ca774 |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_matlib.cpython-313.pyc | test_matlib.cpython-313.pyc | Other | 4,225 | 0.8 | 0 | 0 | node-utils | 671 | 2025-02-04T14:49:28.673847 | MIT | true | 0c3af4b8c6b809910ec1dc5c7305be8b |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_numpy_config.cpython-313.pyc | test_numpy_config.cpython-313.pyc | Other | 2,963 | 0.95 | 0.02381 | 0.076923 | react-lib | 442 | 2023-10-08T02:47:11.669622 | Apache-2.0 | true | d82b4422cf1ec98c173ed220f90d7c14 |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_numpy_version.cpython-313.pyc | test_numpy_version.cpython-313.pyc | Other | 2,501 | 0.8 | 0 | 0 | react-lib | 351 | 2025-05-04T04:48:00.287253 | MIT | true | 9e9b44f924f7541257a95c6b4702fffa |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_public_api.cpython-313.pyc | test_public_api.cpython-313.pyc | Other | 25,200 | 0.95 | 0.06383 | 0.009174 | awesome-app | 856 | 2025-04-22T07:58:18.370133 | BSD-3-Clause | true | 5e65d30085f6b9953cc0aa665626035f |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_reloading.cpython-313.pyc | test_reloading.cpython-313.pyc | Other | 3,540 | 0.95 | 0.052632 | 0.075472 | python-kit | 61 | 2025-03-14T21:54:39.537593 | Apache-2.0 | true | 1dc849d9f8d6cfbc664242d41ff36620 |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_scripts.cpython-313.pyc | test_scripts.cpython-313.pyc | Other | 2,844 | 0.8 | 0 | 0 | awesome-app | 771 | 2025-06-22T23:31:01.386963 | Apache-2.0 | true | 2d92cb3841900157f170cc9fecba8aa7 |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test_warnings.cpython-313.pyc | test_warnings.cpython-313.pyc | Other | 4,441 | 0.8 | 0.057143 | 0 | python-kit | 269 | 2023-09-23T09:11:27.786567 | BSD-3-Clause | true | bf2170832e68f8619a4589dad98fd115 |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\test__all__.cpython-313.pyc | test__all__.cpython-313.pyc | Other | 712 | 0.7 | 0 | 0 | react-lib | 261 | 2025-04-01T19:59:33.784206 | Apache-2.0 | true | 68cb3fb13785adade9846fbc5efd0c94 |
\n\n | .venv\Lib\site-packages\numpy\tests\__pycache__\__init__.cpython-313.pyc | __init__.cpython-313.pyc | Other | 186 | 0.7 | 0 | 0 | awesome-app | 376 | 2024-01-05T22:02:36.785110 | BSD-3-Clause | true | ca0831a42c2235831b2642cddbc20a43 |
"""A mypy_ plugin for managing a number of platform-specific annotations.\nIts functionality can be split into three distinct parts:\n\n* Assigning the (platform-dependent) precisions of certain `~numpy.number`\n subclasses, including the likes of `~numpy.int_`, `~numpy.intp` and\n `~numpy.longlong`. See the document... | .venv\Lib\site-packages\numpy\typing\mypy_plugin.py | mypy_plugin.py | Python | 6,736 | 0.95 | 0.133333 | 0.084967 | python-kit | 737 | 2024-03-27T13:09:13.506441 | MIT | false | 23e5513871b3ed7641b0beced06d4c31 |
"""\n============================\nTyping (:mod:`numpy.typing`)\n============================\n\n.. versionadded:: 1.20\n\nLarge parts of the NumPy API have :pep:`484`-style type annotations. In\naddition a number of type aliases are available to users, most prominently\nthe two below:\n\n- `ArrayLike`: objects that ca... | .venv\Lib\site-packages\numpy\typing\__init__.py | __init__.py | Python | 6,249 | 0.95 | 0.074627 | 0.05036 | vue-tools | 223 | 2025-04-30T22:34:46.836553 | BSD-3-Clause | false | fc8b6f150411db9fa5f36ccdb938e4af |
import os\nimport sys\nfrom pathlib import Path\n\nimport numpy as np\nfrom numpy.testing import assert_\n\nROOT = Path(np.__file__).parents[0]\nFILES = [\n ROOT / "py.typed",\n ROOT / "__init__.pyi",\n ROOT / "ctypeslib" / "__init__.pyi",\n ROOT / "_core" / "__init__.pyi",\n ROOT / "f2py" / "__init__.py... | .venv\Lib\site-packages\numpy\typing\tests\test_isfile.py | test_isfile.py | Python | 910 | 0.85 | 0.15625 | 0 | react-lib | 898 | 2025-02-26T02:40:48.158600 | BSD-3-Clause | true | ebb34143ae66a66563c1ac5005206591 |
"""Test the runtime usage of `numpy.typing`."""\n\nfrom typing import (\n Any,\n NamedTuple,\n Union, # pyright: ignore[reportDeprecated]\n get_args,\n get_origin,\n get_type_hints,\n)\n\nimport pytest\n\nimport numpy as np\nimport numpy._typing as _npt\nimport numpy.typing as npt\n\n\nclass TypeTup(... | .venv\Lib\site-packages\numpy\typing\tests\test_runtime.py | test_runtime.py | Python | 3,021 | 0.95 | 0.117647 | 0 | react-lib | 71 | 2024-12-18T06:31:56.233409 | BSD-3-Clause | true | e348cd43e4d65656081c31a620478c3b |
import importlib.util\nimport os\nimport re\nimport shutil\nimport textwrap\nfrom collections import defaultdict\nfrom typing import TYPE_CHECKING\n\nimport pytest\n\n# Only trigger a full `mypy` run if this environment variable is set\n# Note that these tests tend to take over a minute even on a macOS M1 CPU,\n# and m... | .venv\Lib\site-packages\numpy\typing\tests\test_typing.py | test_typing.py | Python | 6,494 | 0.95 | 0.156098 | 0.075949 | python-kit | 634 | 2024-07-22T00:11:38.332660 | BSD-3-Clause | true | a24d1f3cfa590482cd0295149916cfb5 |
[mypy]\nenable_error_code = deprecated, ignore-without-code, truthy-bool\nstrict_bytes = True\nwarn_unused_ignores = True\nimplicit_reexport = False\ndisallow_any_unimported = True\ndisallow_any_generics = True\nshow_absolute_path = True\npretty = True\n | .venv\Lib\site-packages\numpy\typing\tests\data\mypy.ini | mypy.ini | Other | 254 | 0.85 | 0 | 0 | react-lib | 553 | 2023-12-28T21:18:27.475976 | BSD-3-Clause | true | be709efbed10dc11c4ce0d73dd2026ea |
from typing import Any\n\nimport numpy as np\nimport numpy.typing as npt\n\nb_ = np.bool()\ndt = np.datetime64(0, "D")\ntd = np.timedelta64(0, "D")\n\nAR_b: npt.NDArray[np.bool]\nAR_u: npt.NDArray[np.uint32]\nAR_i: npt.NDArray[np.int64]\nAR_f: npt.NDArray[np.longdouble]\nAR_c: npt.NDArray[np.complex128]\nAR_m: npt.NDAr... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\arithmetic.pyi | arithmetic.pyi | Other | 3,821 | 0.95 | 0.007937 | 0.072917 | react-lib | 854 | 2024-02-03T03:23:41.470995 | Apache-2.0 | true | 0eb29817f61c6ecbd3e556850c9bbda1 |
from collections.abc import Callable\nfrom typing import Any\n\nimport numpy as np\nimport numpy.typing as npt\n\nAR: npt.NDArray[np.float64]\nfunc1: Callable[[Any], str]\nfunc2: Callable[[np.integer], str]\n\nnp.array2string(AR, style=None) # type: ignore[call-overload]\nnp.array2string(AR, legacy="1.14") # type: ig... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\arrayprint.pyi | arrayprint.pyi | Other | 632 | 0.95 | 0 | 0 | react-lib | 991 | 2024-12-31T22:52:58.760305 | GPL-3.0 | true | e87ac459d2eef9fa8b26ae48db1a9556 |
import numpy as np\nimport numpy.typing as npt\n\nAR_i8: npt.NDArray[np.int64]\nar_iter = np.lib.Arrayterator(AR_i8)\n\nnp.lib.Arrayterator(np.int64()) # type: ignore[arg-type]\nar_iter.shape = (10, 5) # type: ignore[misc]\nar_iter[None] # type: ignore[index]\nar_iter[None, 1] # type: ignore[index]\nar_iter[np.intp... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\arrayterator.pyi | arrayterator.pyi | Other | 477 | 0.95 | 0 | 0 | python-kit | 225 | 2025-03-29T18:29:19.190811 | MIT | true | 720ceb7cb66e8712a366741f16b752de |
import numpy as np\nimport numpy.typing as npt\n\na: npt.NDArray[np.float64]\ngenerator = (i for i in range(10))\n\nnp.require(a, requirements=1) # type: ignore[call-overload]\nnp.require(a, requirements="TEST") # type: ignore[arg-type]\n\nnp.zeros("test") # type: ignore[arg-type]\nnp.zeros() # type: ignore[call-ov... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\array_constructors.pyi | array_constructors.pyi | Other | 1,234 | 0.95 | 0.029412 | 0 | vue-tools | 591 | 2023-11-09T07:44:10.807912 | BSD-3-Clause | true | fe38fa9da3afb17d5234f288b0978554 |
import numpy as np\nfrom numpy._typing import ArrayLike\n\nclass A: ...\n\nx1: ArrayLike = (i for i in range(10)) # type: ignore[assignment]\nx2: ArrayLike = A() # type: ignore[assignment]\nx3: ArrayLike = {1: "foo", 2: "bar"} # type: ignore[assignment]\n\nscalar = np.int64(1)\nscalar.__array__(dtype=np.float64) # ... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\array_like.pyi | array_like.pyi | Other | 511 | 0.95 | 0.133333 | 0 | vue-tools | 83 | 2023-08-06T19:11:45.384858 | MIT | true | ff76821092d686ad21ac96ede005922b |
import numpy as np\nimport numpy.typing as npt\n\nAR_i8: npt.NDArray[np.int64]\n\nnp.pad(AR_i8, 2, mode="bob") # type: ignore[call-overload]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\array_pad.pyi | array_pad.pyi | Other | 143 | 0.95 | 0 | 0 | awesome-app | 282 | 2024-01-23T14:19:16.369890 | GPL-3.0 | true | f2a45eb3119a25b15b0c8cccaa88423f |
import numpy as np\n\ni8 = np.int64()\ni4 = np.int32()\nu8 = np.uint64()\nb_ = np.bool()\ni = int()\n\nf8 = np.float64()\n\nb_ >> f8 # type: ignore[call-overload]\ni8 << f8 # type: ignore[call-overload]\ni | f8 # type: ignore[operator]\ni8 ^ f8 # type: ignore[call-overload]\nu8 & f8 # type: ignore[call-overload]\n... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\bitwise_ops.pyi | bitwise_ops.pyi | Other | 421 | 0.95 | 0 | 0.071429 | vue-tools | 712 | 2024-09-28T00:24:52.928237 | BSD-3-Clause | true | 33fd0d58a461c2f916bbe1e6030718a8 |
import numpy as np\nimport numpy.typing as npt\n\nAR_U: npt.NDArray[np.str_]\nAR_S: npt.NDArray[np.bytes_]\n\nnp.char.equal(AR_U, AR_S) # type: ignore[arg-type]\nnp.char.not_equal(AR_U, AR_S) # type: ignore[arg-type]\n\nnp.char.greater_equal(AR_U, AR_S) # type: ignore[arg-type]\nnp.char.less_equal(AR_U, AR_S) # typ... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\char.pyi | char.pyi | Other | 2,865 | 0.95 | 0 | 0 | python-kit | 266 | 2024-12-24T14:53:36.100286 | GPL-3.0 | true | 810224a447b21a2703cc133b992e289f |
from typing import Any\nimport numpy as np\n\nAR_U: np.char.chararray[tuple[Any, ...], np.dtype[np.str_]]\nAR_S: np.char.chararray[tuple[Any, ...], np.dtype[np.bytes_]]\n\nAR_S.encode() # type: ignore[misc]\nAR_U.decode() # type: ignore[misc]\n\nAR_U.join(b"_") # type: ignore[arg-type]\nAR_S.join("_") # type: ignor... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\chararray.pyi | chararray.pyi | Other | 2,418 | 0.95 | 0 | 0 | awesome-app | 888 | 2025-05-23T10:12:19.422826 | GPL-3.0 | true | 7fd53aaf6aa76ef5b6b148ef0a5d69c1 |
import numpy as np\nimport numpy.typing as npt\n\nAR_i: npt.NDArray[np.int64]\nAR_f: npt.NDArray[np.float64]\nAR_c: npt.NDArray[np.complex128]\nAR_m: npt.NDArray[np.timedelta64]\nAR_M: npt.NDArray[np.datetime64]\n\nAR_f > AR_m # type: ignore[operator]\nAR_c > AR_m # type: ignore[operator]\n\nAR_m > AR_f # type: igno... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\comparisons.pyi | comparisons.pyi | Other | 777 | 0.95 | 0 | 0 | node-utils | 131 | 2025-03-22T05:37:36.584121 | BSD-3-Clause | true | 718a1ebdddeff7e3ac7f6358d0049b58 |
import numpy as np\n\nnp.little_endian = np.little_endian # type: ignore[misc]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\constants.pyi | constants.pyi | Other | 81 | 0.75 | 0 | 0 | awesome-app | 846 | 2024-01-28T00:41:57.771560 | MIT | true | 0c1728236c8a932ccd80fc22346463bb |
from pathlib import Path\nimport numpy as np\n\npath: Path\nd1: np.lib.npyio.DataSource\n\nd1.abspath(path) # type: ignore[arg-type]\nd1.abspath(b"...") # type: ignore[arg-type]\n\nd1.exists(path) # type: ignore[arg-type]\nd1.exists(b"...") # type: ignore[arg-type]\n\nd1.open(path, "r") # type: ignore[arg-type]\nd... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\datasource.pyi | datasource.pyi | Other | 434 | 0.95 | 0 | 0 | node-utils | 302 | 2025-02-15T23:34:55.184586 | Apache-2.0 | true | 84985575163b403087208519326c0ba3 |
import numpy as np\n\nclass Test1:\n not_dtype = np.dtype(float)\n\nclass Test2:\n dtype = float\n\nnp.dtype(Test1()) # type: ignore[call-overload]\nnp.dtype(Test2()) # type: ignore[arg-type]\n\nnp.dtype( # type: ignore[call-overload]\n {\n "field1": (float, 1),\n "field2": (int, 3),\n }\n)... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\dtype.pyi | dtype.pyi | Other | 322 | 0.95 | 0.117647 | 0 | node-utils | 862 | 2025-02-22T19:38:00.480903 | Apache-2.0 | true | fc9b18eb296f3237c694462e1972713c |
import numpy as np\nimport numpy.typing as npt\n\nAR_i: npt.NDArray[np.int64]\nAR_f: npt.NDArray[np.float64]\nAR_m: npt.NDArray[np.timedelta64]\nAR_U: npt.NDArray[np.str_]\n\nnp.einsum("i,i->i", AR_i, AR_m) # type: ignore[arg-type]\nnp.einsum("i,i->i", AR_f, AR_f, dtype=np.int32) # type: ignore[arg-type]\nnp.einsum("... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\einsumfunc.pyi | einsumfunc.pyi | Other | 470 | 0.95 | 0 | 0 | node-utils | 195 | 2024-03-23T12:38:17.784235 | BSD-3-Clause | true | 0e29587bf32bc3bcbf618f624e0096d4 |
import numpy as np\nimport numpy._typing as npt\n\nclass Index:\n def __index__(self) -> int: ...\n\na: np.flatiter[npt.NDArray[np.float64]]\nsupports_array: npt._SupportsArray[np.dtype[np.float64]]\n\na.base = object() # type: ignore[assignment, misc]\na.coords = object() # type: ignore[assignment, misc]\na.index... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\flatiter.pyi | flatiter.pyi | Other | 735 | 0.95 | 0.1 | 0.1875 | vue-tools | 211 | 2023-10-27T22:47:47.422674 | MIT | true | a7a98ecfa8294bee4daf5ce1749e751a |
"""Tests for :mod:`numpy._core.fromnumeric`."""\n\nimport numpy as np\nimport numpy.typing as npt\n\nA = np.array(True, ndmin=2, dtype=bool)\nA.setflags(write=False)\nAR_U: npt.NDArray[np.str_]\nAR_M: npt.NDArray[np.datetime64]\nAR_f4: npt.NDArray[np.float32]\n\na = np.bool(True)\n\nnp.take(a, None) # type: ignore[cal... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\fromnumeric.pyi | fromnumeric.pyi | Other | 5,833 | 0.95 | 0.006757 | 0 | vue-tools | 678 | 2024-01-11T19:03:08.852018 | Apache-2.0 | true | bfe07743898c42ffb8a7ef49059bffcf |
import numpy as np\nimport numpy.typing as npt\n\nAR_i8: npt.NDArray[np.int64]\nAR_f8: npt.NDArray[np.float64]\n\nnp.histogram_bin_edges(AR_i8, range=(0, 1, 2)) # type: ignore[arg-type]\n\nnp.histogram(AR_i8, range=(0, 1, 2)) # type: ignore[arg-type]\n\nnp.histogramdd(AR_i8, range=(0, 1)) # type: ignore[arg-type]\nn... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\histograms.pyi | histograms.pyi | Other | 388 | 0.95 | 0 | 0 | awesome-app | 903 | 2025-01-22T10:58:58.839105 | Apache-2.0 | true | 83470ab86859362a2928a39cbd32d20a |
import numpy as np\n\nAR_LIKE_i: list[int]\nAR_LIKE_f: list[float]\n\nnp.ndindex([1, 2, 3]) # type: ignore[call-overload]\nnp.unravel_index(AR_LIKE_f, (1, 2, 3)) # type: ignore[arg-type]\nnp.ravel_multi_index(AR_LIKE_i, (1, 2, 3), mode="bob") # type: ignore[call-overload]\nnp.mgrid[1] # type: ignore[index]\nnp.mgri... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\index_tricks.pyi | index_tricks.pyi | Other | 531 | 0.95 | 0 | 0 | node-utils | 638 | 2024-04-07T21:08:51.365975 | Apache-2.0 | true | ca778147b0814b86b9b03c8b88a30590 |
from typing import Any\n\nimport numpy as np\nimport numpy.typing as npt\n\nAR_f8: npt.NDArray[np.float64]\nAR_c16: npt.NDArray[np.complex128]\nAR_m: npt.NDArray[np.timedelta64]\nAR_M: npt.NDArray[np.datetime64]\nAR_O: npt.NDArray[np.object_]\nAR_b_list: list[npt.NDArray[np.bool]]\n\ndef fn_none_i(a: None, /) -> npt.ND... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\lib_function_base.pyi | lib_function_base.pyi | Other | 2,879 | 0.95 | 0.048387 | 0.12963 | awesome-app | 530 | 2025-04-17T13:04:55.872711 | BSD-3-Clause | true | 65c330398ae80c55853163fd94cfae0a |
import numpy as np\nimport numpy.typing as npt\n\nAR_f8: npt.NDArray[np.float64]\nAR_c16: npt.NDArray[np.complex128]\nAR_O: npt.NDArray[np.object_]\nAR_U: npt.NDArray[np.str_]\n\npoly_obj: np.poly1d\n\nnp.polymul(AR_f8, AR_U) # type: ignore[arg-type]\nnp.polydiv(AR_f8, AR_U) # type: ignore[arg-type]\n\n5**poly_obj #... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\lib_polynomial.pyi | lib_polynomial.pyi | Other | 966 | 0.95 | 0 | 0 | react-lib | 245 | 2024-07-04T12:24:30.564358 | BSD-3-Clause | true | 768d54b2dfef8cf18eca6d35573fab76 |
import numpy.lib.array_utils as array_utils\n\narray_utils.byte_bounds(1) # type: ignore[arg-type]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\lib_utils.pyi | lib_utils.pyi | Other | 101 | 0.75 | 0 | 0 | react-lib | 427 | 2025-06-15T18:28:12.045031 | BSD-3-Clause | true | 6d6aaba091e8dfc518d6eb09942c266a |
from numpy.lib import NumpyVersion\n\nversion: NumpyVersion\n\nNumpyVersion(b"1.8.0") # type: ignore[arg-type]\nversion >= b"1.8.0" # type: ignore[operator]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\lib_version.pyi | lib_version.pyi | Other | 160 | 0.95 | 0 | 0 | node-utils | 511 | 2025-06-28T20:28:52.853233 | BSD-3-Clause | true | b7c8f99e15c7342e13b79f714d232b51 |
import numpy as np\nimport numpy.typing as npt\n\nAR_f8: npt.NDArray[np.float64]\nAR_O: npt.NDArray[np.object_]\nAR_M: npt.NDArray[np.datetime64]\n\nnp.linalg.tensorsolve(AR_O, AR_O) # type: ignore[arg-type]\n\nnp.linalg.solve(AR_O, AR_O) # type: ignore[arg-type]\n\nnp.linalg.tensorinv(AR_O) # type: ignore[arg-type]... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\linalg.pyi | linalg.pyi | Other | 1,429 | 0.95 | 0 | 0 | vue-tools | 281 | 2024-05-27T11:35:22.911213 | Apache-2.0 | true | ca228239494061c389a8536dff6be96f |
from typing import TypeAlias, TypeVar\n\nimport numpy as np\nimport numpy.typing as npt\nfrom numpy._typing import _Shape\n\n_ScalarT = TypeVar("_ScalarT", bound=np.generic)\nMaskedArray: TypeAlias = np.ma.MaskedArray[_Shape, np.dtype[_ScalarT]]\n\nMAR_1d_f8: np.ma.MaskedArray[tuple[int], np.dtype[np.float64]]\nMAR_b: ... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\ma.pyi | ma.pyi | Other | 6,507 | 0.95 | 0 | 0 | awesome-app | 489 | 2024-06-21T08:20:41.009982 | BSD-3-Clause | true | db48c28d2f2bed4140ca0ca35e0201fc |
import numpy as np\n\nwith open("file.txt", "r") as f:\n np.memmap(f) # type: ignore[call-overload]\nnp.memmap("test.txt", shape=[10, 5]) # type: ignore[call-overload]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\memmap.pyi | memmap.pyi | Other | 174 | 0.95 | 0 | 0 | awesome-app | 752 | 2024-06-29T05:09:30.013001 | GPL-3.0 | true | b6356117800b3634653310323d48067c |
import numpy as np\n\nnp.testing.bob # type: ignore[attr-defined]\nnp.bob # type: ignore[attr-defined]\n\n# Stdlib modules in the namespace by accident\nnp.warnings # type: ignore[attr-defined]\nnp.sys # type: ignore[attr-defined]\nnp.os # type: ignore[attr-defined]\nnp.math # type: ignore[attr-defined]\n\n# Publ... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\modules.pyi | modules.pyi | Other | 620 | 0.95 | 0 | 0.230769 | node-utils | 905 | 2023-09-13T15:36:44.817295 | Apache-2.0 | true | 732a547e42500b0cadb9127a56375bf1 |
import numpy as np\nimport numpy.typing as npt\n\ni8: np.int64\n\nAR_b: npt.NDArray[np.bool]\nAR_u1: npt.NDArray[np.uint8]\nAR_i8: npt.NDArray[np.int64]\nAR_f8: npt.NDArray[np.float64]\nAR_M: npt.NDArray[np.datetime64]\n\nM: np.datetime64\n\nAR_LIKE_f: list[float]\n\ndef func(a: int) -> None: ...\n\nnp.where(AR_b, 1) ... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\multiarray.pyi | multiarray.pyi | Other | 1,708 | 0.95 | 0.019231 | 0 | node-utils | 245 | 2024-01-02T12:02:45.775045 | BSD-3-Clause | true | 867d20c8d1d7fc5dad343bc9578afcd7 |
import numpy as np\n\n# Ban setting dtype since mutating the type of the array in place\n# makes having ndarray be generic over dtype impossible. Generally\n# users should use `ndarray.view` in this situation anyway. See\n#\n# https://github.com/numpy/numpy-stubs/issues/7\n#\n# for more context.\nfloat_array = np.array... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\ndarray.pyi | ndarray.pyi | Other | 392 | 0.95 | 0.090909 | 0.7 | react-lib | 921 | 2024-10-20T12:46:30.305265 | Apache-2.0 | true | fd1aaaf433ac2e59dfabe9a0ec02f15f |
"""\nTests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods.\n\nMore extensive tests are performed for the methods'\nfunction-based counterpart in `../from_numeric.py`.\n\n"""\n\nimport numpy as np\nimport numpy.typing as npt\n\nf8: np.float64\nAR_f8: npt.NDArray[np.float64]\nAR_M: npt.NDArray[np.dat... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\ndarray_misc.pyi | ndarray_misc.pyi | Other | 1,097 | 0.95 | 0.083333 | 0 | awesome-app | 481 | 2025-03-25T13:36:04.591933 | MIT | true | a629ddca48b001d5c939f6233581843d |
import numpy as np\n\nclass Test(np.nditer): ... # type: ignore[misc]\n\nnp.nditer([0, 1], flags=["test"]) # type: ignore[list-item]\nnp.nditer([0, 1], op_flags=[["test"]]) # type: ignore[list-item]\nnp.nditer([0, 1], itershape=(1.0,)) # type: ignore[arg-type]\nnp.nditer([0, 1], buffersize=1.0) # type: ignore[arg-... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\nditer.pyi | nditer.pyi | Other | 327 | 0.95 | 0.125 | 0 | python-kit | 192 | 2024-10-01T15:40:42.710747 | BSD-3-Clause | true | cbd7e6bdfd01afd6ac11476b51fa88fe |
from collections.abc import Sequence\nfrom numpy._typing import _NestedSequence\n\na: Sequence[float]\nb: list[complex]\nc: tuple[str, ...]\nd: int\ne: str\n\ndef func(a: _NestedSequence[int]) -> None: ...\n\nreveal_type(func(a)) # type: ignore[arg-type, misc]\nreveal_type(func(b)) # type: ignore[arg-type, misc]\nrev... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\nested_sequence.pyi | nested_sequence.pyi | Other | 479 | 0.95 | 0.0625 | 0 | vue-tools | 910 | 2024-03-09T14:54:09.873700 | Apache-2.0 | true | b708f35956f2ae8ca12bb0da6824fef1 |
import pathlib\nfrom typing import IO\n\nimport numpy.typing as npt\nimport numpy as np\n\nstr_path: str\nbytes_path: bytes\npathlib_path: pathlib.Path\nstr_file: IO[str]\nAR_i8: npt.NDArray[np.int64]\n\nnp.load(str_file) # type: ignore[arg-type]\n\nnp.save(bytes_path, AR_i8) # type: ignore[call-overload]\nnp.save(st... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\npyio.pyi | npyio.pyi | Other | 670 | 0.95 | 0 | 0 | react-lib | 832 | 2025-04-03T15:46:56.561656 | MIT | true | 248e2ca08f9551973c2adcb0e3863c3f |
import numpy as np\n\nnp.isdtype(1, np.int64) # type: ignore[arg-type]\n\nnp.issubdtype(1, np.int64) # type: ignore[arg-type]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\numerictypes.pyi | numerictypes.pyi | Other | 129 | 0.95 | 0 | 0 | vue-tools | 339 | 2024-07-03T18:45:44.360564 | MIT | true | c15bfe6b809739cbda529eb704ca6570 |
import numpy as np\nimport numpy.typing as npt\n\nSEED_FLOAT: float = 457.3\nSEED_ARR_FLOAT: npt.NDArray[np.float64] = np.array([1.0, 2, 3, 4])\nSEED_ARRLIKE_FLOAT: list[float] = [1.0, 2.0, 3.0, 4.0]\nSEED_SEED_SEQ: np.random.SeedSequence = np.random.SeedSequence(0)\nSEED_STR: str = "String seeding not allowed"\n\n# de... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\random.pyi | random.pyi | Other | 2,965 | 0.95 | 0 | 0.075472 | vue-tools | 531 | 2024-09-09T02:56:29.186333 | Apache-2.0 | true | d416ba1f60f4d03aa156ae73ce057f6f |
import numpy as np\nimport numpy.typing as npt\n\nAR_i8: npt.NDArray[np.int64]\n\nnp.rec.fromarrays(1) # type: ignore[call-overload]\nnp.rec.fromarrays([1, 2, 3], dtype=[("f8", "f8")], formats=["f8", "f8"]) # type: ignore[call-overload]\n\nnp.rec.fromrecords(AR_i8) # type: ignore[arg-type]\nnp.rec.fromrecords([(1.5,... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\rec.pyi | rec.pyi | Other | 758 | 0.95 | 0 | 0 | react-lib | 350 | 2025-01-18T19:41:40.368341 | MIT | true | a329c356461883de8c428da52adbb5be |
import sys\nimport numpy as np\n\nf2: np.float16\nf8: np.float64\nc8: np.complex64\n\n# Construction\n\nnp.float32(3j) # type: ignore[arg-type]\n\n# Technically the following examples are valid NumPy code. But they\n# are not considered a best practice, and people who wish to use the\n# stubs should instead do\n#\n# n... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\scalars.pyi | scalars.pyi | Other | 2,936 | 0.95 | 0.057471 | 0.253521 | node-utils | 34 | 2024-08-07T00:43:03.996129 | MIT | true | a904ca05439f17579765e4af09015ab8 |
from typing import Any\nimport numpy as np\n\n# test bounds of _ShapeT_co\n\nnp.ndarray[tuple[str, str], Any] # type: ignore[type-var]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\shape.pyi | shape.pyi | Other | 137 | 0.95 | 0 | 0.25 | react-lib | 947 | 2024-04-16T16:39:10.456336 | MIT | true | 7704370b815ad7d11edb18b3c63d6a82 |
import numpy as np\n\nclass DTypeLike:\n dtype: np.dtype[np.int_]\n\ndtype_like: DTypeLike\n\nnp.expand_dims(dtype_like, (5, 10)) # type: ignore[call-overload]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\shape_base.pyi | shape_base.pyi | Other | 165 | 0.95 | 0.125 | 0 | vue-tools | 767 | 2025-06-06T14:36:32.416363 | Apache-2.0 | true | 2435f8b9506066de0577b02500b437e2 |
import numpy as np\nimport numpy.typing as npt\n\nAR_f8: npt.NDArray[np.float64]\n\nnp.lib.stride_tricks.as_strided(AR_f8, shape=8) # type: ignore[call-overload]\nnp.lib.stride_tricks.as_strided(AR_f8, strides=8) # type: ignore[call-overload]\n\nnp.lib.stride_tricks.sliding_window_view(AR_f8, axis=(1,)) # type: igno... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\stride_tricks.pyi | stride_tricks.pyi | Other | 339 | 0.95 | 0 | 0 | vue-tools | 497 | 2024-07-25T01:12:58.079207 | BSD-3-Clause | true | acbebd5a6db79b374d4ff76a343d5968 |
import numpy as np\nimport numpy.typing as npt\n\nAR_U: npt.NDArray[np.str_]\nAR_S: npt.NDArray[np.bytes_]\n\nnp.strings.equal(AR_U, AR_S) # type: ignore[arg-type]\nnp.strings.not_equal(AR_U, AR_S) # type: ignore[arg-type]\n\nnp.strings.greater_equal(AR_U, AR_S) # type: ignore[arg-type]\nnp.strings.less_equal(AR_U, ... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\strings.pyi | strings.pyi | Other | 2,385 | 0.95 | 0 | 0 | node-utils | 740 | 2024-04-27T11:21:11.657904 | GPL-3.0 | true | 53af87b5851381fe1987e70b520e3fc9 |
import numpy as np\nimport numpy.typing as npt\n\nAR_U: npt.NDArray[np.str_]\n\ndef func(x: object) -> bool: ...\n\nnp.testing.assert_(True, msg=1) # type: ignore[arg-type]\nnp.testing.build_err_msg(1, "test") # type: ignore[arg-type]\nnp.testing.assert_almost_equal(AR_U, AR_U) # type: ignore[arg-type]\nnp.testing.a... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\testing.pyi | testing.pyi | Other | 1,427 | 0.95 | 0.035714 | 0 | vue-tools | 810 | 2023-12-03T15:54:22.299964 | GPL-3.0 | true | 37f172cdf953acbf7ca2b3748140ae73 |
from typing import Any, TypeVar\n\nimport numpy as np\nimport numpy.typing as npt\n\ndef func1(ar: npt.NDArray[Any], a: int) -> npt.NDArray[np.str_]: ...\n\ndef func2(ar: npt.NDArray[Any], a: float) -> float: ...\n\nAR_b: npt.NDArray[np.bool]\nAR_m: npt.NDArray[np.timedelta64]\n\nAR_LIKE_b: list[bool]\n\nnp.eye(10, M=2... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\twodim_base.pyi | twodim_base.pyi | Other | 968 | 0.95 | 0.0625 | 0 | react-lib | 411 | 2024-03-11T06:34:20.450220 | MIT | true | 6565af34cc72e939a63d5c2cbaf570be |
import numpy as np\nimport numpy.typing as npt\n\nDTYPE_i8: np.dtype[np.int64]\n\nnp.mintypecode(DTYPE_i8) # type: ignore[arg-type]\nnp.iscomplexobj(DTYPE_i8) # type: ignore[arg-type]\nnp.isrealobj(DTYPE_i8) # type: ignore[arg-type]\n\nnp.typename(DTYPE_i8) # type: ignore[call-overload]\nnp.typename("invalid") # t... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\type_check.pyi | type_check.pyi | Other | 410 | 0.95 | 0 | 0 | python-kit | 269 | 2023-10-06T11:41:32.006128 | Apache-2.0 | true | e6072b9226e1432724b3ff6b8e5b92c1 |
import numpy as np\nimport numpy.typing as npt\n\nAR_c: npt.NDArray[np.complex128]\nAR_m: npt.NDArray[np.timedelta64]\nAR_M: npt.NDArray[np.datetime64]\nAR_O: npt.NDArray[np.object_]\n\nnp.fix(AR_c) # type: ignore[arg-type]\nnp.fix(AR_m) # type: ignore[arg-type]\nnp.fix(AR_M) # type: ignore[arg-type]\n\nnp.isposinf(... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\ufunclike.pyi | ufunclike.pyi | Other | 670 | 0.95 | 0 | 0 | vue-tools | 357 | 2024-03-25T00:29:54.531646 | BSD-3-Clause | true | a573825ee774d1bafebe2ca935759ac5 |
import numpy as np\nimport numpy.typing as npt\n\nAR_f8: npt.NDArray[np.float64]\n\nnp.sin.nin + "foo" # type: ignore[operator]\nnp.sin(1, foo="bar") # type: ignore[call-overload]\n\nnp.abs(None) # type: ignore[call-overload]\n\nnp.add(1, 1, 1) # type: ignore[call-overload]\nnp.add(1, 1, axis=0) # type: ignore[cal... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\ufuncs.pyi | ufuncs.pyi | Other | 522 | 0.95 | 0 | 0 | node-utils | 812 | 2024-05-01T18:48:56.038599 | MIT | true | 2127c6821791a33ef223b7764c23a805 |
"""Typing tests for `numpy._core._ufunc_config`."""\n\nimport numpy as np\n\ndef func1(a: str, b: int, c: float) -> None: ...\ndef func2(a: str, *, b: int) -> None: ...\n\nclass Write1:\n def write1(self, a: str) -> None: ...\n\nclass Write2:\n def write(self, a: str, b: str) -> None: ...\n\nclass Write3:\n de... | .venv\Lib\site-packages\numpy\typing\tests\data\fail\ufunc_config.pyi | ufunc_config.pyi | Other | 610 | 0.95 | 0.428571 | 0 | awesome-app | 812 | 2025-03-02T14:50:59.762074 | MIT | true | d6ff6a83ed0b1c9bb96326e3c718e658 |
import numpy.exceptions as ex\n\nex.AxisError(1.0) # type: ignore[call-overload]\nex.AxisError(1, ndim=2.0) # type: ignore[call-overload]\nex.AxisError(2, msg_prefix=404) # type: ignore[call-overload]\n | .venv\Lib\site-packages\numpy\typing\tests\data\fail\warnings_and_errors.pyi | warnings_and_errors.pyi | Other | 205 | 0.95 | 0 | 0 | awesome-app | 56 | 2023-07-31T14:26:04.368669 | GPL-3.0 | true | 9e7204dd381401ef2567beb66e3359cd |
import numpy as np\nfrom numpy._typing import _96Bit, _128Bit\n\nfrom typing import assert_type\n\nassert_type(np.float96(), np.floating[_96Bit])\nassert_type(np.float128(), np.floating[_128Bit])\nassert_type(np.complex192(), np.complexfloating[_96Bit, _96Bit])\nassert_type(np.complex256(), np.complexfloating[_128Bit, ... | .venv\Lib\site-packages\numpy\typing\tests\data\misc\extended_precision.pyi | extended_precision.pyi | Other | 331 | 0.85 | 0 | 0 | awesome-app | 706 | 2023-08-22T00:58:44.376241 | Apache-2.0 | true | d8cd4bab7c76d0364e0e5866608d0814 |
from __future__ import annotations\n\nfrom typing import Any, cast\nimport numpy as np\nimport numpy.typing as npt\nimport pytest\n\nc16 = np.complex128(1)\nf8 = np.float64(1)\ni8 = np.int64(1)\nu8 = np.uint64(1)\n\nc8 = np.complex64(1)\nf4 = np.float32(1)\ni4 = np.int32(1)\nu4 = np.uint32(1)\n\ndt = np.datetime64(1, "... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\arithmetic.py | arithmetic.py | Python | 8,374 | 0.95 | 0.01634 | 0.019417 | awesome-app | 854 | 2023-09-18T16:44:20.691387 | GPL-3.0 | true | d04aa909385412c4cbc1f5511bbf1a5b |
import numpy as np\n\nAR = np.arange(10)\nAR.setflags(write=False)\n\nwith np.printoptions():\n np.set_printoptions(\n precision=1,\n threshold=2,\n edgeitems=3,\n linewidth=4,\n suppress=False,\n nanstr="Bob",\n infstr="Bill",\n formatter={},\n sign="+"... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\arrayprint.py | arrayprint.py | Python | 803 | 0.85 | 0 | 0 | vue-tools | 725 | 2025-01-01T17:58:27.124496 | BSD-3-Clause | true | 9c65b60e564a96576214f3024090220f |
\nfrom __future__ import annotations\n\nfrom typing import Any\nimport numpy as np\n\nAR_i8: np.ndarray[Any, np.dtype[np.int_]] = np.arange(10)\nar_iter = np.lib.Arrayterator(AR_i8)\n\nar_iter.var\nar_iter.buf_size\nar_iter.start\nar_iter.stop\nar_iter.step\nar_iter.shape\nar_iter.flat\n\nar_iter.__array__()\n\nfor i i... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\arrayterator.py | arrayterator.py | Python | 420 | 0.85 | 0.037037 | 0 | react-lib | 896 | 2023-12-03T20:50:06.764062 | GPL-3.0 | true | e65797a142e124c75ee5351ef9b58e67 |
from typing import Any\n\nimport numpy as np\nimport numpy.typing as npt\n\nclass Index:\n def __index__(self) -> int:\n return 0\n\n\nclass SubClass(npt.NDArray[np.float64]):\n pass\n\n\ndef func(i: int, j: int, **kwargs: Any) -> SubClass:\n return B\n\n\ni8 = np.int64(1)\n\nA = np.array([1])\nB = A.vi... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\array_constructors.py | array_constructors.py | Python | 2,584 | 0.85 | 0.029197 | 0 | awesome-app | 320 | 2024-12-03T07:55:07.234632 | GPL-3.0 | true | 7a04f4caf8d171a031275938577a814c |
from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nimport numpy as np\n\nif TYPE_CHECKING:\n from numpy._typing import NDArray, ArrayLike, _SupportsArray\n\nx1: ArrayLike = True\nx2: ArrayLike = 5\nx3: ArrayLike = 1.0\nx4: ArrayLike = 1 + 1j\nx5: ArrayLike = np.int8(1)\nx6: ArrayLike = np.floa... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\array_like.py | array_like.py | Python | 1,075 | 0.95 | 0.116279 | 0.0625 | react-lib | 543 | 2025-06-27T01:25:04.360896 | Apache-2.0 | true | 6daffaa4bc0823ca38049cfb11e80c11 |
import numpy as np\n\ni8 = np.int64(1)\nu8 = np.uint64(1)\n\ni4 = np.int32(1)\nu4 = np.uint32(1)\n\nb_ = np.bool(1)\n\nb = bool(1)\ni = int(1)\n\nAR = np.array([0, 1, 2], dtype=np.int32)\nAR.setflags(write=False)\n\n\ni8 << i8\ni8 >> i8\ni8 | i8\ni8 ^ i8\ni8 & i8\n\ni << AR\ni >> AR\ni | AR\ni ^ AR\ni & AR\n\ni8 << AR\... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\bitwise_ops.py | bitwise_ops.py | Python | 1,095 | 0.85 | 0 | 0 | python-kit | 720 | 2024-11-25T12:51:34.200925 | GPL-3.0 | true | 25bbed76270a1b34c60bc4f58419f090 |
from __future__ import annotations\n\nfrom typing import cast, Any\nimport numpy as np\n\nc16 = np.complex128()\nf8 = np.float64()\ni8 = np.int64()\nu8 = np.uint64()\n\nc8 = np.complex64()\nf4 = np.float32()\ni4 = np.int32()\nu4 = np.uint32()\n\ndt = np.datetime64(0, "D")\ntd = np.timedelta64(0, "D")\n\nb_ = np.bool()\... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\comparisons.py | comparisons.py | Python | 3,613 | 0.95 | 0 | 0.02214 | vue-tools | 515 | 2024-02-27T12:11:24.519756 | MIT | true | 92b0cc528a723d72930fa1c56c3f497a |
import numpy as np\n\ndtype_obj = np.dtype(np.str_)\nvoid_dtype_obj = np.dtype([("f0", np.float64), ("f1", np.float32)])\n\nnp.dtype(dtype=np.int64)\nnp.dtype(int)\nnp.dtype("int")\nnp.dtype(None)\n\nnp.dtype((int, 2))\nnp.dtype((int, (1,)))\n\nnp.dtype({"names": ["a", "b"], "formats": [int, float]})\nnp.dtype({"names"... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\dtype.py | dtype.py | Python | 1,127 | 0.95 | 0.017544 | 0.02381 | python-kit | 838 | 2023-12-21T13:26:17.252245 | BSD-3-Clause | true | ff16632537603afb375dfaa1bc9c749d |
from __future__ import annotations\n\nfrom typing import Any\n\nimport numpy as np\n\nAR_LIKE_b = [True, True, True]\nAR_LIKE_u = [np.uint32(1), np.uint32(2), np.uint32(3)]\nAR_LIKE_i = [1, 2, 3]\nAR_LIKE_f = [1.0, 2.0, 3.0]\nAR_LIKE_c = [1j, 2j, 3j]\nAR_LIKE_U = ["1", "2", "3"]\n\nOUT_f: np.ndarray[Any, np.dtype[np.fl... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\einsumfunc.py | einsumfunc.py | Python | 1,406 | 0.85 | 0 | 0 | node-utils | 405 | 2024-02-24T08:06:46.995513 | Apache-2.0 | true | f57b3282f11a865b4586a75a80bdf0f6 |
import numpy as np\n\na = np.empty((2, 2)).flat\n\na.base\na.copy()\na.coords\na.index\niter(a)\nnext(a)\na[0]\na[[0, 1, 2]]\na[...]\na[:]\na.__array__()\na.__array__(np.dtype(np.float64))\n\nb = np.array([1]).flat\na[b]\n | .venv\Lib\site-packages\numpy\typing\tests\data\pass\flatiter.py | flatiter.py | Python | 222 | 0.85 | 0 | 0 | python-kit | 864 | 2024-12-27T14:08:51.989150 | Apache-2.0 | true | 176e2bccc7f766a1a1ed035e7f2b1fd4 |
"""Tests for :mod:`numpy._core.fromnumeric`."""\n\nimport numpy as np\n\nA = np.array(True, ndmin=2, dtype=bool)\nB = np.array(1.0, ndmin=2, dtype=np.float32)\nA.setflags(write=False)\nB.setflags(write=False)\n\na = np.bool(True)\nb = np.float32(1.0)\nc = 1.0\nd = np.array(1.0, dtype=np.float32) # writeable\n\nnp.take... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\fromnumeric.py | fromnumeric.py | Python | 4,263 | 0.95 | 0.003676 | 0 | python-kit | 700 | 2025-06-23T15:33:43.453733 | Apache-2.0 | true | 254d917fd7c8f61addfab7e35e40db31 |
from __future__ import annotations\nfrom typing import Any\nimport numpy as np\n\nAR_LIKE_b = [[True, True], [True, True]]\nAR_LIKE_i = [[1, 2], [3, 4]]\nAR_LIKE_f = [[1.0, 2.0], [3.0, 4.0]]\nAR_LIKE_U = [["1", "2"], ["3", "4"]]\n\nAR_i8: np.ndarray[Any, np.dtype[np.int64]] = np.array(AR_LIKE_i, dtype=np.int64)\n\nnp.n... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\index_tricks.py | index_tricks.py | Python | 1,462 | 0.85 | 0 | 0 | vue-tools | 784 | 2024-10-22T05:19:49.806703 | MIT | true | aa6a71859a07e50cf4bb1560e2150552 |
"""Based on the `if __name__ == "__main__"` test code in `lib/_user_array_impl.py`."""\n\nfrom __future__ import annotations\n\nimport numpy as np\nfrom numpy.lib.user_array import container\n\nN = 10_000\nW = H = int(N**0.5)\n\na: np.ndarray[tuple[int, int], np.dtype[np.int32]]\nua: container[tuple[int, int], np.dtype... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\lib_user_array.py | lib_user_array.py | Python | 612 | 0.95 | 0.045455 | 0.071429 | react-lib | 355 | 2025-05-01T10:35:54.188031 | BSD-3-Clause | true | 7b6a6364e08991b5b40fc591fbd05ddf |
from __future__ import annotations\n\nfrom io import StringIO\n\nimport numpy as np\nimport numpy.lib.array_utils as array_utils\n\nFILE = StringIO()\nAR = np.arange(10, dtype=np.float64)\n\n\ndef func(a: int) -> bool:\n return True\n\n\narray_utils.byte_bounds(AR)\narray_utils.byte_bounds(np.float64())\n\nnp.info(1... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\lib_utils.py | lib_utils.py | Python | 336 | 0.85 | 0.052632 | 0 | react-lib | 138 | 2025-04-18T19:37:09.460637 | Apache-2.0 | true | 67f00f52373d0722b98e93deda59c6c9 |
from numpy.lib import NumpyVersion\n\nversion = NumpyVersion("1.8.0")\n\nversion.vstring\nversion.version\nversion.major\nversion.minor\nversion.bugfix\nversion.pre_release\nversion.is_devversion\n\nversion == version\nversion != version\nversion < "1.8.0"\nversion <= version\nversion > version\nversion >= "1.8.0"\n | .venv\Lib\site-packages\numpy\typing\tests\data\pass\lib_version.py | lib_version.py | Python | 317 | 0.85 | 0 | 0 | vue-tools | 564 | 2023-10-24T12:55:05.374228 | MIT | true | 2ece33de474ef57a775b66932783f8e9 |
from __future__ import annotations\n\nfrom typing import Any, TYPE_CHECKING\nfrom functools import partial\n\nimport pytest\nimport numpy as np\n\nif TYPE_CHECKING:\n from collections.abc import Callable\n\nAR = np.array(0)\nAR.setflags(write=False)\n\nKACF = frozenset({None, "K", "A", "C", "F"})\nACF = frozenset({N... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\literal.py | literal.py | Python | 1,559 | 0.95 | 0.078431 | 0.023256 | node-utils | 868 | 2025-04-06T11:47:11.951738 | GPL-3.0 | true | d0280b9b1c320814dc6dea7c1bad8529 |
from typing import Any, TypeAlias, TypeVar, cast\n\nimport numpy as np\nimport numpy.typing as npt\nfrom numpy._typing import _Shape\n\n_ScalarT = TypeVar("_ScalarT", bound=np.generic)\nMaskedArray: TypeAlias = np.ma.MaskedArray[_Shape, np.dtype[_ScalarT]]\n\nMAR_b: MaskedArray[np.bool] = np.ma.MaskedArray([True])\nMAR... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\ma.py | ma.py | Python | 3,536 | 0.95 | 0 | 0.044776 | awesome-app | 202 | 2024-04-21T00:35:06.865727 | Apache-2.0 | true | 2cc6acbfa37f71215f08bacc06b3ce32 |
import numpy as np\n\nf8 = np.float64(1)\ni8 = np.int64(1)\nu8 = np.uint64(1)\n\nf4 = np.float32(1)\ni4 = np.int32(1)\nu4 = np.uint32(1)\n\ntd = np.timedelta64(1, "D")\nb_ = np.bool(1)\n\nb = bool(1)\nf = float(1)\ni = int(1)\n\nAR = np.array([1], dtype=np.bool)\nAR.setflags(write=False)\n\nAR2 = np.array([1], dtype=np... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\mod.py | mod.py | Python | 1,725 | 0.95 | 0 | 0.032 | awesome-app | 356 | 2024-05-12T03:45:24.223580 | BSD-3-Clause | true | 8d5b00dc98b62f11fc9624c94924735d |
import numpy as np\nfrom numpy import f2py\n\nnp.char\nnp.ctypeslib\nnp.emath\nnp.fft\nnp.lib\nnp.linalg\nnp.ma\nnp.matrixlib\nnp.polynomial\nnp.random\nnp.rec\nnp.strings\nnp.testing\nnp.version\n\nnp.lib.format\nnp.lib.mixins\nnp.lib.scimath\nnp.lib.stride_tricks\nnp.lib.array_utils\nnp.ma.extras\nnp.polynomial.cheby... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\modules.py | modules.py | Python | 670 | 0.85 | 0 | 0 | vue-tools | 10 | 2024-11-12T09:16:56.441187 | GPL-3.0 | true | fd398c512035239012b5fd457739c163 |
import numpy as np\nimport numpy.typing as npt\n\nAR_f8: npt.NDArray[np.float64] = np.array([1.0])\nAR_i4 = np.array([1], dtype=np.int32)\nAR_u1 = np.array([1], dtype=np.uint8)\n\nAR_LIKE_f = [1.5]\nAR_LIKE_i = [1]\n\nb_f8 = np.broadcast(AR_f8)\nb_i4_f8_f8 = np.broadcast(AR_i4, AR_f8, AR_f8)\n\nnext(b_f8)\nb_f8.reset()... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\multiarray.py | multiarray.py | Python | 1,407 | 0.85 | 0 | 0 | react-lib | 236 | 2024-05-10T13:40:40.909190 | Apache-2.0 | true | 321eb3c11b4ed87aae5f47640077dd89 |
import os\nimport tempfile\n\nimport numpy as np\n\nnd = np.array([[1, 2], [3, 4]])\nscalar_array = np.array(1)\n\n# item\nscalar_array.item()\nnd.item(1)\nnd.item(0, 1)\nnd.item((0, 1))\n\n# tobytes\nnd.tobytes()\nnd.tobytes("C")\nnd.tobytes(None)\n\n# tofile\nif os.name != "nt":\n with tempfile.NamedTemporaryFile(... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\ndarray_conversion.py | ndarray_conversion.py | Python | 1,612 | 0.95 | 0.011494 | 0.190476 | node-utils | 680 | 2024-06-13T02:10:16.632216 | GPL-3.0 | true | 7d9c0a65217515e34e49c42131c095ce |
"""\nTests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods.\n\nMore extensive tests are performed for the methods'\nfunction-based counterpart in `../from_numeric.py`.\n\n"""\n\nfrom __future__ import annotations\n\nimport operator\nfrom typing import cast, Any\n\nimport numpy as np\nimport numpy.ty... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\ndarray_misc.py | ndarray_misc.py | Python | 3,897 | 0.95 | 0.025253 | 0.02 | awesome-app | 716 | 2025-05-14T08:27:35.513158 | MIT | true | 9ccfb36400f4750239674b2b5c5d4898 |
import numpy as np\n\nnd1 = np.array([[1, 2], [3, 4]])\n\n# reshape\nnd1.reshape(4)\nnd1.reshape(2, 2)\nnd1.reshape((2, 2))\n\nnd1.reshape((2, 2), order="C")\nnd1.reshape(4, order="C")\n\n# resize\nnd1.resize()\nnd1.resize(4)\nnd1.resize(2, 2)\nnd1.resize((2, 2))\n\nnd1.resize((2, 2), refcheck=True)\nnd1.resize(4, refc... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\ndarray_shape_manipulation.py | ndarray_shape_manipulation.py | Python | 687 | 0.95 | 0 | 0.205882 | python-kit | 335 | 2023-11-14T13:36:36.052463 | BSD-3-Clause | true | 702580b959ce646e268cd452080fba18 |
import numpy as np\n\narr = np.array([1])\nnp.nditer([arr, None])\n | .venv\Lib\site-packages\numpy\typing\tests\data\pass\nditer.py | nditer.py | Python | 67 | 0.65 | 0 | 0 | node-utils | 122 | 2023-09-27T04:38:22.131162 | BSD-3-Clause | true | a1c63aa936b8b695ac79d3b0d2676f0d |
"""\nTests for :mod:`numpy._core.numeric`.\n\nDoes not include tests which fall under ``array_constructors``.\n\n"""\n\nfrom __future__ import annotations\nfrom typing import cast\n\nimport numpy as np\nimport numpy.typing as npt\n\nclass SubClass(npt.NDArray[np.float64]): ...\n\n\ni8 = np.int64(1)\n\nA = cast(\n np... | .venv\Lib\site-packages\numpy\typing\tests\data\pass\numeric.py | numeric.py | Python | 1,717 | 0.85 | 0.021053 | 0 | vue-tools | 999 | 2024-06-25T16:17:37.062501 | MIT | true | 34274a107072844b6dc1f6b38daa093f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.