a êöøc„ã@sJddlZddlZddlmZmZmZdgZe dej¡Z Gdd„dƒZ dS)éN)ÚListÚOptionalÚUnionÚ ReceiveBuffers ? c@s¶eZdZddœdd„Zeeefddœdd„Zedœdd „Z e dœd d „Z edœd d „Z e edœdd„Z e eedœdd„Zeedœdd„Zeeedœdd„Zedœdd„ZdS)rN)ÚreturncCstƒ|_d|_d|_dS©Nr)Ú bytearrayÚ_dataÚ_next_line_searchÚ_multiple_lines_search©Úself©rú_/workspaces/shunt/resources/test-fastapi/venv/lib/python3.9/site-packages/h11/_receivebuffer.pyÚ__init__0szReceiveBuffer.__init__)Ú byteslikercCs|j|7_|S©N)r )r rrrrÚ__iadd__5szReceiveBuffer.__iadd__cCs tt|ƒƒSr)ÚboolÚlenr rrrÚ__bool__9szReceiveBuffer.__bool__cCs t|jƒSr)rr r rrrÚ__len__<szReceiveBuffer.__len__cCs t|jƒSr)Úbytesr r rrrÚ __bytes__@szReceiveBuffer.__bytes__)ÚcountrcCs*|jd|…}|jd|…=d|_d|_|Sr)r r r ©r rÚoutrrrÚ_extractCs  zReceiveBuffer._extractcCs |jd|…}|sdS| |¡S)zB Extract a fixed number of bytes from the buffer. N)r rrrrrÚmaybe_extract_at_mostMsz#ReceiveBuffer.maybe_extract_at_mostcCsHtd|jdƒ}|j d|¡}|dkr6t|jƒ|_dS|d}| |¡S)zK Extract the first line, if it is completed in the buffer. réó éÿÿÿÿNé)Úmaxr r Úfindrr)r Zsearch_start_indexZ partial_idxÚidxrrrÚmaybe_extract_next_lineWs z%ReceiveBuffer.maybe_extract_next_linecCsÞ|jdd…dkr | d¡gS|jdd…dkr@| d¡gSt |j|j¡}|durrtdt|jƒdƒ|_dS| d¡d}| |¡}| d¡}|D]}|  d¡r˜|d=q˜|d |dkrÊd ksÐnJ‚|d d…=|S) z\ Extract everything up to the first blank line, and return a list of lines. Nró r"r rr!ó éþÿÿÿó) r rÚblank_line_regexÚsearchr r#rÚspanÚsplitÚendswith)r Úmatchr%rÚlinesÚlinerrrÚmaybe_extract_lineshs&     " z!ReceiveBuffer.maybe_extract_linescCs*z|jddkWSty$YdS0dS)Nré!F)r Ú IndexErrorr rrrÚ+is_next_line_obviously_invalid_request_line“s z9ReceiveBuffer.is_next_line_obviously_invalid_request_line)Ú__name__Ú __module__Ú __qualname__rrrrrrrÚintrrrrrr&rr3r6rrrrr/s  +) ÚreÚsysÚtypingrrrÚ__all__ÚcompileÚ MULTILINEr+rrrrrÚs '