diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/common/numpyos.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/arrayobject.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/dragon4.c | 4 | ||||
-rw-r--r-- | numpy/core/src/umath/simd.inc.src | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_arrayprint.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 23 | ||||
-rw-r--r-- | numpy/core/tests/test_numeric.py | 10 | ||||
-rw-r--r-- | numpy/core/tests/test_records.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_regression.py | 4 | ||||
-rw-r--r-- | numpy/core/tests/test_ufunc.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_umath.py | 2 | ||||
-rw-r--r-- | numpy/distutils/system_info.py | 2 | ||||
-rw-r--r-- | numpy/lib/arraypad.py | 4 | ||||
-rw-r--r-- | numpy/lib/recfunctions.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_histograms.py | 2 | ||||
-rw-r--r-- | numpy/linalg/linalg.py | 2 | ||||
-rw-r--r-- | numpy/linalg/umath_linalg.c.src | 2 | ||||
-rw-r--r-- | numpy/ma/core.py | 2 | ||||
-rw-r--r-- | numpy/random/_generator.pyx | 2 | ||||
-rw-r--r-- | numpy/testing/_private/utils.py | 21 |
21 files changed, 50 insertions, 46 deletions
diff --git a/numpy/core/src/common/numpyos.c b/numpy/core/src/common/numpyos.c index d60b1ca17..7a629f46f 100644 --- a/numpy/core/src/common/numpyos.c +++ b/numpy/core/src/common/numpyos.c @@ -283,7 +283,7 @@ fix_ascii_format(char* buf, size_t buflen, int decimal) * converting. * - value: The value to convert * - decimal: if != 0, always has a decimal, and at leasat one digit after - * the decimal. This has the same effect as passing 'Z' in the origianl + * the decimal. This has the same effect as passing 'Z' in the original * PyOS_ascii_formatd * * This is similar to PyOS_ascii_formatd in python > 2.6, except that it does diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c index 0c554d31b..aef0db36c 100644 --- a/numpy/core/src/multiarray/arrayobject.c +++ b/numpy/core/src/multiarray/arrayobject.c @@ -1538,7 +1538,7 @@ array_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) * - If other is not convertible to an array, pass on the error * (MHvK, 2018-06-18: not sure about this, but it's what we have). * - * However, for backwards compatibilty, we cannot yet return arrays, + * However, for backwards compatibility, we cannot yet return arrays, * so we raise warnings instead. Furthermore, we warn on python2 * for LT, LE, GE, GT, since fall-back behaviour is poorly defined. */ diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index b30e24496..41dcaf3bb 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -41,7 +41,7 @@ */ /* - * Scanning function for next element parsing and seperator skipping. + * Scanning function for next element parsing and separator skipping. * These functions return: * - 0 to indicate more data to read * - -1 when reading stopped at the end of the string/file diff --git a/numpy/core/src/multiarray/dragon4.c b/numpy/core/src/multiarray/dragon4.c index 1694596e9..d14b8e638 100644 --- a/numpy/core/src/multiarray/dragon4.c +++ b/numpy/core/src/multiarray/dragon4.c @@ -1565,8 +1565,8 @@ Dragon4(BigInt *bigints, const npy_int32 exponent, /* Options struct for easy passing of Dragon4 options. * * scientific - boolean controlling whether scientific notation is used - * digit_mode - whether to use unique or fixed fracional output - * cutoff_mode - whether 'precision' refers to toal digits, or digits past + * digit_mode - whether to use unique or fixed fractional output + * cutoff_mode - whether 'precision' refers to to all digits, or digits past * the decimal point. * precision - When negative, prints as many digits as needed for a unique * number. When positive specifies the maximum number of diff --git a/numpy/core/src/umath/simd.inc.src b/numpy/core/src/umath/simd.inc.src index 1f29526be..448aa3e72 100644 --- a/numpy/core/src/umath/simd.inc.src +++ b/numpy/core/src/umath/simd.inc.src @@ -1856,7 +1856,7 @@ static NPY_INLINE NPY_GCC_OPT_3 NPY_GCC_TARGET_@ISA@ void * method: x* = x - y*PI/2, where y = rint(x*2/PI). x* \in [-PI/4, PI/4]. * (3) Map cos(x) to (+/-)sine or (+/-)cosine of x* based on the quadrant k = * int(y). - * (4) For elements outside that range, Cody-Waite reduction peforms poorly + * (4) For elements outside that range, Cody-Waite reduction performs poorly * leading to catastrophic cancellation. We compute cosine by calling glibc in * a scalar fashion. * (5) Vectorized implementation has a max ULP of 1.49 and performs at least diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py index eac4647c9..2d0abc517 100644 --- a/numpy/core/tests/test_arrayprint.py +++ b/numpy/core/tests/test_arrayprint.py @@ -856,7 +856,7 @@ def test_unicode_object_array(): class TestContextManager: def test_ctx_mgr(self): - # test that context manager actuall works + # test that context manager actually works with np.printoptions(precision=2): s = str(np.array([2.0]) / 3) assert_equal(s, '[0.67]') diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 85910886a..d47f1e17e 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -44,6 +44,7 @@ from numpy.testing import ( assert_allclose, IS_PYPY, HAS_REFCOUNT, assert_array_less, runstring, temppath, suppress_warnings, break_cycles, ) +from numpy.testing._private.utils import _no_tracing from numpy.core.tests._locales import CommaDecimalPointLocale # Need to test an object that does not fully implement math interface @@ -94,26 +95,6 @@ def _aligned_zeros(shape, dtype=float, order="C", align=None): data.fill(0) return data -def _no_tracing(func): - """ - Decorator to temporarily turn off tracing for the duration of a test. - Needed in tests that check refcounting, otherwise the tracing itself - influences the refcounts - """ - if not hasattr(sys, 'gettrace'): - return func - else: - @functools.wraps(func) - def wrapper(*args, **kwargs): - original_trace = sys.gettrace() - try: - sys.settrace(None) - return func(*args, **kwargs) - finally: - sys.settrace(original_trace) - return wrapper - - class TestFlags: def setup(self): @@ -8324,7 +8305,7 @@ def test_npymath_real(): assert_allclose(got, expected) def test_uintalignment_and_alignment(): - # alignment code needs to satisfy these requrements: + # alignment code needs to satisfy these requirements: # 1. numpy structs match C struct layout # 2. ufuncs/casting is safe wrt to aligned access # 3. copy code is safe wrt to "uint alidned" access diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 934f0a2fd..661beca4f 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -1882,7 +1882,7 @@ class TestClip: assert_array_strict_equal(ac, act) def test_clip_with_out_transposed(self): - # Test that the out argument works when tranposed + # Test that the out argument works when transposed a = np.arange(16).reshape(4, 4) out = np.empty_like(a).T a.clip(4, 10, out=out) @@ -1991,7 +1991,9 @@ class TestClip: actual = np.clip(arr, amin, amax) assert_equal(actual, exp) - @pytest.mark.xfail(reason="no scalar nan propagation yet") + @pytest.mark.xfail(reason="no scalar nan propagation yet", + raises=AssertionError, + strict=True) @pytest.mark.parametrize("arr, amin, amax", [ # problematic scalar nan case from hypothesis (np.zeros(10, dtype=np.int64), @@ -2001,10 +2003,10 @@ class TestClip: def test_clip_scalar_nan_propagation(self, arr, amin, amax): # enforcement of scalar nan propagation for comparisons # called through clip() - expected = np.minimum(np.maximum(a, amin), amax) + expected = np.minimum(np.maximum(arr, amin), amax) with assert_warns(DeprecationWarning): actual = np.clip(arr, amin, amax) - assert_equal(actual, expected) + assert_equal(actual, expected) @pytest.mark.xfail(reason="propagation doesn't match spec") @pytest.mark.parametrize("arr, amin, amax", [ diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py index 4b4bd2729..060176d3d 100644 --- a/numpy/core/tests/test_records.py +++ b/numpy/core/tests/test_records.py @@ -422,7 +422,7 @@ class TestRecord: a['obj'] = data a['int'] = 42 ctor, args = a[0].__reduce__() - # check the contructor is what we expect before interpreting the arguments + # check the constructor is what we expect before interpreting the arguments assert ctor is np.core.multiarray.scalar dtype, obj = args # make sure we did not pickle the address diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index c77c11d41..10255b88d 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -14,8 +14,8 @@ from numpy.testing import ( assert_raises_regex, assert_warns, suppress_warnings, _assert_valid_refcount, HAS_REFCOUNT, ) +from numpy.testing._private.utils import _no_tracing from numpy.compat import asbytes, asunicode, long, pickle -from test.support import no_tracing try: RecursionError @@ -1315,7 +1315,7 @@ class TestRegression: assert_(pickle.loads( pickle.dumps(test_record, protocol=proto)) == test_record) - @no_tracing + @_no_tracing def test_blasdot_uninitialized_memory(self): # Ticket #950 for m in [0, 1, 2]: diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py index 01e3c5087..a299bcf28 100644 --- a/numpy/core/tests/test_ufunc.py +++ b/numpy/core/tests/test_ufunc.py @@ -1811,7 +1811,7 @@ class TestUfunc: assert_raises(TypeError, f, d, 0, keepdims="invalid", dtype="invalid", out=None) - # invalid keyord + # invalid keyword assert_raises(TypeError, f, d, axis=0, dtype=None, invalid=0) assert_raises(TypeError, f, d, invalid=0) assert_raises(TypeError, f, d, 0, keepdims=True, invalid="invalid", diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index e966eebf0..0ab029988 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -1624,7 +1624,7 @@ class TestSpecialMethods: @property def args(self): # We need to ensure these are fetched at the same time, before - # any other ufuncs are calld by the assertions + # any other ufuncs are called by the assertions return (self._prepare_args, self._wrap_args) def __repr__(self): return "a" # for short test output diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 508aeefc5..6a69fed59 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -714,7 +714,7 @@ class system_info: return info def get_info(self, notfound_action=0): - """ Return a dictonary with items that are compatible + """ Return a dictionary with items that are compatible with numpy.distutils.setup keyword arguments. """ flag = 0 diff --git a/numpy/lib/arraypad.py b/numpy/lib/arraypad.py index 247eed07c..7569e7651 100644 --- a/numpy/lib/arraypad.py +++ b/numpy/lib/arraypad.py @@ -232,7 +232,7 @@ def _get_linear_ramps(padded, axis, width_pair, end_value_pair): def _get_stats(padded, axis, width_pair, length_pair, stat_func): """ - Calculate statistic for the empty-padded array in given dimnsion. + Calculate statistic for the empty-padded array in given dimension. Parameters ---------- @@ -271,7 +271,7 @@ def _get_stats(padded, axis, width_pair, length_pair, stat_func): if (left_length == 0 or right_length == 0) \ and stat_func in {np.amax, np.amin}: - # amax and amin can't operate on an emtpy array, + # amax and amin can't operate on an empty array, # raise a more descriptive warning here instead of the default one raise ValueError("stat_length of 0 yields no value for padding") diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index 93aa67a3b..4e62169f4 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -436,7 +436,7 @@ def merge_arrays(seqarrays, fill_value=-1, flatten=False, if seqdtype.names is None: seqdtype = np.dtype([('', seqdtype)]) if not flatten or _zip_dtype((seqarrays,), flatten=True) == seqdtype: - # Minimal processing needed: just make sure everythng's a-ok + # Minimal processing needed: just make sure everything's a-ok seqarrays = seqarrays.ravel() # Find what type of array we must return if usemask: diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py index c21103891..fc16b7396 100644 --- a/numpy/lib/tests/test_histograms.py +++ b/numpy/lib/tests/test_histograms.py @@ -81,7 +81,7 @@ class TestHistogram: a, b = histogram(v, bins, density=False) assert_array_equal(a, [1, 2, 3, 4]) - # Variale bin widths are especially useful to deal with + # Variable bin widths are especially useful to deal with # infinities. v = np.arange(10) bins = [0, 1, 3, 6, np.inf] diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 15615e1a3..7c0b6facf 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -772,7 +772,7 @@ def cholesky(a): return wrap(r.astype(result_t, copy=False)) -# QR decompostion +# QR decomposition def _qr_dispatcher(a, mode=None): return (a,) diff --git a/numpy/linalg/umath_linalg.c.src b/numpy/linalg/umath_linalg.c.src index 21145a861..e66fc9916 100644 --- a/numpy/linalg/umath_linalg.c.src +++ b/numpy/linalg/umath_linalg.c.src @@ -1841,7 +1841,7 @@ typedef struct geev_params_struct { void *WR; /* RWORK in complex versions, REAL W buffer for (sd)geev*/ void *WI; void *VLR; /* REAL VL buffers for _geev where _ is s, d */ - void *VRR; /* REAL VR buffers for _geev hwere _ is s, d */ + void *VRR; /* REAL VR buffers for _geev where _ is s, d */ void *WORK; void *W; /* final w */ void *VL; /* final vl */ diff --git a/numpy/ma/core.py b/numpy/ma/core.py index d51d8e6ec..30aef7465 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -99,7 +99,7 @@ def _deprecate_argsort_axis(arr): The array which argsort was called on np.ma.argsort has a long-term bug where the default of the axis argument - is wrong (gh-8701), which now must be kept for backwards compatibiity. + is wrong (gh-8701), which now must be kept for backwards compatibility. Thankfully, this only makes a difference when arrays are 2- or more- dimensional, so we only need a warning then. """ diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index 0ba403138..5cd699ac7 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -4017,7 +4017,7 @@ cdef class Generator: total, num_colors, colors_ptr, nsamp, num_variates, variates_ptr) if result == -1: - raise MemoryError("Insufficent memory for multivariate_" + raise MemoryError("Insufficient memory for multivariate_" "hypergeometric with method='count' and " "sum(colors)=%d" % total) else: diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 914491b71..69b2af4df 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -2474,3 +2474,24 @@ def _get_mem_available(): return info['memfree'] + info['cached'] return None + + +def _no_tracing(func): + """ + Decorator to temporarily turn off tracing for the duration of a test. + Needed in tests that check refcounting, otherwise the tracing itself + influences the refcounts + """ + if not hasattr(sys, 'gettrace'): + return func + else: + @wraps(func) + def wrapper(*args, **kwargs): + original_trace = sys.gettrace() + try: + sys.settrace(None) + return func(*args, **kwargs) + finally: + sys.settrace(original_trace) + return wrapper + |