-
Notifications
You must be signed in to change notification settings - Fork 2
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
Disallow implicit Any in types #86
Comments
@gabbard Is this just wanting mypy to disallow implicit
|
I think we want:
I would recommend adding them one-by-one so you can identify which issues come from which source. |
@gabbard So far adding just |
@jamart28 : Can you show me an example of such an error? |
preconditions.py:8:
|
@jamart28 : That particular example is weird and can be |
Yes let me find one more straightforward of the same type |
Looking back through it seems like these situations may actually have to do with the inside typings (for the one above the inside
Is this preferable or is something more specific needed? Furthermore, should I just replace all implicit Any's with an explicit Any or attempt to classify something more specific? @gabbard |
@jamart28 : In the |
@gabbard: Of the situation with the dots or all the errors after updating mypy? |
All the errors after updating mypy |
This is just with the first flag above and are all caused by a form of having a generic with no typing after it for what is expected for the generic. In my opinion, the easiest way to show all these would be for me to fix them and then open a draft pull request showing the diffs. I was planning on doing this with each flag above. Would this be acceptable or is a different course of action preferred? |
That is a good approach. If any don't have obvious fixes, link me to the relevant lines of code and I will comment. |
@gabbard: Is there any particular reason we type some variables and not others? I'm specifically referring to a situation like the following lines: vistautils/vistautils/io_utils.py Line 232 in e187056
vistautils/vistautils/io_utils.py Line 380 in e187056
vistautils/vistautils/io_utils.py Line 600 in e187056
|
@jamart28 : In some cases we may have underestimated the type inference, so it is possible some type annotations could be removed without harm. |
@gabbard: So for a quick clarification to hold over until I look at mypy a little closer, does mypy do type inference on variables if possible? |
@jamart28 : |
@gabbard: Do you see anything in the line below that would match this error: vistautils/vistautils/key_value.py Line 169 in e187056
|
Odd - my guess would be that Can you see if you can reproduce this error with a minimal example of a generic class deriving from |
Aha, it looks like we should be using class KeyValueLinearSource(Generic[K, V], ContextManager["KeyValueLinearSource"], metaclass=ABCMeta): |
I can try that. |
Ok. Doing
gets rid of the |
As such one fix is:
Let me know if this is acceptable. |
What if you use |
@jamart28 : poke me about this tomorrow and I can help you more. In the meantime, work on other classes of errors. |
I can do that. I'll move over to something else for today as the next issue I will most likely need help with as well since I have the cause of the issue narrowed down but not the why or the fix. |
Found the solution for the first problem (the one @gabbard was originally helping me with). Adding an |
@LichMaster98 The next two flags suggested above produce the following results. I would like to know if these are intended results and thus should be pursued for a fix or if they should not be added: vistautils/vistautils/range.py Line 26 in 0b0be9d
|
|
|
Originally posted by @berquist in #84
The text was updated successfully, but these errors were encountered: