Validate that ``subprotocols`` is suitable for :func:`build_subprotocol`.
(subprotocols: Sequence[Subprotocol])
| 469 | |
| 470 | |
| 471 | def validate_subprotocols(subprotocols: Sequence[Subprotocol]) -> None: |
| 472 | """ |
| 473 | Validate that ``subprotocols`` is suitable for :func:`build_subprotocol`. |
| 474 | |
| 475 | """ |
| 476 | if not isinstance(subprotocols, Sequence): |
| 477 | raise TypeError("subprotocols must be a list") |
| 478 | if isinstance(subprotocols, str): |
| 479 | raise TypeError("subprotocols must be a list, not a str") |
| 480 | for subprotocol in subprotocols: |
| 481 | if not _token_re.fullmatch(subprotocol): |
| 482 | raise ValueError(f"invalid subprotocol: {subprotocol}") |
| 483 | |
| 484 | |
| 485 | def build_www_authenticate_basic(realm: str) -> str: |
no outgoing calls
searching dependent graphs…