-
Notifications
You must be signed in to change notification settings - Fork 90
Switch from Sentinel types to Enums #154
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
Open
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pgjones
pgjones
force-pushed
the
master
branch
3 times, most recently
from
August 25, 2022 11:02
c42389e to
df6649d
Compare
The latter are much easier to work with when type hinting and can be used successfully with mypyc, whereas the former are sadly very difficult in both aspects. This loses the nice property of `type(NEED_DATA) is NEED_DATA` (as expanded on in the deleted docs section). However, I don't think this is widely used in practice.
@pgjones
pgjones
force-pushed
the
master
branch
from
August 25, 2022 11:38
df6649d to
f13da12
Compare
Contributor
lovelydinosaur
commented
Sep 1, 2022
Contributor
Kludex
commented
Sep 1, 2022
I can check this on Uvicorn tonight. jfyk
Contributor
lovelydinosaur
commented
Sep 1, 2022
@Kludex Sure thing. Permalinks to relevant parts of code in the comment above. (Tho I can see that's not obvious.)
Contributor
Kludex
commented
Oct 30, 2022
This was merged on httpcore: encode/httpcore#579
Contributor
Kludex
commented
Oct 30, 2022
The only problem on uvicorn was:
event = h11.InformationalResponse( status_code=100, headers=[], reason="Continue" )
Issue:
uvicorn/protocols/http/h11_impl.py:537: error: Argument "headers" to "InformationalResponse" has incompatible type "List[<nothing>]"; expected "Union[Headers, List[Tuple[bytes, bytes]], List[Tuple[str, str]]]" [arg-type] uvicorn/protocols/http/h11_impl.py:537: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance uvicorn/protocols/http/h11_impl.py:537: note: Consider using "Sequence" instead, which is covariant Found 1 error in 1 file (checked 53 source files)
I've used this branch on uvicorn to check the changes I'd need: https://github.com/encode/uvicorn/pull/1744/files
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
The latter are much easier to work with when type hinting and can be
used successfully with mypyc, whereas the former are sadly very
difficult in both aspects.
This loses the nice property of
type(NEED_DATA) is NEED_DATA(asexpanded on in the deleted docs section). However, I don't think this
is widely used in practice.
Closes #153. See also #8 for reasoning behind the introduction of the type property.
@njsmith what do you think about this?