Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -2579,7 +2579,7 @@ def flatten_structured_array(a):
"""
for elm in iter(iterable):
if hasattr(elm, '__iter__'):
if hasattr(elm, "__iter__") and not isinstance(elm, (str, bytes)):
yield from flatten_sequence(elm)
else:
yield elm

View file

@ -95,6 +95,7 @@ from numpy._typing import (
_ArrayLikeTD64_co,
_ArrayLikeUInt_co,
_CharLike_co,
_DT64Codes,
_DTypeLike,
_DTypeLikeBool,
_DTypeLikeVoid,
@ -3286,11 +3287,23 @@ def arange(
fill_value: _FillValue | None = None,
hardmask: bool = False,
) -> _Masked1D[np.datetime64[Incomplete]]: ...
@overload # (str, str, timedelta-like, dtype=dt64-like) (requires both start and stop)
def arange(
start_or_stop: str,
/,
stop: str,
step: _TD64Like_co | None = 1,
*,
dtype: _DTypeLike[np.datetime64] | _DT64Codes,
like: _SupportsArrayFunc | None = None,
fill_value: _FillValue | None = None,
hardmask: bool = False,
) -> _Masked1D[np.datetime64[Incomplete]]: ...
@overload # dtype=<unknown>
def arange(
start_or_stop: _ArangeScalar | float,
start_or_stop: _ArangeScalar | float | str,
/,
stop: _ArangeScalar | float | None = None,
stop: _ArangeScalar | float | str | None = None,
step: _ArangeScalar | float | None = 1,
*,
dtype: DTypeLike | None = None,

View file

@ -997,6 +997,13 @@ class TestMaskedArray:
control = np.array([[[1., 1.], ], [[2., 2.], ]], dtype=float)
assert_equal(test, control)
assert_equal(test.dtype, control.dtype)
# for strings
ndtype = [('a', 'U5'), ('b', [('c', 'U5')])]
arr = np.array([('NumPy', ('array',)), ('array', ('numpy',))], dtype=ndtype)
test = flatten_structured_array(arr)
control = np.array([['NumPy', 'array'], ['array', 'numpy']], dtype='U5')
assert_equal(test, control)
assert_equal(test.dtype, control.dtype)
def test_void0d(self):
# Test creating a mvoid object