New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mypy/typing false positives #576
Comments
Paging @mmaslowskicc @euresti @ethanhs 🤞 |
But how many do we add before giving up? |
Three sounds like a good number? |
I see the issue with deep_iterable is typed like this:
Now when you add optional you end up with an I see some paths forward: I don't have too much time so I cannot work on C or D. |
Maybe A + report a bug to mypy? |
how can Answering my own question: maybe_str_list: Optional[List[str]] = attr.ib(
validator=cast(
attr._ValidatorType[Optional[List[str]]],
attr.validators.optional(
attr.validators.deep_iterable(
attr.validators.instance_of(str), attr.validators.instance_of(list)
)
),
)
)```
quite the sight but it pacifies mypy |
Yes, but you'll want to put Can the cast go on the |
Can you confirm instance_of is fixed, Jonas? |
@euresti can I bother you to open a bug on mypy regarding the other issue please? 🐶 I believe we can close this bug once that's done. |
ran into this, and attrs master fixes the instance_of being given a tuple. |
Hmm. I now get no issues with the deep_iterable anymore using the Maybe they fixed the Optional issue. |
Can we close then? |
Sure! |
is there a rough schedule for the next release of attrs? (I just want to know if I need to ship my workarounds or can wait a little bit for an attrs release, sorry if this sounds pushy) |
As soon as #580 is merged. Dunno when someone finds time for review. |
finally got around to update my library and can confirm these typing issues went away. thank you all for your hard work. |
Using attrs 6e7b9f2 and mypy 0.720:
deep_iterable
seems to have an issue when combined withoptional
,instance_of
doesn't like tuples of types.The text was updated successfully, but these errors were encountered: