-
-
Notifications
You must be signed in to change notification settings - Fork 754
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
Annotate httptools_impl.py
#1484
Conversation
self.transport: asyncio.Transport = None # type: ignore[assignment] | ||
self.flow: FlowControl = None # type: ignore[assignment] |
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.
Are you using the # type: ignore[assignment]
just to avoid some assert self.transport is not None
s later?
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.
Yes
if sys.version_info < (3, 8): # pragma: py-gte-38 | ||
from typing_extensions import Literal | ||
else: # pragma: py-lt-38 | ||
from typing import Literal |
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.
do we have a _compat.py
module or something where this sorta boilerplate can go?
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.
No
await self.send( | ||
{"type": "http.response.body", "body": b"Internal Server Error"} | ||
) | ||
self.on_response = lambda: None |
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.
This went from self.on_response = None
to self.on_response = lambda: None`. The new version sounds more correct. Was this a bug?
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.
Good question. That was introduced on #189. I don't know if the line itself is really necessary (?)...
Thanks for the review @adriangb 🙏 |
* Annotate `httptools_impl.py` * Update uvicorn/protocols/http/httptools_impl.py
h11_impl.py
#1397