Skip to content

Commit aa61833

Browse files
committed
Merge branch 'main' into 2023.12
2 parents 6a6719f + d51c277 commit aa61833

16 files changed

+65
-24
lines changed

.github/workflows/array-api-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Array API Tests
33
on: [push, pull_request]
44

55
env:
6-
PYTEST_ARGS: "-v -rxXfE --ci --hypothesis-disable-deadline"
6+
PYTEST_ARGS: "-v -rxXfE --ci --hypothesis-disable-deadline --max-examples 200"
77

88
jobs:
99
array-api-tests:

.github/workflows/ruff.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
check-ruff:
5+
runs-on: ubuntu-latest
6+
continue-on-error: true
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Install Python
10+
uses: actions/setup-python@v5
11+
with:
12+
python-version: "3.11"
13+
- name: Install dependencies
14+
run: |
15+
python -m pip install --upgrade pip
16+
pip install ruff
17+
# Update output format to enable automatic inline annotations.
18+
- name: Run Ruff
19+
run: ruff check --output-format=github .

array_api_strict/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"broadcast_to",
8484
"can_cast",
8585
"finfo",
86+
"isdtype",
8687
"iinfo",
8788
"result_type",
8889
]
@@ -114,6 +115,8 @@
114115
"uint64",
115116
"float32",
116117
"float64",
118+
"complex64",
119+
"complex128",
117120
"bool",
118121
]
119122

@@ -198,6 +201,7 @@
198201
"bitwise_xor",
199202
"ceil",
200203
"clip",
204+
"conj",
201205
"cos",
202206
"cosh",
203207
"divide",
@@ -208,6 +212,7 @@
208212
"floor_divide",
209213
"greater",
210214
"greater_equal",
215+
"imag",
211216
"isfinite",
212217
"isinf",
213218
"isnan",
@@ -227,6 +232,7 @@
227232
"not_equal",
228233
"positive",
229234
"pow",
235+
"real",
230236
"remainder",
231237
"round",
232238
"sign",

array_api_strict/_array_object.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
)
3434
from ._flags import get_array_api_strict_flags, set_array_api_strict_flags
3535

36-
from typing import TYPE_CHECKING, Optional, Tuple, Union, Any, SupportsIndex
36+
from typing import TYPE_CHECKING, SupportsIndex
3737
import types
3838

3939
if TYPE_CHECKING:
40-
from ._typing import Any, PyCapsule, Device, Dtype
40+
from typing import Optional, Tuple, Union, Any
41+
from ._typing import PyCapsule, Device, Dtype
4142
import numpy.typing as npt
4243

4344
import numpy as np
@@ -589,8 +590,8 @@ def __getitem__(
589590
key: Union[
590591
int,
591592
slice,
592-
ellipsis,
593-
Tuple[Union[int, slice, ellipsis, None], ...],
593+
ellipsis, # noqa: F821
594+
Tuple[Union[int, slice, ellipsis, None], ...], # noqa: F821
594595
Array,
595596
],
596597
/,
@@ -780,7 +781,7 @@ def __rshift__(self: Array, other: Union[int, Array], /) -> Array:
780781
def __setitem__(
781782
self,
782783
key: Union[
783-
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], Array
784+
int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], Array # noqa: F821
784785
],
785786
value: Union[int, float, bool, Array],
786787
/,

array_api_strict/_data_type_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
)
1616

1717
from dataclasses import dataclass
18-
from typing import TYPE_CHECKING, List, Tuple, Union
18+
from typing import TYPE_CHECKING
1919

2020
if TYPE_CHECKING:
21+
from typing import List, Tuple, Union
2122
from ._typing import Dtype
22-
from collections.abc import Sequence
2323

2424
import numpy as np
2525

array_api_strict/_indexing_functions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
from ._array_object import Array
44
from ._dtypes import _integer_dtypes
55

6+
from typing import TYPE_CHECKING
7+
8+
if TYPE_CHECKING:
9+
from typing import Optional
10+
611
import numpy as np
712

813
def take(x: Array, indices: Array, /, *, axis: Optional[int] = None) -> Array:

array_api_strict/_manipulation_functions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
from ._array_object import Array
44
from ._data_type_functions import result_type
55

6-
from typing import List, Optional, Tuple, Union
6+
from typing import TYPE_CHECKING
7+
8+
if TYPE_CHECKING:
9+
from typing import List, Optional, Tuple, Union
710

811
import numpy as np
912

@@ -57,7 +60,7 @@ def reshape(x: Array,
5760
/,
5861
shape: Tuple[int, ...],
5962
*,
60-
copy: Optional[Bool] = None) -> Array:
63+
copy: Optional[bool] = None) -> Array:
6164
"""
6265
Array API compatible wrapper for :py:func:`np.reshape <numpy.reshape>`.
6366

array_api_strict/_searching_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
from ._dtypes import _result_type, _real_numeric_dtypes
55
from ._flags import requires_data_dependent_shapes
66

7-
from typing import Optional, Tuple
7+
from typing import TYPE_CHECKING
8+
if TYPE_CHECKING:
9+
from typing import Optional, Tuple
810

911
import numpy as np
1012

array_api_strict/_statistical_functions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
_numeric_dtypes,
77
)
88
from ._array_object import Array
9-
from ._dtypes import float32, float64, complex64, complex128
9+
from ._dtypes import float32, complex64
1010

11-
from typing import TYPE_CHECKING, Optional, Tuple, Union
11+
from typing import TYPE_CHECKING
1212

1313
if TYPE_CHECKING:
14+
from typing import Optional, Tuple, Union
1415
from ._typing import Dtype
1516

1617
import numpy as np

array_api_strict/_typing.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121

2222
from typing import (
2323
Any,
24-
Literal,
25-
Sequence,
26-
Type,
27-
Union,
2824
TypeVar,
2925
Protocol,
3026
)

0 commit comments

Comments
 (0)