Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
ENH: Add annotations for certain module-level dunders
Backport of bcfb118
  • Loading branch information
Bas van Beek committed Feb 2, 2021
commit 1caf01e4469558e981988ecdb2416c9277d8bd7a
3 changes: 3 additions & 0 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ __all__ = [
"var",
]

__path__: List[str]
__version__: str

DataSource: Any
MachAr: Any
ScalarType: Any
Expand Down
29 changes: 29 additions & 0 deletions numpy/typing/tests/data/pass/modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import numpy as np

np.char
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
np.testing
np.version

np.__path__
np.__version__

np.__all__
np.char.__all__
np.ctypeslib.__all__
np.emath.__all__
np.lib.__all__
np.ma.__all__
np.random.__all__
np.rec.__all__
np.testing.__all__
f2py.__all__
14 changes: 14 additions & 0 deletions numpy/typing/tests/data/reveal/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@

# TODO: Remove when annotations have been added to `np.testing.assert_equal`
reveal_type(np.testing.assert_equal) # E: Any

reveal_type(np.__path__) # E: list[builtins.str]
reveal_type(np.__version__) # E: str

reveal_type(np.__all__) # E: list[builtins.str]
reveal_type(np.char.__all__) # E: list[builtins.str]
reveal_type(np.ctypeslib.__all__) # E: list[builtins.str]
reveal_type(np.emath.__all__) # E: list[builtins.str]
reveal_type(np.lib.__all__) # E: list[builtins.str]
reveal_type(np.ma.__all__) # E: list[builtins.str]
reveal_type(np.random.__all__) # E: list[builtins.str]
reveal_type(np.rec.__all__) # E: list[builtins.str]
reveal_type(np.testing.__all__) # E: list[builtins.str]
reveal_type(f2py.__all__) # E: list[builtins.str]