ó
    †>iý  ã                   ó”   • S r SSKrSSKrSSKJr  SSKJr  S r " S S\	5      r
 " S	 S
\	5      rS r " S S\5      r " S S\5      rg)zŽ

requests_toolbelt.multipart.decoder
===================================

This holds all the implementation details of the MultipartDecoder

é    Né   ©Úencode_with)ÚCaseInsensitiveDictc                 óN   • U R                  U5      nU S U X[        U5      -   S  4$ ©N)ÚfindÚlen)ÚcontentÚboundÚpoints      Ú`/home/mande/repo/quber/.venv/lib/python3.13/site-packages/requests_toolbelt/multipart/decoder.pyÚ_split_on_findr      s0   € Ø�L‰L˜Ó€EØ�6�Eˆ?˜G¬C°«JÑ$6Ð$7Ð8Ð8Ð8ó    c                   ó   • \ rS rSrSrg)Ú ImproperBodyPartContentExceptioné   © N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   r   r   r   r      ó   † Úr   r   c                   ó   • \ rS rSrSrg)Ú NonMultipartContentTypeExceptioné   r   Nr   r   r   r   r   r      r   r   r   c                 óæ   ^• [         R                  S   nUS:X  a  U R                  T5      n [        R                  R                  5       R                  U 5      R                  5       nU4S jU 5       $ )Nr   é   c              3   óX   >#   • U  H  u  p[        UT5      [        UT5      4v •  M!     g 7fr   r   )Ú.0ÚkÚvÚencodings      €r   Ú	<genexpr>Ú!_header_parser.<locals>.<genexpr>#   s-   øé € ð â‰DˆAô 
�Q˜Ó	!¤;¨q°(Ó#;Õ<Úùs   ƒ'*)ÚsysÚversion_infoÚdecodeÚemailÚparserÚHeaderParserÚparsestrÚitems)Ústringr%   ÚmajorÚheaderss    `  r   Ú_header_parserr3      s`   ø€ Ü×Ñ˜QÑ€EØ�ƒzØ—‘˜xÓ(ˆÜ�l‰l×'Ñ'Ó)×2Ñ2°6Ó:×@Ñ@ÓB€Gôáóð r   c                   ó.   • \ rS rSrSrS r\S 5       rSrg)ÚBodyParté)   a„  

The ``BodyPart`` object is a ``Response``-like interface to an individual
subpart of a multipart response. It is expected that these will
generally be created by objects of the ``MultipartDecoder`` class.

Like ``Response``, there is a ``CaseInsensitiveDict`` object named headers,
``content`` to access bytes, ``text`` to access unicode, and ``encoding``
to access the unicode codec.

c                 ó¾   • X l         0 nSU;   a4  [        US5      u  o@l        US:w  a  [        UR	                  5       U5      nO[        S5      e[        U5      U l        g )Ns   

r   z$content does not contain CR-LF-CR-LF)r%   r   r   r3   Úlstripr   r   r2   )Úselfr   r%   r2   Úfirsts        r   Ú__init__ÚBodyPart.__init__6   s]   € Ø ŒØˆà˜'Ó!Ü"0°¸+Ó"FÑˆE”<Ø˜‹|Ü(¨¯©«¸ÓB�øä2Ø6óð ô +¨7Ó3ˆ�r   c                 óL   • U R                   R                  U R                  5      $ )z'Content of the ``BodyPart`` in unicode.)r   r*   r%   )r9   s    r   ÚtextÚBodyPart.textD   s   € ð �|‰|×"Ñ" 4§=¡=Ó1Ð1r   )r   r%   r2   N)	r   r   r   r   Ú__doc__r;   Úpropertyr>   r   r   r   r   r5   r5   )   s    † ñ
ò4ð ñ2ó ó2r   r5   c                   óR   • \ rS rSrSrS
S jrS r\S 5       rS r	\
S
S j5       rSrg	)ÚMultipartDecoderéJ   a"  

The ``MultipartDecoder`` object parses the multipart payload of
a bytestring into a tuple of ``Response``-like ``BodyPart`` objects.

The basic usage is::

    import requests
    from requests_toolbelt import MultipartDecoder

    response = requests.get(url)
    decoder = MultipartDecoder.from_response(response)
    for part in decoder.parts:
        print(part.headers['content-type'])

If the multipart content is not from a response, basic usage is::

    from requests_toolbelt import MultipartDecoder

    decoder = MultipartDecoder(content, content_type)
    for part in decoder.parts:
        print(part.headers['content-type'])

For both these usages, there is an optional ``encoding`` parameter. This is
a string, which is the name of the unicode codec to use (default is
``'utf-8'``).

c                 ó|   • X l         X0l        [        5       U l        U R	                  5         U R                  U5        g r   )Úcontent_typer%   ÚtupleÚpartsÚ_find_boundaryÚ_parse_body)r9   r   rF   r%   s       r   r;   ÚMultipartDecoder.__init__g   s0   € à(Ôà Œä“WˆŒ
Ø×ÑÔØ×Ñ˜Õ!r   c                 ó˜  • [        S U R                  R                  S5       5       5      nUS   nUR                  S5      S   R                  5       S:w  a  [	        SR                  U5      5      eUSS   HQ  n[        US5      u  pEUR                  5       S	:X  d  M'  [        UR                  S
5      U R                  5      U l
        MS     g )Nc              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr   )Ústrip)r"   Úxs     r   r&   Ú2MultipartDecoder._find_boundary.<locals>.<genexpr>r   s   é € ÐHÒ+G aŸ™Ÿ	˜	Ò+Gùs   ‚Ú;r   Ú/Ú	multipartz)Unexpected mimetype in content-type: '{}'r   Ú=ÚboundaryÚ")rG   rF   ÚsplitÚlowerr   Úformatr   r   rN   r%   rU   )r9   Úct_infoÚmimetypeÚitemÚattrÚvalues         r   rI   ÚMultipartDecoder._find_boundaryq   sµ   € ÜÑH¨4×+<Ñ+<×+BÑ+BÀ3Ô+GÓHÓHˆØ˜1‘:ˆØ�>‰>˜#Ó˜qÑ!×'Ñ'Ó)¨[Ó8Ü2Ø;×BÑBÀ8ÓLóð ð ˜A˜B“KˆDÜ(ØØó‰KˆDð �z‰z‹|˜zÕ)Ü +¨E¯K©K¸Ó,<¸d¿m¹mÓ L�–ò  r   c                 ó4   • [        U5      nXS U :X  a  XS  $ U $ r   )r
   )ÚpartÚboundary_markerÚbm_lens      r   Ú_fix_first_partÚ MultipartDecoder._fix_first_part€   s'   € ä�_Ó%ˆØ 7 F˜mÓ+Ø˜�=Ð àˆKr   c                 óÔ   ^ ^^^• SR                  ST R                  45      mUU 4S jmS mUR                  SR                  ST45      5      n[        UU4S jU 5       5      T l        g )Nr   ó   --c                 ó\   >• [         R                  U T5      n[        UTR                  5      $ r   )rC   rd   r5   r%   )ra   ÚfixedrU   r9   s     €€r   Ú	body_partÚ/MultipartDecoder._parse_body.<locals>.body_part‹   s&   ø€ Ü$×4Ñ4°T¸8ÓDˆEÜ˜E 4§=¡=Ó1Ð1r   c                 óZ   • U S:g  =(       a     U S:g  =(       a    U S S S:g  =(       a    U S:g  $ )Nr   ó   
é   s   --
rg   r   )ra   s    r   Ú	test_partÚ/MultipartDecoder._parse_body.<locals>.test_part�   s;   € Ø˜C‘K÷ "Ø˜G‘O÷"à˜˜!�H 	Ñ)÷"ð ˜E‘Mð#r   rm   c              3   óR   >#   • U  H  nT" U5      (       d  M  T" U5      v •  M     g 7fr   r   )r"   rO   rj   ro   s     €€r   r&   Ú/MultipartDecoder._parse_body.<locals>.<genexpr>–   s   øé € ÐG²¨A¹)ÀA¿,›<™9 QŸ<˜<²ùs   ƒ'˜')ÚjoinrU   rW   rG   rH   )r9   r   rH   rj   rU   ro   s   `  @@@r   rJ   ÚMultipartDecoder._parse_bodyˆ   sT   û€ Ø—8‘8˜U D§M¡MÐ2Ó3ˆö	2ò	#ð —‘˜cŸh™h¨°Ð':Ó;Ó<ˆÜÕG±ÓGÓGˆ�
r   c                 ód   • UR                   nUR                  R                  SS 5      nU " X4U5      $ )Nzcontent-type)r   r2   Úget)ÚclsÚresponser%   r   rF   s        r   Úfrom_responseÚMultipartDecoder.from_response˜   s2   € à×"Ñ"ˆØ×'Ñ'×+Ñ+¨N¸DÓAˆÙ�7¨(Ó3Ð3r   )rU   rF   r%   rH   N)zutf-8)r   r   r   r   r@   r;   rI   Ústaticmethodrd   rJ   Úclassmethodry   r   r   r   r   rC   rC   J   s@   † ñô8"òMð ñó ðòHð  ó4ó ó4r   rC   )r@   r(   Úemail.parserr+   Úencoderr   Úrequests.structuresr   r   Ú	Exceptionr   r   r3   Úobjectr5   rC   r   r   r   Ú<module>r‚      sU   ðñó Û Ý  Ý 3ò9ô
	 yô 	ô	 yô 	òô2ˆvô 2ôBR4�võ R4r   