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
pyright does not type-guards to bottle.FormsDict #4350
Comments
I'm not able to repro the first of the two errors you're seeing. Which version of the Do you have any other non-default settings configured for pyright? |
Ah, I am able to repro the problem if If you want to use static type checking with the This isn't a bug, this is the expected behavior. |
If this library is important to you, I recommend contacting its maintainers and asking them to add inlined type information and mark the library as typed by including a "py.typed" marker. For more details, they can refer to this documentation. |
@erictraut thx for your insights, I supposed that indeed pyright would infer types from lib code. Now, with this flag enabled: But... if we shadow
Again, we would expect new |
In this case, you have declared that the symbol |
python 3.11.0, pyright 1.1284
Second error is logical but first does not (at least to me, even after pyright's type-concept)
If we move loop inside type-safe branch:
The .items() error is cleared, as expected, so seems that pyright somewhat takes into account
isinstance
If we hint function signature as follow:
Here, all errors are cleared, but I would expect 2 errors: one in signature (should be FormsDict | None), and the most obvious with .items() call.
The text was updated successfully, but these errors were encountered: