Skip to content

Commit e62b3b7

Browse files
authored
Merge pull request numpy#27423 from jorenham/typing/missing-type-args
TYP: Add missing type arguments
2 parents baaff93 + 1978b0e commit e62b3b7

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

numpy/_core/numeric.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def full(
183183
def full(
184184
shape: _SizeType,
185185
fill_value: Any,
186-
dtype: _DType | _SupportsDType,
186+
dtype: _DType | _SupportsDType[_DType],
187187
order: _OrderCF = ...,
188188
**kwargs: Unpack[_KwargsEmpty],
189189
) -> np.ndarray[tuple[_SizeType], _DType]: ...

numpy/_typing/_callable.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ _2Tuple: TypeAlias = tuple[_T1, _T1]
5656
_NBit1 = TypeVar("_NBit1", bound=NBitBase)
5757
_NBit2 = TypeVar("_NBit2", bound=NBitBase)
5858

59-
_IntType = TypeVar("_IntType", bound=integer)
60-
_FloatType = TypeVar("_FloatType", bound=floating)
61-
_NumberType = TypeVar("_NumberType", bound=number)
62-
_NumberType_co = TypeVar("_NumberType_co", covariant=True, bound=number)
59+
_IntType = TypeVar("_IntType", bound=integer[Any])
60+
_FloatType = TypeVar("_FloatType", bound=floating[Any])
61+
_NumberType = TypeVar("_NumberType", bound=number[Any])
62+
_NumberType_co = TypeVar("_NumberType_co", covariant=True, bound=number[Any])
6363
_GenericType_co = TypeVar("_GenericType_co", covariant=True, bound=generic)
6464

6565
class _BoolOp(Protocol[_GenericType_co]):

numpy/_typing/_dtype_like.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ def dtype(self) -> _DType_co: ...
144144
| _BoolCodes
145145
)
146146
_DTypeLikeUInt: TypeAlias = (
147-
type[np.unsignedinteger]
148-
| np.dtype[np.unsignedinteger]
149-
| _SupportsDType[np.dtype[np.unsignedinteger]]
147+
type[np.unsignedinteger[Any]]
148+
| np.dtype[np.unsignedinteger[Any]]
149+
| _SupportsDType[np.dtype[np.unsignedinteger[Any]]]
150150
| _UInt8Codes
151151
| _UInt16Codes
152152
| _UInt32Codes
@@ -161,9 +161,9 @@ def dtype(self) -> _DType_co: ...
161161
)
162162
_DTypeLikeInt: TypeAlias = (
163163
type[int]
164-
| type[np.signedinteger]
165-
| np.dtype[np.signedinteger]
166-
| _SupportsDType[np.dtype[np.signedinteger]]
164+
| type[np.signedinteger[Any]]
165+
| np.dtype[np.signedinteger[Any]]
166+
| _SupportsDType[np.dtype[np.signedinteger[Any]]]
167167
| _Int8Codes
168168
| _Int16Codes
169169
| _Int32Codes
@@ -178,9 +178,9 @@ def dtype(self) -> _DType_co: ...
178178
)
179179
_DTypeLikeFloat: TypeAlias = (
180180
type[float]
181-
| type[np.floating]
182-
| np.dtype[np.floating]
183-
| _SupportsDType[np.dtype[np.floating]]
181+
| type[np.floating[Any]]
182+
| np.dtype[np.floating[Any]]
183+
| _SupportsDType[np.dtype[np.floating[Any]]]
184184
| _Float16Codes
185185
| _Float32Codes
186186
| _Float64Codes
@@ -191,9 +191,9 @@ def dtype(self) -> _DType_co: ...
191191
)
192192
_DTypeLikeComplex: TypeAlias = (
193193
type[complex]
194-
| type[np.complexfloating]
195-
| np.dtype[np.complexfloating]
196-
| _SupportsDType[np.dtype[np.complexfloating]]
194+
| type[np.complexfloating[Any]]
195+
| np.dtype[np.complexfloating[Any]]
196+
| _SupportsDType[np.dtype[np.complexfloating[Any]]]
197197
| _Complex64Codes
198198
| _Complex128Codes
199199
| _CSingleCodes

numpy/polynomial/_polybase.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ from typing import (
1111
SupportsIndex,
1212
TypeAlias,
1313
TypeGuard,
14-
TypeVar,
1514
overload,
1615
)
1716

@@ -42,15 +41,15 @@ from ._polytypes import (
4241
_ArrayLikeCoef_co,
4342
)
4443

45-
from typing_extensions import LiteralString
44+
from typing_extensions import LiteralString, TypeVar
4645

4746

4847
__all__: Final[Sequence[str]] = ("ABCPolyBase",)
4948

5049

51-
_NameCo = TypeVar("_NameCo", bound=None | LiteralString, covariant=True)
50+
_NameCo = TypeVar("_NameCo", bound=LiteralString | None, covariant=True, default=LiteralString | None)
5251
_Self = TypeVar("_Self")
53-
_Other = TypeVar("_Other", bound=ABCPolyBase[Any])
52+
_Other = TypeVar("_Other", bound=ABCPolyBase)
5453

5554
_AnyOther: TypeAlias = ABCPolyBase | _CoefLike_co | _SeriesLikeCoef_co
5655
_Hundred: TypeAlias = Literal[100]

numpy/polynomial/_polytypes.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ from typing import (
77
SupportsIndex,
88
SupportsInt,
99
TypeAlias,
10-
TypeVar,
1110
final,
1211
overload,
1312
)
@@ -30,7 +29,7 @@ from numpy._typing import (
3029
_NumberLike_co,
3130
)
3231

33-
from typing_extensions import LiteralString
32+
from typing_extensions import LiteralString, TypeVar
3433

3534

3635
_T = TypeVar("_T")
@@ -113,7 +112,7 @@ _ArrayLikeCoef_co: TypeAlias = (
113112
| _ArrayLikeCoefObject_co
114113
)
115114

116-
_Name_co = TypeVar("_Name_co", bound=LiteralString, covariant=True)
115+
_Name_co = TypeVar("_Name_co", bound=LiteralString, covariant=True, default=LiteralString)
117116

118117
class _Named(Protocol[_Name_co]):
119118
@property

0 commit comments

Comments
 (0)