forked from data-apis/array-api-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ae5766
commit 55a039a
Showing
3 changed files
with
25 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
from __future__ import annotations # https://github.com/pylint-dev/pylint/pull/9990 | ||
|
||
import typing | ||
from collections.abc import Mapping | ||
from types import ModuleType | ||
from typing import Any | ||
from typing import Any, Protocol | ||
|
||
if typing.TYPE_CHECKING: | ||
from typing_extensions import override | ||
|
||
# To be changed to a Protocol later (see data-apis/array-api#589) | ||
Array = Any # type: ignore[no-any-explicit] | ||
Device = Any # type: ignore[no-any-explicit] | ||
Index = Any # type: ignore[no-any-explicit] | ||
Untyped = Any # type: ignore[no-any-explicit] | ||
Array = Untyped | ||
Device = Untyped | ||
Index = Untyped | ||
|
||
class CanAt(Protocol): | ||
@property | ||
def at(self) -> Mapping[Index, Untyped]: ... | ||
|
||
else: | ||
|
||
def no_op_decorator(f): # pyright: ignore[reportUnreachable] | ||
return f | ||
|
||
override = no_op_decorator | ||
|
||
CanAt = object | ||
|
||
__all__ = ["ModuleType", "override"] | ||
if typing.TYPE_CHECKING: | ||
__all__ += ["Array", "Device", "Index", "Untyped"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters