
    h                         S SK JrJrJrJrJrJrJrJr  / SQr	 " S S\
5      r " S S\5      r " S S\5      r SS	\\   S
\S\S\S\\\4   4
S jjr\" SSS9r " S S\5      rS\\\\\\4   S\4S jrg)    )AnyDictNoReturnPatternTupleTypeTypeVarUnion)ProtocolErrorLocalProtocolErrorRemoteProtocolErrorvalidatebytesifyc                   2    \ rS rSrSrS	S\S\SS4S jjrSrg)
r      a  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                 t    [        U 5      [        L a  [        S5      e[        R	                  X5        X l        g )Nz+tried to directly instantiate ProtocolError)typer   	TypeError	Exception__init__r   )selfr   r   s      ;/var/www/html/env/lib/python3.13/site-packages/h11/_util.pyr   ProtocolError.__init__)   s.    :&IJJ4%!2    )r   )i  )	__name__
__module____qualname____firstlineno____doc__strintr   __static_attributes__ r   r   r   r      s&    83C 3C 3$ 3 3r   r   c                   "    \ rS rSrS\4S jrSrg)r   ;   r   c                     [         U l        U eN)r   	__class__r   s    r   !_reraise_as_remote_protocol_error4LocalProtocolError._reraise_as_remote_protocol_error<   s     - 
r   r+   N)r   r   r    r!   r   r-   r%   r&   r   r   r   r   ;   s    8 r   r   c                       \ rS rSrSrg)r   P   r&   N)r   r   r    r!   r%   r&   r   r   r   r   P   s    r   r   regexdatar   format_argsr   c                     U R                  U5      nU(       d!  U(       a  UR                  " U6 n[        U5      eUR                  5       $ r*   )	fullmatchformatr   	groupdict)r2   r3   r   r4   matchs        r   r   r   T   s>     OOD!E**k*C %%??r   _T_SentinelSentinel)boundc                   l   ^  \ rS rSrS\\   S\S\\S4   S\	\\
4   S\
S\4U 4S	 jjrS\4S
 jrSrU =r$ )r;   k   clsnamebases.	namespacekwdsr   c                 R   > U[         4:X  d   e[        TU ]  " XX#40 UD6nXUl        U$ r*   )r;   super__new__r+   )r?   r@   rA   rB   rC   vr+   s         r   rF   Sentinel.__new__l   s4     ###GOCu@4@r   c                     U R                   $ r*   )r   r,   s    r   __repr__Sentinel.__repr__x   s    }}r   r&   )r   r   r    r!   r   r:   r#   r   r   r   r   rF   rJ   r%   __classcell__r/   s   @r   r;   r;   k   sg    
+

 T3Y
 S>	

 
 

#  r   sc                     [        U 5      [        L a  U $ [        U [        5      (       a  U R	                  S5      n [        U [
        5      (       a  [        S5      e[        U 5      $ )Nasciiz#expected bytes-like object, not int)r   bytes
isinstancer#   encoder$   r   )rM   s    r   r   r      sP    Aw%!SHHW!S=>>8Or   N)zmalformed data)typingr   r   r   r   r   r   r	   r
   __all__r   r   r   r   rP   r#   r   r:   r   r;   	bytearray
memoryviewr$   r   r&   r   r   <module>rW      s    L L L!3I !3^ *	- 	
 4D5>!&-0SV	#u*( m:6t (eY
C<= % r   