-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add Workers and partial ListenerHolder typing #226
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,6 +1,7 @@ | ||||
from typing import Any, Dict, List, Optional, Tuple | ||||
from typing import Any, Dict, List, Optional, Tuple, Protocol | ||||
|
||||
from ._types import WebsocketMessage | ||||
from .http import HTTP1Settings, HTTP2Settings | ||||
|
||||
__version__: str | ||||
|
||||
|
@@ -58,3 +59,35 @@ class WSGIScope: | |||
|
||||
class WorkerSignal: | ||||
def __init__(self): ... | ||||
|
||||
class __WorkerConfig(Protocol): | ||||
def __init__( | ||||
self, | ||||
id: int, | ||||
socket_fd: int, | ||||
threads: int, | ||||
pthreads: int, | ||||
http_mode: str, | ||||
http1_opts: HTTP1Settings, | ||||
http2_opts: HTTP2Settings, | ||||
websockets_enabled: bool, | ||||
opt_enabled: bool, | ||||
ssl_enabled: bool, | ||||
ssl_cert: Optional[str], | ||||
ssl_key: Optional[str], | ||||
): | ||||
... | ||||
|
||||
class ASGIWorker(__WorkerConfig): | ||||
... | ||||
|
||||
class RSGIWorker(__WorkerConfig): | ||||
... | ||||
|
||||
class WSGIWorker(__WorkerConfig): | ||||
... | ||||
|
||||
|
||||
class ListenerHolder: | ||||
@classmethod | ||||
def from_address(cls, bind_addr: str, port: int, backlog: int) -> "ListenerHolder": ... | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is future annotations in re of Protocol? also unless i'm mistaken, the class method doesn't return the instance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, Line 34 in 348d3c7
I commented about class ListenerHolder:
@classmethod
def from_address(cls, bind_addr: str, port: int, backlog: int) -> ListenerHolder: ... |
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.
WSGIWorker
doesn't acceptwebsockets_enabled
andopt_enabled
parameters