Hi Vincent, Could it be that you're overriding numpy's type annotations with those from an external stub-only package? The functions that you mentioned have been annotated as being in the main namespace ever since the 1.20 release; the error message for `finfo` in particular makes me suspicious.
For reference: ``` finfo_obj = np.finfo(np.float64) reveal_type(finfo_obj.tiny) # Revealed type is "numpy.floating*[numpy.typing._64Bit*]" reveal_type(finfo_obj.foo) # "finfo[floating[_64Bit]]" has no attribute "foo" ``` Regards, Bas van Beek ________________________________ From: Vincent Schut <sc...@satelligence.com> Sent: 07 January 2022 15:38 To: numpy-discussion@python.org <numpy-discussion@python.org> Subject: [Numpy-discussion] mypy false positives Hi all, I've got a question about numpy typing. We have our own internal codebase that heavily depends on numpy, and we're trying to get the number of mypy errors down. Many of the remaining mypy errors are actually numpy false positives. I hoped that with the numpy 1.22.0 release these would be fixed, as there ought to be many typing improvements in that version, but apparently they're not? I'm asking here to check if this is just still a work in progress and we should be patient, or if there's something wrong on our side...? Some typical false positives are: "finfo[float32]" has no attribute "tiny" Module has no attribute "count_nonzero" Module has no attribute "rot90" Module has no attribute "asfortranarray" Module has no attribute "isfinite" Module has no attribute "any" Module has no attribute "histogram"; maybe "histogramdd"? Module has no attribute "bitwise_or" Module has no attribute "bitwise_and" Module has no attribute "indices" Module has no attribute "pad" versions: python 3.8.10; numpy 1.22.0; mypy 0.930 -- Vincent Schut Remote Sensing Software Engineer +31 302272679 ~ Maliebaan 22 | 3581CP | Utrecht | Netherlands Linkedin <https://www.linkedin.com/company/satelligence/>~ satelligence.com <http://www.satelligence.com><http://www.satelligence.com> _______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: bas.vanb...@hotmail.com
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com