8000 Run stubtest on Windows for waitress by Avasam · Pull Request #9181 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Run stubtest on Windows for waitress #9181

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

Merged
merged 3 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion stubs/waitress/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ waitress.rfc7230.tobytes
waitress.server.BaseWSGIServer.channel_class
waitress.server.BaseWSGIServer.get_server_name
waitress.server.MultiSocketServer.__init__
waitress.server.UnixWSGIServer.get_server_name
waitress.server.WSGIServer
waitress.task.ErrorTask.content_length
waitress.task.ThreadedTaskDispatcher.start_new_thread
Expand Down
1 change: 1 addition & 0 deletions stubs/waitress/@tests/stubtest_allowlist_darwin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
waitress.server.UnixWSGIServer.get_server_name
1 change: 1 addition & 0 deletions stubs/waitress/@tests/stubtest_allowlist_linux.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
waitress.server.UnixWSGIServer.get_server_name
4 changes: 4 additions & 0 deletions stubs/waitress/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
version = "2.1.*"
requires = []

[tool.stubtest]
# linux and darwin are equivalent
platforms = ["linux", "win32"]
37 changes: 19 additions & 18 deletions stubs/waitress/waitress/server.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import sys
from collections.abc import Sequence
from socket import socket
from typing import Any

from waitress import wasyncore
from waitress.adjustments import Adjustments
from waitress.channel import HTTPChannel
from waitress.task import Task, ThreadedTaskDispatcher

from . import wasyncore

def create_server(
application: Any,
map: Any | None = ...,
Expand Down Expand Up @@ -84,21 +84,22 @@ class TcpWSGIServer(BaseWSGIServer):
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
def set_socket_options(self, conn: socket) -> None: ...

class UnixWSGIServer(BaseWSGIServer):
def __init__(
self,
application: Any,
map: Any | None = ...,
_start: bool = ...,
_sock: Any | None = ...,
dispatcher: Any | None = ...,
adj: Adjustments | None = ...,
sockinfo: Any | None = ...,
**kw: Any,
) -> None: ...
def bind_server_socket(self) -> None: ...
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
def fix_addr(self, addr: Any) -> tuple[str, None]: ...
def get_server_name(self, ip: Any) -> str: ...
if sys.platform != "win32":
class UnixWSGIServer(BaseWSGIServer):
def __init__(
self,
application: Any,
map: Any | None = ...,
_start: bool = ...,
_sock: Any | None = ...,
dispatcher: Any | None = ...,
adj: Adjustments | None = ...,
sockinfo: Any | None = ...,
**kw: Any,
) -> None: ...
def bind_server_socket(self) -> None: ...
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
def fix_addr(self, addr: Any) -> tuple[str, None]: ...
def get_server_name(self, ip: Any) -> str: ...

WSGIServer: TcpWSGIServer
4 changes: 2 additions & 2 deletions stubs/waitress/waitress/trigger.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from socket import socket
from threading import Lock
from typing_extensions import Literal

from . import wasyncore as wasyncore
from waitress import wasyncore as wasyncore

class _triggerbase:
kind: str | None = ...
Expand All @@ -18,7 +18,7 @@ class _triggerbase:
def pull_trigger(self, thunk: Callable[[None], object] | None = ...) -> None: ...
def handle_read(self) -> None: ...

if sys.platform == "linux" or sys.platform == "darwin":
if sys.platform != "win32":
class trigger(_triggerbase, wasyncore.file_dispatcher):
kind: str = ...
def __init__(self, map: Mapping[str, _triggerbase]) -> None: ...
Expand Down
36 changes: 19 additions & 17 deletions stubs/waitress/waitress/wasyncore.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import sys
from collections.abc import Callable, Mapping
from io import BytesIO
from logging import Logger
from socket import socket
from typing import Any
from typing_extensions import TypeAlias

from . import compat as compat, utilities as utilities
from waitress import compat as compat, utilities as utilities

_Socket: TypeAlias = socket

Expand Down Expand Up @@ -77,20 +78,21 @@ class dispatcher_with_send(dispatcher):

def close_all(map: Mapping[int, socket] | None = ..., ignore_all: bool = ...) -> None: ...

class file_wrapper:
fd: BytesIO = ...
def __init__(self, fd: BytesIO) -> None: ...
def __del__(self) -> None: ...
def recv(self, *args: Any) -> bytes: ...
def send(self, *args: Any) -> bytes: ...
def getsockopt(self, level: int, optname: int, buflen: bool | None = ...) -> int: ...
read: Callable[..., bytes] = ...
write: Callable[..., bytes] = ...
def close(self) -> None: ...
def fileno(self) -> BytesIO: ...
if sys.platform != "win32":
class file_wrapper:
fd: BytesIO = ...
def __init__(self, fd: BytesIO) -> None: ...
def __del__(self) -> None: ...
def recv(self, *args: Any) -> bytes: ...
def send(self, *args: Any) -> bytes: ...
def getsockopt(self, level: int, optname: int, buflen: bool | None = ...) -> int: ...
read: Callable[..., bytes] = ...
write: Callable[..., bytes] = ...
def close(self) -> None: ...
def fileno(self) -> BytesIO: ...

class file_dispatcher(dispatcher):
connected: bool = ...
def __init__(self, fd: BytesIO, map: Mapping[int, _Socket] | None = ...) -> None: ...
socket: _Socket = ...
def set_file(self, fd: BytesIO) -> None: ...
class file_dispatcher(dispatcher):
connected: bool = ...
def __init__(self, fd: BytesIO, map: Mapping[int, _Socket] | None = ...) -> None: ...
socket: _Socket = ...
def set_file(self, fd: BytesIO) -> None: ...
0