Format: application/x-python-code
⬇ Download File (3.7 KB)
   1  o
   2  
   3  .'h�
   4  @s�ddlmZmZmZmZmZmZmZmZgd�Z	Gdd�de
   5  �ZGdd�de�ZGdd�de�Z
   6  		dd
   7  eededed
   8  edeeeff
   9  dd�Zeddd�ZGdd�de�Zdeeeeeefdefdd�ZdS)�)�Any�Dict�NoReturn�Pattern�Tuple�Type�TypeVar�Union)�
  10  ProtocolError�LocalProtocolError�RemoteProtocolError�validate�bytesifyc@s(eZdZdZd	dededdfdd�ZdS)
  11  r
  12  aMException 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�returnNcCs*t|�tur
  39  td��t�||�||_dS)Nz+tried to directly instantiate ProtocolError)�typer
  40  �	TypeError�	Exception�__init__r)�selfrr�r�?C:\Users\shubh\Videos\agent\nova\Lib\site-packages\h11/_util.pyr)s
  41  zProtocolError.__init__)r)�__name__�
  42  __module__�__qualname__�__doc__�str�intrrrrrr
  43  sr
  44  c@seZdZdefdd�ZdS)rrcCs
  45  t|_|��N)r�	__class__�rrrr�!_reraise_as_remote_protocol_error<s
  46  z4LocalProtocolError._reraise_as_remote_protocol_errorN)rrrrr#rrrrr;src@seZdZdS)rN)rrrrrrrrPsr�malformed data�regex�datar�format_argsrcGs,|�|�}|s|r|j|�}t|��|��Sr )�	fullmatch�formatr�	groupdict)r%r&rr'�matchrrrr
  47  Ts
  48  
  49  r
  50  �_T_Sentinel�Sentinel)�boundcsXeZdZdeededeedfdeee	fde	def�fdd	�Z
  51  defd
  52  d�Z�ZS)r-�cls�name�bases.�	namespace�kwdsrcs2|tfksJ�t�j||||fi|��}||_|Sr )r-�super�__new__r!)r/r0r1r2r3�v�r!rrr5lszSentinel.__new__cCs|jSr )rr"rrr�__repr__xszSentinel.__repr__)
  53  rrrrr,rrrrrr5r8�
  54  __classcell__rrr7rr-ks��
  55  �
  56  ����scCs>t|�tur|St|t�r|�d�}t|t�rtd��t|�S)N�asciiz#expected bytes-like object, not int)r�bytes�
  57  isinstancer�encoderr)r:rrrrs
  58  
  59  
  60  rN)r$)�typingrrrrrrrr	�__all__rr
  61  rrr<rr
  62  r,rr-�	bytearray�
  63  memoryviewrrrrrr�<module>s((	/�����
  64  
  65  �$