Files
2025-04-30 08:48:49 -05:00

73 lines
2.2 KiB
Python

# uncompyle6 version 3.9.2
# Python bytecode version base 3.7.0 (3394)
# Decompiled from: Python 3.8.19 (default, Mar 20 2024, 15:27:52)
# [Clang 14.0.6 ]
# Embedded file name: /var/user/app/device_supervisorbak/device_supervisor/lib/h2/errors.py
# Compiled at: 2024-04-18 03:12:55
# Size of source mod 2**32: 5040 bytes
"""
h2/errors
~~~~~~~~~~~~~~~~~~~
Global error code registry containing the established HTTP/2 error codes.
The current registry is available at:
https://tools.ietf.org/html/rfc7540#section-11.4
"""
import enum
class ErrorCodes(enum.IntEnum):
__doc__ = "\n All known HTTP/2 error codes.\n\n .. versionadded:: 2.5.0\n "
NO_ERROR = 0
PROTOCOL_ERROR = 1
INTERNAL_ERROR = 2
FLOW_CONTROL_ERROR = 3
SETTINGS_TIMEOUT = 4
STREAM_CLOSED = 5
FRAME_SIZE_ERROR = 6
REFUSED_STREAM = 7
CANCEL = 8
COMPRESSION_ERROR = 9
CONNECT_ERROR = 10
ENHANCE_YOUR_CALM = 11
INADEQUATE_SECURITY = 12
HTTP_1_1_REQUIRED = 13
def _error_code_from_int(code):
"""
Given an integer error code, returns either one of :class:`ErrorCodes
<h2.errors.ErrorCodes>` or, if not present in the known set of codes,
returns the integer directly.
"""
try:
return ErrorCodes(code)
except ValueError:
return code
NO_ERROR = ErrorCodes.NO_ERROR
PROTOCOL_ERROR = ErrorCodes.PROTOCOL_ERROR
INTERNAL_ERROR = ErrorCodes.INTERNAL_ERROR
FLOW_CONTROL_ERROR = ErrorCodes.FLOW_CONTROL_ERROR
SETTINGS_TIMEOUT = ErrorCodes.SETTINGS_TIMEOUT
STREAM_CLOSED = ErrorCodes.STREAM_CLOSED
FRAME_SIZE_ERROR = ErrorCodes.FRAME_SIZE_ERROR
REFUSED_STREAM = ErrorCodes.REFUSED_STREAM
CANCEL = ErrorCodes.CANCEL
COMPRESSION_ERROR = ErrorCodes.COMPRESSION_ERROR
CONNECT_ERROR = ErrorCodes.CONNECT_ERROR
ENHANCE_YOUR_CALM = ErrorCodes.ENHANCE_YOUR_CALM
INADEQUATE_SECURITY = ErrorCodes.INADEQUATE_SECURITY
HTTP_1_1_REQUIRED = ErrorCodes.HTTP_1_1_REQUIRED
H2_ERRORS = list(ErrorCodes)
__all__ = [
'H2_ERRORS', 'NO_ERROR', 'PROTOCOL_ERROR', 'INTERNAL_ERROR',
'FLOW_CONTROL_ERROR',
'SETTINGS_TIMEOUT', 'STREAM_CLOSED',
'FRAME_SIZE_ERROR', 'REFUSED_STREAM',
'CANCEL', 'COMPRESSION_ERROR',
'CONNECT_ERROR', 'ENHANCE_YOUR_CALM', 'INADEQUATE_SECURITY',
'HTTP_1_1_REQUIRED',
'ErrorCodes']