text
stringlengths
0
20k
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np if TYPE_CHECKING: from numpy._typing import NDArray, ArrayLike, _SupportsArray x1: ArrayLike = True x2: ArrayLike = 5 x3: ArrayLike = 1.0 x4: ArrayLike = 1 + 1j x5: ArrayLike = np.int8(1) x6: ArrayLike = np.float64(1) x7: Arr...
import numpy as np a = np.empty((2, 2)).flat a.base a.copy() a.coords a.index iter(a) next(a) a[0] a[[0, 1, 2]] a[...] a[:] a.__array__() a.__array__(np.dtype(np.float64)) b = np.array([1]).flat a[b]
"""Tests for :mod:`numpy._core.fromnumeric`.""" import numpy as np A = np.array(True, ndmin=2, dtype=bool) B = np.array(1.0, ndmin=2, dtype=np.float32) A.setflags(write=False) B.setflags(write=False) a = np.bool(True) b = np.float32(1.0) c = 1.0 d = np.array(1.0, dtype=np.float32) # writeable np.take(a, 0) np.take...
"""Based on the `if __name__ == "__main__"` test code in `lib/_user_array_impl.py`.""" from __future__ import annotations import numpy as np from numpy.lib.user_array import container N = 10_000 W = H = int(N**0.5) a: np.ndarray[tuple[int, int], np.dtype[np.int32]] ua: container[tuple[int, int], np.dtype[np.int32]]...
""" Tests for :mod:`numpy._core.numeric`. Does not include tests which fall under ``array_constructors``. """ from __future__ import annotations from typing import cast import numpy as np import numpy.typing as npt class SubClass(npt.NDArray[np.float64]): ... i8 = np.int64(1) A = cast( np.ndarray[tuple[int,...
"""Test the runtime usage of `numpy.typing`.""" from typing import ( Any, NamedTuple, Union, # pyright: ignore[reportDeprecated] get_args, get_origin, get_type_hints, ) import pytest import numpy as np import numpy._typing as _npt import numpy.typing as npt class TypeTup(NamedTuple): t...
import importlib.util import os import re import shutil import textwrap from collections import defaultdict from typing import TYPE_CHECKING import pytest # Only trigger a full `mypy` run if this environment variable is set # Note that these tests tend to take over a minute even on a macOS M1 CPU, # and more than tha...
import os import sys from pathlib import Path import numpy as np from numpy.testing import assert_ ROOT = Path(np.__file__).parents[0] FILES = [ ROOT / "py.typed", ROOT / "__init__.pyi", ROOT / "ctypeslib" / "__init__.pyi", ROOT / "_core" / "__init__.pyi", ROOT / "f2py" / "__init__.pyi", ROOT ...
""" =================== Universal Functions =================== Ufuncs are, generally speaking, mathematical functions or operations that are applied element-by-element to the contents of an array. That is, the result in each output array element only depends on the value in the corresponding input array (or arrays) a...
""" Distributor init file Distributors: you can add custom code here to support particular distributions of numpy. For example, this is a good place to put any BLAS/LAPACK initialization code. The numpy standard source distribution will not put code in this file, so you can safely replace this file with your own ver...
from ._generator import Generator from ._mt19937 import MT19937 from ._pcg64 import PCG64, PCG64DXSM from ._philox import Philox from ._sfc64 import SFC64 from .bit_generator import BitGenerator from .mtrand import RandomState BitGenerators = {'MT19937': MT19937, 'PCG64': PCG64, 'PCG6...
#cython: language_level=3 from libc.stdint cimport uint32_t from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer import numpy as np cimport numpy as np cimport cython from numpy.random cimport bitgen_t from numpy.random import PCG64 np.import_array() @cython.boundscheck(False) @cython.wraparound...
#cython: language_level=3 """ This file shows how the to use a BitGenerator to create a distribution. """ import numpy as np cimport numpy as np cimport cython from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer from libc.stdint cimport uint16_t, uint64_t from numpy.random cimport bitgen_t from numpy...
r""" Building the required library in this example requires a source distribution of NumPy or clone of the NumPy git repository since distributions.c is not included in binary distributions. On *nix, execute in numpy/random/src/distributions export ${PYTHON_VERSION}=3.8 # Python version export PYTHON_INCLUDE=#path to...
from timeit import timeit import numba as nb import numpy as np from numpy.random import PCG64 bit_gen = PCG64() next_d = bit_gen.cffi.next_double state_addr = bit_gen.cffi.state_address def normals(n, state): out = np.empty(n) for i in range((n + 1) // 2): x1 = 2.0 * next_d(state) - 1.0 x2 ...
""" Use cffi to access any of the underlying C functions from distributions.h """ import os import cffi import numpy as np from .parse import parse_distributions_h ffi = cffi.FFI() inc_dir = os.path.join(np.get_include(), 'numpy') # Basic numpy types ffi.cdef(''' typedef intptr_t npy_intp; typedef unsigne...
import os def parse_distributions_h(ffi, inc_dir): """ Parse distributions.h located in inc_dir for CFFI, filling in the ffi.cdef Read the function declarations without the "#define ..." macros that will be filled in when loading the library. """ with open(os.path.join(inc_dir, 'random', 'bi...
""" ======================== Random Number Generation ======================== Use ``default_rng()`` to create a `Generator` and call its methods. =============== ========================================================= Generator --------------- --------------------------------------------------------- Generator ...
**This software is dual-licensed under the The University of Illinois/NCSA Open Source License (NCSA) and The 3-Clause BSD License** # NCSA Open Source License **Copyright (c) 2019 Kevin Sheppard. All rights reserved.** Developed by: Kevin Sheppard (<kevin.sheppard@economics.ox.ac.uk>, <kevin.k.sheppard@gmail.com>) [...
import os import shutil import subprocess import sys import sysconfig import warnings from importlib.util import module_from_spec, spec_from_file_location import pytest import numpy as np from numpy.testing import IS_EDITABLE, IS_WASM try: import cffi except ImportError: cffi = None if sys.flags.optimize > ...
import sys import pytest import numpy as np from numpy import random from numpy.testing import ( assert_, assert_array_equal, assert_raises, ) class TestRegression: def test_VonMises_range(self): # Make sure generated random variables are in [-pi, pi]. # Regression test for ticket #...
import pytest import numpy as np from numpy.random import MT19937, Generator from numpy.testing import assert_, assert_array_equal class TestRegression: def setup_method(self): self.mt19937 = Generator(MT19937(121263137472525314065)) def test_vonmises_range(self): # Make sure generated rand...
import numpy as np from numpy.random import SeedSequence from numpy.testing import assert_array_compare, assert_array_equal def test_reference_data(): """ Check that SeedSequence generates data the same as the C++ reference. https://gist.github.com/imneme/540829265469e673d045 """ inputs = [ [...
import os import sys from os.path import join import pytest import numpy as np from numpy.random import ( MT19937, PCG64, PCG64DXSM, SFC64, Generator, Philox, RandomState, SeedSequence, default_rng, ) from numpy.random._common import interface from numpy.testing import ( assert...
import sys import numpy as np from numpy import random from numpy.testing import ( assert_, assert_array_equal, assert_raises, ) class TestRegression: def test_VonMises_range(self): # Make sure generated random variables are in [-pi, pi]. # Regression test for ticket #986. fo...
""" Exceptions and Warnings ======================= General exceptions used by NumPy. Note that some exceptions may be module specific, such as linear algebra errors. .. versionadded:: NumPy 1.25 The exceptions module is new in NumPy 1.25. Older exceptions remain available through the main NumPy namespace ...
""" Pytest test running. This module implements the ``test()`` function for NumPy modules. The usual boiler plate for doing that is to put the following in the module ``__init__.py`` file:: from numpy._pytesttester import PytestTester test = PytestTester(__name__) del PytestTester Warnings filtering and...
"""Miscellaneous functions for testing masked arrays and subclasses :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu """ import operator import numpy as np import numpy._core.umath as umath import numpy.testing from numpy import ndarray from numpy.testing import ( # noqa: F401 assert_, asse...
""" ============= Masked Arrays ============= Arrays sometimes contain invalid or missing data. When doing operations on such arrays, we wish to suppress invalid values, which is the purpose masked arrays fulfill (an example of typical use is given below). For example, examine the following array: >>> x = np.array(...
.. -*- rest -*- ================================================== API changes in the new masked array implementation ================================================== Masked arrays are subclasses of ndarray --------------------------------------- Contrary to the original implementation, masked arrays are now regul...
"""Test deprecation and future warnings. """ import io import textwrap import pytest import numpy as np from numpy.ma.core import MaskedArrayFutureWarning from numpy.ma.testutils import assert_equal from numpy.testing import assert_warns class TestArgsort: """ gh-8701 """ def _test_base(self, argsort, cls)...
"""Tests suite for mrecords. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu """ import pickle import numpy as np import numpy.ma as ma from numpy._core.records import fromarrays as recfromarrays from numpy._core.records import fromrecords as recfromrecords from numpy._core.records import recarray ...
import pytest import numpy as np from numpy.ma import masked_array from numpy.testing import assert_array_equal def test_matrix_transpose_raises_error_for_1d(): msg = "matrix transpose with ndim < 2 is undefined" ma_arr = masked_array(data=[1, 2, 3, 4, 5, 6], mask=[1, 0, 1, 1, 1, 0]...
import numpy as np from numpy.testing import ( assert_, assert_allclose, assert_array_equal, suppress_warnings, ) class TestRegression: def test_masked_array_create(self): # Ticket #17 x = np.ma.masked_array([0, 1, 2, 3, 0, 4, 5, 6], mask=[0, 0, 0, 1,...
"""Tests suite for MaskedArray & subclassing. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu """ import numpy as np from numpy.lib.mixins import NDArrayOperatorsMixin from numpy.ma.core import ( MaskedArray, add, arange, array, asanyarray, asarray, divide, hypot, ...
"""This hook should collect all binary files and any hidden modules that numpy needs. Our (some-what inadequate) docs for writing PyInstaller hooks are kept here: https://pyinstaller.readthedocs.io/en/stable/hooks.html """ from PyInstaller.compat import is_pure_conda from PyInstaller.utils.hooks import collect_dynami...
"""A crude *bit of everything* smoke test to verify PyInstaller compatibility. PyInstaller typically goes wrong by forgetting to package modules, extension modules or shared libraries. This script should aim to touch as many of those as possible in an attempt to trip a ModuleNotFoundError or a DLL load failure due to ...
import subprocess from pathlib import Path import pytest # PyInstaller has been very unproactive about replacing 'imp' with 'importlib'. @pytest.mark.filterwarnings('ignore::DeprecationWarning') # It also leaks io.BytesIO()s. @pytest.mark.filterwarnings('ignore::ResourceWarning') @pytest.mark.parametrize("mode", ["-...
import pytest from numpy.testing import IS_EDITABLE, IS_WASM if IS_WASM: pytest.skip( "WASM/Pyodide does not use or support Fortran", allow_module_level=True ) if IS_EDITABLE: pytest.skip( "Editable install doesn't support tests with a compile step", allow_module_level=Tr...
""" Wrapper functions to more user-friendly calling of certain math functions whose output data-type is different than the input data-type in certain domains of the input. For example, for functions like `log` with branch cuts, the versions in this module provide the mathematically valid answers in the complex plane::...
""" A buffered iterator for big arrays. This module solves the problem of iterating over a big file-based array without having to read it into memory. The `Arrayterator` class wraps an array object, and when iterated it will return sub-arrays with at most a user-specified number of elements. """ from functools import...
""" Introspection helper functions. """ __all__ = ['opt_func_info'] def opt_func_info(func_name=None, signature=None): """ Returns a dictionary containing the currently supported CPU dispatched features for all optimized functions. Parameters ---------- func_name : str (optional) Reg...
"""Automatically adapted for numpy Sep 19, 2005 by convertcode.py """ import functools __all__ = ['iscomplexobj', 'isrealobj', 'imag', 'iscomplex', 'isreal', 'nan_to_num', 'real', 'real_if_close', 'typename', 'mintypecode', 'common_type'] import numpy._core.numeric as _nx from numpy....
""" Module of functions that are like ufuncs in acting on arrays and optionally storing results in an output array. """ __all__ = ['fix', 'isneginf', 'isposinf'] import numpy._core.numeric as nx from numpy._core.overrides import array_function_dispatch def _dispatcher(x, out=None): return (x, out) @array_func...
""" Utilities that manipulate strides to achieve desirable effects. An explanation of strides can be found in the :ref:`arrays.ndarray`. """ import numpy as np from numpy._core.numeric import normalize_axis_tuple from numpy._core.overrides import array_function_dispatch, set_module __all__ = ['broadcast_to', 'broadc...
from ._array_utils_impl import ( # noqa: F401 __all__, __doc__, byte_bounds, normalize_axis_index, normalize_axis_tuple, )
from ._npyio_impl import DataSource, NpzFile, __doc__ # noqa: F401
""" ``numpy.lib`` is mostly a space for implementing functions that don't belong in core or in another NumPy submodule with a clear purpose (e.g. ``random``, ``fft``, ``linalg``, ``ma``). ``numpy.lib``'s private submodules contain basic functions that are used by other public modules and are useful to have in the main...
""" Container class for backward compatibility with NumArray. The user_array.container class exists for backward compatibility with NumArray and is not meant to be used in new code. If you need to create an array container class, we recommend either creating a class that wraps an ndarray or subclasses ndarray. """ fr...
from ._scimath_impl import ( # noqa: F401 __all__, __doc__, arccos, arcsin, arctanh, log, log2, log10, logn, power, sqrt, )
from ._user_array_impl import __doc__, container # noqa: F401
from ._format_impl import ( # noqa: F401 ARRAY_ALIGN, BUFFER_SIZE, EXPECTED_KEYS, GROWTH_AXIS_MAX_DIGITS, MAGIC_LEN, MAGIC_PREFIX, __all__, __doc__, descr_to_dtype, drop_metadata, dtype_to_descr, header_data_from_array_1_0, isfileobj, magic, open_memmap, ...
""" Mixin classes for custom array types that don't inherit from ndarray. """ __all__ = ['NDArrayOperatorsMixin'] def _disables_array_ufunc(obj): """True when __array_ufunc__ is set to None.""" try: return obj.__array_ufunc__ is None except AttributeError: return False def _binary_metho...
"""Utility to compare (NumPy) version strings. The NumpyVersion class allows properly comparing numpy version strings. The LooseVersion and StrictVersion classes that distutils provides don't work; they don't recognize anything like alpha/beta/rc/dev versions. """ import re __all__ = ['NumpyVersion'] class NumpyVe...
from ._stride_tricks_impl import __doc__, as_strided, sliding_window_view # noqa: F401
import os import urllib.request as urllib_request from shutil import rmtree from tempfile import NamedTemporaryFile, mkdtemp, mkstemp from urllib.error import URLError from urllib.parse import urlparse import pytest import numpy.lib._datasource as datasource from numpy.testing import assert_, assert_equal, assert_rai...
from itertools import chain import pytest import numpy as np from numpy.testing import assert_array_equal, assert_equal, assert_raises def test_packbits(): # Copied from the docstring. a = [[[1, 0, 1], [0, 1, 0]], [[1, 1, 0], [0, 0, 1]]] for dt in '?bBhHiIlLqQ': arr = np.array(a, dtype=...
"""Test functions for matrix module """ import pytest import numpy as np from numpy import ( add, arange, array, diag, eye, fliplr, flipud, histogram2d, mask_indices, ones, tri, tril_indices, tril_indices_from, triu_indices, triu_indices_from, vander, ...
import numpy as np from numpy import ( common_type, iscomplex, iscomplexobj, isneginf, isposinf, isreal, isrealobj, mintypecode, nan_to_num, real_if_close, ) from numpy.testing import assert_, assert_array_equal, assert_equal def assert_all(x): assert_(np.all(x), x) class...
import numpy as np from numpy.lib import array_utils from numpy.testing import assert_equal class TestByteBounds: def test_byte_bounds(self): # pointer difference matches size * itemsize # due to contiguity a = np.arange(12).reshape(3, 4) low, high = array_utils.byte_bounds(a) ...
from functools import reduce from operator import mul import numpy as np from numpy.lib import Arrayterator from numpy.random import randint from numpy.testing import assert_ def test(): np.random.seed(np.arange(10)) # Create a random array ndims = randint(5) + 1 shape = tuple(randint(10) + 1 for di...
"""Tests for the NumpyVersion class. """ from numpy.lib import NumpyVersion from numpy.testing import assert_, assert_raises def test_main_versions(): assert_(NumpyVersion('1.8.0') == '1.8.0') for ver in ['1.9.0', '2.0.0', '1.8.1', '10.0.1']: assert_(NumpyVersion('1.8.0') < ver) for ver in ['1.7...
from io import StringIO import pytest import numpy as np import numpy.lib._utils_impl as _utils_impl from numpy.testing import assert_raises_regex def test_assert_raises_regex_context_manager(): with assert_raises_regex(ValueError, 'no deprecation warning'): raise ValueError('no deprecation warning') ...
import pytest import numpy as np import numpy.polynomial.polynomial as poly from numpy.testing import ( assert_, assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, assert_equal, assert_raises, ) # `poly1d` has some support for `np.bool` and `np.timedelta64...
import time from datetime import date import numpy as np from numpy.lib._iotools import ( LineSplitter, NameValidator, StringConverter, easy_dtype, flatten_dtype, has_nested_fields, ) from numpy.testing import ( assert_, assert_allclose, assert_equal, assert_raises, ) class Te...
import numpy as np from numpy import fix, isneginf, isposinf from numpy.testing import assert_, assert_array_equal, assert_equal, assert_raises class TestUfunclike: def test_isposinf(self): a = np.array([np.inf, -np.inf, np.nan, 0.0, 3.0, -3.0]) out = np.zeros(a.shape, bool) tgt = np.arra...
import os import numpy as np from numpy.testing import ( _assert_valid_refcount, assert_, assert_array_almost_equal, assert_array_equal, assert_equal, assert_raises, ) class TestRegression: def test_poly1d(self): # Ticket #28 assert_equal(np.poly1d([1]) - np.poly1d([1, 0])...
import numbers import operator import numpy as np from numpy.testing import assert_, assert_equal, assert_raises # NOTE: This class should be kept as an exact copy of the example from the # docstring for NDArrayOperatorsMixin. class ArrayLike(np.lib.mixins.NDArrayOperatorsMixin): def __init__(self, value): ...
""" Miscellaneous utils. """ from numpy._core import asarray from numpy._core.numeric import normalize_axis_index, normalize_axis_tuple from numpy._utils import set_module __all__ = ["byte_bounds", "normalize_axis_tuple", "normalize_axis_index"] @set_module("numpy.lib.array_utils") def byte_bounds(a): """ Re...
""" A sub-package for efficiently dealing with polynomials. Within the documentation for this sub-package, a "finite power series," i.e., a polynomial (also referred to simply as a "series") is represented by a 1-D numpy array of the polynomial's coefficients, ordered from lowest order term to highest. For example, a...
"""Tests for hermite module. """ from functools import reduce import numpy as np import numpy.polynomial.hermite as herm from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_, assert_almost_equal, assert_equal, assert_raises, ) H0 = np.array([1]) H1 = np.array([0, 2]) H2...
"""Test inter-conversion of different polynomial classes. This tests the convert and cast methods of all the polynomial classes. """ import operator as op from numbers import Number import pytest import numpy as np from numpy.exceptions import RankWarning from numpy.polynomial import ( Chebyshev, Hermite, ...
"""Tests for legendre module. """ from functools import reduce import numpy as np import numpy.polynomial.legendre as leg from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_, assert_almost_equal, assert_equal, assert_raises, ) L0 = np.array([1]) L1 = np.array([0, 1]) L...
""" Tests related to the ``symbol`` attribute of the ABCPolyBase class. """ import pytest import numpy.polynomial as poly from numpy._core import array from numpy.testing import assert_, assert_equal, assert_raises class TestInit: """ Test polynomial creation with symbol kwarg. """ c = [1, 2, 3] ...
"""Tests for polyutils module. """ import numpy as np import numpy.polynomial.polyutils as pu from numpy.testing import ( assert_, assert_almost_equal, assert_equal, assert_raises, ) class TestMisc: def test_trimseq(self): tgt = [1] for num_trailing_zeros in range(5): ...
"""Tests for laguerre module. """ from functools import reduce import numpy as np import numpy.polynomial.laguerre as lag from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_, assert_almost_equal, assert_equal, assert_raises, ) L0 = np.array([1]) / 1 L1 = np.array([1, -...
"""Tests for hermite_e module. """ from functools import reduce import numpy as np import numpy.polynomial.hermite_e as herme from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_, assert_almost_equal, assert_equal, assert_raises, ) He0 = np.array([1]) He1 = np.array([0,...
""" Pytest configuration and fixtures for the Numpy test suite. """ import os import string import sys import tempfile import warnings from contextlib import contextmanager import hypothesis import pytest import numpy import numpy as np from numpy._core._multiarray_tests import get_fpu_mode from numpy._core.tests._na...
""" Array API Inspection namespace This is the namespace for inspection functions as defined by the array API standard. See https://data-apis.org/array-api/latest/API_specification/inspection.html for more details. """ from numpy._core import ( bool, complex64, complex128, dtype, float32, floa...
""" Tests which scan for certain occurrences in the code, they may not find all of these occurrences but should catch almost all. """ import ast import tokenize from pathlib import Path import pytest import numpy class ParseCall(ast.NodeVisitor): def __init__(self): self.ls = [] def visit_Attribute...
""" Test scripts Test that we can run executable scripts that have been installed with numpy. """ import os import subprocess import sys from os.path import dirname, isfile from os.path import join as pathjoin import pytest import numpy as np from numpy.testing import IS_WASM, assert_equal is_inplace = isfile(pathj...
import sys import sysconfig import weakref from pathlib import Path import pytest import numpy as np from numpy.ctypeslib import as_array, load_library, ndpointer from numpy.testing import assert_, assert_array_equal, assert_equal, assert_raises try: import ctypes except ImportError: ctypes = None else: ...
import importlib import importlib.metadata import os import pathlib import subprocess import pytest import numpy as np import numpy._core.include import numpy._core.lib.pkgconfig from numpy.testing import IS_EDITABLE, IS_INSTALLED, IS_WASM, NUMPY_ROOT INCLUDE_DIR = NUMPY_ROOT / '_core' / 'include' PKG_CONFIG_DIR = N...
""" Check the numpy version is valid. Note that a development version is marked by the presence of 'dev0' or '+' in the version string, all else is treated as a release. The version string itself is set from the output of ``git describe`` which relies on tags. Examples -------- Valid Development: 1.22.0.dev0 1.22.0....
import pickle import subprocess import sys import textwrap from importlib import reload import pytest import numpy.exceptions as ex from numpy.testing import ( IS_WASM, assert_, assert_equal, assert_raises, assert_warns, ) def test_numpy_reloading(): # gh-7844. Also check that relevant globa...
import collections import numpy as np def test_no_duplicates_in_np__all__(): # Regression test for gh-10198. dups = {k: v for k, v in collections.Counter(np.__all__).items() if v > 1} assert len(dups) == 0
import numpy as np import numpy.matlib from numpy.testing import assert_, assert_array_equal def test_empty(): x = numpy.matlib.empty((2,)) assert_(isinstance(x, np.matrix)) assert_(x.shape, (1, 2)) def test_ones(): assert_array_equal(numpy.matlib.ones((2, 3)), np.matrix([[ 1.,...
""" Check the numpy config is valid. """ from unittest.mock import patch import pytest import numpy as np pytestmark = pytest.mark.skipif( not hasattr(np.__config__, "_built_with_meson"), reason="Requires Meson builds", ) class TestNumPyConfigs: REQUIRED_CONFIG_KEYS = [ "Compilers", "Ma...
import sys from importlib.util import LazyLoader, find_spec, module_from_spec import pytest # Warning raised by _reload_guard() in numpy/__init__.py @pytest.mark.filterwarnings("ignore:The NumPy module was reloaded") def test_lazy_load(): # gh-22045. lazyload doesn't import submodule names into the namespace ...
"""Utility to compare pep440 compatible version strings. The LooseVersion and StrictVersion classes that distutils provides don't work; they don't recognize anything like alpha/beta/rc/dev versions. """ # Copyright (c) Donald Stufft and individual contributors. # All rights reserved. # Redistribution and use in sour...
""" This is a module for defining private helpers which do not depend on the rest of NumPy. Everything in here must be self-contained so that it can be imported anywhere else without creating circular imports. If a utility requires the import of NumPy, it probably belongs in ``numpy._core``. """ import functools impo...
"""Subset of inspect module from upstream python We use this instead of upstream because upstream inspect is slow to import, and significantly contributes to numpy import times. Importing this copy has almost no overhead. """ import types __all__ = ['getargspec', 'formatargspec'] # ---------------------------------...