Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
TYP: consistent type-parameter defaults for ndarray subclasses
  • Loading branch information
jorenham committed May 11, 2025
commit ede9ea453ebd73468805167382f6df56edcdd612
8 changes: 4 additions & 4 deletions numpy/_core/defchararray.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ from typing import (
Literal as L,
overload,
TypeAlias,
TypeVar,
Any,
SupportsIndex,
SupportsInt,
)
from typing_extensions import TypeVar

import numpy as np
from numpy import (
Expand Down Expand Up @@ -89,10 +89,10 @@ __all__ = [
"chararray",
]

_ShapeT_co = TypeVar("_ShapeT_co", bound=tuple[int, ...], covariant=True)
_ShapeT_co = TypeVar("_ShapeT_co", bound=_Shape, default=_Shape, covariant=True)
_CharacterT = TypeVar("_CharacterT", bound=np.character)
_CharDTypeT_co = TypeVar("_CharDTypeT_co", bound=dtype[np.character], covariant=True)
_CharArray: TypeAlias = chararray[tuple[int, ...], dtype[_CharacterT]]
_CharDTypeT_co = TypeVar("_CharDTypeT_co", bound=dtype[np.character], default=dtype, covariant=True)
_CharArray: TypeAlias = chararray[_Shape, dtype[_CharacterT]]

_StringDTypeArray: TypeAlias = np.ndarray[_Shape, np.dtypes.StringDType]
_StringDTypeSupportsArray: TypeAlias = _SupportsArray[np.dtypes.StringDType]
Expand Down
10 changes: 5 additions & 5 deletions numpy/ma/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# ruff: noqa: ANN001, ANN002, ANN003, ANN201, ANN202 ANN204, ANN401

from collections.abc import Sequence
from typing import Any, Literal, Self, SupportsIndex, TypeAlias, TypeVar, overload
from typing import Any, Literal, Self, SupportsIndex, TypeAlias, overload

from _typeshed import Incomplete
from typing_extensions import TypeIs, deprecated
from typing_extensions import TypeIs, TypeVar, deprecated

import numpy as np
from numpy import (
Expand Down Expand Up @@ -221,10 +221,10 @@ __all__ = [
"zeros_like",
]

_ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...])
_ShapeT_co = TypeVar("_ShapeT_co", bound=tuple[int, ...], covariant=True)
_ShapeT = TypeVar("_ShapeT", bound=_Shape)
_ShapeT_co = TypeVar("_ShapeT_co", bound=_Shape, default=_Shape, covariant=True)
_DTypeT = TypeVar("_DTypeT", bound=dtype)
_DTypeT_co = TypeVar("_DTypeT_co", bound=dtype, covariant=True)
_DTypeT_co = TypeVar("_DTypeT_co", bound=dtype, default=dtype, covariant=True)
_ArrayT = TypeVar("_ArrayT", bound=ndarray[Any, Any])
_ScalarT = TypeVar("_ScalarT", bound=generic)
_ScalarT_co = TypeVar("_ScalarT_co", bound=generic, covariant=True)
Expand Down
Loading