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
TYP: stub numpy._globals
  • Loading branch information
jorenham committed Feb 8, 2025
commit 8133ca747425ab1601c44d4adf359473652001bf
8 changes: 2 additions & 6 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import mmap
import ctypes as ct
import array as _array
import datetime as dt
import enum
from abc import abstractmethod
from types import EllipsisType, ModuleType, TracebackType, MappingProxyType, GenericAlias
from decimal import Decimal
Expand Down Expand Up @@ -505,6 +504,8 @@ from numpy.lib._function_base_impl import (
quantile,
)

from numpy._globals import _CopyMode

from numpy.lib._histograms_impl import (
histogram_bin_edges,
histogram,
Expand Down Expand Up @@ -4898,11 +4899,6 @@ bitwise_right_shift = right_shift
permute_dims = transpose
pow = 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 numpy/_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] = ...
1 change: 1 addition & 0 deletions numpy/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ python_sources = [
'_configtool.py',
'_distributor_init.py',
'_globals.py',
'_globals.pyi',
'_pytesttester.py',
'_pytesttester.pyi',
'_expired_attrs_2_0.py',
Expand Down
Loading