
    ,h                     |    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
y)    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y)r   returnNc                 >    t               | _        d| _        d| _        y Nr   )	bytearray_data_next_line_search_multiple_lines_searchselfs    T/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/h11/_receivebuffer.py__init__zReceiveBuffer.__init__0   s    [
!"&'#    	byteslikec                 0    | 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I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    TZZ  r   countc                 ^    | j                   d | }| j                   d |= d| _        d| _        |S r
   )r   r   r   r   r!   outs      r   _extractzReceiveBuffer._extractC   s7    jj% JJvv!"&'#
r   c                 H    | j                   d| }|sy| j                  |      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   s)     jj% }}U##r   c                     t        d| j                  dz
        }| j                  j                  d|      }|dk(  rt	        | j                        | _        y|dz   }| j                  |      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   sf    
 !D$:$:Q$>?jjoog/AB"%(_D" Ao}}S!!r   c                    | j                   dd dk(  r| j                  d       g S | j                   dd dk(  r| j                  d       g S t        j                  | j                   | j                        }|(t        dt        | j                         dz
        | _        y|j                  d      d   }| j                  |      }|j                  d      }|D ]  }|j                  d      s|d=  |d	   |d   cxk(  rd
k(  sJ  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   s   
 ::bq>U"MM!I::bq>W$MM!I !''

D4O4OP=*-aTZZ11D*ED' jjmBmmC 		%  	D}}U#H	 RyE"I,,,,,"#Jr   c                 F    	 | j                   d   dk  S # t        $ r Y y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'' 		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   /   s    (
%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 j jr   