← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/h11/__pycache__/_util.cpython-312.pyc

50 lines

�

c�bj�
���ddlmZmZmZmZmZmZmZmZgd�Z	Gd�de
�ZGd�de�ZGd�de�Z
	dd	eed
ededed
eeeff
d�Zedd��ZGd�de�Zdeeeeeefd
efd�Zy)�)�Any�Dict�NoReturn�Pattern�Tuple�Type�TypeVar�Union)�
ProtocolError�LocalProtocolError�RemoteProtocolError�validate�bytesifyc�&�eZdZdZddededdfd�Zy)raMException 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�v�t|�turtd��tj	||�||_y)Nz+tried to directly instantiate ProtocolError)�typer�	TypeError�	Exception�__init__r)�selfrrs   �`/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/h11/_util.pyrzProtocolError.__init__)s2����:��&��I�J�J����4��%�!2���)i�)�__name__�
__module__�__qualname__�__doc__�str�intr�rrrrs!���83�C�3�C�3�$�3rrc��eZdZdefd�Zy)rrc��t|_|��N)r
�	__class__�rs r�!_reraise_as_remote_protocol_errorz4LocalProtocolError._reraise_as_remote_protocol_error<s��-����
rN)rrrrr(r"rrrr;s���8�rrc��eZdZy)r
N)rrrr"rrr
r
Ps��rr
�regex�datar�format_argsrc��|j|�}|s|r|j|�}t|��|j�Sr%)�	fullmatch�formatr�	groupdict)r*r+rr,�matchs     rrrTs@��
�O�O�D�!�E����#�*�*�k�*�C� ��%�%��?�?��r�_T_Sentinel�Sentinel)�boundc�^��eZdZdeededeedfdeee	fde	def�fd�Z
defd	�Z�xZS)
r3�cls�name�bases.�	namespace�kwdsrc�T��|tfk(sJ�t�|�||||fi|��}||_|Sr%)r3�super�__new__r&)r6r7r8r9r:�vr&s      �rr=zSentinel.__new__ls:������#�#�#��G�O�C��u�i�@�4�@������rc��|jSr%)rr's r�__repr__zSentinel.__repr__xs���}�}�r)
rrrrr2r rrrrr=r@�
__classcell__)r&s@rr3r3ksb���
�
�+�
�
��
��T�3�Y��
���S��>�	
�
�
�
�
��#�r�sc��t|�tur|St|t�r|j	d�}t|t
�rt
d��t|�S)N�asciiz#expected bytes-like object, not int)r�bytes�
isinstancer �encoder!r)rBs rrrsJ���A�w�%�����!�S��
�H�H�W����!�S���=�>�>���8�OrN)zmalformed data)�typingrrrrrrr	r
�__all__rrrr
rEr rr2rr3�	bytearray�
memoryviewr!rr"rr�<module>rLs���L�L�L���!3�I�!3�^���*	�-�	�
4D���5�>��!&��-0��SV��	�#�u�*���(�m�:�6���t��(��e�Y�
�C��<�=��%�r