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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
src/numpy-stubs/testing
src/numpy-stubs/typing
src/numpy-stubs/__config__.pyi
src/numpy-stubs/_globals.pyi
src/numpy-stubs/_pytesttester.pyi
src/numpy-stubs/dtypes.pyi
src/numpy-stubs/exceptions.pyi
Expand All @@ -77,6 +78,7 @@ jobs:
src/numpy-stubs/testing
src/numpy-stubs/typing
src/numpy-stubs/__config__.pyi
src/numpy-stubs/_globals.pyi
src/numpy-stubs/_pytesttester.pyi
src/numpy-stubs/dtypes.pyi
src/numpy-stubs/exceptions.pyi
Expand Down
15 changes: 3 additions & 12 deletions src/numpy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import abc
import builtins
import ctypes as ct
import datetime as dt
import enum
import sys
from _typeshed import StrOrBytesPath, SupportsFlush, SupportsLenAndGetItem, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
Expand Down Expand Up @@ -467,6 +466,7 @@ from . import (
typing as npt,
version as version,
)
from ._globals import _CopyMode

@runtime_checkable
class _Buffer(Protocol):
Expand Down Expand Up @@ -1779,7 +1779,7 @@ class dtype(Generic[_SCT_co]):

@final
class flatiter(Generic[_ArrayT_co]):
__hash__: ClassVar[None]
__hash__: ClassVar[None] = None # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride]
@property
def base(self) -> _ArrayT_co: ...
@property
Expand All @@ -1791,11 +1791,7 @@ class flatiter(Generic[_ArrayT_co]):
def __next__(self: flatiter[NDArray[_SCT]]) -> _SCT: ...
def __len__(self) -> int: ...
@overload
def __getitem__(
self: flatiter[NDArray[_SCT]],
key: int | integer | tuple[int | integer],
/,
) -> _SCT: ...
def __getitem__(self: flatiter[NDArray[_SCT]], key: int | integer | tuple[int | integer], /) -> _SCT: ...
@overload
def __getitem__(
self,
Expand Down Expand Up @@ -5280,11 +5276,6 @@ bitwise_right_shift: Final = right_shift
permute_dims: Final = transpose
pow: Final = power

class _CopyMode(enum.Enum):
ALWAYS: L[True]
IF_NEEDED: L[False]
NEVER: L[2]

class errstate:
def __init__(
self,
Expand Down
15 changes: 15 additions & 0 deletions src/numpy-stubs/_globals.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
__all__ = ["_CopyMode", "_NoValue"]

import enum
from typing import Final, final

@final
class _CopyMode(enum.Enum):
ALWAYS = True
IF_NEEDED = False
NEVER = 2

@final
class _NoValueType: ...

_NoValue: Final[_NoValueType] = ...