Skip to content

Commit fe5f4ea

Browse files
committed
TYP: drop py310 support
1 parent 0309890 commit fe5f4ea

File tree

93 files changed

+188
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+188
-302
lines changed

numpy/__config__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from enum import Enum
22
from types import ModuleType
3-
from typing import Final, Literal as L, TypedDict, overload, type_check_only
4-
from typing_extensions import NotRequired
3+
from typing import Final, NotRequired, TypedDict, overload, type_check_only
4+
from typing import Literal as L
55

66
_CompilerConfigDictValue = TypedDict(
77
"_CompilerConfigDictValue",

numpy/__init__.pyi

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,19 @@ from typing import (
211211
Final,
212212
Generic,
213213
Literal as L,
214+
LiteralString,
215+
Never,
214216
NoReturn,
217+
Protocol,
218+
Self,
215219
SupportsComplex,
216220
SupportsFloat,
217221
SupportsInt,
218222
SupportsIndex,
219223
TypeAlias,
220224
TypedDict,
221225
final,
226+
overload,
222227
type_check_only,
223228
)
224229

@@ -227,7 +232,7 @@ from typing import (
227232
# library include `typing_extensions` stubs:
228233
# https://github.com/python/typeshed/blob/main/stdlib/typing_extensions.pyi
229234
from _typeshed import StrOrBytesPath, SupportsFlush, SupportsLenAndGetItem, SupportsWrite
230-
from typing_extensions import CapsuleType, LiteralString, Never, Protocol, Self, TypeVar, Unpack, overload
235+
from typing_extensions import CapsuleType, TypeVar
231236

232237
from numpy import (
233238
char,
@@ -813,7 +818,7 @@ _ShapeT = TypeVar("_ShapeT", bound=_Shape)
813818
_ShapeT_co = TypeVar("_ShapeT_co", bound=_Shape, covariant=True)
814819
_1DShapeT = TypeVar("_1DShapeT", bound=_1D)
815820
_2DShapeT_co = TypeVar("_2DShapeT_co", bound=_2D, covariant=True)
816-
_1NShapeT = TypeVar("_1NShapeT", bound=tuple[L[1], Unpack[tuple[L[1], ...]]]) # (1,) | (1, 1) | (1, 1, 1) | ...
821+
_1NShapeT = TypeVar("_1NShapeT", bound=tuple[L[1], *tuple[L[1], ...]]) # (1,) | (1, 1) | (1, 1, 1) | ...
817822

818823
_ScalarT = TypeVar("_ScalarT", bound=generic)
819824
_ScalarT_co = TypeVar("_ScalarT_co", bound=generic, default=Any, covariant=True)
@@ -2543,7 +2548,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
25432548
@overload # == 1-d
25442549
def __iter__(self: ndarray[tuple[int], dtype[_ScalarT]], /) -> Iterator[_ScalarT]: ...
25452550
@overload # >= 2-d
2546-
def __iter__(self: ndarray[tuple[int, int, Unpack[tuple[int, ...]]], dtype[_ScalarT]], /) -> Iterator[NDArray[_ScalarT]]: ...
2551+
def __iter__(self: ndarray[tuple[int, int, *tuple[int, ...]], dtype[_ScalarT]], /) -> Iterator[NDArray[_ScalarT]]: ...
25472552
@overload # ?-d
25482553
def __iter__(self, /) -> Iterator[Any]: ...
25492554

@@ -3727,7 +3732,7 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]):
37273732
*sizes6_: SupportsIndex,
37283733
order: _OrderACF = "C",
37293734
copy: builtins.bool | None = None,
3730-
) -> ndarray[tuple[L[1], L[1], L[1], L[1], L[1], Unpack[tuple[L[1], ...]]], dtype[Self]]: ...
3735+
) -> ndarray[tuple[L[1], L[1], L[1], L[1], L[1], *tuple[L[1], ...]], dtype[Self]]: ...
37313736

37323737
def squeeze(self, axis: None | L[0] | tuple[()] = ...) -> Self: ...
37333738
def transpose(self, axes: None | tuple[()] = ..., /) -> Self: ...

numpy/_array_api_info.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
from typing import (
22
ClassVar,
33
Literal,
4+
Never,
45
TypeAlias,
56
TypedDict,
67
TypeVar,
78
final,
89
overload,
910
type_check_only,
1011
)
11-
from typing_extensions import Never
1212

1313
import numpy as np
1414

1515
_Device: TypeAlias = Literal["cpu"]
16-
_DeviceLike: TypeAlias = None | _Device
16+
_DeviceLike: TypeAlias = _Device | None
1717

1818
_Capabilities = TypedDict(
1919
"_Capabilities",

numpy/_core/_exceptions.pyi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from collections.abc import Iterable
2-
from typing import Any, Final, overload
3-
4-
from typing_extensions import TypeVar, Unpack
2+
from typing import Any, Final, TypeVar, overload
53

64
import numpy as np
75
from numpy import _CastingKind
@@ -10,7 +8,7 @@ from numpy._utils import set_module as set_module
108
###
119

1210
_T = TypeVar("_T")
13-
_TupleT = TypeVar("_TupleT", bound=tuple[()] | tuple[Any, Any, Unpack[tuple[Any, ...]]])
11+
_TupleT = TypeVar("_TupleT", bound=tuple[()] | tuple[Any, Any, *tuple[Any, ...]])
1412
_ExceptionT = TypeVar("_ExceptionT", bound=Exception)
1513

1614
###

numpy/_core/_internal.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import ctypes as ct
22
import re
33
from collections.abc import Callable, Iterable
4-
from typing import Any, Final, Generic, overload
4+
from typing import Any, Final, Generic, Self, overload
55

6-
from typing_extensions import Self, TypeVar, deprecated
6+
from typing_extensions import TypeVar, deprecated
77

88
import numpy as np
99
import numpy.typing as npt

numpy/_core/_machar.pyi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from collections.abc import Iterable
2-
from typing import Any, Final, overload
3-
4-
from typing_extensions import TypeVar, Unpack
2+
from typing import Any, Final, TypeVar, overload
53

64
import numpy as np
75
from numpy import _CastingKind
@@ -10,7 +8,7 @@ from numpy._utils import set_module as set_module
108
###
119

1210
_T = TypeVar("_T")
13-
_TupleT = TypeVar("_TupleT", bound=tuple[()] | tuple[Any, Any, Unpack[tuple[Any, ...]]])
11+
_TupleT = TypeVar("_TupleT", bound=tuple[()] | tuple[Any, Any, *tuple[Any, ...]])
1412
_ExceptionT = TypeVar("_ExceptionT", bound=Exception)
1513

1614
###

numpy/_core/_methods.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from collections.abc import Callable
2-
from typing import Any, TypeAlias
3-
4-
from typing_extensions import Concatenate
2+
from typing import Any, Concatenate, TypeAlias
53

64
import numpy as np
75

numpy/_core/fromnumeric.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from collections.abc import Sequence
33
from typing import (
44
Any,
55
Literal,
6+
Never,
67
Protocol,
78
SupportsIndex,
89
TypeAlias,
@@ -12,7 +13,7 @@ from typing import (
1213
)
1314

1415
from _typeshed import Incomplete
15-
from typing_extensions import Never, deprecated
16+
from typing_extensions import deprecated
1617

1718
import numpy as np
1819
from numpy import (

numpy/_core/multiarray.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ from typing import (
1414
Final,
1515
Protocol,
1616
ClassVar,
17+
Unpack,
1718
type_check_only,
1819
)
19-
from typing_extensions import CapsuleType, Unpack
20+
from typing_extensions import CapsuleType
2021

2122
import numpy as np
2223
from numpy import ( # type: ignore[attr-defined]

numpy/_core/numeric.pyi

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
from collections.abc import Callable, Sequence
2-
from typing import (
3-
Any,
4-
Final,
5-
TypeAlias,
6-
overload,
7-
TypeVar,
8-
Literal as L,
9-
SupportsAbs,
10-
SupportsIndex,
11-
NoReturn,
12-
TypeGuard,
13-
)
14-
from typing_extensions import Unpack
2+
from typing import Any, Final, TypeAlias, overload, TypeVar, Literal as L, SupportsAbs, SupportsIndex, NoReturn, TypeGuard, Unpack
153

164
import numpy as np
175
from numpy import (

0 commit comments

Comments
 (0)