11"""A module containing the `_NestedSequence` protocol."""
22
3- from __future__ import annotations
4-
5- from typing import (
6- TYPE_CHECKING ,
7- Any ,
8- Protocol ,
9- TypeVar ,
10- runtime_checkable ,
11- )
3+ from typing import TYPE_CHECKING , Any , Protocol , TypeVar , runtime_checkable
124
135if TYPE_CHECKING :
146 from collections .abc import Iterator
@@ -36,8 +28,6 @@ class _NestedSequence(Protocol[_T_co]):
3628 --------
3729 .. code-block:: python
3830
39- >>> from __future__ import annotations
40-
4131 >>> from typing import TYPE_CHECKING
4232 >>> import numpy as np
4333 >>> from numpy._typing import _NestedSequence
@@ -64,19 +54,19 @@ def __len__(self, /) -> int:
6454 """Implement ``len(self)``."""
6555 raise NotImplementedError
6656
67- def __getitem__ (self , index : int , / ) -> _T_co | _NestedSequence [_T_co ]:
57+ def __getitem__ (self , index : int , / ) -> " _T_co | _NestedSequence[_T_co]" :
6858 """Implement ``self[x]``."""
6959 raise NotImplementedError
7060
7161 def __contains__ (self , x : object , / ) -> bool :
7262 """Implement ``x in self``."""
7363 raise NotImplementedError
7464
75- def __iter__ (self , / ) -> Iterator [_T_co | _NestedSequence [_T_co ]]:
65+ def __iter__ (self , / ) -> " Iterator[_T_co | _NestedSequence[_T_co]]" :
7666 """Implement ``iter(self)``."""
7767 raise NotImplementedError
7868
79- def __reversed__ (self , / ) -> Iterator [_T_co | _NestedSequence [_T_co ]]:
69+ def __reversed__ (self , / ) -> " Iterator[_T_co | _NestedSequence[_T_co]]" :
8070 """Implement ``reversed(self)``."""
8171 raise NotImplementedError
8272
0 commit comments