Skip to content

Commit e594225

Browse files
nstarmanjorenhamlucascolley
committed
Apply suggestions from code review
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com> Co-authored-by: Lucas Colley <lucas.colley8@gmail.com> Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
1 parent 72b39f4 commit e594225

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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>
33

44
---
55

@@ -21,7 +21,7 @@ uv add array-api-typing
2121
<summary>from source, using pip</summary>
2222

2323
```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
2525
```
2626

2727
</details>
@@ -30,7 +30,7 @@ pip install git+https://https://github.com/data-apis/array-api-typing.git
3030

3131
```bash
3232
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
3434
cd array-api-typing
3535
pip install -e . # editable mode
3636
```
@@ -43,7 +43,7 @@ pip install -e . # editable mode
4343
>>> import array_api_typing as xpt
4444
>>> import numpy as np
4545

46-
>>> def func(x: xpt.HasNamespace) -> xpt.HasNamespace:
46+
>>> def func(x: xpt.HasArrayNamespace) -> xpt.HasArrayNamespace:
4747
... return x
4848

4949
>>> func(np.array([1, 2, 3]))

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
pattern="src/**/*.py",
1212
)
1313

14-
pytest_collect_file = (readme_tester + python_file_tester).pytest()
14+
pytest_collect_file = (readme_tester + python_file_tester).pytest()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"pytest-cov>=3",
5151
"pytest-github-actions-annotate-failures>=0.3.0",
5252
"sybil>=8.0.0",
53-
]
53+
]
5454

5555

5656
[tool.hatch]

src/array_api_typing/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Static typing support for the array API standard."""
22

3-
__all__ = ["HasNamespace"]
3+
__all__ = ["HasArrayNamespace", "__version__", "__version_tuple__"]
44

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__

src/array_api_typing/_namespace.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Static typing support for the array API standard."""
22

3-
__all__ = ["HasNamespace"]
3+
__all__ = ["HasArrayNamespace"]
44

55
from types import ModuleType
66
from typing import Protocol, final
@@ -10,11 +10,9 @@
1010

1111

1212
@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
1414
"""Protocol for classes that have an `__array_namespace__` method.
1515
16-
This is for type-annotating objects that should
17-
1816
Example:
1917
>>> import array_api_typing as xpt
2018
>>>
@@ -23,9 +21,9 @@ class HasNamespace(Protocol[T]): # type: ignore[misc] # see python/mypy#17288
2321
... return object()
2422
>>>
2523
>>> x = MyArray()
26-
>>> def has_namespace(x: xpt.HasNamespace) -> bool:
24+
>>> def has_array_namespace(x: xpt.HasArrayNamespace) -> bool:
2725
... return hasattr(x, "__array_namespace__")
28-
>>> has_namespace(x)
26+
>>> has_array_namespace(x)
2927
True
3028
3129
"""

0 commit comments

Comments
 (0)