
     f                     v    d dl Z d dlZd dlmZmZmZ dgZ e j        de j                  Z	 G d d          Z
dS )    N)ListOptionalUnionReceiveBuffers   
?
c                       e Zd ZddZdeeef         dd fdZdefdZ	de
fdZdefdZd	e
defd
Zd	e
dee         fdZdee         fdZdeee                  fdZdefdZdS )r   returnNc                 H    t                      | _        d| _        d| _        d S Nr   )	bytearray_data_next_line_search_multiple_lines_searchselfs    U/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/h11/_receivebuffer.py__init__zReceiveBuffer.__init__0   s#    [[
!"&'###    	byteslikec                 &    | xj         |z  c_         | S N)r   )r   r   s     r   __iadd__zReceiveBuffer.__iadd__5   s    

i

r   c                 :    t          t          |                     S r   )boollenr   s    r   __bool__zReceiveBuffer.__bool__9   s    CIIr   c                 *    t          | j                  S r   )r   r   r   s    r   __len__zReceiveBuffer.__len__<   s    4:r   c                 *    t          | j                  S r   )bytesr   r   s    r   	__bytes__zReceiveBuffer.__bytes__@   s    TZ   r   countc                 T    | j         d |         }| j         d |= d| _        d| _        |S r
   )r   r   r   r   r!   outs      r   _extractzReceiveBuffer._extractC   s5    j% Jvv!"&'#
r   c                 R    | j         d|         }|sdS |                     |          S )zB
        Extract a fixed number of bytes from the buffer.
        N)r   r%   r#   s      r   maybe_extract_at_mostz#ReceiveBuffer.maybe_extract_at_mostM   s3     j%  	4}}U###r   c                     t          d| j        dz
            }| j                            d|          }|dk    rt	          | j                  | _        dS |dz   }|                     |          S )zK
        Extract the first line, if it is completed in the buffer.
        r         
N   )maxr   r   findr   r%   )r   search_start_indexpartial_idxidxs       r   maybe_extract_next_linez%ReceiveBuffer.maybe_extract_next_lineW   so    
 !D$:Q$>??joog/ABB"%(__D"4 Ao}}S!!!r   c                 \   | j         dd         dk    r|                     d           g S | j         dd         dk    r|                     d           g S t                              | j         | j                  }|,t          dt          | j                   dz
            | _        dS |                    d          d         }|                     |          }|                    d          }|D ]}|	                    d          r|d= |d	         |d         cxk    rd
k    sn J |d	d= |S )z\
        Extract everything up to the first blank line, and return a list of lines.
        Nr)      
r,   r*   r   r+      r   )
r   r%   blank_line_regexsearchr   r-   r   spansplitendswith)r   matchr1   r$   lineslines         r   maybe_extract_linesz!ReceiveBuffer.maybe_extract_linesh   sA   
 :bqb>U""MM!I:bqb>W$$MM!I !''
D4OPP=*-aTZ11D*E*ED'4 jjmmBmmC  		%   	 	D}}U## HRyE"I,,,,,,,,,,"##Jr   c                 H    	 | j         d         dk     S # t          $ r Y dS w xY w)Nr   !   F)r   
IndexErrorr   s    r   +is_next_line_obviously_invalid_request_linez9ReceiveBuffer.is_next_line_obviously_invalid_request_line   s<    	 :a=4'' 	 	 	55	s    
!!)r   N)__name__
__module____qualname__r   r   r   r   r   r   r   intr   r    r%   r   r'   r2   r   r?   rC    r   r   r   r   /   sN       ( ( ( (
%y(8"9 o    $        !5 ! ! ! !c i    $3 $8I3F $ $ $ $"))< " " " "" Xd9o%>        VT      r   )resystypingr   r   r   __all__compile	MULTILINEr7   r   rH   r   r   <module>rO      s    				 



 ( ( ( ( ( ( ( ( ( (
N 2:j",77 j j j j j j j j j jr   