File: //usr/local/lib/python3.10/dist-packages/h11/__pycache__/_util.cpython-310.pyc
o
���g �
@ s� d dl mZmZmZmZmZmZmZmZ g d�Z G dd� de
�ZG dd� de�ZG dd� de�Z
dd
ee deded
edeeef f
dd�Zeddd�ZG dd� de�Zdeeeeeef defdd�ZdS )� )�Any�Dict�NoReturn�Pattern�Tuple�Type�TypeVar�Union)�
ProtocolError�LocalProtocolError�RemoteProtocolError�validate�bytesifyc @ s( e Zd ZdZd dededdfdd�ZdS )
r
aM Exception indicating a violation of the HTTP/1.1 protocol.
This as an abstract base class, with two concrete base classes:
:exc:`LocalProtocolError`, which indicates that you tried to do something
that HTTP/1.1 says is illegal, and :exc:`RemoteProtocolError`, which
indicates that the remote peer tried to do something that HTTP/1.1 says is
illegal. See :ref:`error-handling` for details.
In addition to the normal :exc:`Exception` features, it has one attribute:
.. attribute:: error_status_hint
This gives a suggestion as to what status code a server might use if
this error occurred as part of a request.
For a :exc:`RemoteProtocolError`, this is useful as a suggestion for
how you might want to respond to a misbehaving peer, if you're
implementing a server.
For a :exc:`LocalProtocolError`, this can be taken as a suggestion for
how your peer might have responded to *you* if h11 had allowed you to
continue.
The default is 400 Bad Request, a generic catch-all for protocol
violations.
� �msg�error_status_hint�returnNc C s* t | �tu r
td��t�| |� || _d S )Nz+tried to directly instantiate ProtocolError)�typer
� TypeError� Exception�__init__r )�selfr r � r �4/usr/local/lib/python3.10/dist-packages/h11/_util.pyr ) s
zProtocolError.__init__)r )�__name__�
__module__�__qualname__�__doc__�str�intr r r r r r
s r
c @ s e Zd Zdefdd�ZdS )r r c C s
t | _| ��N)r � __class__�r r r r �!_reraise_as_remote_protocol_error<