Skip to content

Commit c42672b

Browse files
committed
Narrow down type of client_max_window_bits.
1 parent bba423e commit c42672b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/websockets/extensions/permessage_deflate.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import zlib
44
from collections.abc import Sequence
5-
from typing import Any
5+
from typing import Any, Literal
66

77
from .. import frames
88
from ..exceptions import (
@@ -212,7 +212,7 @@ def _build_parameters(
212212
server_no_context_takeover: bool,
213213
client_no_context_takeover: bool,
214214
server_max_window_bits: int | None,
215-
client_max_window_bits: int | bool | None,
215+
client_max_window_bits: int | Literal[True] | None,
216216
) -> list[ExtensionParameter]:
217217
"""
218218
Build a list of ``(name, value)`` pairs for some compression parameters.
@@ -234,7 +234,7 @@ def _build_parameters(
234234

235235
def _extract_parameters(
236236
params: Sequence[ExtensionParameter], *, is_server: bool
237-
) -> tuple[bool, bool, int | None, int | bool | None]:
237+
) -> tuple[bool, bool, int | None, int | Literal[True] | None]:
238238
"""
239239
Extract compression parameters from a list of ``(name, value)`` pairs.
240240
@@ -245,7 +245,7 @@ def _extract_parameters(
245245
server_no_context_takeover: bool = False
246246
client_no_context_takeover: bool = False
247247
server_max_window_bits: int | None = None
248-
client_max_window_bits: int | bool | None = None
248+
client_max_window_bits: int | Literal[True] | None = None
249249

250250
for name, value in params:
251251
if name == "server_no_context_takeover":
@@ -324,7 +324,7 @@ def __init__(
324324
server_no_context_takeover: bool = False,
325325
client_no_context_takeover: bool = False,
326326
server_max_window_bits: int | None = None,
327-
client_max_window_bits: int | bool | None = True,
327+
client_max_window_bits: int | Literal[True] | None = True,
328328
compress_settings: dict[str, Any] | None = None,
329329
) -> None:
330330
"""

0 commit comments

Comments
 (0)