HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/h11/__pycache__/_util.cpython-310.pyc
o

���g�
@s�ddlmZmZmZmZmZmZmZmZgd�Z	Gdd�de
�ZGdd�de�ZGdd�de�Z
		dd
eededed
edeeeff
dd�Zeddd�ZGdd�de�Zdeeeeeefdefdd�ZdS)�)�Any�Dict�NoReturn�Pattern�Tuple�Type�TypeVar�Union)�
ProtocolError�LocalProtocolError�RemoteProtocolError�validate�bytesifyc@s(eZdZdZd	dededdfdd�ZdS)
r
aMException 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�returnNcCs*t|�tur
td��t�||�||_dS)Nz+tried to directly instantiate ProtocolError)�typer
�	TypeError�	Exception�__init__r)�selfrr�r�4/usr/local/lib/python3.10/dist-packages/h11/_util.pyr)s
zProtocolError.__init__)r)�__name__�
__module__�__qualname__�__doc__�str�intrrrrrr
sr
c@seZdZdefdd�ZdS)rrcCs
t|_|��N)r�	__class__�rrrr�!_reraise_as_remote_protocol_error<s
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
Ts

r
�_T_Sentinel�Sentinel)�boundcsXeZdZdeededeedfdeee	fde	def�fdd	�Z
defd
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__)
rrrrr,rrrrrr5r8�
__classcell__rrr7rr-ks��
�
����scCs>t|�tur|St|t�r|�d�}t|t�rtd��t|�S)N�asciiz#expected bytes-like object, not int)r�bytes�
isinstancer�encoderr)r:rrrrs


rN)r$)�typingrrrrrrrr	�__all__rr
rrr<rr
r,rr-�	bytearray�
memoryviewrrrrrr�<module>s((	/�����

�$