Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/numpy-stubs/exceptions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class TooHardError(RuntimeError): ...
class DTypePromotionError(TypeError): ...

class AxisError(ValueError, IndexError):
__slots__ = "_msg", "axis", "ndim"

axis: int | None
ndim: int | None
@overload
Expand Down
14 changes: 13 additions & 1 deletion src/numpy-stubs/lib/_index_tricks_impl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class ndindex:
def ndincr(self, /) -> None: ...

class nd_grid(Generic[_BoolT_co]):
__slots__: ClassVar[tuple[str, ...]] = ("sparse",)

sparse: _BoolT_co
def __init__(self, sparse: _BoolT_co = ...) -> None: ...
@overload
Expand All @@ -107,14 +109,18 @@ class nd_grid(Generic[_BoolT_co]):

@final
class MGridClass(nd_grid[L[False]]):
__slots__ = ()

def __init__(self) -> None: ...

@final
class OGridClass(nd_grid[L[True]]):
__slots__ = ()

def __init__(self) -> None: ...

class AxisConcatenator(Generic[_AxisT_co, _MatrixT_co, _NDMinT_co, _Trans1DT_co]):
__slots__ = "axis", "matrix", "ndmin", "trans1d"
__slots__: ClassVar[tuple[str, ...]] = "axis", "matrix", "ndmin", "trans1d"

makemat: ClassVar[type[_nt.Matrix]]

Expand Down Expand Up @@ -147,13 +153,19 @@ class AxisConcatenator(Generic[_AxisT_co, _MatrixT_co, _NDMinT_co, _Trans1DT_co]

@final
class RClass(AxisConcatenator[L[0], L[False], L[1], L[-1]]):
__slots__ = ()

def __init__(self, /) -> None: ...

@final
class CClass(AxisConcatenator[L[-1], L[False], L[2], L[0]]):
__slots__ = ()

def __init__(self, /) -> None: ...

class IndexExpression(Generic[_BoolT_co]):
__slots__ = ("maketuple",)

maketuple: _BoolT_co
def __init__(self, /, maketuple: _BoolT_co) -> None: ...
#
Expand Down
7 changes: 6 additions & 1 deletion src/numpy-stubs/ma/extras.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import Final
from typing import Final, final
from typing_extensions import override

import _numtype as _nt
Expand Down Expand Up @@ -80,14 +80,19 @@ class _fromnxfunction_allargs(_fromnxfunction):
def __call__(self, *args: Incomplete, **params: Incomplete) -> Incomplete: ...

class MAxisConcatenator(AxisConcatenator):
__slots__ = ()

@staticmethod
@override
def concatenate(arrays: Incomplete, axis: int = 0) -> Incomplete: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
@classmethod
@override
def makemat(cls, arr: Incomplete) -> Incomplete: ... # type: ignore[override] # pyright: ignore[reportIncompatibleVariableOverride]

@final
class mr_class(MAxisConcatenator):
__slots__ = ()

def __init__(self) -> None: ...

def count_masked(arr: Incomplete, axis: Incomplete = ...) -> Incomplete: ...
Expand Down