-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
http: improve types #9055
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
http: improve types #9055
Changes from 2 commits
7bd6409
ca92fd2
2e733fa
a3b8882
65171d1
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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,7 +31,6 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): | |||||||||||||
default_request_version: str # undocumented | ||||||||||||||
weekdayname: ClassVar[Sequence[str]] # undocumented | ||||||||||||||
monthname: ClassVar[Sequence[str | None]] # undocumented | ||||||||||||||
def __init__(self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer) -> None: ... | ||||||||||||||
def handle_one_request(self) -> None: ... | ||||||||||||||
def handle_expect_100(self) -> bool: ... | ||||||||||||||
def send_error(self, code: int, message: str | None = ..., explain: str | None = ...) -> None: ... | ||||||||||||||
|
@@ -52,7 +51,12 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): | |||||||||||||
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): | ||||||||||||||
extensions_map: dict[str, str] | ||||||||||||||
def __init__( | ||||||||||||||
self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer, directory: str | None = ... | ||||||||||||||
self, | ||||||||||||||
request: socketserver._RequestType, | ||||||||||||||
client_address: socketserver._AddressType, | ||||||||||||||
server: socketserver.BaseServer, | ||||||||||||||
directory: str | None = ..., | ||||||||||||||
index_pages: Sequence[str] | None = ..., | ||||||||||||||
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. As
Suggested change
(directory is also passed to os.fspath() in later version (but not 3.7), but that's out of scope for this PR, since it needs overloads.) 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.
|
||||||||||||||
) -> None: ... | ||||||||||||||
def do_GET(self) -> None: ... | ||||||||||||||
def do_HEAD(self) -> 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.
HTTPConnection.send()
also allowsstr
:I think the best solution is just to add
str
to thebody
argument ofrequest
manually.