-
-
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
Cover httptools_impl on mypy #1102
Closed
Closed
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8114674
added typing
jkklapp 5603eb5
add file in mypy checks
jkklapp 641f57e
fixed some mypy issues
jkklapp b77075c
more fixes
jkklapp 1496af9
remove unused import
jkklapp d5f06fe
fix issue with timeout_keep_alive_task
jkklapp 6675de3
init to None
jkklapp 2e3f97a
fix access_log type
jkklapp 4562a47
fix issue with scope
jkklapp eaa2996
fix more issues
jkklapp daf2447
fix scope parameter
jkklapp 8668afb
make headers a dict
jkklapp 29bfbae
use only httpscope
jkklapp 47f1617
fixed typing of chunked_encoding
jkklapp edf38f5
set exc to Any
jkklapp b68ddb7
use headers as list
jkklapp 43aa456
fix interpolation issues
jkklapp b69a5bf
remove unused imports
jkklapp 1bec6f8
init cycle to None
jkklapp 39017d2
ignore remaining issues
jkklapp fd63a27
sort imports
jkklapp 8230f4a
fixed types in send and receive
jkklapp d963b2c
add optional to _loop param
jkklapp 53a0814
use new types for receive and send typing
jkklapp 22a30ca
fix on_response init typing
jkklapp 034c0e4
fix scope typing
jkklapp 2d1d0fc
:rotating_light: Cover httptools_impl on mypy
Kludex b717401
merge master
Kludex 2ba089f
finally
Kludex 348e380
fix on 3.6
Kludex 7083c26
fix on 3.7
Kludex 130e96b
fix wrong merge
Kludex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,44 @@ | ||
import asyncio | ||
import types | ||
import typing | ||
from typing import ( | ||
TYPE_CHECKING, | ||
Any, | ||
Callable, | ||
Iterable, | ||
MutableMapping, | ||
Optional, | ||
Protocol, | ||
Tuple, | ||
Type, | ||
Union, | ||
) | ||
|
||
if TYPE_CHECKING: | ||
from uvicorn.config import Config | ||
from uvicorn.server_state import ServerState | ||
|
||
# WSGI | ||
Environ = typing.MutableMapping[str, typing.Any] | ||
ExcInfo = typing.Tuple[ | ||
typing.Type[BaseException], BaseException, typing.Optional[types.TracebackType] | ||
] | ||
StartResponse = typing.Callable[ | ||
[str, typing.Iterable[typing.Tuple[str, str]], typing.Optional[ExcInfo]], None | ||
] | ||
WSGIApp = typing.Callable[ | ||
[Environ, StartResponse], typing.Union[typing.Iterable[bytes], BaseException] | ||
] | ||
Environ = MutableMapping[str, Any] | ||
ExcInfo = Tuple[Type[BaseException], BaseException, Optional[types.TracebackType]] | ||
StartResponse = Callable[[str, Iterable[Tuple[str, str]], Optional[ExcInfo]], None] | ||
WSGIApp = Callable[[Environ, StartResponse], Union[Iterable[bytes], BaseException]] | ||
|
||
|
||
class WebProtocol(Protocol): | ||
def __init__( | ||
self, | ||
config: "Config", | ||
server_state: "ServerState", | ||
on_connection_lost: Optional[Callable[..., Any]], | ||
_loop: Optional[asyncio.AbstractEventLoop] = None, | ||
) -> None: | ||
... | ||
|
||
def connection_made(self, transport) -> None: | ||
... | ||
|
||
def data_received(self, data: bytes) -> None: | ||
... | ||
|
||
def shutdown(self) -> None: | ||
... |
This file contains 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
Oops, something went wrong.
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.
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.
Here, I'm not sure if we should actually call it
WebProtocolProtocol
, because theProtocol
is from typing. 🤔