
    Whj&                     \   d dl Z ddlmZ ddlmZ ddlmZmZmZ g dZ	 e j
         ej        d                    Z G d d	          Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )    N   )_headers)request_target)bytesifyLocalProtocolErrorvalidate)RequestInformationalResponseResponseDataEndOfMessageConnectionClosedasciic                   2    e Zd Zg Zi Zd Zd Zd Zd ZdZ	dS )_EventBundlec                 L   |                     dd          }t          | j                  }|D ]3}||vr-t          d                    || j        j                            4|                    | j                  }|D ]3}||vr-t          d                    || j        j                            4| j	        
                    | j                   | j	        
                    |           d| j	        v r t          j        | j        |          | _        |s{dD ]-}|| j	        v r"t          | j	        |                   | j	        |<   .d| j	        v rBt          | j        t"                    st%          d	          t#          | j                  | _        |                                  d S )
N_parsedFzunrecognized kwarg {} for {}z missing required kwarg {} for {}headers)r   )methodtargethttp_versionreasonstatus_codezstatus code must be integer)popset_fields	TypeErrorformat	__class____name__
difference	_defaults__dict__updater   normalize_and_validater   r   
isinstancer   intr   	_validate)selfkwargsr   allowedkwargrequiredfields          Q/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/h11/_events.py__init__z_EventBundle.__init__   s   **Y..dl## 	 	EG##299t~6    $ %%dn55 	 	EF""6==t~6    # 	T^,,,V$$$ %%#:g  DL  
	9G J JDM))+3DM%4H+I+IDM%(--!$"2C88 L,-JKKK $'t'7#8#8     c                     d S N r)   s    r/   r(   z_EventBundle._validateI   s    r1   c                       j         j        } fd j        D             }d                    |          }d                    ||          S )Nc                 R    g | ]#}d                      |j        |                   $S )z{}={})r   r#   ).0r.   r)   s     r/   
<listcomp>z)_EventBundle.__repr__.<locals>.<listcomp>N   s;     
 
 
<AGNN5$-"677
 
 
r1   z, z{}({}))r   r    r   joinr   )r)   name
kwarg_strs	kwarg_strs   `   r/   __repr__z_EventBundle.__repr__L   s^    ~&
 
 
 
EI\
 
 

 IIj))	tY///r1   c                 B    | j         |j         k    o| j        |j        k    S r3   )r   r#   )r)   others     r/   __eq__z_EventBundle.__eq__U   s    ~0TT]en5TTr1   N)
r    
__module____qualname__r   r"   r0   r(   r>   rA   __hash__r4   r1   r/   r   r      s_        GI( ( (T  0 0 0U U U HHHr1   r   c                   (    e Zd ZdZg dZddiZd ZdS )r	   an  The beginning of an HTTP request.

    Fields:

    .. attribute:: method

       An HTTP method, e.g. ``b"GET"`` or ``b"POST"``. Always a byte
       string. :term:`Bytes-like objects <bytes-like object>` and native
       strings containing only ascii characters will be automatically
       converted to byte strings.

    .. attribute:: target

       The target of an HTTP request, e.g. ``b"/index.html"``, or one of the
       more exotic formats described in `RFC 7320, section 5.3
       <https://tools.ietf.org/html/rfc7230#section-5.3>`_. Always a byte
       string. :term:`Bytes-like objects <bytes-like object>` and native
       strings containing only ascii characters will be automatically
       converted to byte strings.

    .. attribute:: headers

       Request headers, represented as a list of (name, value) pairs. See
       :ref:`the header normalization rules <headers-format>` for details.

    .. attribute:: http_version

       The HTTP protocol version, represented as a byte string like
       ``b"1.1"``. See :ref:`the HTTP version normalization rules
       <http_version-format>` for details.

    )r   r   r   r   r      1.1c                     d}| j         D ]\  }}|dk    r|dz  }| j        dk    r|dk    rt          d          |dk    rt          d          t          t          | j        d           d S )Nr   s   hostr   rF   zMissing mandatory Host: headerzFound multiple Host: headerszIllegal target characters)r   r   r   r   request_target_rer   )r)   
