-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Labels
Description
Describe the issue:
mypy produces for both, ma.ones_like and ma.zeros_like the error: Module has no attribute. The apparent reason is that both are not listed in ma/__init__.pyi. Is this a simple omission? ma/core.pyi includes both, though, so ma.core.ones_like or ma.core.zeros_like work.
Reproduce the code example:
import numpy as np
import numpy.ma as ma
import numpy.ma.core as mac
x: ma.MaskedArray = ma.MaskedArray([1.0, 3.0, 5.0])
# x = ma.MaskedArray([1.0, 3.0, 5.0])
print(ma.ones_like(x))
print(ma.zeros_like(x))
print(np.ones_like(x))
print(mac.ones_like(x))
print(mac.zeros_like(x))Error message:
test.py:7: error: Module has no attribute "ones_like" [attr-defined]
test.py:8: error: Module has no attribute "zeros_like" [attr-defined]
Found 2 errors in 1 file (checked 1 source file)Python and NumPy Versions:
2.1.0
3.12.5 (main, Aug 7 2024, 00:00:00) [GCC 14.2.1 20240801 (Red Hat 14.2.1-1)]
Type-checker version and settings:
mypy 1.11.2 (compiled: yes)
Additional typing packages.
No response
jorenham