Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 080173d

Browse files
authored
ENH: add numerical constants (#51)
1 parent f335f16 commit 080173d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

numpy-stubs/__init__.pyi

+16
Original file line numberDiff line numberDiff line change
@@ -571,5 +571,21 @@ def isclose(
571571
def array_equal(a1: _ArrayLike, a2: _ArrayLike) -> bool: ...
572572
def array_equiv(a1: _ArrayLike, a2: _ArrayLike) -> bool: ...
573573

574+
# Numerical constants
575+
Inf: float
576+
Infinity: float
577+
NAN: float
578+
NINF: float
579+
NZERO: float
580+
NaN: float
581+
PINF: float
582+
PZERO: float
583+
e: float
584+
euler_gamma: float
585+
inf: float
586+
infty: float
587+
nan: float
588+
pi: float
589+
574590
# TODO(shoyer): remove when the full numpy namespace is defined
575591
def __getattr__(name: str) -> Any: ...

tests/reveal/constants.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import numpy as np
2+
3+
reveal_type(np.Inf) # E: float
4+
reveal_type(np.Infinity) # E: float
5+
reveal_type(np.NAN) # E: float
6+
reveal_type(np.NINF) # E: float
7+
reveal_type(np.NZERO) # E: float
8+
reveal_type(np.NaN) # E: float
9+
reveal_type(np.PINF) # E: float
10+
reveal_type(np.PZERO) # E: float
11+
reveal_type(np.e) # E: float
12+
reveal_type(np.euler_gamma) # E: float
13+
reveal_type(np.inf) # E: float
14+
reveal_type(np.infty) # E: float
15+
reveal_type(np.nan) # E: float
16+
reveal_type(np.pi) # E: float

0 commit comments

Comments
 (0)