mirror of
https://github.com/numpy/numpy.git
synced 2026-10-28 16:34:42 +08:00
MAINT: Fix typos
This commit is contained in:
54 files changed
+75
-75
No files matched your search
+1
-1
@@ -6,7 +6,7 @@ This page provides an overview of development priorities for NumPy.
|
||||
Specifically, it contains a roadmap with a higher-level overview, as
|
||||
well as NumPy Enhancement Proposals (NEPs)—suggested changes
|
||||
to the library—in various stages of discussion or completion.
|
||||
See :doc:`nep-0000` for more informations about NEPs.
|
||||
See :doc:`nep-0000` for more information about NEPs.
|
||||
|
||||
Roadmap
|
||||
-------
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ def replace_scalar_type_names():
|
||||
if sys.implementation.name == 'cpython':
|
||||
c_typ.tp_name = _name_cache[typ] = b"numpy." + name.encode('utf8')
|
||||
else:
|
||||
# It is not guarenteed that the c_typ has this model on other
|
||||
# It is not guaranteed that the c_typ has this model on other
|
||||
# implementations
|
||||
_name_cache[typ] = b"numpy." + name.encode('utf8')
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ distances among them. The output dimension ``p`` must therefore be equal to
|
||||
in an output array of the right size. If the size of a core dimension of an output
|
||||
cannot be determined from a passed in input or output array, an error will be
|
||||
raised. This can be changed by defining a ``PyUFunc_ProcessCoreDimsFunc`` function
|
||||
and assigning it to the ``proces_core_dims_func`` field of the ``PyUFuncObject``
|
||||
and assigning it to the ``process_core_dims_func`` field of the ``PyUFuncObject``
|
||||
structure. See below for more details.
|
||||
|
||||
Note: Prior to NumPy 1.10.0, less strict checks were in place: missing core
|
||||
|
||||
@@ -203,7 +203,7 @@ foreach opt_name, conf : parse_options
|
||||
warning('CPU Feature "@0@" is no longer explicitly supported, redirecting to "@1@".'.format(tok, ntok))
|
||||
endif
|
||||
warning('Please check the latest documentation for build options.')
|
||||
if ntok == '' or not append # redirected features not safe to be execluded
|
||||
if ntok == '' or not append # redirected features not safe to be excluded
|
||||
continue
|
||||
endif
|
||||
tok = ntok
|
||||
|
||||
+1
-1
@@ -3774,7 +3774,7 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]):
|
||||
def setfield(self: Never, val: Never, /, dtype: Never, offset: L[0] = 0) -> None: ... # type: ignore[misc]
|
||||
def searchsorted(self: Never, v: Never, /, side: L["left"] = "left", sorter: None = None) -> Never: ... # type: ignore[misc]
|
||||
|
||||
# NOTE: this wont't raise, but won't do anything either
|
||||
# NOTE: this won't raise, but won't do anything either
|
||||
@overload
|
||||
@deprecated("Resizing a NumPy generic inplace has been deprecated in NumPy 2.5")
|
||||
def resize(self, /, *, refcheck: py_bool = True) -> None: ...
|
||||
|
||||
@@ -1188,14 +1188,14 @@ def bmm_einsum(eq, a, b, out=None, **kwargs):
|
||||
|
||||
# prepare left
|
||||
if eq_a is not None:
|
||||
# diagonals, sums, and tranpose
|
||||
# diagonals, sums, and transpose
|
||||
a = c_einsum(eq_a, a)
|
||||
if new_shape_a is not None:
|
||||
a = reshape(a, new_shape_a)
|
||||
|
||||
# prepare right
|
||||
if eq_b is not None:
|
||||
# diagonals, sums, and tranpose
|
||||
# diagonals, sums, and transpose
|
||||
b = c_einsum(eq_b, b)
|
||||
if new_shape_b is not None:
|
||||
b = reshape(b, new_shape_b)
|
||||
|
||||
@@ -495,7 +495,7 @@ typedef PyArray_Descr *(PyArrayDTypeMeta_EnsureCanonical)(PyArray_Descr *dtype);
|
||||
typedef PyArray_Descr *(PyArrayDTypeMeta_FinalizeDescriptor)(PyArray_Descr *dtype);
|
||||
|
||||
/*
|
||||
* Constants that can be queried and used e.g. by reduce identies defaults.
|
||||
* Constants that can be queried and used e.g. by reducing identities defaults.
|
||||
* These are also used to expose .finfo and .iinfo for example.
|
||||
*/
|
||||
/* Numerical constants */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#include "npy_cpu_features.h" // NPY_CPU_HAVE
|
||||
/**
|
||||
* This header genereated by the build system and contains:
|
||||
* This header was generated by the build system and contains:
|
||||
*
|
||||
* - Headers for platform-specific instruction sets.
|
||||
* - Helper macros that encapsulate enabled features through user-defined build options
|
||||
@@ -79,7 +79,7 @@ npy_cpu_dispatch_trace(const char *func_name, const char *signature,
|
||||
* Extract the enabled CPU targets from the generated configuration file.
|
||||
*
|
||||
* This macro is used to extract the enabled CPU targets from the generated configuration file,
|
||||
* which is derived from 'meson.multi_targets()' or from 'disutils.CCompilerOpt' in the case of using distutils.
|
||||
* which is derived from 'meson.multi_targets()' or from 'disuttils.CCompilerOpt' in the case of using distutils.
|
||||
* It then calls 'npy_cpu_dispatch_trace()' to insert a new item into the '__cpu_targets_info__' dictionary,
|
||||
* based on the provided FUNC_NAME and SIGNATURE.
|
||||
*
|
||||
|
||||
@@ -502,7 +502,7 @@ npy__cpu_init_features(void)
|
||||
// long mode only
|
||||
npy__cpu_have[NPY_CPU_FEATURE_LAHF] = (reg[2] & (1 << 0)) != 0;
|
||||
#else
|
||||
// alawys available
|
||||
// always available
|
||||
npy__cpu_have[NPY_CPU_FEATURE_LAHF] = 1;
|
||||
#endif
|
||||
npy__cpu_have[NPY_CPU_FEATURE_LZCNT] = (reg[2] & (1 << 5)) != 0;
|
||||
|
||||
@@ -528,7 +528,7 @@ NPYV_IMPL_LSX_REST_PARTIAL_TYPES_PAIR(u64, s64)
|
||||
NPYV_IMPL_LSX_REST_PARTIAL_TYPES_PAIR(f64, s64)
|
||||
|
||||
/************************************************************
|
||||
* de-interlave load / interleave contiguous store
|
||||
* de-interleave load / interleave contiguous store
|
||||
************************************************************/
|
||||
// two channels
|
||||
#define NPYV_IMPL_LSX_MEM_INTERLEAVE(SFX, ZSFX) \
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
// Indicates if the SIMD operations are available for float16.
|
||||
#define NPY_HWY_F16 (NPY_HWY && HWY_HAVE_FLOAT16)
|
||||
// Note: Highway requires SIMD extentions with native float32 support, so we don't need
|
||||
// Note: Highway requires SIMD extensions with native float32 support, so we don't need
|
||||
// to check for it.
|
||||
|
||||
// Indicates if the SIMD operations are available for float64.
|
||||
@@ -64,7 +64,7 @@ namespace simd {
|
||||
/// We can not import all the symbols from the HWY_NAMESPACE because it will
|
||||
/// conflict with the existing symbols in the numpy namespace.
|
||||
namespace hn = hwy::HWY_NAMESPACE;
|
||||
// internaly used by the template header
|
||||
// internally used by the template header
|
||||
template <typename TLane>
|
||||
using _Tag = hn::ScalableTag<TLane>;
|
||||
#endif
|
||||
|
||||
@@ -567,7 +567,7 @@ boundarraymethod_dealloc(PyObject *self)
|
||||
* changes and especially testing if they were to be made public.
|
||||
*/
|
||||
static PyObject *
|
||||
boundarraymethod__resolve_descripors(
|
||||
boundarraymethod__resolve_descriptors(
|
||||
PyBoundArrayMethodObject *self, PyObject *descr_tuple)
|
||||
{
|
||||
int nin = self->method->nin;
|
||||
@@ -957,7 +957,7 @@ PyArrayMethod_GetMaskedStridedLoop(
|
||||
|
||||
|
||||
PyMethodDef boundarraymethod_methods[] = {
|
||||
{"_resolve_descriptors", (PyCFunction)boundarraymethod__resolve_descripors,
|
||||
{"_resolve_descriptors", (PyCFunction)boundarraymethod__resolve_descriptors,
|
||||
METH_O, "Resolve the given dtypes."},
|
||||
{"_simple_strided_call", (PyCFunction)boundarraymethod__simple_strided_call,
|
||||
METH_O, "call on 1-d inputs and pre-allocated outputs (single call)."},
|
||||
|
||||
@@ -4380,7 +4380,7 @@ static int
|
||||
|
||||
/*
|
||||
Keeping Half macros consistent with standard C
|
||||
Refernce: https://en.cppreference.com/w/c/types/limits.html
|
||||
Reference: https://en.cppreference.com/w/c/types/limits.html
|
||||
*/
|
||||
#define HALF_MAX 31743 /* Bit pattern for 65504.0 */
|
||||
#define HALF_MIN 1024 /* Bit pattern for smallest positive normal: 2^-14 */
|
||||
@@ -4476,7 +4476,7 @@ static int
|
||||
/*
|
||||
Definition: Minimum negative integer such that FLT_RADIX raised by power one less than that integer is a normalized float, double and long double respectively
|
||||
|
||||
refernce: https://en.cppreference.com/w/c/types/limits.html
|
||||
reference: https://en.cppreference.com/w/c/types/limits.html
|
||||
*/
|
||||
*(npy_intp *)ptr = @ABB@_MIN_EXP - 1;
|
||||
return 1;
|
||||
|
||||
@@ -654,7 +654,7 @@ PyArray_Round(PyArrayObject *a, int decimals, PyArrayObject *out)
|
||||
op2 = n_ops.multiply;
|
||||
if (decimals == INT_MIN) {
|
||||
// not technically correct but it doesn't matter because no one in
|
||||
// this millenium is using floating point numbers with enough
|
||||
// this milllenium is using floating point numbers with enough
|
||||
// accuracy for this to matter
|
||||
decimals = INT_MAX;
|
||||
}
|
||||
|
||||
@@ -1060,7 +1060,7 @@ PyArray_NewFromDescrAndBase(
|
||||
* NPY_KEEPORDER - Keeps the axis ordering of prototype.
|
||||
* descr - If not NULL, overrides the data type of the result.
|
||||
* dtype - If not NULL and if descr is NULL, overrides the data type
|
||||
of the result, so long as dtype is non-parameteric
|
||||
of the result, so long as dtype is non-parametric
|
||||
* ndim - If not -1, overrides the shape of the result.
|
||||
* dims - If ndim is not -1, overrides the shape of the result.
|
||||
* subok - If 1, use the prototype's array subtype, otherwise
|
||||
|
||||
@@ -2755,7 +2755,7 @@ indexing_error:
|
||||
*
|
||||
* @param Index information filled by prepare_index.
|
||||
* @param Number of indices (gotten through prepare_index).
|
||||
* @param Kind of index (gotten through preprare_index).
|
||||
* @param Kind of index (gotten through prepare_index).
|
||||
* @param NpyIter flags for an extra array. If 0 assume that there is no
|
||||
* extra operand. NPY_ITER_ALLOCATE can make sense here.
|
||||
* @param Array being indexed
|
||||
|
||||
@@ -346,7 +346,7 @@ PyArray_DescrFromTypeObject(PyObject *type)
|
||||
_PyArray_LegacyDescr *conv = NULL;
|
||||
int res = PyObject_GetOptionalAttr(type, npy_interned_str.dtype, &attr);
|
||||
if (res < 0) {
|
||||
return NULL; // Should be a rather criticial error, so just fail.
|
||||
return NULL; // Should be a rather critical error, so just fail.
|
||||
}
|
||||
if (res == 1) {
|
||||
if (!PyArray_DescrCheck(attr)) {
|
||||
|
||||
@@ -2128,7 +2128,7 @@ static PyObject *
|
||||
gentype___copy__(PyObject *self)
|
||||
{
|
||||
// scalars are immutable, so we can return a new reference
|
||||
// the only expections are scalars with void dtype
|
||||
// the only exceptions are scalars with void dtype
|
||||
if (PyObject_IsInstance(self, (PyObject *)&PyVoidArrType_Type)) {
|
||||
// path via array
|
||||
return gentype_generic_method(self, NULL, NULL, "__copy__");
|
||||
@@ -2142,7 +2142,7 @@ gentype___deepcopy__(PyObject *self, PyObject *args)
|
||||
// note: maybe the signature needs to be updated as __deepcopy__ can accept the keyword memo
|
||||
|
||||
// scalars are immutable, so we can return a new reference
|
||||
// the only expections are scalars with void dtype
|
||||
// the only exceptions are scalars with void dtype
|
||||
// if the number of arguments is not 1, we let gentype_generic_method do the
|
||||
// error handling
|
||||
if (PyObject_IsInstance(self, (PyObject *)&PyVoidArrType_Type) || (PyTuple_Size(args)!=1)) {
|
||||
|
||||
@@ -123,7 +123,7 @@ binsearch(const char *arr, const char *key, char *ret, npy_intp arr_len,
|
||||
|
||||
Optimization: we unroll the first iteration for the following reasons:
|
||||
1. ret is not initialized with the bases, so we save |keys| writes
|
||||
by not having to intialize it with 0s.
|
||||
by not having to initialize it with 0s.
|
||||
2. By assuming the initial base for every key is 0, we also save
|
||||
|keys| reads.
|
||||
3. In the first iteration, all elements are compared against the
|
||||
|
||||
@@ -367,7 +367,7 @@ PyArray_NewLegacyWrappingArrayMethod(PyUFuncObject *ufunc,
|
||||
flags = _NPY_METH_FORCE_CAST_INPUTS;
|
||||
}
|
||||
|
||||
PyArrayMethod_GetReductionInitial *get_reduction_intial = NULL;
|
||||
PyArrayMethod_GetReductionInitial *get_reduction_initial = NULL;
|
||||
if (ufunc->nin == 2 && ufunc->nout == 1) {
|
||||
npy_bool reorderable = NPY_FALSE;
|
||||
PyObject *identity_obj = PyUFunc_GetDefaultIdentity(
|
||||
@@ -385,7 +385,7 @@ PyArray_NewLegacyWrappingArrayMethod(PyUFuncObject *ufunc,
|
||||
flags |= NPY_METH_IS_REORDERABLE;
|
||||
}
|
||||
if (identity_obj != Py_None) {
|
||||
get_reduction_intial = &get_initial_from_ufunc;
|
||||
get_reduction_initial = &get_initial_from_ufunc;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ufunc->nin+ufunc->nout; i++) {
|
||||
@@ -401,7 +401,7 @@ PyArray_NewLegacyWrappingArrayMethod(PyUFuncObject *ufunc,
|
||||
PyType_Slot slots[4] = {
|
||||
{NPY_METH_get_loop, &get_wrapped_legacy_ufunc_loop},
|
||||
{NPY_METH_resolve_descriptors, &simple_legacy_resolve_descriptors},
|
||||
{NPY_METH_get_reduction_initial, get_reduction_intial},
|
||||
{NPY_METH_get_reduction_initial, get_reduction_initial},
|
||||
{0, NULL},
|
||||
};
|
||||
if (any_output_flexible) {
|
||||
|
||||
@@ -141,7 +141,7 @@ get_value_range(PyObject *value, int type_num, int *range)
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* If we are checking for unisgned long long, the value may be larger
|
||||
* If we are checking for unsigned long long, the value may be larger
|
||||
* then long long, but within range of unsigned long long. Check this
|
||||
* by doing the normal Python integer comparison.
|
||||
*/
|
||||
|
||||
@@ -4546,7 +4546,7 @@ ufunc_generic_fastcall(PyUFuncObject *ufunc,
|
||||
PyObject *keepdims_obj = NULL, *casting_obj = NULL, *order_obj = NULL;
|
||||
PyObject *subok_obj = NULL, *signature_obj = NULL, *sig_obj = NULL;
|
||||
PyObject *dtype_obj = NULL;
|
||||
/* Typically, NumPy defaults to returnin scalars for 0-D results */
|
||||
/* Typically, NumPy defaults to returning scalars for 0-D results */
|
||||
npy_bool return_scalar = NPY_TRUE;
|
||||
|
||||
/* Skip parsing if there are no keyword arguments, nothing left to do */
|
||||
@@ -4640,7 +4640,7 @@ ufunc_generic_fastcall(PyUFuncObject *ufunc,
|
||||
if ((where_obj != NULL && where_obj != Py_True)
|
||||
&& (full_args.out == NULL) && (out_obj == NULL)) {
|
||||
if (PyErr_WarnEx(PyExc_UserWarning,
|
||||
"'where' used without 'out', expect unitialized memory in output. "
|
||||
"'where' used without 'out', expect uninitialized memory in output. "
|
||||
"If this is intentional, use out=None.", 1) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -1158,7 +1158,7 @@ PyUFunc_MultiplicationTypeResolver(PyUFuncObject *ufunc,
|
||||
return -1;
|
||||
}
|
||||
|
||||
// This is wrong agaian cause of elsize, but only the DType matters
|
||||
// This is wrong again because of elsize, but only the DType matters
|
||||
// here (String or Unicode).
|
||||
out_dtypes[2] = out_dtypes[1];
|
||||
Py_INCREF(out_dtypes[1]);
|
||||
|
||||
@@ -475,7 +475,7 @@ def test_copyto_cast_safety():
|
||||
np.copyto(np.arange(3, dtype=np.float32), 2e300, casting="safe")
|
||||
|
||||
|
||||
def test_copyto_permut():
|
||||
def test_copyto_permute():
|
||||
# test explicit overflow case
|
||||
pad = 500
|
||||
l = [True] * pad + [True, True, True, True]
|
||||
|
||||
@@ -910,7 +910,7 @@ def test_empty_string():
|
||||
@pytest.mark.parametrize("res_dt,hug_val",
|
||||
[("float16", "1e30"), ("float32", "1e200")])
|
||||
def test_string_to_float_coercion_errors(dtype, res_dt, hug_val):
|
||||
# This test primarly tests setitem
|
||||
# This test primarily tests setitem
|
||||
val = np.array(["3M"], dtype=dtype)[0] # use the scalar
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
|
||||
@@ -345,7 +345,7 @@ class TestTooManyArgsExtremum(_DeprecationTestCase):
|
||||
message = "Passing more than 2 positional arguments to np.maximum and np.minimum "
|
||||
|
||||
@pytest.mark.parametrize("ufunc", [np.minimum, np.maximum])
|
||||
def test_extremem_3_args(self, ufunc):
|
||||
def test_extremum_3_args(self, ufunc):
|
||||
self.assert_deprecated(ufunc, args=(np.ones(1), np.zeros(1), np.empty(1)))
|
||||
|
||||
|
||||
|
||||
@@ -1199,7 +1199,7 @@ class TestDTypeMakeCanonical:
|
||||
|
||||
def test_object_flag_not_inherited(self):
|
||||
# The following dtype still indicates "object", because its included
|
||||
# in the unaccessible space (maybe this could change at some point):
|
||||
# in the inaccessible space (maybe this could change at some point):
|
||||
arr = np.ones(3, "i,O,i")[["f0", "f2"]]
|
||||
assert arr.dtype.hasobject
|
||||
canonical_dt = np.result_type(arr.dtype)
|
||||
|
||||
@@ -1184,7 +1184,7 @@ class TestEinsumPath:
|
||||
ret &= (comp[pos + 1] == benchmark[pos + 1])
|
||||
assert_(ret)
|
||||
|
||||
def test_memory_contraints(self):
|
||||
def test_memory_constraints(self):
|
||||
# Ensure memory constraints are satisfied
|
||||
|
||||
outer_test = self.build_operands('a,b,c->abc')
|
||||
|
||||
@@ -1400,7 +1400,7 @@ class TestCreation:
|
||||
with pytest.raises(ValueError, match="ndmax must be in the range"):
|
||||
np.array(data, ndmax=-1)
|
||||
|
||||
def test_ndmax_greather_than_NPY_MAXDIMS(self):
|
||||
def test_ndmax_greater_than_NPY_MAXDIMS(self):
|
||||
data = [1, 2, 3]
|
||||
# current NPY_MAXDIMS is 64
|
||||
with pytest.raises(ValueError, match="ndmax must be in the range"):
|
||||
@@ -1808,7 +1808,7 @@ class TestStructured:
|
||||
@pytest.mark.parametrize("align", [True, False])
|
||||
def test_structured_promotion_packs(self, dtype_dict, align):
|
||||
# Structured dtypes are packed when promoted (we consider the packed
|
||||
# form to be "canonical"), so tere is no extra padding.
|
||||
# form to be "canonical"), so there is no extra padding.
|
||||
dtype = np.dtype(dtype_dict, align=align)
|
||||
# Remove non "canonical" dtype options:
|
||||
dtype_dict.pop("itemsize", None)
|
||||
@@ -8331,22 +8331,22 @@ class TestWarnings:
|
||||
|
||||
class TestMinScalarType:
|
||||
|
||||
def test_usigned_shortshort(self):
|
||||
def test_unsigned_shortshort(self):
|
||||
dt = np.min_scalar_type(2**8 - 1)
|
||||
wanted = np.dtype('uint8')
|
||||
assert_equal(wanted, dt)
|
||||
|
||||
def test_usigned_short(self):
|
||||
def test_unsigned_short(self):
|
||||
dt = np.min_scalar_type(2**16 - 1)
|
||||
wanted = np.dtype('uint16')
|
||||
assert_equal(wanted, dt)
|
||||
|
||||
def test_usigned_int(self):
|
||||
def test_unsigned_int(self):
|
||||
dt = np.min_scalar_type(2**32 - 1)
|
||||
wanted = np.dtype('uint32')
|
||||
assert_equal(wanted, dt)
|
||||
|
||||
def test_usigned_longlong(self):
|
||||
def test_unsigned_longlong(self):
|
||||
dt = np.min_scalar_type(2**63 - 1)
|
||||
wanted = np.dtype('uint64')
|
||||
assert_equal(wanted, dt)
|
||||
|
||||
@@ -257,7 +257,7 @@ class ReadValuesNested:
|
||||
assert_equal(h['z'], np.array([self._buffer[0][5],
|
||||
self._buffer[1][5]], dtype='u1'))
|
||||
|
||||
def test_nested1_acessors(self):
|
||||
def test_nested1_accessors(self):
|
||||
"""Check reading the nested fields of a nested array (1st level)"""
|
||||
h = np.array(self._buffer, dtype=self._descr)
|
||||
if not self.multiple_rows:
|
||||
@@ -287,7 +287,7 @@ class ReadValuesNested:
|
||||
self._buffer[1][3][1]],
|
||||
dtype='c16'))
|
||||
|
||||
def test_nested2_acessors(self):
|
||||
def test_nested2_accessors(self):
|
||||
"""Check reading the nested fields of a nested array (2nd level)"""
|
||||
h = np.array(self._buffer, dtype=self._descr)
|
||||
if not self.multiple_rows:
|
||||
@@ -573,7 +573,7 @@ class TestScalarTypeNames:
|
||||
assert getattr(np, t.__name__) is t
|
||||
|
||||
@pytest.mark.parametrize('t', numeric_types)
|
||||
def test_names_are_undersood_by_dtype(self, t):
|
||||
def test_names_are_understood_by_dtype(self, t):
|
||||
""" Test the dtype constructor maps names back to the type """
|
||||
assert np.dtype(t.__name__).type is t
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class TestScalarPEP3118:
|
||||
v = memoryview(s)
|
||||
assert self._as_dict(v) == expected
|
||||
|
||||
# integers of the paltform-appropriate endianness
|
||||
# integers of the platform-appropriate endianness
|
||||
code_points = np.frombuffer(v, dtype='i4')
|
||||
|
||||
assert_equal(code_points, [ord(c) for c in s])
|
||||
|
||||
@@ -397,7 +397,7 @@ class TestModulus:
|
||||
a //= b
|
||||
|
||||
class TestComparison:
|
||||
def test_comparision_different_types(self):
|
||||
def test_comparison_different_types(self):
|
||||
x = np.array(1)
|
||||
y = np.array('s')
|
||||
eq = x == y
|
||||
@@ -1066,7 +1066,7 @@ def test_longdouble_complex():
|
||||
def test_pyscalar_subclasses(subtype, __op__, __rop__, op, cmp):
|
||||
# This tests that python scalar subclasses behave like a float64 (if they
|
||||
# don't override it).
|
||||
# In an earlier version of NEP 50, they behaved like the Python buildins.
|
||||
# In an earlier version of NEP 50, they behaved like the Python builtins.
|
||||
def op_func(self, other):
|
||||
return __op__
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ def test_large_string_cast():
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dt", ["S1", "U1"])
|
||||
def test_in_place_mutiply_no_overflow(dt):
|
||||
def test_in_place_multiply_no_overflow(dt):
|
||||
# see gh-30495
|
||||
a = np.array("a", dtype=dt)
|
||||
a *= 20
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ class _CopyMode(enum.Enum):
|
||||
|
||||
|
||||
class _SignatureDescriptor:
|
||||
# A descriptor to store on the ufunc __dict__ that avoids definig a
|
||||
# A descriptor to store on the ufunc __dict__ that avoids defining a
|
||||
# signature for the ufunc class/type but allows the instance to have one.
|
||||
# This is needed because inspect.signature() chokes on normal properties
|
||||
# (as of 3.14 at least).
|
||||
|
||||
@@ -15,7 +15,7 @@ class _NestedSequence[T](Protocol):
|
||||
Warning
|
||||
-------
|
||||
`_NestedSequence` currently does not work in combination with typevars,
|
||||
*e.g.* ``def func(a: _NestedSequnce[T]) -> T: ...``.
|
||||
*e.g.* ``def func(a: _NestedSequence[T]) -> T: ...``.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
@@ -11,7 +11,7 @@ in ``numpy._core``.
|
||||
import functools
|
||||
import warnings
|
||||
|
||||
from ._convertions import asbytes, asunicode
|
||||
from ._conversions import asbytes, asunicode
|
||||
|
||||
|
||||
def set_module(module):
|
||||
|
||||
@@ -2,7 +2,7 @@ from _typeshed import IdentityFunction
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Protocol, overload, type_check_only
|
||||
|
||||
from ._convertions import asbytes as asbytes, asunicode as asunicode
|
||||
from ._conversions import asbytes as asbytes, asunicode as asunicode
|
||||
|
||||
###
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
+3
-3
@@ -23,9 +23,9 @@ except ModuleNotFoundError:
|
||||
|
||||
try:
|
||||
import pytest_run_parallel # noqa: F401
|
||||
PARALLEL_RUN_AVALIABLE = True
|
||||
PARALLEL_RUN_AVAILABLE = True
|
||||
except ModuleNotFoundError:
|
||||
PARALLEL_RUN_AVALIABLE = False
|
||||
PARALLEL_RUN_AVAILABLE = False
|
||||
|
||||
_old_fpu_mode = None
|
||||
_collect_results = {}
|
||||
@@ -66,7 +66,7 @@ def pytest_configure(config):
|
||||
"leaks_references: Tests that are known to leak references.")
|
||||
config.addinivalue_line("markers",
|
||||
"slow: Tests that are very slow.")
|
||||
if not PARALLEL_RUN_AVALIABLE:
|
||||
if not PARALLEL_RUN_AVAILABLE:
|
||||
config.addinivalue_line("markers",
|
||||
"parallel_threads(n): run the given test function in parallel "
|
||||
"using `n` threads.",
|
||||
|
||||
@@ -663,7 +663,7 @@ class TestSharedMemory:
|
||||
a = self.array(shape, intent.inplace, obj)
|
||||
# Spot check that they contain the same information initially.
|
||||
assert obj[1][2] == a.arr[1][2], repr((obj, a.arr))
|
||||
# If we change a.arr, that will not immediatetly be reflected in obj.
|
||||
# If we change a.arr, that will not immediately be reflected in obj.
|
||||
change_item = 54 if self.type.dtype != bool else False
|
||||
a.arr[1][2] = change_item
|
||||
assert a.arr[1][2] == np.array(change_item, dtype=self.type.dtype)
|
||||
@@ -673,7 +673,7 @@ class TestSharedMemory:
|
||||
assert a.arr.base is obj
|
||||
# It has a different organization from obj.
|
||||
assert a.arr.flags["FORTRAN"] and not a.arr.flags["CONTIGUOUS"]
|
||||
# If we resolve the write-back, obj will be propertly filled.
|
||||
# If we resolve the write-back, obj will be properly filled.
|
||||
code = wrap.resolve_write_back_if_copy(a.arr)
|
||||
assert code == 1, "no write-back resolution was done!"
|
||||
assert obj[1][2] == np.array(change_item, dtype=self.type.dtype)
|
||||
|
||||
@@ -60,7 +60,7 @@ class TestPublicPrivate:
|
||||
assert set(tt['b_']['attrspec']) == {'public', 'bind(c)'}
|
||||
assert set(tt['c']['attrspec']) == {'public'}
|
||||
|
||||
def test_nowrap_private_proceedures(self, tmp_path):
|
||||
def test_nowrap_private_procedures(self, tmp_path):
|
||||
fpath = util.getpath("tests", "src", "crackfortran", "gh23879.f90")
|
||||
mod = crackfortran.crackfortran([str(fpath)])
|
||||
assert len(mod) == 1
|
||||
|
||||
@@ -123,7 +123,7 @@ class TestF77Comments(util.F2PyTest):
|
||||
res = self.module.testsub2()
|
||||
npt.assert_allclose(expected, res)
|
||||
|
||||
class TestF90Contiuation(util.F2PyTest):
|
||||
class TestF90Continuation(util.F2PyTest):
|
||||
# Check that comments are stripped from F90 continuation lines
|
||||
sources = [util.getpath("tests", "src", "regression", "f90continuation.f90")]
|
||||
|
||||
|
||||
@@ -1956,7 +1956,7 @@ def trim_zeros(filt, trim='fb', axis=None):
|
||||
returned that still contains all values which are not zero.
|
||||
If an axis is specified, `filt` will be sliced in that dimension only
|
||||
on the sides specified by `trim`. The remaining area will be the
|
||||
smallest that still contains all values wich are not zero.
|
||||
smallest that still contains all values which are not zero.
|
||||
|
||||
.. versionadded:: 2.2.0
|
||||
|
||||
@@ -5070,7 +5070,7 @@ def meshgrid(*xi, copy=True, sparse=False, indexing='xy'):
|
||||
``(1, ..., 1, Ni, 1, ..., 1)``. These sparse coordinate grids are
|
||||
intended to be used with :ref:`basics.broadcasting`. When all
|
||||
coordinates are used in an expression, broadcasting still leads to a
|
||||
fully-dimensonal result array.
|
||||
fully-dimensional result array.
|
||||
|
||||
Default is False.
|
||||
|
||||
|
||||
@@ -507,9 +507,9 @@ class TestAverage:
|
||||
assert_equal(type(rw), subclass)
|
||||
|
||||
def test_upcasting(self):
|
||||
typs = [('i4', 'i4', 'f8'), ('i4', 'f4', 'f8'), ('f4', 'i4', 'f8'),
|
||||
types = [('i4', 'i4', 'f8'), ('i4', 'f4', 'f8'), ('f4', 'i4', 'f8'),
|
||||
('f4', 'f4', 'f4'), ('f4', 'f8', 'f8')]
|
||||
for at, wt, rt in typs:
|
||||
for at, wt, rt in types:
|
||||
a = np.array([[1, 2], [3, 4]], dtype=at)
|
||||
w = np.array([[1, 2], [3, 4]], dtype=wt)
|
||||
assert_equal(np.average(a, weights=w).dtype, np.dtype(rt))
|
||||
|
||||
@@ -529,7 +529,7 @@ def test_quoted_field(q):
|
||||
|
||||
|
||||
@pytest.mark.parametrize("q", ('"', "'", "`"))
|
||||
def test_quoted_field_with_whitepace_delimiter(q):
|
||||
def test_quoted_field_with_whitespace_delimiter(q):
|
||||
txt = StringIO(
|
||||
f"{q}alpha, x{q} 2.5\n{q}beta, y{q} 4.5\n{q}gamma, z{q} 5.0\n"
|
||||
)
|
||||
|
||||
@@ -835,7 +835,7 @@ _TIME_UNITS = (
|
||||
"Y", "M", "W", "D", "h", "m", "s", "ms", "us", "ns", "ps", "fs", "as"
|
||||
)
|
||||
|
||||
# All `inexact` + `timdelta64` type codes
|
||||
# All `inexact` + `timedelta64` type codes
|
||||
_TYPE_CODES = list(np.typecodes["AllFloat"])
|
||||
_TYPE_CODES += [f"m8[{unit}]" for unit in _TIME_UNITS]
|
||||
|
||||
|
||||
@@ -1231,7 +1231,7 @@ class TestMedian:
|
||||
b[2] = np.nan
|
||||
assert_equal(np.ma.median(a, (0, 2)), b)
|
||||
|
||||
def test_ambigous_fill(self):
|
||||
def test_ambiguous_fill(self):
|
||||
# 255 is max value, used as filler for sort
|
||||
a = np.array([[3, 3, 255], [3, 3, 255]], dtype=np.uint8)
|
||||
a = np.ma.masked_array(a, mask=a == 3)
|
||||
|
||||
@@ -323,7 +323,7 @@ class TestIndexing:
|
||||
class TestNewScalarIndexing:
|
||||
a = matrix([[1, 2], [3, 4]])
|
||||
|
||||
def test_dimesions(self):
|
||||
def test_dimensions(self):
|
||||
a = self.a
|
||||
x = a[0]
|
||||
assert_equal(x.ndim, 2)
|
||||
|
||||
@@ -458,7 +458,7 @@ class TestPCG64(Base):
|
||||
assert val_neg == val_pos
|
||||
assert val_big == val_pos
|
||||
|
||||
def test_advange_large(self):
|
||||
def test_advance_large(self):
|
||||
rs = Generator(self.bit_generator(38219308213743))
|
||||
pcg = rs.bit_generator
|
||||
state = pcg.state["state"]
|
||||
@@ -497,7 +497,7 @@ class TestPCG64DXSM(Base):
|
||||
assert val_neg == val_pos
|
||||
assert val_big == val_pos
|
||||
|
||||
def test_advange_large(self):
|
||||
def test_advance_large(self):
|
||||
rs = Generator(self.bit_generator(38219308213743))
|
||||
pcg = rs.bit_generator
|
||||
state = pcg.state
|
||||
|
||||
@@ -1685,7 +1685,7 @@ class TestRandomDist:
|
||||
[1.093830802293668, 1.256977002164613]])
|
||||
assert_array_almost_equal(actual, desired, decimal=15)
|
||||
|
||||
def test_standard_expoential_type_error(self):
|
||||
def test_standard_exponential_type_error(self):
|
||||
assert_raises(TypeError, random.standard_exponential, dtype=np.int32)
|
||||
|
||||
def test_standard_gamma(self):
|
||||
|
||||
@@ -112,7 +112,7 @@ class TestRegression:
|
||||
# # CDF of the beta distribution at x:
|
||||
# p = mp.betainc(a, b, x1=0, x2=x, regularized=True)
|
||||
# n = 1000000
|
||||
# exprected_freq = float(n*p)
|
||||
# expected_freq = float(n*p)
|
||||
#
|
||||
expected_freq = 77616.90831318991
|
||||
assert 0.95 * expected_freq < nzeros < 1.05 * expected_freq
|
||||
|
||||
@@ -161,7 +161,7 @@ class TestRegression:
|
||||
rs2 = np.random.RandomState(seed=123456789)
|
||||
assert rs1.randint(0, 100) == rs2.randint(0, 100)
|
||||
|
||||
def test_choice_retun_dtype(self):
|
||||
def test_choice_return_dtype(self):
|
||||
# GH 9867, now long since the NumPy default changed.
|
||||
c = np.random.choice(10, p=[.1] * 10, size=2)
|
||||
assert c.dtype == np.dtype(np.long)
|
||||
|
||||
@@ -21,7 +21,7 @@ f8.argpartition(0) # type: ignore[attr-defined]
|
||||
f8.partition(0) # type: ignore[attr-defined]
|
||||
f8.dot(1) # type: ignore[attr-defined]
|
||||
|
||||
# NOTE: The following functions retur `Never`, causing mypy to stop analysis at that
|
||||
# NOTE: The following functions return `Never`, causing mypy to stop analysis at that
|
||||
# point, which we circumvent by wrapping them in a function.
|
||||
|
||||
def f8_diagonal(x: np.float64) -> Never:
|
||||
|
||||
Reference in new issue
Block a user