From 9c47664b83b078ad7445d0e07dc756ff377cb3cc Mon Sep 17 00:00:00 2001 From: nstarman Date: Sun, 24 Nov 2024 16:21:05 -0500 Subject: [PATCH] fixes for ci after rebase Signed-off-by: nstarman docs: fixes Signed-off-by: nstarman --- spec/draft/API_specification/array_object.rst | 2 +- src/array_api_stubs/_draft/_types.py | 8 ++++---- src/array_api_stubs/_draft/array_object.py | 8 ++++---- src/array_api_stubs/_draft/creation_functions.py | 2 +- src/array_api_stubs/_draft/info.py | 14 ++++++++------ 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/spec/draft/API_specification/array_object.rst b/spec/draft/API_specification/array_object.rst index 2d9df85f1..a4e44a2c2 100644 --- a/spec/draft/API_specification/array_object.rst +++ b/spec/draft/API_specification/array_object.rst @@ -163,7 +163,7 @@ A conforming implementation of the array API standard must provide and support a - `operator.ne(x1, x2) `_ - `operator.__ne__(x1, x2) `_ -:meth:`.array.__lt__`, :meth:`.array.__le__`, :meth:`.array.__gt__`, :meth:`.array.__ge__` are only defined for arrays having real-valued data types. Other comparison operators should be defined for arrays having any data type. +:meth:`.Array.__lt__`, :meth:`.Array.__le__`, :meth:`.Array.__gt__`, :meth:`.Array.__ge__` are only defined for arrays having real-valued data types. Other comparison operators should be defined for arrays having any data type. For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`). In-place Operators diff --git a/src/array_api_stubs/_draft/_types.py b/src/array_api_stubs/_draft/_types.py index 188cfb9f2..158e63b2c 100644 --- a/src/array_api_stubs/_draft/_types.py +++ b/src/array_api_stubs/_draft/_types.py @@ -110,17 +110,17 @@ class Info(Protocol): def capabilities(self) -> Capabilities: ... - def default_device(self) -> device: + def default_device(self) -> Device: ... - def default_dtypes(self, *, device: Optional[device]) -> DefaultDataTypes: + def default_dtypes(self, *, device: Optional[Device]) -> DefaultDataTypes: ... - def devices(self) -> List[device]: + def devices(self) -> List[Device]: ... def dtypes( - self, *, device: Optional[device], kind: Optional[Union[str, Tuple[str, ...]]] + self, *, device: Optional[Device], kind: Optional[Union[str, Tuple[str, ...]]] ) -> DataTypes: ... diff --git a/src/array_api_stubs/_draft/array_object.py b/src/array_api_stubs/_draft/array_object.py index ebbfc2ab5..78ab46611 100644 --- a/src/array_api_stubs/_draft/array_object.py +++ b/src/array_api_stubs/_draft/array_object.py @@ -311,7 +311,7 @@ def __dlpack__( self, /, *, - stream: Any | None = None, + stream: Any | None = None, max_version: tuple[int, int] | None = None, dl_device: tuple[Enum, int] | None = None, copy: bool | None = None, @@ -367,10 +367,10 @@ def __dlpack__( if it does support that), or of a different version. This means the consumer must verify the version even when `max_version` is passed. - dl_device: Optional[tuple[enum.Enum, int]] + dl_device: Optional[tuple[`enum.Enum`, int]] the DLPack device type. Default is ``None``, meaning the exported capsule should be on the same device as ``self`` is. When specified, the format - must be a 2-tuple, following that of the return value of :meth:`array.__dlpack_device__`. + must be a 2-tuple, following that of the return value of :meth:`Array.__dlpack_device__`. If the device type cannot be handled by the producer, this function must raise ``BufferError``. @@ -492,7 +492,7 @@ def __dlpack_device__(self, /) -> tuple[Enum, int]: Returns ------- - device: Tuple[Enum, int] + device: Tuple[enum.Enum, int] a tuple ``(device_type, device_id)`` in DLPack format. Valid device type enum members are: :: diff --git a/src/array_api_stubs/_draft/creation_functions.py b/src/array_api_stubs/_draft/creation_functions.py index 6de79268e..07ed482f0 100644 --- a/src/array_api_stubs/_draft/creation_functions.py +++ b/src/array_api_stubs/_draft/creation_functions.py @@ -268,7 +268,7 @@ def from_dlpack( Notes ----- - See :meth:`array.__dlpack__` for implementation suggestions for `from_dlpack` in + See :meth:`Array.__dlpack__` for implementation suggestions for `from_dlpack` in order to handle DLPack versioning correctly. A way to move data from two array libraries to the same device (assumed supported by both libraries) in diff --git a/src/array_api_stubs/_draft/info.py b/src/array_api_stubs/_draft/info.py index 6177fb12f..dce4ccf8f 100644 --- a/src/array_api_stubs/_draft/info.py +++ b/src/array_api_stubs/_draft/info.py @@ -18,10 +18,11 @@ DataTypes, Capabilities, Info, + Device, ) -def __array_namespace_info__() -> Info: +def __array_namespace_info__() -> Info: # type: ignore[empty-body] """ Returns a namespace with Array API namespace inspection utilities. @@ -48,9 +49,10 @@ def __array_namespace_info__() -> Info: .. versionadded: 2023.12 """ + ... -def capabilities() -> Capabilities: +def capabilities() -> Capabilities: # type: ignore[empty-body] """ Returns a dictionary of array library capabilities. @@ -72,7 +74,7 @@ def capabilities() -> Capabilities: """ -def default_device() -> device: +def default_device() -> Device: # type: ignore[empty-body] """ Returns the default device. @@ -88,7 +90,7 @@ def default_device() -> device: """ -def default_dtypes( +def default_dtypes( # type: ignore[empty-body] *, device: Optional[device] = None, ) -> DefaultDataTypes: @@ -124,7 +126,7 @@ def default_dtypes( """ -def dtypes( +def dtypes( # type: ignore[empty-body] *, device: Optional[device] = None, kind: Optional[Union[str, Tuple[str, ...]]] = None, @@ -179,7 +181,7 @@ def dtypes( """ -def devices() -> List[device]: +def devices() -> List[device]: # type: ignore[empty-body] """ Returns a list of supported devices which are available at runtime.