Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 2162156

Browse files
authored
ENH: add integer constants (#52)
1 parent 080173d commit 2162156

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

numpy-stubs/__init__.pyi

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,10 @@ def isclose(
571571
def array_equal(a1: _ArrayLike, a2: _ArrayLike) -> bool: ...
572572
def array_equiv(a1: _ArrayLike, a2: _ArrayLike) -> bool: ...
573573

574-
# Numerical constants
574+
#
575+
# Constants
576+
#
577+
575578
Inf: float
576579
Infinity: float
577580
NAN: float
@@ -587,5 +590,33 @@ infty: float
587590
nan: float
588591
pi: float
589592

593+
ALLOW_THREADS: int
594+
BUFSIZE: int
595+
CLIP: int
596+
ERR_CALL: int
597+
ERR_DEFAULT: int
598+
ERR_IGNORE: int
599+
ERR_LOG: int
600+
ERR_PRINT: int
601+
ERR_RAISE: int
602+
ERR_WARN: int
603+
FLOATING_POINT_SUPPORT: int
604+
FPE_DIVIDEBYZERO: int
605+
FPE_INVALID: int
606+
FPE_OVERFLOW: int
607+
FPE_UNDERFLOW: int
608+
MAXDIMS: int
609+
MAY_SHARE_BOUNDS: int
610+
MAY_SHARE_EXACT: int
611+
RAISE: int
612+
SHIFT_DIVIDEBYZERO: int
613+
SHIFT_INVALID: int
614+
SHIFT_OVERFLOW: int
615+
SHIFT_UNDERFLOW: int
616+
UFUNC_BUFSIZE_DEFAULT: int
617+
WRAP: int
618+
little_endian: int
619+
tracemalloc_domain: int
620+
590621
# TODO(shoyer): remove when the full numpy namespace is defined
591622
def __getattr__(name: str) -> Any: ...

tests/reveal/constants.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,31 @@
1414
reveal_type(np.infty) # E: float
1515
reveal_type(np.nan) # E: float
1616
reveal_type(np.pi) # E: float
17+
18+
reveal_type(np.ALLOW_THREADS) # E: int
19+
reveal_type(np.BUFSIZE) # E: int
20+
reveal_type(np.CLIP) # E: int
21+
reveal_type(np.ERR_CALL) # E: int
22+
reveal_type(np.ERR_DEFAULT) # E: int
23+
reveal_type(np.ERR_IGNORE) # E: int
24+
reveal_type(np.ERR_LOG) # E: int
25+
reveal_type(np.ERR_PRINT) # E: int
26+
reveal_type(np.ERR_RAISE) # E: int
27+
reveal_type(np.ERR_WARN) # E: int
28+
reveal_type(np.FLOATING_POINT_SUPPORT) # E: int
29+
reveal_type(np.FPE_DIVIDEBYZERO) # E: int
30+
reveal_type(np.FPE_INVALID) # E: int
31+
reveal_type(np.FPE_OVERFLOW) # E: int
32+
reveal_type(np.FPE_UNDERFLOW) # E: int
33+
reveal_type(np.MAXDIMS) # E: int
34+
reveal_type(np.MAY_SHARE_BOUNDS) # E: int
35+
reveal_type(np.MAY_SHARE_EXACT) # E: int
36+
reveal_type(np.RAISE) # E: int
37+
reveal_type(np.SHIFT_DIVIDEBYZERO) # E: int
38+
reveal_type(np.SHIFT_INVALID) # E: int
39+
reveal_type(np.SHIFT_OVERFLOW) # E: int
40+
reveal_type(np.SHIFT_UNDERFLOW) # E: int
41+
reveal_type(np.UFUNC_BUFSIZE_DEFAULT) # E: int
42+
reveal_type(np.WRAP) # E: int
43+
reveal_type(np.little_endian) # E: int
44+
reveal_type(np.tracemalloc_domain) # E: int

0 commit comments

Comments
 (0)