Too many false positives - what's the use? #1861
Replies: 1 comment
-
The Any is because we define
I tried something resembling your snippet in mypy-playground and couldn't reproduce this error: https://mypy-play.net/?mypy=latest&python=3.12&flags=strict&gist=8c91ef07f1b622146546b04ea36dc4a4 . If you can provide a self-contained piece of code exhibiting this error, please report a bug to mypy.
You can turn on the
As far as the type checker sees, you are passing an instance of the parent class when only the child class is accepted. The constructor requires an object of type Possibly the |
Beta Was this translation helpful? Give feedback.
-
Hey! I am heavily using typing annotations in my code and trying to get help with
mypy
to ensure I don't miss anything, but after running it on my code I find it gives me so many false positives that it's useless to me. It requires me to be overly verbose just to please it, and most of the things it points out aren't problems to me.Here are some examples:
byte_utils
It's obvious this is a float being returned - isn't it?
Then:
^ this is a bit dirty by me - having to check instances and convert, but still - I handle it properly and i'll never call
.value
on a non-PriceRepresentation classthen:
It doesn't seem to support changing variable types?
Then
when the constructor accepts a GB precisely:
for some reason, it can't figure out that Gigabyte inherits DataUnit
Can you please tell me if my code is wrong, or I'm using mypy wrong, or my expectations aren't in order? At this point, I really don't see a way I can use mypy in a way that's useful to me
Beta Was this translation helpful? Give feedback.
All reactions