array-api-strict 2.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {array_api_strict-2.0 → array_api_strict-2.0.1}/PKG-INFO +1 -1
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_array_object.py +10 -4
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_flags.py +15 -2
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_version.py +3 -3
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_array_object.py +8 -2
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict.egg-info/PKG-INFO +1 -1
- {array_api_strict-2.0 → array_api_strict-2.0.1}/LICENSE +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/README.md +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/__init__.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_constants.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_creation_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_data_type_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_dtypes.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_elementwise_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_fft.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_indexing_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_info.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_linalg.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_linear_algebra_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_manipulation_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_searching_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_set_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_sorting_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_statistical_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_typing.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_utility_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/__init__.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/conftest.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_creation_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_data_type_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_elementwise_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_flags.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_indexing_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_linalg.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_manipulation_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_set_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_sorting_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_statistical_functions.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_validation.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict.egg-info/SOURCES.txt +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict.egg-info/dependency_links.txt +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict.egg-info/requires.txt +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict.egg-info/top_level.txt +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/setup.cfg +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/setup.py +0 -0
- {array_api_strict-2.0 → array_api_strict-2.0.1}/versioneer.py +0 -0
|
@@ -677,10 +677,16 @@ class Array:
|
|
|
677
677
|
"""
|
|
678
678
|
Performs the operation __iter__.
|
|
679
679
|
"""
|
|
680
|
-
# Manually disable iteration
|
|
681
|
-
# things like ones((3, 3))[0], which
|
|
682
|
-
# [].
|
|
683
|
-
|
|
680
|
+
# Manually disable iteration on higher dimensional arrays, since
|
|
681
|
+
# __getitem__ raises IndexError on things like ones((3, 3))[0], which
|
|
682
|
+
# causes list(ones((3, 3))) to give [].
|
|
683
|
+
if self.ndim > 1:
|
|
684
|
+
raise TypeError("array iteration is not allowed in array-api-strict")
|
|
685
|
+
# Allow iteration for 1-D arrays. The array API doesn't strictly
|
|
686
|
+
# define __iter__, but it doesn't disallow it. The default Python
|
|
687
|
+
# behavior is to implement iter as a[0], a[1], ... when __getitem__ is
|
|
688
|
+
# implemented, which implies iteration on 1-D arrays.
|
|
689
|
+
return (Array._new(i) for i in self._array)
|
|
684
690
|
|
|
685
691
|
def __le__(self: Array, other: Union[int, float, Array], /) -> Array:
|
|
686
692
|
"""
|
|
@@ -81,8 +81,8 @@ def set_array_api_strict_flags(
|
|
|
81
81
|
array-api-strict will change the default version to 2023.12.
|
|
82
82
|
|
|
83
83
|
boolean_indexing : bool, optional
|
|
84
|
-
Whether indexing by a boolean array is supported.
|
|
85
|
-
Note that although boolean array indexing does result in
|
|
84
|
+
Whether indexing by a boolean array is supported. This flag is enabled
|
|
85
|
+
by default. Note that although boolean array indexing does result in
|
|
86
86
|
data-dependent shapes, this flag is independent of the
|
|
87
87
|
`data_dependent_shapes` flag (see below).
|
|
88
88
|
|
|
@@ -276,6 +276,19 @@ class ArrayAPIStrictFlags:
|
|
|
276
276
|
See :func:`set_array_api_strict_flags` for a
|
|
277
277
|
description of the available flags.
|
|
278
278
|
|
|
279
|
+
Examples
|
|
280
|
+
--------
|
|
281
|
+
|
|
282
|
+
>>> from array_api_strict import ArrayAPIStrictFlags, get_array_api_strict_flags
|
|
283
|
+
>>> with ArrayAPIStrictFlags(api_version="2022.12", boolean_indexing=False):
|
|
284
|
+
... flags = get_array_api_strict_flags()
|
|
285
|
+
>>> flags
|
|
286
|
+
{'api_version': '2022.12',
|
|
287
|
+
'boolean_indexing': False,
|
|
288
|
+
'data_dependent_shapes': True,
|
|
289
|
+
'enabled_extensions': ('linalg', 'fft')
|
|
290
|
+
}
|
|
291
|
+
|
|
279
292
|
See Also
|
|
280
293
|
--------
|
|
281
294
|
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2024-
|
|
11
|
+
"date": "2024-07-01T13:26:20-0600",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "2.0"
|
|
14
|
+
"full-revisionid": "7c55e4712b706128366a12fc3bea82d182b9f1a6",
|
|
15
|
+
"version": "2.0.1"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import operator
|
|
2
|
+
from builtins import all as all_
|
|
2
3
|
|
|
3
4
|
from numpy.testing import assert_raises, suppress_warnings
|
|
4
5
|
import numpy as np
|
|
@@ -21,6 +22,7 @@ from .._dtypes import (
|
|
|
21
22
|
int32,
|
|
22
23
|
int64,
|
|
23
24
|
uint64,
|
|
25
|
+
float64,
|
|
24
26
|
bool as bool_,
|
|
25
27
|
)
|
|
26
28
|
from .._flags import set_array_api_strict_flags
|
|
@@ -423,8 +425,12 @@ def test_array_namespace():
|
|
|
423
425
|
pytest.raises(ValueError, lambda: a.__array_namespace__(api_version="2021.11"))
|
|
424
426
|
pytest.raises(ValueError, lambda: a.__array_namespace__(api_version="2024.12"))
|
|
425
427
|
|
|
426
|
-
def
|
|
427
|
-
pytest.raises(TypeError, lambda: iter(
|
|
428
|
+
def test_iter():
|
|
429
|
+
pytest.raises(TypeError, lambda: iter(asarray(3)))
|
|
430
|
+
assert list(ones(3)) == [asarray(1.), asarray(1.), asarray(1.)]
|
|
431
|
+
assert all_(isinstance(a, Array) for a in iter(ones(3)))
|
|
432
|
+
assert all_(a.shape == () for a in iter(ones(3)))
|
|
433
|
+
assert all_(a.dtype == float64 for a in iter(ones(3)))
|
|
428
434
|
pytest.raises(TypeError, lambda: iter(ones((3, 3))))
|
|
429
435
|
|
|
430
436
|
@pytest.mark.parametrize("api_version", ['2021.12', '2022.12', '2023.12'])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/_linear_algebra_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_creation_functions.py
RENAMED
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_data_type_functions.py
RENAMED
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_elementwise_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_indexing_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_set_functions.py
RENAMED
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_sorting_functions.py
RENAMED
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict/tests/test_statistical_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{array_api_strict-2.0 → array_api_strict-2.0.1}/array_api_strict.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|