Format: application/x-python-code
1 o
2
3 .'h �
4 @ s� d dl mZmZmZmZmZmZmZmZ g d�Z G dd� de
5 �ZG dd� de�ZG dd� de�Z
6 dd
7 ee deded
8 edeeef f
9 dd�Zeddd�ZG dd� de�Zdeeeeeef defdd�ZdS )� )�Any�Dict�NoReturn�Pattern�Tuple�Type�TypeVar�Union)�
10 ProtocolError�LocalProtocolError�RemoteProtocolError�validate�bytesifyc @ s( e Zd ZdZd dededdfdd�ZdS )
11 r
12 aM Exception indicating a violation of the HTTP/1.1 protocol.
13
14 This as an abstract base class, with two concrete base classes:
15 :exc:`LocalProtocolError`, which indicates that you tried to do something
16 that HTTP/1.1 says is illegal, and :exc:`RemoteProtocolError`, which
17 indicates that the remote peer tried to do something that HTTP/1.1 says is
18 illegal. See :ref:`error-handling` for details.
19
20 In addition to the normal :exc:`Exception` features, it has one attribute:
21
22 .. attribute:: error_status_hint
23
24 This gives a suggestion as to what status code a server might use if
25 this error occurred as part of a request.
26
27 For a :exc:`RemoteProtocolError`, this is useful as a suggestion for
28 how you might want to respond to a misbehaving peer, if you're
29 implementing a server.
30
31 For a :exc:`LocalProtocolError`, this can be taken as a suggestion for
32 how your peer might have responded to *you* if h11 had allowed you to
33 continue.
34
35 The default is 400 Bad Request, a generic catch-all for protocol
36 violations.
37
38 � �msg�error_status_hint�returnNc C s* t | �tu r
39 td��t�| |� || _d S )Nz+tried to directly instantiate ProtocolError)�typer
40 � TypeError� Exception�__init__r )�selfr r � r �?C:\Users\shubh\Videos\agent\nova\Lib\site-packages\h11/_util.pyr ) s
41 zProtocolError.__init__)r )�__name__�
42 __module__�__qualname__�__doc__�str�intr r r r r r
43 s r
44 c @ s e Zd Zdefdd�ZdS )r r c C s
45 t | _| ��N)r � __class__�r r r r �!_reraise_as_remote_protocol_error<