1 from collections import deque
2 from logging import Logger
3 from threading import Condition, Lock
4 from typing import Any, Mapping, Sequence
6 from .channel import HTTPChannel
7 from .utilities import Error
9 rename_headers: Mapping[str, str]
10 hop_by_hop: frozenset[Any]
12 class ThreadedTaskDispatcher:
14 active_count: int = ...
16 queue_logger: Logger = ...
17 threads: set[Any] = ...
18 queue: deque[Task] = ...
20 queue_cv: Condition = ...
21 thread_exit_cv: Condition = ...
22 def __init__(self) -> None: ...
23 def start_new_thread(self, target: Any, args: Any) -> None: ...
24 def handler_thread(self, thread_no: int) -> None: ...
25 def set_thread_count(self, count: int) -> None: ...
26 def add_task(self, task: Task) -> None: ...
27 def shutdown(self, cancel_pending: bool = ..., timeout: int = ...) -> bool: ...
30 close_on_finish: bool = ...
32 wrote_header: bool = ...
34 content_length: int | None = ...
35 content_bytes_written: int = ...
36 logged_write_excess: bool = ...
37 logged_write_no_body: bool = ...
39 chunked_response: bool = ...
41 channel: HTTPChannel = ...
43 response_headers: Sequence[tuple[str, str]] = ...
45 def __init__(self, channel: HTTPChannel, request: Error) -> None: ...
46 def service(self) -> None: ...
48 def has_body(self) -> bool: ...
49 def build_response_header(self) -> bytes: ...
50 def remove_content_length_header(self) -> None: ...
51 def start(self) -> None: ...
52 def finish(self) -> None: ...
53 def write(self, data: bytes) -> None: ...
55 class ErrorTask(Task):
58 close_on_finish: bool = ...
59 content_length: int = ...
60 def execute(self) -> None: ...
63 environ: Any | None = ...
64 response_headers: Sequence[tuple[str, str]] = ...
67 content_length: int = ...
68 close_on_finish: bool = ...
69 def execute(self) -> None: ...
70 def get_environment(self) -> Any: ...