8000 Improve `pywin32.isapi` (#13889) · python/typeshed@6759cb1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6759cb1

Browse files
authored
Improve pywin32.isapi (#13889)
1 parent 8bfae33 commit 6759cb1

File tree

5 files changed

+126
-123
lines changed

5 files changed

+126
-123
lines changed

stubs/pywin32/isapi/__init__.pyi

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
from _typeshed import Incomplete
2-
31
class ISAPIError(Exception):
4-
errno: Incomplete
5-
strerror: Incomplete
6-
funcname: Incomplete
7-
def __init__(self, errno, strerror: Incomplete | None = None, funcname: Incomplete | None = None) -> None: ...
2+
errno: int
3+
strerror: str | None
4+
funcname: str | None
5+
def __init__(self, errno: int, strerror: str | None = None, funcname: str | None = None) -> None: ...
86

97
class FilterError(ISAPIError): ...
108
class ExtensionError(ISAPIError): ...

stubs/pywin32/isapi/install.pyi

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
from _typeshed import Incomplete
1+
from _typeshed import Incomplete, StrOrBytesPath, StrPath, SupportsGetItem, Unused
2+
from collections.abc import Callable, Iterable, Mapping
3+
from optparse import OptionParser
4+
from typing import Final, Literal
25

3-
this_dir: Incomplete
6+
this_dir: str
47

58
class FilterParameters:
69
Name: Incomplete
@@ -33,8 +36,8 @@ class VirtualDirParameters:
3336
ScriptMapUpdate: str
3437
Server: Incomplete
3538
def __init__(self, **kw) -> None: ...
36-
def is_root(self): ...
37-
def split_path(self): ...
39+
def is_root(self) -> bool: ...
40+
def split_path(self) -> list[str]: ...
3841

3942
class ScriptMapParams:
4043
Extension: Incomplete
@@ -56,43 +59,43 @@ class ISAPIParameters:
5659

5760
verbose: int
5861

59-
def log(level, what) -> None: ...
62+
def log(level: int, what: object) -> None: ...
6063

6164
class InstallationError(Exception): ...
6265
class ItemNotFound(InstallationError): ...
6366
class ConfigurationError(InstallationError): ...
6467

65-
def FindPath(options, server, name): ...
66-
def LocateWebServerPath(description): ...
67-
def GetWebServer(description: Incomplete | None = None): ...
68+
def FindPath(options, server: str | bytes | bytearray, name: str) -> str: ...
69+
def LocateWebServerPath(description: str): ...
70+
def GetWebServer(description: str | None = None): ...
6871
def LoadWebServer(path): ...
69-
def FindWebServer(options, server_desc): ...
70-
def split_path(path): ...
72+
def FindWebServer(options, server_desc: str | bytes | bytearray | None) -> str: ...
73+
def split_path(path: str) -> list[str]: ...
7174
def CreateDirectory(params, options): ...
72-
def AssignScriptMaps(script_maps, target, update: str = "replace") -> None: ...
75+
def AssignScriptMaps(script_maps: Iterable[ScriptMapParams], target, update: str = "replace") -> None: ...
7376
def get_unique_items(sequence, reference): ...
7477
def CreateISAPIFilter(filterParams, options): ...
7578
def DeleteISAPIFilter(filterParams, options) -> None: ...
7679
def AddExtensionFiles(params, options) -> None: ...
7780
def DeleteExtensionFileRecords(params, options) -> None: ...
78-
def CheckLoaderModule(dll_name) -> None: ...
81+
def CheckLoaderModule(dll_name: StrOrBytesPath) -> None: ...
7982
def Install(params, options) -> None: ...
8083
def RemoveDirectory(params, options) -> None: ...
8184
def RemoveScriptMaps(vd_params, options) -> None: ...
8285
def Uninstall(params, options) -> None: ...
83-
def GetLoaderModuleName(mod_name, check_module: Incomplete | None = None): ...
84-
def InstallModule(conf_module_name, params, options, log=...) -> None: ...
85-
def UninstallModule(conf_module_name, params, options, log=...) -> None: ...
86+
def GetLoaderModuleName(mod_name: StrPath, check_module: bool | None = None) -> str: ...
87+
def InstallModule(conf_module_name: StrPath, params, options, log: Callable[[int, str], Unused] = ...) -> None: ...
88+
def UninstallModule(conf_module_name: StrPath, params, options, log: Callable[[int, str], Unused] = ...) -> None: ...
8689

87-
standard_arguments: Incomplete
90+
standard_arguments: Final[dict[Literal["install", "remove"], Callable[..., Incomplete]]]
8891

89-
def build_usage(handler_map): ...
92+
def build_usage(handler_map: Mapping[str, object]) -> str: ...
9093
def MergeStandardOptions(options, params) -> None: ...
9194
def HandleCommandLine(
9295
params,
93-
argv: Incomplete | None = None,
94-
conf_module_name: Incomplete | None = None,
96+
argv: SupportsGetItem[int, str] | None = None,
97+
conf_module_name: str | None = None,
9598
default_arg: str = "install",
96-
opt_parser: Incomplete | None = None,
97-
custom_arg_handlers={},
99+
opt_parser: OptionParser | None = None,
100+
custom_arg_handlers: Mapping[str, object] = {},
98101
) -> None: ...

stubs/pywin32/isapi/isapicon.pyi

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
1-
from _typeshed import Incomplete
1+
from typing import Final
22

3-
HTTP_CONTINUE: int
4-
HTTP_SWITCHING_PROTOCOLS: int
5-
HTTP_PROCESSING: int
6-
HTTP_OK: int
7-
HTTP_CREATED: int
8-
HTTP_ACCEPTED: int
9-
HTTP_NON_AUTHORITATIVE: int
10-
HTTP_NO_CONTENT: int
11-
HTTP_RESET_CONTENT: int
12-
HTTP_PARTIAL_CONTENT: int
13-
HTTP_MULTI_STATUS: int
14-
HTTP_MULTIPLE_CHOICES: int
15-
HTTP_MOVED_PERMANENTLY: int
16-
HTTP_MOVED_TEMPORARILY: int
17-
HTTP_SEE_OTHER: int
18-
HTTP_NOT_MODIFIED: int
19-
HTTP_USE_PROXY: int
20-
HTTP_TEMPORARY_REDIRECT: int
21-
HTTP_BAD_REQUEST: int
22-
HTTP_UNAUTHORIZED: int
23-
HTTP_PAYMENT_REQUIRED: int
24-
HTTP_FORBIDDEN: int
25-
HTTP_NOT_FOUND: int
26-
HTTP_METHOD_NOT_ALLOWED: int
27-
HTTP_NOT_ACCEPTABLE: int
28-
HTTP_PROXY_AUTHENTICATION_REQUIRED: int
29-
HTTP_REQUEST_TIME_OUT: int
30-
HTTP_CONFLICT: int
31-
HTTP_GONE: int
32-
HTTP_LENGTH_REQUIRED: int
33-
HTTP_PRECONDITION_FAILED: int
34-
HTTP_REQUEST_ENTITY_TOO_LARGE: int
35-
HTTP_REQUEST_URI_TOO_LARGE: int
36-
HTTP_UNSUPPORTED_MEDIA_TYPE: int
37-
HTTP_RANGE_NOT_SATISFIABLE: int
38-
HTTP_EXPECTATION_FAILED: int
39-
HTTP_UNPROCESSABLE_ENTITY: int
40-
HTTP_INTERNAL_SERVER_ERROR: int
41-
HTTP_NOT_IMPLEMENTED: int
42-
HTTP_BAD_GATEWAY: int
43-
HTTP_SERVICE_UNAVAILABLE: int
44-
HTTP_GATEWAY_TIME_OUT: int
45-
HTTP_VERSION_NOT_SUPPORTED: int
46-
HTTP_VARIANT_ALSO_VARIES: int
47-
HSE_STATUS_SUCCESS: int
48-
HSE_STATUS_SUCCESS_AND_KEEP_CONN: int
49-
HSE_STATUS_PENDING: int
50-
HSE_STATUS_ERROR: int
51-
SF_NOTIFY_SECURE_PORT: int
52-
SF_NOTIFY_NONSECURE_PORT: int
53-
SF_NOTIFY_READ_RAW_DATA: int
54-
SF_NOTIFY_PREPROC_HEADERS: int
55-
SF_NOTIFY_AUTHENTICATION: int
56-
SF_NOTIFY_URL_MAP: int
57-
SF_NOTIFY_ACCESS_DENIED: int
58-
SF_NOTIFY_SEND_RESPONSE: int
59-
SF_NOTIFY_SEND_RAW_DATA: int
60-
SF_NOTIFY_LOG: int
61-
SF_NOTIFY_END_OF_REQUEST: int
62-
SF_NOTIFY_END_OF_NET_SESSION: int
63-
SF_NOTIFY_ORDER_HIGH: int
64-
SF_NOTIFY_ORDER_MEDIUM: int
65-
SF_NOTIFY_ORDER_LOW: int
66-
SF_NOTIFY_ORDER_DEFAULT: int
67-
SF_NOTIFY_ORDER_MASK: Incomplete
68-
SF_STATUS_REQ_FINISHED: int
69-
SF_STATUS_REQ_FINISHED_KEEP_CONN: Incomplete
70-
SF_STATUS_REQ_NEXT_NOTIFICATION: Incomplete
71-
SF_STATUS_REQ_HANDLED_NOTIFICATION: Incomplete
72-
SF_STATUS_REQ_ERROR: Incomplete
73-
SF_STATUS_REQ_READ_NEXT: Incomplete
74-
HSE_IO_SYNC: int
75-
HSE_IO_ASYNC: int
76-
HSE_IO_DISCONNECT_AFTER_SEND: int
77-
HSE_IO_SEND_HEADERS: int
78-
HSE_IO_NODELAY: int
79-
HSE_IO_FINAL_SEND: int
80-
HSE_IO_CACHE_RESPONSE: int
81-
HSE_EXEC_URL_NO_HEADERS: int
82-
HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR: int
83-
HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE: int
84-
HSE_EXEC_URL_DISABLE_CUSTOM_ERROR: int
85-
HSE_EXEC_URL_SSI_CMD: int
86-
HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE: int
3+
HTTP_CONTINUE: Final = 100
4+
HTTP_SWITCHING_PROTOCOLS: Final = 101
5+
HTTP_PROCESSING: Final = 102
6+
HTTP_OK: Final = 200
7+
HTTP_CREATED: Final = 201
8+
HTTP_ACCEPTED: Final = 202
9+
HTTP_NON_AUTHORITATIVE: Final = 203
10+
HTTP_NO_CONTENT: Final = 204
11+
HTTP_RESET_CONTENT: Final = 205
12+
HTTP_PARTIAL_CONTENT: Final = 206
13+
HTTP_MULTI_STATUS: Final = 207
14+
HTTP_MULTIPLE_CHOICES: Final = 300
15+
HTTP_MOVED_PERMANENTLY: Final = 301
16+
HTTP_MOVED_TEMPORARILY: Final = 302
17+
HTTP_SEE_OTHER: Final = 303
18+
HTTP_NOT_MODIFIED: Final = 304
19+
HTTP_USE_PROXY: Final = 305
20+
HTTP_TEMPORARY_REDIRECT: Final = 307
21+
HTTP_BAD_REQUEST: Final = 400
22+
HTTP_UNAUTHORIZED: Final = 401
23+
HTTP_PAYMENT_REQUIRED: Final = 402
24+
HTTP_FORBIDDEN: Final = 403
25+
HTTP_NOT_FOUND: Final = 404
26+
HTTP_METHOD_NOT_ALLOWED: Final = 405
27+
HTTP_NOT_ACCEPTABLE: Final = 406
28+
HTTP_PROXY_AUTHENTICATION_REQUIRED: Final = 407
29+
HTTP_REQUEST_TIME_OUT: Final = 408
30+
HTTP_CONFLICT: Final = 409
31+
HTTP_GONE: Final = 410
32+
HTTP_LENGTH_REQUIRED: Final = 411
33+
HTTP_PRECONDITION_FAILED: Final = 412
34+
HTTP_REQUEST_ENTITY_TOO_LARGE: Final = 413
35+
HTTP_REQUEST_URI_TOO_LARGE: Final = 414
36+
HTTP_UNSUPPORTED_MEDIA_TYPE: Final = 415
37+
HTTP_RANGE_NOT_SATISFIABLE: Final = 416
38+
HTTP_EXPECTATION_FAILED: Final = 417
39+
HTTP_UNPROCESSABLE_ENTITY: Final = 422
40+
HTTP_INTERNAL_SERVER_ERROR: Final = 500
41+
HTTP_NOT_IMPLEMENTED: Final = 501
42+
HTTP_BAD_GATEWAY: Final = 502
43+
HTTP_SERVICE_UNAVAILABLE: Final = 503
44+
HTTP_GATEWAY_TIME_OUT: Final = 504
45+
HTTP_VERSION_NOT_SUPPORTED: Final = 505
46+
HTTP_VARIANT_ALSO_VARIES: Final = 506
47+
HSE_STATUS_SUCCESS: Final = 1
48+
HSE_STATUS_SUCCESS_AND_KEEP_CONN: Final = 2
49+
HSE_STATUS_PENDING: Final = 3
50+
HSE_STATUS_ERROR: Final = 4
51+
SF_NOTIFY_SECURE_PORT: Final = 0x00000001
52+
SF_NOTIFY_NONSECURE_PORT: Final = 0x00000002
53+
SF_NOTIFY_READ_RAW_DATA: Final = 0x00008000
54+
SF_NOTIFY_PREPROC_HEADERS: Final = 0x00004000
55+
SF_NOTIFY_AUTHENTICATION: Final = 0x00002000
56+
SF_NOTIFY_URL_MAP: Final = 0x00001000
57+
SF_NOTIFY_ACCESS_DENIED: Final = 0x00000800
58+
SF_NOTIFY_SEND_RESPONSE: Final = 0x00000040
59+
SF_NOTIFY_SEND_RAW_DATA: Final = 0x00000400
60+
SF_NOTIFY_LOG: Final = 0x00000200
61+
SF_NOTIFY_END_OF_REQUEST: Final = 0x00000080
62+
SF_NOTIFY_END_OF_NET_SESSION: Final = 0x00000100
63+
SF_NOTIFY_ORDER_HIGH: Final = 0x00080000
64+
SF_NOTIFY_ORDER_MEDIUM: Final = 0x00040000
65+
SF_NOTIFY_ORDER_LOW: Final = 0x00020000
66+
SF_NOTIFY_ORDER_DEFAULT: Final = SF_NOTIFY_ORDER_LOW
67+
SF_NOTIFY_ORDER_MASK: Final = 917504
68+
SF_STATUS_REQ_FINISHED: Final = 134217728
69+
SF_STATUS_REQ_FINISHED_KEEP_CONN: Final = 134217729
70+
SF_STATUS_REQ_NEXT_NOTIFICATION: Final = 134217730
71+
SF_STATUS_REQ_HANDLED_NOTIFICATION: Final = 134217731
72+
SF_STATUS_REQ_ERROR: Final = 134217732
73+
SF_STATUS_REQ_READ_NEXT: Final = 134217733
74+
HSE_IO_SYNC: Final = 0x00000001
75+
HSE_IO_ASYNC: Final = 0x00000002
76+
HSE_IO_DISCONNECT_AFTER_SEND: Final = 0x00000004
77+
HSE_IO_SEND_HEADERS: Final = 0x00000008
78+
HSE_IO_NODELAY: Final = 0x00001000
79+
HSE_IO_FINAL_SEND: Final = 0x00000010
80+
HSE_IO_CACHE_RESPONSE: Final = 0x00000020
81+
HSE_EXEC_URL_NO_HEADERS: Final = 0x02
82+
HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR: Final = 0x04
83+
HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE: Final = 0x10
84+
HSE_EXEC_URL_DISABLE_CUSTOM_ERROR: Final = 0x20
85+
HSE_EXEC_URL_SSI_CMD: Final = 0x40
86+
HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE: Final = 0x80

stubs/pywin32/isapi/simple.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class SimpleExtension:
22
def GetExtensionVersion(self, vi) -> None: ...
3-
def HttpExtensionProc(self, control_block) -> None: ...
3+
def HttpExtensionProc(self, control_block) -> int | None: ...
44
def TerminateExtension(self, status) -> None: ...
55

66
class SimpleFilter:

stubs/pywin32/isapi/threaded_extension.pyi

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import threading
2-
from _typeshed import Incomplete
2+
from _typeshed import Unused
3+
from collections.abc import Callable
4+
from typing import Final
35

46
import isapi.simple
57

6-
ISAPI_REQUEST: int
7-
ISAPI_SHUTDOWN: int
8+
ISAPI_REQUEST: Final = 1
9+
ISAPI_SHUTDOWN: Final = 2
810

911
class WorkerThread(threading.Thread):
1012
running: bool
11-
io_req_port: Incomplete
12-
extension: Incomplete
13-
def __init__(self, extension, io_req_port) -> None: ...
13+
io_req_port: int
14+
extension: ThreadPoolExtension
15+
def __init__(self, extension: ThreadPoolExtension, io_req_port: int) -> None: ...
1416
def call_handler(self, cblock) -> None: ...
1517

1618
class ThreadPoolExtension(isapi.simple.SimpleExtension):
1719
max_workers: int
1820
worker_shutdown_wait: int
19-
workers: Incomplete
20-
dispatch_map: Incomplete
21-
io_req_port: Incomplete
21+
workers: list[WorkerThread]
22+
dispatch_map: dict[int, Callable[..., Unused]]
23+
io_req_port: int
2224
def GetExtensionVersion(self, vi) -> None: ...
23-
def HttpExtensionProc(self, control_block): ...
25+
def HttpExtensionProc(self, control_block) -> int: ...
2426
def TerminateExtension(self, status) -> None: ...
2527
def DispatchConnection(self, errCode, bytes, key, overlapped) -> None: ...
2628
def Dispatch(self, ecb) -> None: ...

0 commit comments

Comments
 (0)
0