L i|ddlZddlZddlmZmZmZdgZejdejZ GddZ y)N)ListOptionalUnion ReceiveBuffers ? ceZdZddZdeeefddfdZdefdZ de fdZ defdZ d e defd Z d e deefd Zdeefd Zdeeefd ZdefdZy)rreturnNc>t|_d|_d|_yNr) bytearray_data_next_line_search_multiple_lines_searchselfs X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/h11/_receivebuffer.py__init__zReceiveBuffer.__init__0s[ !"&'# byteslikec0|xj|z c_|SN)r )rrs r__iadd__zReceiveBuffer.__iadd__5s i  rc*tt|Sr)boollenrs r__bool__zReceiveBuffer.__bool__9sCIrc,t|jSr)rr rs r__len__zReceiveBuffer.__len__<s4::rc,t|jSr)bytesr rs r __bytes__zReceiveBuffer.__bytes__@sTZZ  rcountc^|jd|}|jd|=d|_d|_|Sr )r r rrr!outs r_extractzReceiveBuffer._extractCs7jj%  JJvv !"&'# rcH|jd|}|sy|j|S)zB Extract a fixed number of bytes from the buffer. N)r r%r#s rmaybe_extract_at_mostz#ReceiveBuffer.maybe_extract_at_mostMs)jj% }}U##rctd|jdz }|jjd|}|dk(rt |j|_y|dz}|j |S)zK Extract the first line, if it is completed in the buffer. r N)maxr r findrr%)rsearch_start_index partial_idxidxs rmaybe_extract_next_linez%ReceiveBuffer.maybe_extract_next_lineWsf !D$:$:Q$>?jjoog/AB " %(_D "Ao}}S!!rc|jdddk(r|jdgS|jdddk(r|jdgStj|j|j}|(t dt |jdz |_y|jdd}|j|}|jd}|D]}|jds|d=|d |dcxk(rd k(sJJ|d d=|S) z\ Extract everything up to the first blank line, and return a list of lines. Nr) r,r*rr+ r) r r%blank_line_regexsearchrr-rspansplitendswith)rmatchr1r$lineslines rmaybe_extract_linesz!ReceiveBuffer.maybe_extract_lineshs ::bq>U " MM! I ::bq>W $ MM! I!'' D4O4OP =*-aTZZ11D*ED 'jjmBmmC  %  D}}U#H RyE"I,,,,,, "#J rcF |jddkS#t$rYywxYw)Nr!F)r IndexErrorrs r+is_next_line_obviously_invalid_request_linez9ReceiveBuffer.is_next_line_obviously_invalid_request_lines. ::a=4' '  s   )rN)__name__ __module__ __qualname__rrrr rrrintrr r%rr'r2rr?rCrrrr/s( %y(8"9o$!5!ci$3$8I3F$"))<"" Xd9o%> VTr) resystypingrrr__all__compile MULTILINEr7rrHrrrOs? ((  N2::j",,7jjr