8000 Run stubtest on Windows for waitress (#9181) · python/typeshed@82c0ea7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 82c0ea7

Browse files
authored
Run stubtest on Windows for waitress (#9181)
1 parent 005801d commit 82c0ea7

File tree

7 files changed

+46
-38
lines changed

7 files changed

+46
-38
lines changed

stubs/waitress/@tests/stubtest_allowlist.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ waitress.rfc7230.tobytes
2727
waitress.server.BaseWSGIServer.channel_class
2828
waitress.server.BaseWSGIServer.get_server_name
2929
waitress.server.MultiSocketServer.__init__
30-
waitress.server.UnixWSGIServer.get_server_name
3130
waitress.server.WSGIServer
3231
waitress.task.ErrorTask.content_length
3332
waitress.task.ThreadedTaskDispatcher.start_new_thread
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
waitress.server.UnixWSGIServer.get_server_name
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
waitress.server.UnixWSGIServer.get_server_name

stubs/waitress/METADATA.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
version = "2.1.*"
22
requires = []
3+
4+
[tool.stubtest]
5+
# linux and darwin are equivalent
6+
platforms = ["linux", "win32"]

stubs/waitress/waitress/server.pyi

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import sys
12
from collections.abc import Sequence
23
from socket import socket
34
from typing import Any
45

6+
from waitress import wasyncore
57
from waitress.adjustments import Adjustments
68
from waitress.channel import HTTPChannel
79
from waitress.task import Task, ThreadedTaskDispatcher
810

9-
from . import wasyncore
10-
1111
def create_server(
1212
application: Any,
1313
map: Any | None = ...,
@@ -84,21 +84,22 @@ class TcpWSGIServer(BaseWSGIServer):
8484
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
8585
def set_socket_options(self, conn: socket) -> None: ...
8686

87-
class UnixWSGIServer(BaseWSGIServer):
88-
def __init__(
89-
self,
90-
application: Any,
91-
map: Any | None = ...,
92-
_start: bool = ...,
93-
_sock: Any | None = ...,
94-
dispatcher: Any | None = ...,
95-
adj: Adjustments | None = ...,
96-
sockinfo: Any | None = ...,
97-
**kw: Any,
98-
) -> None: ...
99-
def bind_server_socket(self) -> None: ...
100-
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
101-
def fix_addr(self, addr: Any) -> tuple[str, None]: ...
102-
def get_server_name(self, ip: Any) -> str: ...
87+
if sys.platform != "win32":
88+
class UnixWSGIServer(BaseWSGIServer):
89+
def __init__(
90+
self,
91+
application: Any,
92+
map: Any | None = ...,
93+
_start: bool = ...,
94+
_sock: Any | None = ...,
95+
dispatcher: Any | None = ...,
96+
adj: Adjustments | None = ...,
97+
sockinfo: Any | None = ...,
98+
**kw: Any,
99+
) -> None: ...
100+
def bind_server_socket(self) -> None: ...
101+
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
102+
def fix_addr(self, addr: Any) -> tuple[str, None]: ...
103+
def get_server_name(self, ip: Any) -> str: ...
103104

104105
WSGIServer: TcpWSGIServer

stubs/waitress/waitress/trigger.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from socket import socket
44
from threading import Lock
55
from typing_extensions import Literal
66

7-
from . import wasyncore as wasyncore
7+
from waitress import wasyncore as wasyncore
88

99
class _triggerbase:
1010
kind: str | None = ...
1818
def pull_trigger(self, thunk: Callable[[None], object] | None = ...) -> None: ...
1919
def handle_read(self) -> None: ...
2020

21-
if sys.platform == "linux" or sys.platform == "darwin":
21+
if sys.platform != "win32":
2222
class trigger(_triggerbase, wasyncore.file_dispatcher):
2323
kind: str = ...
2424
def __init__(self, map: Mapping[str, _triggerbase]) -> None: ...

stubs/waitress/waitress/wasyncore.pyi

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import sys
12
from collections.abc import Callable, Mapping
23
from io import BytesIO
34
from logging import Logger
45
from socket import socket
56
from typing import Any
67
from typing_extensions import TypeAlias
78

8-
from . import compat as compat, utilities as utilities
9+
from waitress import compat as compat, utilities as utilities
910

1011
_Socket: TypeAlias = socket
1112

@@ -77,20 +78,21 @@ class dispatcher_with_send(dispatcher):
7778

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

80-
class file_wrapper:
81-
fd: BytesIO = ...
82-
def __init__(self, fd: BytesIO) -> None: ...
83-
def __del__(self) -> None: ...
84-
def recv(self, *args: Any) -> bytes: ...
85-
def send(self, *args: Any) -> bytes: ...
86-
def getsockopt(self, level: int, optname: int, buflen: bool | None = ...) -> int: ...
87-
read: Callable[..., bytes] = ...
88-
write: Callable[..., bytes] = ...
89-
def close(self) -> None: ...
90-
def fileno(self) -> BytesIO: ...
81+
if sys.platform != "win32":
82+
class file_wrapper:
83+
fd: BytesIO = ...
84+
def __init__(self, fd: BytesIO) -> None: ...
85+
def __del__(self) -> None: ...
86+
def recv(self, *args: Any) -> bytes: ...
87+
def send(self, *args: Any) -> bytes: ...
88+
def getsockopt(self, level: int, optname: int, buflen: bool | None = ...) -> int: ...
89+
read: Callable[..., bytes] = ...
90+
write: Callable[..., bytes] = ...
91+
def close(self) -> None: ...
92+
def fileno(self) -> BytesIO: ...
9193

92-
class file_dispatcher(dispatcher):
93-
connected: bool = ...
94-
def __init__(self, fd: BytesIO, map: Mapping[int, _Socket] | None = ...) -> None: ...
95-
socket: _Socket = ...
96-
def set_file(self, fd: BytesIO) -> None: ...
94+
class file_dispatcher(dispatcher):
95+
connected: bool = ...
96+
def __init__(self, fd: BytesIO, map: Mapping[int, _Socket] | None = ...) -> None: ...
97+
socket: _Socket = ...
98+
def set_file(self, fd: BytesIO) -> None: ...

0 commit comments

Comments
 (0)
0