Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d4a4e99

Browse files
committed
MAINT: Spellcheck some files.
Fix spelling and grammar in numpy/core/src/multiarray/mapping.c numpy/core/tests/test_indexing.py numpy/core/tests/test_regression.py
1 parent 94417e4 commit d4a4e99

3 files changed

Lines changed: 35 additions & 35 deletions

File tree

numpy/core/src/multiarray/mapping.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ array_assign_boolean_subscript(PyArrayObject *self,
12241224

12251225
if (needs_api) {
12261226
/*
1227-
* FIXME?: most assignment operations stop after the first occurance
1227+
* FIXME?: most assignment operations stop after the first occurrence
12281228
* of an error. Boolean does not currently, but should at least
12291229
* report the error. (This is only relevant for things like str->int
12301230
* casts which call into python)
@@ -1439,7 +1439,7 @@ array_subscript(PyArrayObject *self, PyObject *op)
14391439
/*
14401440
* TODO: Should this be a view or not? The only reason not would be
14411441
* optimization (i.e. of array[...] += 1) I think.
1442-
* Before, it was just self for a single Ellipis.
1442+
* Before, it was just self for a single ellipsis.
14431443
*/
14441444
result = PyArray_View(self, NULL, NULL);
14451445
/* A single ellipsis, so no need to decref */
@@ -1664,7 +1664,7 @@ array_assign_item(PyArrayObject *self, Py_ssize_t i, PyObject *op)
16641664
/*
16651665
* This fallback takes the old route of `arr.flat[index] = values`
16661666
* for one dimensional `arr`. The route can sometimes fail slightly
1667-
* different (ValueError instead of IndexError), in which case we
1667+
* differently (ValueError instead of IndexError), in which case we
16681668
* warn users about the change. But since it does not actually care *at all*
16691669
* about shapes, it should only fail for out of bound indexes or
16701670
* casting errors.
@@ -2448,7 +2448,7 @@ PyArray_MapIterCheckIndices(PyArrayMapIterObject *mit)
24482448
NPY_BEGIN_THREADS_DEF;
24492449

24502450
if (mit->size == 0) {
2451-
/* All indices got broadcasted away, do *not* check as it always was */
2451+
/* All indices got broadcast away, do *not* check as it always was */
24522452
return 0;
24532453
}
24542454

@@ -2671,7 +2671,7 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
26712671
* 1. No subspace iteration is necessary, so the extra_op can
26722672
* be included into the index iterator (it will be buffered)
26732673
* 2. Subspace iteration is necessary, so the extra op is iterated
2674-
* independendly, and the iteration order is fixed at C (could
2674+
* independently, and the iteration order is fixed at C (could
26752675
* also use Fortran order if the array is Fortran order).
26762676
* In this case the subspace iterator is not buffered.
26772677
*
@@ -2864,7 +2864,7 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
28642864
NPY_ITER_GROWINNER;
28652865

28662866
/*
2867-
* For a single 1-d operand, guarantee itertion order
2867+
* For a single 1-d operand, guarantee iteration order
28682868
* (scipy used this). Note that subspace may be used.
28692869
*/
28702870
if ((mit->numiter == 1) && (PyArray_NDIM(index_arrays[0]) == 1)) {
@@ -3076,7 +3076,7 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
30763076

30773077
fail:
30783078
/*
3079-
* Check whether the operand was not broadcastable and replace the error
3079+
* Check whether the operand could not be broadcast and replace the error
30803080
* in that case. This should however normally be found early with a
30813081
* direct goto to broadcast_error
30823082
*/
@@ -3091,7 +3091,7 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
30913091
/* (j < 0 is currently impossible, extra_op is reshaped) */
30923092
j >= 0 &&
30933093
PyArray_DIM(extra_op, i) != mit->dimensions[j]) {
3094-
/* extra_op cannot be broadcasted to the indexing result */
3094+
/* extra_op cannot be broadcast to the indexing result */
30953095
goto broadcast_error;
30963096
}
30973097
}
@@ -3151,7 +3151,7 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
31513151
* that most of this public API is currently not guaranteed
31523152
* to stay the same between versions. If you plan on using
31533153
* it, please consider adding more utility functions here
3154-
* to accomodate new features.
3154+
* to accommodate new features.
31553155
*/
31563156
NPY_NO_EXPORT PyObject *
31573157
PyArray_MapIterArray(PyArrayObject * a, PyObject * index)

numpy/core/tests/test_indexing.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_boolean_indexing_onedim(self):
147147

148148
def test_boolean_assignment_value_mismatch(self):
149149
# A boolean assignment should fail when the shape of the values
150-
# cannot be broadcasted to the subscription. (see also gh-3458)
150+
# cannot be broadcast to the subscription. (see also gh-3458)
151151
a = np.arange(4)
152152
def f(a, v):
153153
a[a > -1] = v
@@ -188,12 +188,12 @@ def test_reverse_strides_and_subspace_bufferinit(self):
188188
# If the strides are not reversed, the 0 in the arange comes last.
189189
assert_equal(a[0], 0)
190190

191-
# This also tests that the subspace buffer is initiliazed:
191+
# This also tests that the subspace buffer is initialized:
192192
a = np.ones((5, 2))
193193
c = np.arange(10).reshape(5, 2)[::-1]
194194
a[b, :] = c
195195
assert_equal(a[0], [0, 1])
196-
196+
197197
def test_reversed_strides_result_allocation(self):
198198
# Test a bug when calculating the output strides for a result array
199199
# when the subspace size was 1 (and test other cases as well)
@@ -346,7 +346,7 @@ def test_small_regressions(self):
346346
# Reference count of intp for index checks
347347
a = np.array([0])
348348
refcount = sys.getrefcount(np.dtype(np.intp))
349-
# item setting always checks indices in seperate function:
349+
# item setting always checks indices in separate function:
350350
a[np.array([0], dtype=np.intp)] = 1
351351
a[np.array([0], dtype=np.uint8)] = 1
352352
assert_raises(IndexError, a.__setitem__,
@@ -537,11 +537,11 @@ class TestMultiIndexingAutomated(TestCase):
537537
These test use code to mimic the C-Code indexing for selection.
538538
539539
NOTE: * This still lacks tests for complex item setting.
540-
* If you change behavoir of indexing, you might want to modify
540+
* If you change behavior of indexing, you might want to modify
541541
these tests to try more combinations.
542542
* Behavior was written to match numpy version 1.8. (though a
543543
first version matched 1.7.)
544-
* Only tuple indicies are supported by the mimicing code.
544+
* Only tuple indices are supported by the mimicking code.
545545
(and tested as of writing this)
546546
* Error types should match most of the time as long as there
547547
is only one error. For multiple errors, what gets raised
@@ -564,7 +564,7 @@ def setUp(self):
564564
slice(4, -1, -2),
565565
slice(None, None, -3),
566566
# Some Fancy indexes:
567-
np.empty((0, 1, 1), dtype=np.intp), # empty broadcastable
567+
np.empty((0, 1, 1), dtype=np.intp), # empty and can be broadcast
568568
np.array([0, 1, -2]),
569569
np.array([[2], [0], [1]]),
570570
np.array([[0, -1], [0, 1]], dtype=np.dtype('intp').newbyteorder()),
@@ -611,7 +611,7 @@ def _get_multi_index(self, arr, indices):
611611
fancy_dim = 0
612612
# NOTE: This is a funny twist (and probably OK to change).
613613
# The boolean array has illegal indexes, but this is
614-
# allowed if the broadcasted fancy-indices are 0-sized.
614+
# allowed if the broadcast fancy-indices are 0-sized.
615615
# This variable is to catch that case.
616616
error_unless_broadcast_to_empty = False
617617

@@ -656,7 +656,7 @@ def _get_multi_index(self, arr, indices):
656656
if arr.ndim - ndim < 0:
657657
# we can't take more dimensions then we have, not even for 0-d arrays.
658658
# since a[()] makes sense, but not a[(),]. We will raise an error
659-
# lateron, unless a broadcasting error occurs first.
659+
# later on, unless a broadcasting error occurs first.
660660
raise IndexError
661661

662662
if ndim == 0 and not None in in_indices:
@@ -668,7 +668,7 @@ def _get_multi_index(self, arr, indices):
668668

669669
for ax, indx in enumerate(in_indices):
670670
if isinstance(indx, slice):
671-
# convert to an index array anways:
671+
# convert to an index array
672672
indx = np.arange(*indx.indices(arr.shape[ax]))
673673
indices.append(['s', indx])
674674
continue
@@ -701,7 +701,7 @@ def _get_multi_index(self, arr, indices):
701701
indx = flat_indx
702702
else:
703703
# This could be changed, a 0-d boolean index can
704-
# make sense (even outide the 0-d indexed array case)
704+
# make sense (even outside the 0-d indexed array case)
705705
# Note that originally this is could be interpreted as
706706
# integer in the full integer special case.
707707
raise IndexError
@@ -753,7 +753,7 @@ def _get_multi_index(self, arr, indices):
753753
arr = arr.transpose(*(fancy_axes + axes))
754754

755755
# We only have one 'f' index now and arr is transposed accordingly.
756-
# Now handle newaxes by reshaping...
756+
# Now handle newaxis by reshaping...
757757
ax = 0
758758
for indx in indices:
759759
if indx[0] == 'f':
@@ -771,7 +771,7 @@ def _get_multi_index(self, arr, indices):
771771
res = np.broadcast(*indx[1:]) # raises ValueError...
772772
else:
773773
res = indx[1]
774-
# unfortunatly the indices might be out of bounds. So check
774+
# unfortunately the indices might be out of bounds. So check
775775
# that first, and use mode='wrap' then. However only if
776776
# there are any indices...
777777
if res.size != 0:
@@ -909,7 +909,7 @@ def test_multidim(self):
909909
# spot and the simple ones in one other spot.
910910
with warnings.catch_warnings():
911911
# This is so that np.array(True) is not accepted in a full integer
912-
# index, when running the file seperatly.
912+
# index, when running the file separately.
913913
warnings.filterwarnings('error', '', DeprecationWarning)
914914
for simple_pos in [0, 2, 3]:
915915
tocheck = [self.fill_indices, self.complex_indices,

numpy/core/tests/test_regression.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_endian_bool_indexing(self,level=rlevel):
181181
assert_(np.all(b[yb] > 0.5))
182182

183183
def test_endian_where(self,level=rlevel):
184-
"""GitHuB issue #369"""
184+
"""GitHub issue #369"""
185185
net = np.zeros(3, dtype='>f4')
186186
net[1] = 0.00458849
187187
net[2] = 0.605202
@@ -290,7 +290,7 @@ def test_unicode_string_comparison(self,level=rlevel):
290290

291291
def test_tobytes_FORTRANORDER_discontiguous(self,level=rlevel):
292292
"""Fix in r2836"""
293-
# Create discontiguous Fortran-ordered array
293+
# Create non-contiguous Fortran ordered array
294294
x = np.array(np.random.rand(3, 3), order='F')[:, :2]
295295
assert_array_almost_equal(x.ravel(), np.fromstring(x.tobytes()))
296296

@@ -311,7 +311,7 @@ def bfb(): x[:] = np.arange(3, dtype=float)
311311
self.assertRaises(ValueError, bfb)
312312

313313
def test_nonarray_assignment(self):
314-
# See also Issue gh-2870, test for nonarray assignment
314+
# See also Issue gh-2870, test for non-array assignment
315315
# and equivalent unsafe casted array assignment
316316
a = np.arange(10)
317317
b = np.ones(10, dtype=bool)
@@ -560,15 +560,15 @@ def test_reshape_zero_strides(self, level=rlevel):
560560
assert_(a.reshape(5, 1).strides[0] == 0)
561561

562562
def test_reshape_zero_size(self, level=rlevel):
563-
"""Github Issue #2700, setting shape failed for 0-sized arrays"""
563+
"""GitHub Issue #2700, setting shape failed for 0-sized arrays"""
564564
a = np.ones((0, 2))
565565
a.shape = (-1, 2)
566566

567567
# Cannot test if NPY_RELAXED_STRIDES_CHECKING changes the strides.
568568
# With NPY_RELAXED_STRIDES_CHECKING the test becomes superfluous.
569569
@dec.skipif(np.ones(1).strides[0] == np.iinfo(np.intp).max)
570570
def test_reshape_trailing_ones_strides(self):
571-
# Github issue gh-2949, bad strides for trailing ones of new shape
571+
# GitHub issue gh-2949, bad strides for trailing ones of new shape
572572
a = np.zeros(12, dtype=np.int32)[::2] # not contiguous
573573
strides_c = (16, 8, 8, 8)
574574
strides_f = (8, 24, 48, 48)
@@ -756,9 +756,9 @@ def test_bool_indexing_invalid_nr_elements(self, level=rlevel):
756756
s = np.ones(10, dtype=float)
757757
x = np.array((15,), dtype=float)
758758
def ia(x, s, v): x[(s>0)]=v
759-
# After removing deprecation, the following is are ValueErrors.
759+
# After removing deprecation, the following are ValueErrors.
760760
# This might seem odd as compared to the value error below. This
761-
# is due to the fact that the new code always use "nonzero" logic
761+
# is due to the fact that the new code always uses "nonzero" logic
762762
# and the boolean special case is not taken.
763763
self.assertRaises(IndexError, ia, x, s, np.zeros(9, dtype=float))
764764
self.assertRaises(IndexError, ia, x, s, np.zeros(11, dtype=float))
@@ -848,7 +848,7 @@ def test_object_array_refcounting(self, level=rlevel):
848848
cnt0_b = cnt(b)
849849
cnt0_c = cnt(c)
850850

851-
# -- 0d -> 1d broadcasted slice assignment
851+
# -- 0d -> 1-d broadcast slice assignment
852852

853853
arr = np.zeros(5, dtype=np.object_)
854854

@@ -865,7 +865,7 @@ def test_object_array_refcounting(self, level=rlevel):
865865

866866
del arr
867867

868-
# -- 1d -> 2d broadcasted slice assignment
868+
# -- 1-d -> 2-d broadcast slice assignment
869869

870870
arr = np.zeros((5, 2), dtype=np.object_)
871871
arr0 = np.zeros(2, dtype=np.object_)
@@ -884,7 +884,7 @@ def test_object_array_refcounting(self, level=rlevel):
884884

885885
del arr, arr0
886886

887-
# -- 2d copying + flattening
887+
# -- 2-d copying + flattening
888888

889889
arr = np.zeros((5, 2), dtype=np.object_)
890890

@@ -1029,8 +1029,8 @@ def test_compress_small_type(self, level=rlevel):
10291029
b = np.zeros((2, 1), dtype = np.single)
10301030
try:
10311031
a.compress([True, False], axis = 1, out = b)
1032-
raise AssertionError("compress with an out which cannot be " \
1033-
"safely casted should not return "\
1032+
raise AssertionError("compress with an out which cannot be "
1033+
"safely casted should not return "
10341034
"successfully")
10351035
except TypeError:
10361036
pass

0 commit comments

Comments
 (0)