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
Fix type hints for log_config
#1539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wch ! 🎉
I think it's normal for mypy not to warn here, as dict == Dict[str, Any]
... It's just that Pyright on strict mode (I think?) see it as a problem... Or maybe mypy with more strict setup see it as a problem as well? 🤔
Ah, I didn't know that I did find this flag for mypy:
I tried using mypy with that option:
|
I think we should use |
The Lines 399 to 407 in 0954e56
|
It should make a copy then (maybe another PR) |
* Fix type hints for log_config * Update uvicorn/main.py Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
* Fix type hints for log_config * Update uvicorn/main.py Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
This is a fix for the issue reported here: #1536
Previously, if external code called
uvicorn.run()
and was type-checked with pyright, it reportederror: Type of "run" is partially unknown
. This is because it wants the generic typedict
to have parameters specifying the type, as indict[str, Any]
.I'm actually a bit surprised that mypy doesn't also report this as a problem, since all the examples I saw in the mypy docs provide a parameter for generics like
list
anddict
.