Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c66326

Browse filesBrowse files
committed
TYP: consistent type-parameter defaults for ndarray subclasses
1 parent e796021 commit 7c66326
Copy full SHA for 7c66326

File tree

Expand file treeCollapse file tree

2 files changed

+9
-9
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-9
lines changed

‎numpy/_core/defchararray.pyi

Copy file name to clipboardExpand all lines: numpy/_core/defchararray.pyi
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ from typing import (
22
Literal as L,
33
overload,
44
TypeAlias,
5-
TypeVar,
65
Any,
76
SupportsIndex,
87
SupportsInt,
98
)
9+
from typing_extensions import TypeVar
1010

1111
import numpy as np
1212
from numpy import (
@@ -89,10 +89,10 @@ __all__ = [
8989
"chararray",
9090
]
9191

92-
_ShapeT_co = TypeVar("_ShapeT_co", bound=tuple[int, ...], covariant=True)
92+
_ShapeT_co = TypeVar("_ShapeT_co", bound=_Shape, default=_Shape, covariant=True)
9393
_CharacterT = TypeVar("_CharacterT", bound=np.character)
94-
_CharDTypeT_co = TypeVar("_CharDTypeT_co", bound=dtype[np.character], covariant=True)
95-
_CharArray: TypeAlias = chararray[tuple[int, ...], dtype[_CharacterT]]
94+
_CharDTypeT_co = TypeVar("_CharDTypeT_co", bound=dtype[np.character], default=dtype, covariant=True)
95+
_CharArray: TypeAlias = chararray[_Shape, dtype[_CharacterT]]
9696

9797
_StringDTypeArray: TypeAlias = np.ndarray[_Shape, np.dtypes.StringDType]
9898
_StringDTypeSupportsArray: TypeAlias = _SupportsArray[np.dtypes.StringDType]

‎numpy/ma/core.pyi

Copy file name to clipboardExpand all lines: numpy/ma/core.pyi
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# ruff: noqa: ANN001, ANN002, ANN003, ANN201, ANN202 ANN204, ANN401
33

44
from collections.abc import Sequence
5-
from typing import Any, Literal, Self, SupportsIndex, TypeAlias, TypeVar, overload
5+
from typing import Any, Literal, Self, SupportsIndex, TypeAlias, overload
66

77
from _typeshed import Incomplete
8-
from typing_extensions import TypeIs, deprecated
8+
from typing_extensions import TypeIs, TypeVar, deprecated
99

1010
import numpy as np
1111
from numpy import (
@@ -221,10 +221,10 @@ __all__ = [
221221
"zeros_like",
222222
]
223223

224-
_ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...])
225-
_ShapeT_co = TypeVar("_ShapeT_co", bound=tuple[int, ...], covariant=True)
224+
_ShapeT = TypeVar("_ShapeT", bound=_Shape)
225+
_ShapeT_co = TypeVar("_ShapeT_co", bound=_Shape, default=_Shape, covariant=True)
226226
_DTypeT = TypeVar("_DTypeT", bound=dtype)
227-
_DTypeT_co = TypeVar("_DTypeT_co", bound=dtype, covariant=True)
227+
_DTypeT_co = TypeVar("_DTypeT_co", bound=dtype, default=dtype, covariant=True)
228228
_ArrayT = TypeVar("_ArrayT", bound=ndarray[Any, Any])
229229
_ScalarT = TypeVar("_ScalarT", bound=generic)
230230
_ScalarT_co = TypeVar("_ScalarT_co", bound=generic, covariant=True)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.