File tree Expand file tree Collapse file tree 5 files changed +14
-16
lines changed Expand file tree Collapse file tree 5 files changed +14
-16
lines changed Original file line number Diff line number Diff line change 1
- <h1 align =' center ' > array-api-typing </h1 >
2
- <h3 align =" center " >Type Annotations for the Array APi </h3 >
1
+ <h1 align =" center " > array-api-typing </h1 >
2
+ <h3 align =" center " >Type Annotations for the Python array API standard </h3 >
3
3
4
4
---
5
5
@@ -21,7 +21,7 @@ uv add array-api-typing
21
21
<summary >from source, using pip</summary >
22
22
23
23
``` bash
24
- pip install git+https://https:// github.com/data-apis/array-api-typing.git
24
+ pip install git+https://github.com/data-apis/array-api-typing.git
25
25
```
26
26
27
27
</details >
@@ -30,7 +30,7 @@ pip install git+https://https://github.com/data-apis/array-api-typing.git
30
30
31
31
``` bash
32
32
cd /path/to/parent
33
- git clone https://https:// github.com/data-apis/array-api-typing.git
33
+ git clone https://github.com/data-apis/array-api-typing.git
34
34
cd array-api-typing
35
35
pip install -e . # editable mode
36
36
```
@@ -43,7 +43,7 @@ pip install -e . # editable mode
43
43
>>> import array_api_typing as xpt
44
44
>>> import numpy as np
45
45
46
- >>> def func (x : xpt.HasNamespace ) -> xpt.HasNamespace :
46
+ >>> def func (x : xpt.HasArrayNamespace ) -> xpt.HasArrayNamespace :
47
47
... return x
48
48
49
49
>>> func(np.array([1 , 2 , 3 ]))
Original file line number Diff line number Diff line change 11
11
pattern = "src/**/*.py" ,
12
12
)
13
13
14
- pytest_collect_file = (readme_tester + python_file_tester ).pytest ()
14
+ pytest_collect_file = (readme_tester + python_file_tester ).pytest ()
Original file line number Diff line number Diff line change 50
50
" pytest-cov>=3" ,
51
51
" pytest-github-actions-annotate-failures>=0.3.0" ,
52
52
" sybil>=8.0.0" ,
53
- ]
53
+ ]
54
54
55
55
56
56
[tool .hatch ]
Original file line number Diff line number Diff line change 1
1
"""Static typing support for the array API standard."""
2
2
3
- __all__ = ["HasNamespace " ]
3
+ __all__ = ["HasArrayNamespace" , "__version__" , "__version_tuple__ " ]
4
4
5
- from ._version import version as __version__ , version_tuple as __version_tuple__
6
- from ._namespace import HasNamespace
5
+ from ._namespace import HasArrayNamespace
6
+ from ._version import version as __version__ , version_tuple as __version_tuple__
Original file line number Diff line number Diff line change 1
1
"""Static typing support for the array API standard."""
2
2
3
- __all__ = ["HasNamespace " ]
3
+ __all__ = ["HasArrayNamespace " ]
4
4
5
5
from types import ModuleType
6
6
from typing import Protocol , final
10
10
11
11
12
12
@final
13
- class HasNamespace (Protocol [T ]): # type: ignore[misc] # see python/mypy#17288
13
+ class HasArrayNamespace (Protocol [T ]): # type: ignore[misc] # see python/mypy#17288
14
14
"""Protocol for classes that have an `__array_namespace__` method.
15
15
16
- This is for type-annotating objects that should
17
-
18
16
Example:
19
17
>>> import array_api_typing as xpt
20
18
>>>
@@ -23,9 +21,9 @@ class HasNamespace(Protocol[T]): # type: ignore[misc] # see python/mypy#17288
23
21
... return object()
24
22
>>>
25
23
>>> x = MyArray()
26
- >>> def has_namespace (x: xpt.HasNamespace ) -> bool:
24
+ >>> def has_array_namespace (x: xpt.HasArrayNamespace ) -> bool:
27
25
... return hasattr(x, "__array_namespace__")
28
- >>> has_namespace (x)
26
+ >>> has_array_namespace (x)
29
27
True
30
28
31
29
"""
You can’t perform that action at this time.
0 commit comments