Skip to content

Commit 978bbe7

Browse files
authored
Merge pull request numpy#19559 from BvB93/pytest
ENH: Add annotations for `__path__` and `PytestTester`
2 parents e58c1a7 + 77f718c commit 978bbe7

File tree

13 files changed

+58
-0
lines changed

13 files changed

+58
-0
lines changed

numpy/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ from abc import abstractmethod
99
from types import TracebackType, MappingProxyType
1010
from contextlib import ContextDecorator
1111

12+
from numpy._pytesttester import PytestTester
1213
from numpy.core.multiarray import flagsobj
1314
from numpy.core._internal import _ctypes
1415
from numpy.core.getlimits import MachArLike
@@ -625,6 +626,7 @@ __all__: List[str]
625626
__path__: List[str]
626627
__version__: str
627628
__git_version__: str
629+
test: PytestTester
628630

629631
# TODO: Move placeholders to their respective module once
630632
# their annotations are properly implemented

numpy/_pytesttester.pyi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from typing import List, Iterable
2+
from typing_extensions import Literal as L
3+
4+
__all__: List[str]
5+
6+
class PytestTester:
7+
module_name: str
8+
def __init__(self, module_name: str) -> None: ...
9+
def __call__(
10+
self,
11+
label: L["fast", "full"] = ...,
12+
verbose: int = ...,
13+
extra_argv: None | Iterable[str] = ...,
14+
doctests: L[False] = ...,
15+
coverage: bool = ...,
16+
durations: int = ...,
17+
tests: None | Iterable[str] = ...,
18+
) -> bool: ...

numpy/f2py/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import subprocess
33
from typing import Any, List, Iterable, Dict, overload
44
from typing_extensions import TypedDict, Literal as L
55

6+
from numpy._pytesttester import PytestTester
7+
68
class _F2PyDictBase(TypedDict):
79
csrc: List[str]
810
h: List[str]
@@ -13,6 +15,7 @@ class _F2PyDict(_F2PyDictBase, total=False):
1315

1416
__all__: List[str]
1517
__path__: List[str]
18+
test: PytestTester
1619

1720
def run_main(comline_list: Iterable[str]) -> Dict[str, _F2PyDict]: ...
1821

numpy/fft/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from typing import Any, List
22

3+
from numpy._pytesttester import PytestTester
4+
35
__all__: List[str]
6+
__path__: List[str]
7+
test: PytestTester
48

59
def fft(a, n=..., axis=..., norm=...): ...
610
def ifft(a, n=..., axis=..., norm=...): ...

numpy/lib/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import math as math
22
from typing import Any, List
33

4+
from numpy._pytesttester import PytestTester
5+
46
from numpy import (
57
ndenumerate as ndenumerate,
68
ndindex as ndindex,
@@ -237,6 +239,8 @@ from numpy.core.multiarray import (
237239
)
238240

239241
__all__: List[str]
242+
__path__: List[str]
243+
test: PytestTester
240244

241245
__version__ = version
242246
emath = scimath

numpy/linalg/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from typing import Any, List
22

3+
from numpy._pytesttester import PytestTester
4+
35
__all__: List[str]
6+
__path__: List[str]
7+
test: PytestTester
48

59
class LinAlgError(Exception): ...
610

numpy/ma/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from typing import Any, List
22

3+
from numpy._pytesttester import PytestTester
4+
35
from numpy.ma import extras as extras
46

57
from numpy.ma.core import (
@@ -230,3 +232,5 @@ from numpy.ma.extras import (
230232
)
231233

232234
__all__: List[str]
235+
__path__: List[str]
236+
test: PytestTester

numpy/matrixlib/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
from typing import Any, List
22

3+
from numpy._pytesttester import PytestTester
4+
35
from numpy import (
46
matrix as matrix,
57
)
68

79
__all__: List[str]
10+
__path__: List[str]
11+
test: PytestTester
812

913
def bmat(obj, ldict=..., gdict=...): ...
1014
def asmatrix(data, dtype=...): ...

numpy/polynomial/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from typing import List
22

3+
from numpy._pytesttester import PytestTester
4+
35
from numpy.polynomial import (
46
chebyshev as chebyshev,
57
hermite as hermite,
@@ -16,5 +18,7 @@ from numpy.polynomial.legendre import Legendre as Legendre
1618
from numpy.polynomial.polynomial import Polynomial as Polynomial
1719

1820
__all__: List[str]
21+
__path__: List[str]
22+
test: PytestTester
1923

2024
def set_default_printstyle(style): ...

numpy/random/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from typing import List
22

3+
from numpy._pytesttester import PytestTester
4+
35
from numpy.random._generator import Generator as Generator
46
from numpy.random._generator import default_rng as default_rng
57
from numpy.random._mt19937 import MT19937 as MT19937
@@ -66,3 +68,5 @@ from numpy.random.mtrand import (
6668
)
6769

6870
__all__: List[str]
71+
__path__: List[str]
72+
test: PytestTester

0 commit comments

Comments
 (0)