MCPcopy Index your code
hub / github.com/python-websockets/websockets / build_extension_item

Function build_extension_item

src/websockets/headers.py:392–408  ·  view source on GitHub ↗

Build an extension definition. This is the reverse of :func:`parse_extension_item`.

(
    name: ExtensionName, parameters: Sequence[ExtensionParameter]
)

Source from the content-addressed store, hash-verified

390
391
392def build_extension_item(
393 name: ExtensionName, parameters: Sequence[ExtensionParameter]
394) -> str:
395 """
396 Build an extension definition.
397
398 This is the reverse of :func:`parse_extension_item`.
399
400 """
401 return "; ".join(
402 [cast(str, name)]
403 + [
404 # Quoted strings aren't necessary because values are always tokens.
405 name if value is None else f"{name}={value}"
406 for name, value in parameters
407 ]
408 )
409
410
411def build_extension(extensions: Sequence[ExtensionHeader]) -> str:

Callers 1

build_extensionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…