o
    '=j¼  ã                   @  s  d Z ddlmZ ddlmZ G dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZ	G dd„ deƒZ
G dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deeƒZG dd„ deƒZG dd„ deƒZG dd „ d eƒZG d!d"„ d"eƒZd#S )$z@
h2/exceptions
~~~~~~~~~~~~~

Exceptions for the HTTP/2 module.
é    )Úannotationsé   )Ú
ErrorCodesc                   @  ó   e Zd ZdZdS )ÚH2ErrorzB
    The base class for all exceptions for the HTTP/2 module.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   úWC:\Users\psant\Downloads\Anu Raj Backend\school\venv\Lib\site-packages\h2/exceptions.pyr      ó    r   c                   @  ó   e Zd ZdZejZdS )ÚProtocolErrorzF
    An action was attempted in violation of the HTTP/2 protocol.
    N)r   r	   r
   r   r   ZPROTOCOL_ERRORÚ
error_coder   r   r   r   r      ó    
r   c                   @  r   )ÚFrameTooLargeErrorzL
    The frame that we tried to send or that we received was too large.
    N©r   r	   r
   r   r   ZFRAME_SIZE_ERRORr   r   r   r   r   r      r   r   c                   @  r   )ÚFrameDataMissingErrorzW
    The frame that we received is missing some data.

    .. versionadded:: 2.0.0
    Nr   r   r   r   r   r   $   s    
r   c                   @  r   )ÚTooManyStreamsErrorzb
    An attempt was made to open a stream that would lead to too many concurrent
    streams.
    Nr   r   r   r   r   r   /   r   r   c                   @  r   )ÚFlowControlErrorz@
    An attempted action violates flow control constraints.
    N)r   r	   r
   r   r   ZFLOW_CONTROL_ERRORr   r   r   r   r   r   7   r   r   c                   @  ó$   e Zd ZdZddd„Zdd
d„ZdS )ÚStreamIDTooLowErrorz„
    An attempt was made to open a stream that had an ID that is lower than the
    highest ID we have seen on this connection.
    Ú	stream_idÚintÚmax_stream_idÚreturnÚNonec                 C  ó   || _ || _d S ©N©r   r   )Úselfr   r   r   r   r   Ú__init__F   s   
zStreamIDTooLowError.__init__Ústrc                 C  ó   d| j › d| j› �S )NzStreamIDTooLowError: z is lower than r!   ©r"   r   r   r   Ú__str__M   ó   zStreamIDTooLowError.__str__N)r   r   r   r   r   r   ©r   r$   ©r   r	   r
   r   r#   r'   r   r   r   r   r   @   s    
r   c                   @  r   )ÚNoAvailableStreamIDErrorzˆ
    There are no available stream IDs left to the connection. All stream IDs
    have been exhausted.

    .. versionadded:: 2.0.0
    Nr   r   r   r   r   r+   Q   r   r+   c                   @  ó   e Zd ZdZd	dd„ZdS )
ÚNoSuchStreamErrorzÂ
    A stream-specific action referenced a stream that does not exist.

    .. versionchanged:: 2.0.0
       Became a subclass of :class:`ProtocolError
       <h2.exceptions.ProtocolError>`
    r   r   r   r   c                 C  s
   || _ d S r    )r   ©r"   r   r   r   r   r#   d   s   
zNoSuchStreamError.__init__N©r   r   r   r   ©r   r	   r
   r   r#   r   r   r   r   r-   [   s    r-   c                   @  r,   )
ÚStreamClosedErrorzÙ
    A more specific form of
    :class:`NoSuchStreamError <h2.exceptions.NoSuchStreamError>`. Indicates
    that the stream has since been closed, and that all state relating to that
    stream has been removed.
    r   r   r   r   c                 C  s   || _ tj| _g | _d S r    )r   r   ZSTREAM_CLOSEDr   Z_eventsr.   r   r   r   r#   q   s   
zStreamClosedError.__init__Nr/   r0   r   r   r   r   r1   i   s    r1   c                      s"   e Zd ZdZd
‡ fdd	„Z‡  ZS )ÚInvalidSettingsValueErrorz\
    An attempt was made to set an invalid Settings value.

    .. versionadded:: 2.0.0
    Úmsgr$   r   r   r   r   c                   s   t ƒ  |¡ || _d S r    )Úsuperr#   r   )r"   r3   r   ©Ú	__class__r   r   r#   „   s   
z"InvalidSettingsValueError.__init__)r3   r$   r   r   r   r   )r   r	   r
   r   r#   Ú__classcell__r   r   r5   r   r2   }   s    r2   c                   @  r   )ÚInvalidBodyLengthErrorz{
    The remote peer sent more or less data that the Content-Length header
    indicated.

    .. versionadded:: 2.0.0
    Úexpectedr   Úactualr   r   c                 C  r   r    ©Zexpected_lengthZactual_length)r"   r9   r:   r   r   r   r#   ‘   s   
zInvalidBodyLengthError.__init__r$   c                 C  r%   )Nz!InvalidBodyLengthError: Expected z bytes, received r;   r&   r   r   r   r'   •   r(   zInvalidBodyLengthError.__str__N)r9   r   r:   r   r   r   r)   r*   r   r   r   r   r8   ‰   s    
r8   c                   @  r   )ÚUnsupportedFrameErrorz¸
    The remote peer sent a frame that is unsupported in this context.

    .. versionadded:: 2.1.0

    .. versionchanged:: 4.0.0
       Removed deprecated KeyError parent class.
    Nr   r   r   r   r   r<   ™   r   r<   c                   @  r   )ÚRFC1122Errora—  
    Emitted when users attempt to do something that is literally allowed by the
    relevant RFC, but is sufficiently ill-defined that it's unwise to allow
    users to actually do it.

    While there is some disagreement about whether or not we should be liberal
    in what accept, it is a truth universally acknowledged that we should be
    conservative in what emit.

    .. versionadded:: 2.4.0
    Nr   r   r   r   r   r=   ¥   r   r=   c                   @  r   )ÚDenialOfServiceErrora@  
    Emitted when the remote peer exhibits a behaviour that is likely to be an
    attempt to perform a Denial of Service attack on the implementation. This
    is a form of ProtocolError that carries a different error code, and allows
    more easy detection of this kind of behaviour.

    .. versionadded:: 2.5.0
    N)r   r	   r
   r   r   ZENHANCE_YOUR_CALMr   r   r   r   r   r>   ¶   s    
r>   N)r   Ú
__future__r   Úerrorsr   Ú	Exceptionr   r   r   r   r   r   r   r+   r-   r1   Ú
ValueErrorr2   r8   r<   r=   r>   r   r   r   r   Ú<module>   s$    			
