Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

typing.py 1.4KB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. from __future__ import annotations
  2. import logging
  3. from typing import List, NewType, Optional, Tuple, Union
  4. __all__ = [
  5. "Data",
  6. "LoggerLike",
  7. "Origin",
  8. "Subprotocol",
  9. "ExtensionName",
  10. "ExtensionParameter",
  11. ]
  12. # Public types used in the signature of public APIs
  13. Data = Union[str, bytes]
  14. """Types supported in a WebSocket message:
  15. :class:`str` for a Text_ frame, :class:`bytes` for a Binary_.
  16. .. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
  17. .. _Binary : https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
  18. """
  19. LoggerLike = Union[logging.Logger, logging.LoggerAdapter]
  20. """Types accepted where a :class:`~logging.Logger` is expected."""
  21. Origin = NewType("Origin", str)
  22. """Value of a ``Origin`` header."""
  23. Subprotocol = NewType("Subprotocol", str)
  24. """Subprotocol in a ``Sec-WebSocket-Protocol`` header."""
  25. ExtensionName = NewType("ExtensionName", str)
  26. """Name of a WebSocket extension."""
  27. ExtensionParameter = Tuple[str, Optional[str]]
  28. """Parameter of a WebSocket extension."""
  29. # Private types
  30. ExtensionHeader = Tuple[ExtensionName, List[ExtensionParameter]]
  31. """Extension in a ``Sec-WebSocket-Extensions`` header."""
  32. ConnectionOption = NewType("ConnectionOption", str)
  33. """Connection option in a ``Connection`` header."""
  34. UpgradeProtocol = NewType("UpgradeProtocol", str)
  35. """Upgrade protocol in an ``Upgrade`` header."""