host_countr;   values       r/   r(   zRequest._validate   s     
< 	  	 KD%wa
&&:??$%EFFF>>$%CDDD"DK1LMMMMMr1   N)r    rB   rC   __doc__r   r"   r(   r4   r1   r/   r	   r	   \   sJ         B >==G(IN N N N Nr1   r	   c                        e Zd Zg dZdddZdS )_ResponseBase)r   r   r   r   rF   r1   )r   r   N)r    rB   rC   r   r"   r4   r1   r/   rM   rM      s&        BBBG!'377IIIr1   rM   c                       e Zd ZdZd ZdS )r
   a  An HTTP informational response.

    Fields:

    .. attribute:: status_code

       The status code of this response, as an integer. For an
       :class:`InformationalResponse`, this is always in the range [100,
       200).

    .. attribute:: headers

       Request headers, represented as a list of (name, value) pairs. See
       :ref:`the header normalization rules <headers-format>` for
       details.

    .. attribute:: http_version

       The HTTP protocol version, represented as a byte string like
       ``b"1.1"``. See :ref:`the HTTP version normalization rules
       <http_version-format>` for details.

    .. attribute:: reason

       The reason phrase of this response, as a byte string. For example:
       ``b"OK"``, or ``b"Not Found"``.

    c                 |    d| j         cxk    rdk     s)n t          d                    | j                             d S )Nd      zGInformationalResponse status_code should be in range [100, 200), not {}r   r   r   r5   s    r/   r(   zInformationalResponse._validate   sS    t'----#----$%%+VD,<%=%=   .-r1   Nr    rB   rC   rK   r(   r4   r1   r/   r
   r
      s-         :    r1   r
   c                       e Zd ZdZd ZdS )r   a  The beginning of an HTTP response.

    Fields:

    .. attribute:: status_code

       The status code of this response, as an integer. For an
       :class:`Response`, this is always in the range [200,
       600).

    .. attribute:: headers

       Request headers, represented as a list of (name, value) pairs. See
       :ref:`the header normalization rules <headers-format>` for details.

    .. attribute:: http_version

       The HTTP protocol version, represented as a byte string like
       ``b"1.1"``. See :ref:`the HTTP version normalization rules
       <http_version-format>` for details.

    .. attribute:: reason

       The reason phrase of this response, as a byte string. For example:
       ``b"OK"``, or ``b"Not Found"``.

    c                 |    d| j         cxk    rdk     s)n t          d                    | j                             d S )NrQ   iX  z:Response status_code should be in range [200, 600), not {}rR   r5   s    r/   r(   zResponse._validate   sW    t'----#----$LSS$    .-r1   NrS   r4   r1   r/   r   r      s-         8    r1   r   c                   $    e Zd ZdZg dZdddZdS )r   a  Part of an HTTP message body.

    Fields:

    .. attribute:: data

       A :term:`bytes-like object` containing part of a message body. Or, if
       using the ``combine=False`` argument to :meth:`Connection.send`, then
       any object that your socket writing code knows what to do with, and for
       which calling :func:`len` returns the number of bytes that will be
       written -- see :ref:`sendfile` for details.

    .. attribute:: chunk_start

       A marker that indicates whether this data object is from the start of a
       chunked transfer encoding chunk. This field is ignored when when a Data
       event is provided to :meth:`Connection.send`: it is only valid on
       events emitted from :meth:`Connection.next_event`. You probably
       shouldn't use this attribute at all; see
       :ref:`chunk-delimiters-are-bad` for details.

    .. attribute:: chunk_end

       A marker that indicates whether this data object is the last for a
       given chunked transfer encoding chunk. This field is ignored when when
       a Data event is provided to :meth:`Connection.send`: it is only valid
       on events emitted from :meth:`Connection.next_event`. You probably
       shouldn't use this attribute at all; see
       :ref:`chunk-delimiters-are-bad` for details.

    )datachunk_start	chunk_endF)rX   rY   Nr    rB   rC   rK   r   r"   r4   r1   r/   r   r      s3         @ 322G %E::IIIr1   r   c                        e Zd ZdZdgZdg iZdS )r   aj  The end of an HTTP message.

    Fields:

    .. attribute:: headers

       Default value: ``[]``

       Any trailing headers attached to this message, represented as a list of
       (name, value) pairs. See :ref:`the header normalization rules
       <headers-format>` for details.

       Must be empty unless ``Transfer-Encoding: chunked`` is in use.

    r   NrZ   r4   r1   r/   r   r     s*           kGBIIIr1   r   c                       e Zd ZdZdS )r   aA  This event indicates that the sender has closed their outgoing
    connection.

    Note that this does not necessarily mean that they can't *receive* further
    data, because TCP connections are composed to two one-way channels which
    can be closed independently. See :ref:`closing` for details.

    No fields.
    N)r    rB   rC   rK   r4   r1   r/   r   r   #  s          	Dr1   r   )re r   _abnfr   _utilr   r   r   __all__compileencoderH   r   r	   rM   r
   r   r   r   r   r4   r1   r/   <module>rd      s   
			       ! ! ! ! ! ! 9 9 9 9 9 9 9 9 9 9   BJ4~4W==>> > > > > > > > >B4N 4N 4N 4N 4Nl 4N 4N 4Nn8 8 8 8 8L 8 8 8
# # # # #M # # #L# # # # #} # # #L"; "; "; "; ";< "; "; ";T         <      *	 	 	 	 	| 	 	 	 	 	r1   