File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
__all__ = ("HasArrayNamespace" ,)
2
2
3
3
from types import ModuleType
4
- from typing import Protocol , final
4
+ from typing import Protocol
5
5
from typing_extensions import TypeVar
6
6
7
7
T = TypeVar ("T" , bound = object , default = ModuleType ) # PEP 696 default
8
8
9
9
10
- @final
11
10
class HasArrayNamespace (Protocol [T ]): # type: ignore[misc] # see python/mypy#17288
12
11
"""Protocol for classes that have an `__array_namespace__` method.
13
12
Original file line number Diff line number Diff line change 5
5
6
6
7
7
@runtime_checkable
8
- class CheckableHasArrayNamespace (xpt .HasArrayNamespace , Protocol ): # type: ignore[misc]
9
- """Runtime checkable version of HasArrayNamespace."""
8
+ class CheckableHasArrayNamespace (xpt .HasArrayNamespace , Protocol ):
9
+ """A runtime-checkable version of the HasArrayNamespace protocol."""
10
+
11
+ # This class is used to ensure that the protocol can be checked at runtime.
12
+ # It inherits from xpt.HasArrayNamespace and is marked as runtime_checkable.
10
13
11
14
12
15
class GoodArray :
You can’t perform that action at this time.
0 commit comments