ó
    &ÝNj/6 ã                  óÚ  • % S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
r
Jr  S SKJr  S SKJrJr  SSKJrJr  SS	KJrJrJrJr  \(       a\  S S
KJr  S SKJrJrJrJrJr   " S S\5      r  " S S\SS9r! " S S\SS9r" " S S\SS9r# " S S\SS9r$ " S S\$5      r%\S   r&S\'S'   \(" 5       r) " S S\5      r* " S S \5      r+Sr,S!r-S"r.S#r/S$r0S%r1S&r2S'r3S(r4S)r5S r6S*r7\8" \75      r9S+r: S,r; S-r< S@S. jr=SAS/ jr> " S0 S15      r? " S2 S35      r@ " S4 S55      rA " S6 S7\A5      rB " S8 S9\A5      rC " S: S;\A5      rD " S< S=5      rE0 4         SBS> jjrF SC           SDS? jjrGg)Eé    )ÚannotationsN)ÚIntEnum)ÚBufferedRandomÚBytesIO)ÚNumber)ÚTYPE_CHECKINGÚcasté   )ÚBase64DecoderÚQuotedPrintableDecoder)Ú	FileErrorÚFormParserErrorÚMultipartParseErrorÚQuerystringParseError)ÚCallable)ÚAnyÚLiteralÚProtocolÚ	TypeAliasÚ	TypedDictc                  ó   • \ rS rSrSS jrSrg)ÚSupportsReadé   c                ó   • g ©N© )ÚselfÚ_SupportsRead__ns     ÚW/home/mande/repo/quber/.venv/lib/python3.13/site-packages/python_multipart/multipart.pyÚreadÚSupportsRead.read   s   € ¨3ó    r   N)r   ÚintÚreturnÚbytes)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r    Ú__static_attributes__r   r"   r   r   r      s   † ß.r"   r   c                  óH   • \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S'   S	rg
)ÚQuerystringCallbacksé   úCallable[[], None]Úon_field_startú!Callable[[bytes, int, int], None]Úon_field_nameÚon_field_dataÚon_field_endÚon_endr   N©r&   r'   r(   r)   Ú__annotations__r*   r   r"   r   r,   r,      s    ‡ Ø*Ó*Ø8Ó8Ø8Ó8Ø(Ó(Ø"Ö"r"   r,   F)Útotalc                  ó4   • \ rS rSr% S\S'   S\S'   S\S'   Srg)	ÚOctetStreamCallbacksé   r.   Úon_startr0   Úon_datar4   r   Nr5   r   r"   r   r9   r9      s   ‡ Ø$Ó$Ø2Ó2Ø"Ö"r"   r9   c                  óp   • \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S'   S\S	'   S\S
'   S\S'   S\S'   Srg)ÚMultipartCallbacksé#   r.   Úon_part_beginr0   Úon_part_dataÚon_part_endÚon_header_beginÚon_header_fieldÚon_header_valueÚon_header_endÚon_headers_finishedr4   r   Nr5   r   r"   r   r>   r>   #   s8   ‡ Ø)Ó)Ø7Ó7Ø'Ó'Ø+Ó+Ø:Ó:Ø:Ó:Ø)Ó)Ø/Ó/Ø"Ö"r"   r>   c                  óH   • \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S	'   S
rg)Ú
FileConfigé.   ústr | bytes | NoneÚ
UPLOAD_DIRÚboolÚUPLOAD_DELETE_TMPÚUPLOAD_KEEP_FILENAMEÚUPLOAD_KEEP_EXTENSIONSr#   ÚMAX_MEMORY_FILE_SIZEr   Nr5   r   r"   r   rI   rI   .   s    ‡ Ø&Ó&ØÓØ"Ó"Ø $Ó$Ø!Ö!r"   rI   c                  ó>   • \ rS rSr% S\S'   S\S'   S\S'   S\S'   S	rg
)ÚFormParserConfigé5   rM   ÚUPLOAD_ERROR_ON_BAD_CTEÚfloatÚMAX_BODY_SIZEr#   ÚMAX_HEADER_COUNTÚMAX_HEADER_SIZEr   Nr5   r   r"   r   rS   rS   5   s   ‡ Ø!%Ó%ØÓØÓØÖr"   rS   )ÚstartÚdataÚendÚfield_startÚ
field_nameÚ
field_dataÚ	field_endÚ
part_beginÚ	part_dataÚpart_endÚheader_beginÚheader_fieldÚheader_valueÚ
header_endÚheaders_finishedr   ÚCallbackNamec                  ó$   • \ rS rSrSrSrSrSrSrg)ÚQuerystringStateéQ   z˜Querystring parser states.

These are used to keep track of the state of the parser, and are used to determine
what to do when new data is encountered.
r   r
   é   r   N)	r&   r'   r(   r)   Ú__doc__ÚBEFORE_FIELDÚ
FIELD_NAMEÚ
FIELD_DATAr*   r   r"   r   rk   rk   Q   s   † ñð €LØ€JØƒJr"   rk   c                  óL   • \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrg)ÚMultipartStateé]   z–Multipart parser states.

These are used to keep track of the state of the parser, and are used to determine
what to do when new data is encountered.
r   r
   rm   é   é   é   é   é   é   é	   é
   é   é   r   N)r&   r'   r(   r)   rn   ÚSTARTÚSTART_BOUNDARYÚHEADER_FIELD_STARTÚHEADER_FIELDÚHEADER_VALUE_STARTÚHEADER_VALUEÚHEADER_VALUE_ALMOST_DONEÚHEADERS_ALMOST_DONEÚPART_DATA_STARTÚ	PART_DATAÚPART_DATA_ENDÚEND_BOUNDARYÚENDr*   r   r"   r   rs   rs   ]   sN   † ñð €EØ€NØÐØ€LØÐØ€LØ ÐØÐØ€OØ€IØ€MØ€LØ
ƒCr"   rs   rm   é   r|   é:   é    é-   é&   éa   éz   sM   ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'*+-.^_`|~rz   i€  é   c                ód  • SU -   n / nSnU R                  SU5      U:X  Ga  US-  nU R                  SU5      nUSpTUS:”  aN  XPR                  SXC5      U R                  SXC5      -
  -  nUS-  S:X  a  OX@R                  SUS-   5      pCUS:”  a  MN  US:  a  [        U 5      nU R                  SX#5      nUS:X  a  XU nO9XU R                  5       R	                  5       S-   XS-   U R                  5       -   nUR                  UR                  5       5        UnU R                  SU5      U:X  a  GM  U$ )	NÚ;r   r
   Ú"ú\"rm   Ú=éÿÿÿÿ)ÚfindÚcountÚlenÚrstripÚlowerÚlstripÚappendÚstrip)ÚsÚplistrZ   r\   ÚindÚdiffÚiÚfs           r   Ú_parseparamr¨   Ÿ   s:  € ð
 	ˆa‰€AØ€EØ€EØ
�&‰&��eÓ
 Ô
%Ø�‰
ˆØ�f‰f�S˜%Ó ˆØ˜1ˆTØ�A‹gØ—G‘G˜C Ó*¨Q¯W©W°U¸CÓ-EÑEÑEˆDØ�a‰x˜1‹}ØØŸF™F 3¨¨a©Ó0�ð	 �A�gð
 �‹7Ü�a“&ˆCØ�F‰F�3˜Ó#ˆØ�‹7Ø˜�‰Aà˜�
×!Ñ!Ó#×)Ñ)Ó+¨cÑ1°A¸!±e¸c°N×4IÑ4IÓ4KÑKˆAØ�‰�Q—W‘W“YÔØˆð# �&‰&��eÓ
 Ö
%ð$ €Lr"   c                óº  • U (       d  S0 4$ [        U [        5      (       a  U R                  S5      n [        U [        5      (       d   S5       eSU ;  a/  U R	                  5       R                  5       R                  S5      0 4$ [        U 5      tp0 nU H³  nUR                  S5      u  pVnSU;   a  M  [        U5      S:¼  a7  US   S	:X  a.  US
   S	:X  a%  USS
 R                  SS5      R                  SS	5      nUS:X  a&  USS S:X  d	  USS S:X  a  UR                  S5      S
   nUR                  S5      X5R                  S5      '   Mµ     UR                  S5      U4$ )z`Parses a Content-Type header into a value in the following format: (content_type, {parameters}).r"   úlatin-1zValue should be a string by nowr•   r˜   Ú*rm   r   r–   r™   r
   z\\Ú\r—   Úfilenameru   z:\N)Ú
isinstancer%   ÚdecodeÚstrrž   r¡   Úencoder¨   Ú	partitionrœ   ÚreplaceÚsplit)ÚvalueÚctypeÚsegmentsÚoptionsÚsegmentÚkeyÚ_Úvals           r   Úparse_options_headerr½   ¼   s\  € æØ�RˆyÐô �%œ×ÑØ—‘˜YÓ'ˆô �eœS×!Ñ!ÐDÐ#DÓDÐ!ð �%ÓØ—‘“×#Ñ#Ó%×,Ñ,¨YÓ7¸Ð<Ð<ä" 5Ó)Ð€EØ"$€GÛˆØ×'Ñ'¨Ó,‰ˆ�ð
 �#‹:ÙÜˆs‹8�q‹=˜S ™V s›]¨s°2©w¸#«~Ø�a˜�)×#Ñ# F¨DÓ1×9Ñ9¸%ÀÓEˆCð �*Ó # a¨ (¨eÓ"3°s¸2¸A°wÀ&Ó7HØ—)‘)˜D“/ "Ñ%ˆCØ),¯©°IÓ)>ˆ—
‘
˜9Ó%Ó&ñ ð �<‰<˜	Ó" GÐ+Ð+r"   c                  óÊ   • \ rS rSrSrSS.SS jjr\SS j5       rSS jrSS jr	SS	 jr
SS
 jrSS jrSS jr\SS j5       r\SS j5       r\SS j5       rSS jrSS jrSrg)ÚFieldéà   a:  A Field object represents a (parsed) form field.  It represents a single
field with a corresponding name and value.

The name that a :class:`Field` will be instantiated with is the same name
that would be found in the following HTML::

    <input name="name_goes_here" type="text"/>

This class defines two methods, :meth:`on_data` and :meth:`on_end`, that
will be called when data is written to the Field, and when the Field is
finalized, respectively.

Args:
    name: The name of the form field.
    content_type: The value of the Content-Type header for this field.
N©Úcontent_typec               ó@   • Xl         / U l        X l        [        U l        g r   )Ú_nameÚ_valueÚ_content_typeÚ_missingÚ_cache)r   ÚnamerÂ   s      r   Ú__init__ÚField.__init__ò   s   € ØŒ
Ø#%ˆŒØ)Ôô ˆ�r"   c                ó€   • U " U5      nUc  UR                  5         OUR                  U5        UR                  5         U$ )aT  Create an instance of a :class:`Field`, and set the corresponding
value - either None or an actual value.  This method will also
finalize the Field itself.

Args:
    name: the name of the form field.
    value: the value of the form field - either a bytestring or None.

Returns:
    A new instance of a [`Field`][python_multipart.Field].
)Úset_noneÚwriteÚfinalize)ÚclsrÉ   rµ   r§   s       r   Ú
from_valueÚField.from_valueú   s4   € ñ �‹IˆØ‰=Ø�J‰J�Là�G‰G�EŒNØ	�
‰
ŒØˆr"   c                ó$   • U R                  U5      $ )z�Write some data into the form field.

Args:
    data: The data to write to the field.

Returns:
    The number of bytes written.
©r<   ©r   r[   s     r   rÎ   ÚField.write  s   € ð �|‰|˜DÓ!Ð!r"   c                ód   • U R                   R                  U5        [        U l        [	        U5      $ )z±This method is a callback that will be called whenever data is
written to the Field.

Args:
    data: The data to write to the field.

Returns:
    The number of bytes written.
)rÅ   r    rÇ   rÈ   rœ   rÕ   s     r   r<   ÚField.on_data  s'   € ð 	�‰×Ñ˜4Ô ÜˆŒÜ�4‹yÐr"   c                ól   • U R                   [        L a!  SR                  U R                  5      U l         gg)ú6This method is called whenever the Field is finalized.r"   N©rÈ   rÇ   ÚjoinrÅ   ©r   s    r   r4   ÚField.on_end)  s'   € à�;‰;œ(Ò"ØŸ(™( 4§;¡;Ó/ˆD�Kð #r"   c                ó$   • U R                  5         g)zFinalize the form field.N©r4   rÝ   s    r   rÏ   ÚField.finalize.  s   € à�‰�r"   c                ón   • U R                   [        L a   SR                  U R                  5      U l         U ?g)z=Close the Field object.  This will free any underlying cache.r"   NrÛ   rÝ   s    r   ÚcloseÚField.close2  s)   € ð �;‰;œ(Ò"ØŸ(™( 4§;¡;Ó/ˆDŒKà‰Kr"   c                ó   • SU l         g)aZ  Some fields in a querystring can possibly have a value of None - for
example, the string "foo&bar=&baz=asdf" will have a field with the
name "foo" and value None, one with name "bar" and value "", and one
with name "baz" and value "asdf".  Since the write() interface doesn't
support writing None, this function will set the field value to None.
N)rÈ   rÝ   s    r   rÍ   ÚField.set_none:  s   € ð ˆ�r"   c                ó   • U R                   $ )z,This property returns the name of the field.)rÄ   rÝ   s    r   r^   ÚField.field_nameC  s   € ð �z‰zÐr"   c                óÜ   • U R                   [        L a   SR                  U R                  5      U l         [	        U R                   [
        5      (       d  U R                   b   eU R                   $ )z2This property returns the value of the form field.r"   )rÈ   rÇ   rÜ   rÅ   r®   r%   rÝ   s    r   rµ   ÚField.valueH  sN   € ð �;‰;œ(Ò"ØŸ(™( 4§;¡;Ó/ˆDŒKä˜$Ÿ+™+¤u×-Ñ-°·±Ñ1DÐDÐDØ�{‰{Ðr"   c                ó   • U R                   $ )z:This property returns the content_type value of the field.©rÆ   rÝ   s    r   rÂ   ÚField.content_typeQ  ó   € ð ×!Ñ!Ð!r"   c                óª   • [        U[        5      (       a9  U R                  UR                  :H  =(       a    U R                  UR                  :H  $ [        $ r   )r®   r¿   r^   rµ   ÚNotImplemented)r   Úothers     r   Ú__eq__ÚField.__eq__V  s<   € Ü�eœU×#Ñ#Ø—?‘? e×&6Ñ&6Ñ6×T¸4¿:¹:ÈÏÉÑ;TÐTä!Ð!r"   c                ó
  • U R                   b8  [        U R                   5      S:”  a  [        U R                   S S 5      S S S-   nO[        U R                   5      nU R                  R                   SU R
                  < SU S3$ )Nr‘   r™   z...'z(field_name=z, value=Ú))rµ   rœ   ÚreprÚ	__class__r&   r^   )r   Úvs     r   Ú__repr__ÚField.__repr__\  sw   € Ø�:‰:Ñ!¤c¨$¯*©*£o¸Ó&:ô �T—Z‘Z  �_Ó% c rÐ*¨VÑ3‰Aä�T—Z‘ZÓ ˆAà—.‘.×)Ñ)Ð*¨,°t·±Ñ6IÈÐRSÐQTÐTUÐVÐVr"   )rÈ   rÆ   rÄ   rÅ   )rÉ   úbytes | NonerÂ   ú
str | Noner$   ÚNone)rÉ   r%   rµ   rû   r$   r¿   ©r[   r%   r$   r#   ©r$   rý   ©r$   rû   ©r$   rü   )rñ   Úobjectr$   rM   ©r$   r°   )r&   r'   r(   r)   rn   rÊ   ÚclassmethodrÑ   rÎ   r<   r4   rÏ   rã   rÍ   Úpropertyr^   rµ   rÂ   rò   rù   r*   r   r"   r   r¿   r¿   à   sŒ   † ñð" JN÷ ð óó ðô*	"ôô0ô
ôôð óó ðð óó ðð ó"ó ð"ô"÷Wr"   r¿   c                  ó   • \ rS rSrSrS0 4SS.         SS jjjr\SS j5       r\SS j5       r\SS j5       r	\SS	 j5       r
\SS
 j5       r\SS j5       r\SS j5       rSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSrg) ÚFileig  aO  This class represents an uploaded file.  It handles writing file data to
either an in-memory file or a temporary file on-disk, if the optional
threshold is passed.

There are some options that can be passed to the File to change behavior
of the class.  Valid options are as follows:

| Name                  | Type  | Default | Description |
|-----------------------|-------|---------|-------------|
| UPLOAD_DIR            | `str` | None    | The directory to store uploaded files in. If this is None, a temporary file will be created in the system's standard location. |
| UPLOAD_DELETE_TMP     | `bool`| True    | Delete automatically created TMP file |
| UPLOAD_KEEP_FILENAME  | `bool`| False   | Whether or not to keep the filename of the uploaded file. If True, then the filename will be converted to a safe representation (e.g. by removing any invalid path segments), and then saved with the same name). Otherwise, a temporary name will be used. |
| UPLOAD_KEEP_EXTENSIONS| `bool`| False   | Whether or not to keep the uploaded file's extension. If False, the file will be saved with the default temporary extension (usually ".tmp"). Otherwise, the file's extension will be maintained. Note that this will properly combine with the UPLOAD_KEEP_FILENAME setting. |
| MAX_MEMORY_FILE_SIZE  | `int` | 1 MiB   | The maximum number of bytes of a File to keep in memory. By default, the contents of a File are kept into memory until a certain limit is reached, after which the contents of the File are written to a temporary file. This behavior can be disabled by setting this value to an appropriately large value (or, for example, infinity, such as `float('inf')`. |

Args:
    file_name: The name of the file that this [`File`][python_multipart.File] represents.
    field_name: The name of the form field that this file was uploaded with.  This can be None, if, for example,
        the file was uploaded with Content-Type application/octet-stream.
    config: The configuration for this File.  See above for valid configuration keys and their corresponding values.
    content_type: The value of the Content-Type header.
NrÁ   c               óZ  • [         R                  " [        5      U l        X0l        SU l        SU l        [        5       U l        X l	        Xl
        X@l        S U l        UbM  [        R                  R                  U5      n[        R                  R!                  U5      u  pgX`l        Xpl        g g )NTr   )ÚloggingÚ	getLoggerr&   ÚloggerÚ_configÚ
_in_memoryÚ_bytes_writtenr   Ú_fileobjÚ_field_nameÚ
_file_namerÆ   Ú_actual_file_nameÚosÚpathÚbasenameÚsplitextÚ
_file_baseÚ_ext)r   Ú	file_namer^   ÚconfigrÂ   r  ÚbaseÚexts           r   rÊ   ÚFile.__init__  s‘   € ô ×'Ò'¬Ó1ˆŒØŒØˆŒØˆÔÜ29³)ˆŒð &ÔØ#ŒØ)Ôð 04ˆÔð Ñ ä—w‘w×'Ñ'¨	Ó2ˆHÜŸ™×(Ñ(¨Ó2‰IˆDØ"ŒOØ�Ið !r"   c                ó   • U R                   $ )zˆThe form field associated with this file.  May be None if there isn't
one, for example when we have an application/octet-stream upload.
)r  rÝ   s    r   r^   ÚFile.field_nameŸ  s   € ð
 ×ÑÐr"   c                ó   • U R                   $ )z*The file name given in the upload request.)r  rÝ   s    r   r  ÚFile.file_name¦  s   € ð �‰Ðr"   c                ó   • U R                   $ )z]The file name that this file is saved as.  Will be None if it's not
currently saved on disk.
)r  rÝ   s    r   Úactual_file_nameÚFile.actual_file_name«  s   € ð
 ×%Ñ%Ð%r"   c                ó   • U R                   $ )z�The file object that we're currently writing to.  Note that this
will either be an instance of a :class:`io.BytesIO`, or a regular file
object.
)r  rÝ   s    r   Úfile_objectÚFile.file_object²  s   € ð �}‰}Ðr"   c                ó   • U R                   $ )zjThe total size of this file, counted as the number of bytes that
currently have been written to the file.
)r  rÝ   s    r   ÚsizeÚ	File.sizeº  s   € ð
 ×"Ñ"Ð"r"   c                ó   • U R                   $ )zaA boolean representing whether or not this file object is currently
stored in-memory or on-disk.
)r  rÝ   s    r   Ú	in_memoryÚFile.in_memoryÁ  s   € ð
 �‰Ðr"   c                ó   • U R                   $ )z4The Content-Type value for this part, if it was set.rì   rÝ   s    r   rÂ   ÚFile.content_typeÈ  rî   r"   c                ó~  • U R                   (       d  U R                  R                  S5        gU R                  R	                  S5        U R                  5       n[        R                  " U R                  U5        UR	                  U R                  5        U R                  nXl        SU l         UR                  5         g)a  If the file is already on-disk, do nothing.  Otherwise, copy from
the in-memory buffer to a disk file, and then reassign our internal
file object to this new disk file.

Note that if you attempt to flush a file that is already on-disk, a
warning will be logged to this module's logger.
z0Trying to flush to disk when we're not in memoryNr   F)
r  r  Úwarningr  ÚseekÚ_get_disk_fileÚshutilÚcopyfileobjr  rã   )r   Únew_fileÚold_fileobjs      r   Úflush_to_diskÚFile.flush_to_diskÍ  s–   € ð ��Ø�K‰K×ÑÐ RÔSØð 	�‰×Ñ˜1Ôð ×&Ñ&Ó(ˆô 	×Ò˜4Ÿ=™=¨(Ô3ð 	�‰�d×)Ñ)Ô*ð —m‘mˆØ Œð  ˆŒð 	×ÑÕr"   c           	     óŽ  • U R                   R                  S5        U R                  R                  S5      nU R                  R                  SS5      nU R                  R                  SS5      nU R                  R                  SS5      nSnUb™  U(       a’  U R                   R                  S	U5        U(       a  U R                  U R
                  -   OU R                  n[        R                  R                  X5      n U R                   R                  S
U5        [        US5      nGO)U(       a.  U R
                  R                  [        R                  " 5       5      OSnUc  Sn	O<[!        U["        5      (       a%  UR                  [        R                  " 5       5      n	OUn	U R                   R                  SX„U	S.5         [%        [&        [(        R*                  " X„U	S95      nUc   e[!        UR,                  [.        5      (       a/  UR,                  R1                  [        R                  " 5       5      nO[%        ["        UR,                  5      nX`l        U$ ! [         a,    SnU R                   R                  S5        [        SU-  5      ef = f! [         a'    U R                   R                  S5        [        S5      ef = f)zFThis function is responsible for getting a file object on-disk for us.zOpening a file on diskrL   rO   FrP   rN   TNzSaving with filename in: %rzOpening file: %rzw+bzError opening temporary filez Error opening temporary file: %rz*Creating a temporary file with options: %r)ÚsuffixÚdeleteÚdirz#Error creating named temporary file)r  Úinfor  Úgetr  r  r  r  rÜ   ÚopenÚOSErrorÚ	exceptionr   r¯   ÚsysÚgetfilesystemencodingr®   r%   r	   r   ÚtempfileÚNamedTemporaryFilerÉ   r°   r±   r  )
r   Úfile_dirÚkeep_filenameÚkeep_extensionsÚ
delete_tmpÚtmp_fileÚfnamer  r;  r=  s
             r   r3  ÚFile._get_disk_fileï  sG  € à�‰×ÑÐ1Ô2à—<‘<×#Ñ# LÓ1ˆØŸ™×(Ñ(Ð)?ÀÓGˆØŸ,™,×*Ñ*Ð+CÀUÓKˆØ—\‘\×%Ñ%Ð&9¸4Ó@ˆ
Ø*.ˆð Ñ¦MØ�K‰K×ÑÐ:¸HÔEö 4C�D—O‘O d§i¡iÒ/ÈÏÉˆEä—7‘7—<‘< Ó0ˆDðKØ—‘× Ñ Ð!3°TÔ:Ü  eÓ,’ö GV�T—Y‘Y×%Ñ%¤c×&?Ò&?Ó&AÔBÐ[_ˆFàÑØ‘Ü˜H¤e×,Ñ,Ø—o‘o¤c×&?Ò&?Ó&AÓB‘à�ð �K‰K×ÑØ<ÈÐnqÑ>rôðGÜ¤´×0KÒ0KÐSYÐruÑ0vÓw�ð
 Ñ'Ð'Ð'ä˜(Ÿ-™-¬×-Ñ-Ø Ÿ™×,Ñ,¬S×-FÒ-FÓ-HÓI‘äœU H§M¡MÓ2�à!&ÔØˆøôI ó KØ�à—‘×%Ñ%Ð&DÔEÜÐ BÀTÑ IÓJÐJð	Kûô0 ó GØ—‘×%Ñ%Ð&KÔLÜÐ EÓFÐFðGús   Ã?(I Ç#J É6JÊ1Kc                ó$   • U R                  U5      $ )z8Write some data to the File.

:param data: a bytestring
rÔ   rÕ   s     r   rÎ   Ú
File.write+  s   € ð
 �|‰|˜DÓ!Ð!r"   c                ó¨  • U R                   R                  U5      nU[        U5      :w  a(  U R                  R	                  SU[        U5      5        U$ U =R
                  U-  sl        U R                  R                  S5      nU R                  (       a>  Ub;  U R
                  U:”  a+  U R                  R                  S5        U R                  5         U$ )z¯This method is a callback that will be called whenever data is
written to the File.

Args:
    data: The data to write to the file.

Returns:
    The number of bytes written.
z bwritten != len(data) (%d != %d)rQ   zFlushing to disk)r  rÎ   rœ   r  r1  r  r  r?  r  r>  r8  )r   r[   ÚbwrittenÚmax_memory_file_sizes       r   r<   ÚFile.on_data2  s³   € ð —=‘=×&Ñ& tÓ,ˆð ”s˜4“yÓ Ø�K‰K×ÑÐ BÀHÌcÐRVËiÔXØˆOð 	×Ò˜xÑ'Õð  $Ÿ|™|×/Ñ/Ð0FÓGÐØ�?�?Ð3Ñ?ÀT×EXÑEXÐ[oÓEoØ�K‰K×ÑÐ/Ô0Ø×ÑÔ ð ˆr"   c                ó8   • U R                   R                  5         g)rÚ   N)r  ÚflushrÝ   s    r   r4   ÚFile.on_endO  s   € ð 	�‰×ÑÕr"   c                ó$   • U R                  5         g)z~Finalize the form file.  This will not close the underlying file,
but simply signal that we are finished writing to the File.
Nrà   rÝ   s    r   rÏ   ÚFile.finalizeT  s   € ð 	�‰�r"   c                ó8   • U R                   R                  5         g)z‹Close the File object.  This will actually close the underlying
file object (whether it's a :class:`io.BytesIO` or an actual file
object).
N)r  rã   rÝ   s    r   rã   Ú
File.closeZ  s   € ð
 	�‰×ÑÕr"   c                ól   • U R                   R                   SU R                  < SU R                  < S3$ )Nz(file_name=z, field_name=rõ   )r÷   r&   r  r^   rÝ   s    r   rù   ÚFile.__repr__a  s4   € Ø—.‘.×)Ñ)Ð*¨+°d·n±nÑ5GÀ}ÐUY×UdÑUdÑTgÐghÐiÐir"   )r  r  r  rÆ   r  r  r  r  r  r  r  )
r  rû   r^   rû   r  rI   rÂ   rü   r$   rý   r   )r$   zBytesIO | BufferedRandom)r$   r#   )r$   rM   r  rÿ   )r$   r   rþ   r  )r&   r'   r(   r)   rn   rÊ   r  r^   r  r#  r&  r)  r,  rÂ   r8  r3  rÎ   r<   r4   rÏ   rã   rù   r*   r   r"   r   r  r  g  s  † ñð4 $(Øð	ð $(ñàðð !ðð ð	ð !ðð 
öð@ ó ó ð ð óó ðð ó&ó ð&ð óó ðð ó#ó ð#ð óó ðð ó"ó ð"ô ôD:ôx"ôô:ô
ô÷jr"   r  c                  ól   • \ rS rSrSrSS jr S         SS jjrSS jrSS jrSS jr	SS	 jr
S
rg)Ú
BaseParserie  aÅ  This class is the base class for all parsers.  It contains the logic for
calling and adding callbacks.

A callback can be one of two different forms.  "Notification callbacks" are
callbacks that are called when something happens - for example, when a new
part of a multipart message is encountered by the parser.  "Data callbacks"
are called when we get some sort of data - for example, part of the body of
a multipart chunk.  Notification callbacks are called with no parameters,
whereas data callbacks are called with three, as follows::

    data_callback(data, start, end)

The "data" parameter is a bytestring (i.e. "foo" on Python 2, or b"foo" on
Python 3).  "start" and "end" are integer indexes into the "data" string
that represent the data of interest.  Thus, in a data callback, the slice
`data[start:end]` represents the data that the callback is "interested in".
The callback is not passed a copy of the data, since copying severely hurts
performance.
c                óP   • [         R                  " [        5      U l        0 U l        g r   )r	  r
  r&   r  Ú	callbacksrÝ   s    r   rÊ   ÚBaseParser.__init__z  s   € Ü×'Ò'¬Ó1ˆŒØ[]ˆ�r"   Nc                óš   • U R                   R                  SU-   5      nUc  g[        SU5      nUb  Ub  X4:X  a  gU" X#U5        gU" 5         g)a³  This function calls a provided callback with some data.  If the
callback is not set, will do nothing.

Args:
    name: The name of the callback to call (as a string).
    data: Data to pass to the callback.  If None, then it is assumed that the callback is a notification
        callback, and no parameters are given.
    end: An integer that is passed to the data callback.
    start: An integer that is passed to the data callback.
Úon_NzCallable[..., Any])r`  r?  r	   )r   rÉ   r[   rZ   r\   Úfuncs         r   ÚcallbackÚBaseParser.callback~  sS   € ð �~‰~×!Ñ! %¨$¡,Ó/ˆØ‰<ØÜÐ(¨$Ó/ˆàÑàÑ  U£\ØÙ�˜cÕ"á�Fr"   c                ól   • Uc   U R                   R                  SU-   S5        gX R                   SU-   '   g)aA  Update the function for a callback.  Removes from the callbacks dict
if new_func is None.

:param name: The name of the callback to call (as a string).

:param new_func: The new function for the callback.  If None, then the
                 callback will be removed (with no error if it does not
                 exist).
Nrc  )r`  Úpop)r   rÉ   Únew_funcs      r   Úset_callbackÚBaseParser.set_callback˜  s2   € ð ÑØ�N‰N×Ñ˜u t™|¨TÕ2à+3�N‰N˜5 4™<Ò(r"   c                ó   • g r   r   rÝ   s    r   rã   ÚBaseParser.close§  ó   € Ør"   c                ó   • g r   r   rÝ   s    r   rÏ   ÚBaseParser.finalizeª  rn  r"   c                ó4   • SU R                   R                  -  $ ©Nz%s()©r÷   r&   rÝ   s    r   rù   ÚBaseParser.__repr__­  ó   € Ø˜Ÿ™×/Ñ/Ñ/Ð/r"   )r`  r  rÿ   )NNN)
rÉ   ri   r[   rû   rZ   ú
int | Noner\   rv  r$   rý   )rÉ   ri   ri  zCallable[..., Any] | Noner$   rý   r  )r&   r'   r(   r)   rn   rÊ   re  rj  rã   rÏ   rù   r*   r   r"   r   r^  r^  e  sU   † ñô(^ð
 jnðØ ðØ(4ðØDNðØ\fðà	õô44ôô÷0r"   r^  c                  ób   ^ • \ rS rSrSr0 \" S5      4S	U 4S jjjrS
S jrSS jrSS jr	Sr
U =r$ )ÚOctetStreamParseri±  a  This parser parses an octet-stream request body and calls callbacks when
incoming data is received.  Callbacks are as follows:

| Callback Name  | Parameters      | Description                                         |
|----------------|-----------------|-----------------------------------------------------|
| on_start       | None            | Called when the first data is parsed.               |
| on_data        | data, start, end| Called for each data chunk that is parsed.           |
| on_end         | None            | Called when the parser is finished parsing all data.|

Args:
    callbacks: A dictionary of callbacks.  See the documentation for [`BaseParser`][python_multipart.BaseParser].
    max_size: The maximum size of body to parse.  Defaults to infinity - i.e. unbounded.
Úinfc                ó¨   >• [         TU ]  5         Xl        SU l        [	        U[
        5      (       a  US:  a  [        SU-  5      eX l        SU l        g ©NFr
   ú*max_size must be a positive number, not %rr   )	ÚsuperrÊ   r`  Ú_startedr®   r   Ú
ValueErrorÚmax_sizeÚ_current_size)r   r`  r€  r÷   s      €r   rÊ   ÚOctetStreamParser.__init__À  sK   ø€ Ü‰ÑÔØ"ŒØˆŒä˜(¤F×+Ñ+¨x¸!«|ÜÐIÈHÑTÓUÐUØ%-ŒØˆÕr"   c                ó¨  • U R                   (       d  U R                  S5        SU l         [        U5      nU R                  U-   U R                  :”  aW  [        U R                  U R                  -
  5      nU R                  R                  SU R                  U R                  UU5        UnU =R                  U-  sl        U R                  SUSU5        U$ )zÕWrite some data to the parser, which will perform size verification,
and then pass the data to the underlying callback.

Args:
    data: The data to write to the parser.

Returns:
    The number of bytes written.
rZ   TúDCurrent size is %d (max %d), so truncating data length from %d to %dr[   r   )r~  re  rœ   r�  r€  r#   r  r1  )r   r[   Údata_lenÚnew_sizes       r   rÎ   ÚOctetStreamParser.writeÊ  sµ   € ð �}�}Ø�M‰M˜'Ô"Ø ˆDŒMô �t“9ˆØ×Ñ Ñ)¨T¯]©]Ó:ä˜4Ÿ=™=¨4×+=Ñ+=Ñ=Ó>ˆHØ�K‰K×ÑØVØ×"Ñ"Ø—‘ØØôð  ˆHð 	×Ò˜hÑ&ÕØ�‰�f˜d A xÔ0Øˆr"   c                ó&   • U R                  S5        g)zdFinalize this parser, which signals to that we are finished parsing,
and sends the on_end callback.
r\   N)re  rÝ   s    r   rÏ   ÚOctetStreamParser.finalizeë  s   € ð 	�‰�eÕr"   c                ó4   • SU R                   R                  -  $ rr  rs  rÝ   s    r   rù   ÚOctetStreamParser.__repr__ñ  ru  r"   )r�  r~  r`  r€  )r`  r9   r€  rV   rþ   rÿ   r  )r&   r'   r(   r)   rn   rV   rÊ   rÎ   rÏ   rù   r*   Ú__classcell__©r÷   s   @r   rx  rx  ±  s3   ø† ñð :<ÉuÐUZË|÷ ñ ôôB÷0ò 0r"   rx  c                  óˆ   ^ • \ rS rSr% SrS\S'   0 S\" S5      4       SU 4S jjjrSS jrSS	 jr	SS
 jr
SS jrSrU =r$ )ÚQuerystringParseriõ  añ  This is a streaming querystring parser.  It will consume data, and call
the callbacks given when it has data.

| Callback Name  | Parameters      | Description                                         |
|----------------|-----------------|-----------------------------------------------------|
| on_field_start | None            | Called when a new field is encountered.             |
| on_field_name  | data, start, end| Called when a portion of a field's name is encountered. |
| on_field_data  | data, start, end| Called when a portion of a field's data is encountered. |
| on_field_end   | None            | Called when the end of a field is encountered.      |
| on_end         | None            | Called when the parser is finished parsing all data.|

Args:
    callbacks: A dictionary of callbacks.  See the documentation for [`BaseParser`][python_multipart.BaseParser].
    strict_parsing: Whether or not to parse the body strictly.  Defaults to False.  If this is set to True, then the
        behavior of the parser changes as the following: if a field has a value with an equal sign
        (e.g. "foo=bar", or "foo="), it is always included.  If a field has no equals sign (e.g. "...&name&..."),
        it will be treated as an error if 'strict_parsing' is True, otherwise included.  If an error is encountered,
        then a [`QuerystringParseError`][python_multipart.exceptions.QuerystringParseError] will be raised.
    max_size: The maximum size of body to parse.  Defaults to infinity - i.e. unbounded.
rk   ÚstateFry  c                óÞ   >• [         TU ]  5         [        R                  U l        SU l        Xl        [        U[        5      (       a  US:  a  [        SU-  5      eX0l
        SU l        X l        g r{  )r}  rÊ   rk   ro   r�  Ú
_found_sepr`  r®   r   r  r€  r�  Ústrict_parsing)r   r`  r“  r€  r÷   s       €r   rÊ   ÚQuerystringParser.__init__  sd   ø€ ô 	‰ÑÔÜ%×2Ñ2ˆŒ
ØˆŒà"Œô ˜(¤F×+Ñ+¨x¸!«|ÜÐIÈHÑTÓUÐUØ%-ŒØˆÔð -Õr"   c                óŠ  • [        U5      nU R                  U-   U R                  :”  aW  [        U R                  U R                  -
  5      nU R                  R                  SU R                  U R                  UU5        UnSn U R                  X5      nU =R                  U-  sl        U$ ! U =R                  U-  sl        f = f)añ  Write some data to the parser, which will perform size verification,
parse into either a field name or value, and then pass the
corresponding data to the underlying callback.  If an error is
encountered while parsing, a QuerystringParseError will be raised.  The
"offset" attribute of the raised exception will be set to the offset in
the input data chunk (NOT the overall stream) that caused the error.

Args:
    data: The data to write to the parser.

Returns:
    The number of bytes written.
r„  r   ©rœ   r�  r€  r#   r  r1  Ú_internal_write©r   r[   r…  r†  Úls        r   rÎ   ÚQuerystringParser.write  ó´   € ô �t“9ˆØ×Ñ Ñ)¨T¯]©]Ó:ä˜4Ÿ=™=¨4×+=Ñ+=Ñ=Ó>ˆHØ�K‰K×ÑØVØ×"Ñ"Ø—‘ØØôð  ˆHàˆð	$Ø×$Ñ$ TÓ4ˆAà×Ò !Ñ#Õàˆøð ×Ò !Ñ#Öúó   ÂB+ Â+Cc                óø  • U R                   nU R                  nU R                  nSnXb:  GaA  X   nU[        R                  :X  aq  U[
        :X  a=  U(       a2  U(       a  [        SU-  US9eU R                  R                  SU5        GOÙSnGOÕU R                  S5        US-  n[        R                  nSnGO«U[        R                  :X  añ  UR                  SXb5      nUS	:w  a  UR                  S
Xh5      n	OUR                  S
Xb5      n	U	S	:w  a'  U R                  SXU	5        U	n[        R                  nGO-U(       dV  US	:w  a:  U R                  SXU5        U R                  S5        US-
  n[        R                  nOæU R                  SXU5        UnOÐUS	:w  a  [        SU4-  US9eU R                  SXU5        UnO¦U[        R                  :X  ah  UR                  SXb5      nUS	:w  a:  U R                  SXU5        U R                  S5        US-
  n[        R                  nO@U R                  SXU5        UnO*SX64-  n
U R                  R                  U
5        [        X¦S9eUS-  nXb:  a  GMA  X0l         XPl        U$ )Nr   z"Skipping duplicate ampersand at %d©ÚoffsetTr]   r
   Fó   &r™   ó   =r^   r`   z{When strict_parsing is True, we require an equals sign in all field chunks. Did not find one in the chunk that starts at %dr_   ú!Reached an unknown state %d at %d)r�  r“  r’  rk   ro   Ú	AMPERSANDr   r  Údebugre  rp   rš   rq   r1  )r   r[   Úlengthr�  r“  Ú	found_sepr¦   ÚchÚsep_posÚ
equals_posÚmsgs              r   r—  Ú!QuerystringParser._internal_writeC  st  € Ø—
‘
ˆØ×,Ñ,ˆØ—O‘Oˆ	àˆØŒjØ‘ˆBð Ô(×5Ñ5Ó5ð œ“?Þ æ)Ü"7Ð8\Ð_`Ñ8`ÐijÑ"kÐkà ŸK™K×-Ñ-Ð.RÐTUÖVð
 %)š	ð
 —M‘M -Ô0Ø˜‘F�AÜ,×7Ñ7�EØ %’IàÔ*×5Ñ5Ó5ð Ÿ)™) D¨!Ó4�ð
 ˜b“=Ø!%§¡¨4°Ó!<‘Jà!%§¡¨4°Ó!;�Jà Ó#à—M‘M ,°¸ÔDð
 #�AÜ,×7Ñ7’Eö *ð
 # b›=Ø ŸM™M¨,¸ÀÔIØ ŸM™M¨+Ô6à '¨!¡˜AÜ$4×$AÑ$A™Eð !ŸM™M¨,¸ÀÔHØ &™Að
 # b›=Ü"7ð!JàMNÈDñ!Qð ()ñ	#ð ð Ÿ™ l°D¸VÔDØ"™àÔ*×5Ñ5Ó5àŸ)™) D¨!Ó4�ð ˜b“=Ø—M‘M ,°¸ÔAØ—M‘M +Ô.ð   !™�AÜ,×9Ñ9‘Eð —M‘M ,°¸Ô@Ø‘Að :¸U¸JÑF�Ø—‘×#Ñ# CÔ(Ü+¨CÑ:Ð:à�‰FˆAði Žjðl Œ
Ø#ŒØˆr"   c                ó¤   • U R                   [        R                  [        R                  4;   a  U R	                  S5        U R	                  S5        g)z¦Finalize this parser, which signals to that we are finished parsing,
if we're still in the middle of a field, an on_field_end callback, and
then the on_end callback.
r`   r\   N)r�  rk   rq   rp   re  rÝ   s    r   rÏ   ÚQuerystringParser.finalizeÃ  s;   € ð �:‰:Ô*×5Ñ5Ô7G×7RÑ7RÐSÓSØ�M‰M˜+Ô&Ø�‰�eÕr"   c                óx   • SR                  U R                  R                  U R                  U R                  5      $ )Nz&{}(strict_parsing={!r}, max_size={!r}))Úformatr÷   r&   r“  r€  rÝ   s    r   rù   ÚQuerystringParser.__repr__Í  s0   € Ø7×>Ñ>Ø�N‰N×#Ñ# T×%8Ñ%8¸$¿-¹-ó
ð 	
r"   )r�  r’  r`  r€  r�  r“  )r`  r,   r“  rM   r€  rV   r$   rý   rþ   ©r[   r%   r¥  r#   r$   r#   rÿ   r  )r&   r'   r(   r)   rn   r6   rV   rÊ   rÎ   r—  rÏ   rù   r*   rŒ  r�  s   @r   r�  r�  õ  sf   ø‡ ñð* Óð 13È5ÑdiÐjoÓdpð-Ø-ð-ØDHð-Ø\að-à	÷-ð -ô$"ôH~ô@÷
ò 
r"   r�  c                  óŒ   ^ • \ rS rSrSr0 \" S5      4\\S.           SU 4S jjjjrSS jr	SS jr
SS jrSS	 jrS
rU =r$ )ÚMultipartParseriÓ  a¨  This class is a streaming multipart/form-data parser.

| Callback Name      | Parameters      | Description |
|--------------------|-----------------|-------------|
| on_part_begin      | None            | Called when a new part of the multipart message is encountered. |
| on_part_data       | data, start, end| Called when a portion of a part's data is encountered. |
| on_part_end        | None            | Called when the end of a part is reached. |
| on_header_begin    | None            | Called when we've found a new header in a part of a multipart message |
| on_header_field    | data, start, end| Called each time an additional portion of a header is read (i.e. the part of the header that is before the colon; the "Foo" in "Foo: Bar"). |
| on_header_value    | data, start, end| Called when we get data for a header. |
| on_header_end      | None            | Called when the current header is finished - i.e. we've reached the newline at the end of the header. |
| on_headers_finished| None            | Called when all headers are finished, and before the part data starts. |
| on_end             | None            | Called when the parser is finished parsing all data. |

Args:
    boundary: The multipart boundary.  This is required, and must match what is given in the HTTP request - usually in the Content-Type header.
    callbacks: A dictionary of callbacks.  See the documentation for [`BaseParser`][python_multipart.BaseParser].
    max_size: The maximum size of body to parse.  Defaults to infinity - i.e. unbounded.
    max_header_count: The maximum number of headers allowed per part.
    max_header_size: The maximum size of a single header line (excluding the trailing CRLF).
ry  )Úmax_header_countÚmax_header_sizec               óä  >• [         TU ]  5         [        R                  U l        S=U l        U l        X l        [        U[        5      (       a  US:  a  [        SU-  5      eX0l        SU l        X@l        SU l        XPl        SU l        0 U l        [        U[$        5      (       a  UR'                  S5      n[)        U5      [*        :”  a  [-        S[)        U5       S[*         35      eSU-   U l        g )Nr   r
   r|  rª   zBoundary length z exceeds maximum of s   
--)r}  rÊ   rs   r   r�  ÚindexÚflagsr`  r®   r   r  r€  r�  r´  Ú_current_header_countrµ  Ú_current_header_sizeÚmarksr°   r±   rœ   ÚMAX_BOUNDARY_LENGTHr   Úboundary)r   r½  r`  r€  r´  rµ  r÷   s         €r   rÊ   ÚMultipartParser.__init__ê  sÜ   ø€ ô 	‰ÑÔÜ#×)Ñ)ˆŒ
Ø"#Ð#ˆŒ
�T”Zà"Œä˜(¤F×+Ñ+¨x¸!«|ÜÐIÈHÑTÓUÐUØ ŒØˆÔà 0ÔØ%&ˆÔ"à.ÔØ$%ˆÔ!ð &(ˆŒ
ô �h¤×$Ñ$Ø—‘ yÓ1ˆHÜˆx‹=Ô.Ó.Ü!Ð$4´S¸³]°OÐCWÔXkÐWlÐ"mÓnÐnØ! HÑ,ˆ�r"   c                óŠ  • [        U5      nU R                  U-   U R                  :”  aW  [        U R                  U R                  -
  5      nU R                  R                  SU R                  U R                  UU5        UnSn U R                  X5      nU =R                  U-  sl        U$ ! U =R                  U-  sl        f = f)aã  Write some data to the parser, which will perform size verification,
and then parse the data into the appropriate location (e.g. header,
data, etc.), and pass this on to the underlying callback.  If an error
is encountered, a MultipartParseError will be raised.  The "offset"
attribute on the raised exception will be set to the offset of the byte
in the input chunk that caused the error.

Args:
    data: The data to write to the parser.

Returns:
    The number of bytes written.
r„  r   r–  r˜  s        r   rÎ   ÚMultipartParser.write  r›  rœ  c                ó  ^ ^^^^^^• T R                   m[        T5      mT R                  nT R                  nT R                  nT R
                  nT R                  mSmS#S$UUU 4S jjjnS%UU 4S jjnS&S'U 4S jjjn	S&S(UUUUU 4S jjjn
TT:  Ga°  TT   nU[        R                  :X  aK  U[        :X  d
  U[        :X  a  TR                  ST5      mTS:X  a  TmGOgMR  Sn[        R                  nTS-  mGO>U[        R                  :X  Ga  UTS	-
  :X  aW  U[        :X  a  [        R                  nO5U[        :w  a+  S
T4-  nT R                  R!                  U5        [#        UTS9eUS-  nGOÉUTS-
  :X  a^  U[        :w  a+  ST4-  nT R                  R!                  U5        [#        UTS9eSnT R%                  S5        SnSm[        R&                  nGObUTUS	-      :w  a5  STUS	-      X´S	-   4-  nT R                  R!                  U5        [#        UTS9eUS-  nGOU[        R&                  :X  ag  SnU[        :w  a!  US-  nUT R(                  :”  a
  [#        STS9eSmU" S5        U[        :w  a  T R%                  S5        [        R*                  nTS-  mGOŸU[        R*                  :X  Ga7  U[        :X  a&  US:X  a   U	" S5        [        R,                  nTS-  mGMO  TR                  STT5      nUS:w  a  UOTnU" US:X  a  UT-
  OUT-
  S-   5        TTU nUR/                  S [0        5      (       aR  [3        S U 5       5      nTUR                  U5      -   nSUU4-  nT R                  R!                  U5        [#        UUS9eXNT-
  -  nUS:X  a  TmGO¡US:X  a+  ST4-  nT R                  R!                  U5        [#        UTS9eUmU
" ST5        [        R4                  nGOSU[        R4                  :X  a8  U[6        :X  a  U" 5         TS-  mGMƒ  U" S5        [        R8                  nTS-  mGOU[        R8                  :X  ab  TR                  STT5      nUS:w  a  UOTnU" UT-
  5        US:w  a0  UmU
" ST5        T R%                  S5        Sm[        R:                  nGO•TmGO‘U[        R:                  :X  aH  U[        :w  a,  SU< S3nT R                  R!                  U5        [#        UTS9e[        R&                  nGO5U[        R,                  :X  aY  U[        :w  a,  SU< S3nT R                  R!                  U5        [#        UTS9eT R%                  S5        [        R<                  nGOÈU[        R<                  :X  a  U" S5        [        R>                  nTS-  mGO•U[        R>                  :X  GaÄ  UnUS:X  a{  TR                  TTT5      nUS:¼  a  TS-
  nUT-   S-
  mTT   nOOTRA                  TS S [C        TTT-
  S-   5      T5      nUS:w  a  TRE                  TUT 5      (       a  TU-
  nTmGM¬  UT:  a  TU   U:X  a  US-  nGOSnGOUT:X  a0  US-  nU[        :X  a
  U[F        -  nOôU[        :X  a
  U[H        -  nOàSnOÝUTS-   :X  aÔ  U[F        -  (       am  U[        :X  aV  U[F        ) -  nU
" STU-
  5        T R%                  S5        T R%                  S5        SnSmSn[        R&                  nTS-  mGMs  SnU[F        ) -  nOYU[H        -  (       aK  U[        :X  a?  U
" STU-
  5        T R%                  S5        T R%                  S5        [        RJ                  nOSnUS:X  a  US:”  a  SnTS-  mO¼U[        R                  :X  ae  UTS-
  :X  a[  U[        :w  a+  S T4-  nT R                  R!                  U5        [#        UTS9eUS-  nT R%                  S5        [        RJ                  nOCU[        RJ                  :X  a  TmO:S!UT4-  nT R                  R!                  U5        [#        UTS9eTS-  mTT:  a  GM°  U
" STS"5        U
" STS"5        U
" STU-
  S"5        UT l        UT l        UT l        UT l        TT l        T$ ))Nr   r
   c                óD   >• TU -  mTTR                   :”  a
  [        STS9eg )NzMaximum header size exceededrž  )rµ  r   )ÚamountÚcurrent_header_sizer¦   r   s    €€€r   Úadvance_header_sizeÚ<MultipartParser._internal_write.<locals>.advance_header_sizeC  s0   ø€ à 6Ñ)ÐØ" T×%9Ñ%9Ó9Ü)Ð*HÐQRÑSÐSð :r"   c                ó$   >• TTR                   U '   g r   )r»  )rÉ   r¦   r   s    €€r   Úset_markÚ1MultipartParser._internal_write.<locals>.set_markJ  s   ø€ Ø ˆD�J‰J�tÒr"   c                ó>   >• TR                   R                  U S 5        g r   )r»  rh  )rÉ   Úresetr   s     €r   Údelete_markÚ4MultipartParser._internal_write.<locals>.delete_markN  s   ø€ Ø�J‰J�N‰N˜4 Õ&r"   c                óZ  >• T
R                   R                  U 5      nUc  g X::  a  OÏUS:¼  a  T
R                  U TX15        OµU* nUT::  a  T
R                  U TSU5        O}T
R                  [        -  (       a  TS-   nT
R                  XSU5        OLT
R                  [
        -  (       a  TS-   nT
R                  XSU5        OT
R                  R                  S5        US:”  a  T
R                  U TSU5        U(       a  UT	-
  T
R                   U '   g T
R                   R                  U S 5        g )Nr   s   
s   --
zLook-back buffer error)	r»  r?  re  r¸  ÚFLAG_PART_BOUNDARYÚFLAG_LAST_BOUNDARYr  r1  rh  )rÉ   Úend_iÚ	remainingÚmarked_indexÚlookbehind_lenÚlookbackr½  Úboundary_lengthr[   r¥  r   s         €€€€€r   Údata_callbackÚ6MultipartParser._internal_write.<locals>.data_callbackV  s  ø€ ØŸ:™:Ÿ>™>¨$Ó/ˆLØÑ#Øð Ó$àØ Ó"à—‘˜d D¨,Õ>ð #/ �Ø! _Ó4Ø—M‘M $¨°!°^ÕDØ—Z‘ZÔ"4×4Ø'¨'Ñ1�HØ—M‘M $°!°^ÕDØ—Z‘ZÔ"4×4Ø'¨)Ñ3�HØ—M‘M $°!°^ÕDà—K‘K×'Ñ'Ð(@ÔAà˜1“9Ø—M‘M $¨¨a°Ô7ö Ø#(¨6¡>�—
‘
˜4Ò à—
‘
—‘˜t TÕ*r"   ó   -r™   rm   z'Did not find CR at end of boundary (%d)rž  z'Did not find LF at end of boundary (%d)ra   z2Expected boundary character %r, got %r at index %dzMaximum header count exceededre   rd   ó   :c              3  ó<   #   • U  H  o[         ;  d  M  Uv •  M     g 7fr   )ÚTOKEN_CHARS_SET)Ú.0Úbs     r   Ú	<genexpr>Ú2MultipartParser._internal_write.<locals>.<genexpr>ë  s   é € ÐLª% Q¼OÑ3KŸq™qª%ùs   ‚“	z*Found invalid character %r in header at %dzFound 0-length header at %drf   ó   rg   z2Did not find LF character at end of header (found rõ   z)Did not find LF at end of headers (found rh   rb   rc   r\   z&Did not find - at end of boundary (%d)r¢  T)r
   )rÃ  r#   r$   rý   )rÉ   r°   r$   rý   )F)rÉ   r°   rË  rM   r$   rý   )rÉ   ri   rÑ  r#   rÒ  rM   r$   rý   )&r½  rœ   r�  r·  r¸  r¹  rº  rs   r   ÚCRÚLFrš   r€   ÚHYPHENrŠ   r  r1  r   re  r�   r´  r‚   r†   Ú	translateÚTOKEN_CHARSÚnextrƒ   ÚSPACEr„   r…   r‡   rˆ   ÚrfindÚmaxÚ
startswithrÏ  rÐ  r‹   )r   r[   r¥  r�  r·  r¸  Úcurrent_header_countrÅ  rÈ  rÌ  r×  Úcrª  Úcolonr\   ÚfieldÚbadÚbad_iÚcrÚ
prev_indexÚi0Úkr½  rÖ  rÄ  r¦   s   ```                   @@@@r   r—  ÚMultipartParser._internal_write3  sÆ  þ€ à—=‘=ˆÜ˜h›-ˆð —
‘
ˆØ—
‘
ˆØ—
‘
ˆØ#×9Ñ9ÐØ"×7Ñ7Ðð ˆ÷	Tó 	T÷	!ð 	!÷	'ñ 	'÷%	+õ %	+ðP �&ŒjØ�Q‘ˆAàœ×,Ñ,Ó,àœ“7˜a¤2›gØŸ	™	 $¨Ó*�AØ˜B“wà"˜ÙÙð �ô '×5Ñ5�Ø�Q‘’àœ.×7Ñ7Ô7ð ˜O¨aÑ/Ó/ØœF“{ä .× ;Ñ ;™Øœb›àGÈ1È$ÑN˜ØŸ™×+Ñ+¨CÔ0Ü1°#¸aÑ@Ð@à˜Q‘J’Eà˜o°Ñ1Ó1ØœB“wØGÈ1È$ÑN˜ØŸ™×+Ñ+¨CÔ0Ü1°#¸aÑ@Ð@ð �Eð —M‘M ,Ô/Ø+,Ð(Ø*+Ð'ô +×=Ñ=’Eð ˜H U¨Q¡YÑ/Ó/ØRÐV^Ð_dÐghÑ_hÑViÐklÐvwÑnwÐUxÑx˜ØŸ™×+Ñ+¨CÔ0Ü1°#¸aÑ@Ð@ð ˜Q‘J’Eàœ.×;Ñ;Ó;ð �àœ“7Ø(¨AÑ-Ð(Ø+¨d×.CÑ.CÓCÜ1Ð2QÐZ[Ñ\Ð\Ø*+Ð'ñ ˜Ô(ð œ“7Ø—M‘M .Ô1ô '×3Ñ3�Ø�Q‘’àœ.×5Ñ5Ô5ð œ“7˜u¨›zÙ Ô/Ü*×>Ñ>�EØ˜‘F�AÚð Ÿ	™	 $¨¨6Ó2�Ø$¨›{‘e°�ñ $¨u¸«{ C¨!¢GÀÀaÁÈ!ÁÔLà˜Q˜s˜�Ø—?‘? 4¬×5Ñ5ÜÑL©%ÓLÓL�CØ §¡¨CÓ 0Ñ0�EØFÈ#ÈuÈÑU�CØ—K‘K×'Ñ'¨Ô,Ü-¨c¸%Ñ@Ð@à˜q™Ñ �Ø˜B“;à’Að  “zØ;¸q¸dÑB˜ØŸ™×+Ñ+¨CÔ0Ü1°#¸aÑ@Ð@ð �AÙ! .°!Ô4ô +×=Ñ=’Eàœ.×;Ñ;Ó;àœ“:Ù'Ô)Ø˜‘F�AÚñ ˜Ô(ô '×3Ñ3�Ø�Q‘’àœ.×5Ñ5Ó5ð —Y‘Y˜u a¨Ó0�Ø "›H‘b¨&�Ù# C¨!¡GÔ,Ø˜“8Ø�AÙ! .°!Ô4Ø—M‘M ,Ô/Ø*+Ð'Ü*×CÑC’Eà’Aàœ.×AÑAÓAàœ“7ØNÈqÉeÐSTÐU�CØ—K‘K×'Ñ'¨Ô,Ü-¨c¸!Ñ<Ð<ô
 '×9Ñ9’àœ.×<Ñ<Ó<ð œ“7ØEÀaÁUÈ!ÐL�CØ—K‘K×'Ñ'¨Ô,Ü-¨c¸!Ñ<Ð<à—‘Ð0Ô1Ü&×6Ñ6’àœ.×8Ñ8Ó8á˜Ô%ô '×0Ñ0�Ø�Q‘’àœ.×2Ñ2Ô2ð #�
ð ˜A“:ð Ÿ™ 8¨Q°Ó7�BØ˜Q“wà /°!Ñ 3˜Ø Ñ0°1Ñ4˜Ø  ™G™ð !ŸJ™J x°° |´S¸¸FÀ_Ñ<TÐWXÑ<XÓ5YÐ[aÓb˜Ø ›7 x×':Ñ':¸4ÀÀ&¸>×'JÑ'JØ$*¨Q¡J˜Eð #˜Ú ð ˜?Ó*à ‘¨!Ó+à ™
šà !šð ˜oÓ-à˜Q‘J�Eð œB“wØÔ!3Ñ3™ð œf›ØÔ!3Ñ3™ð
 !"™ð ˜o°Ñ1Ó1ð Ô1×1à¤›7à!Ô&8Ð%8Ñ8˜Eñ *¨+°q¸5±yÔAð !ŸM™M¨*Ô5Ø ŸM™M¨,Ô7Ø34Ð0Ø23Ð/ð %&˜EÜ$2×$EÑ$E˜EØ ™F˜AÚ$ð !"˜ØÔ"4Ð!4Ñ4™ð Ô!3×3à¤›;á)¨+°q¸5±yÔAð !ŸM™M¨*Ô5Ø ŸM™M¨%Ô0Ü$2×$6Ñ$6™Eð %&˜Eð ˜A“: *¨q£.à!"�Jð ˜‘F�Aøàœ.×5Ñ5Ó5Ø˜O¨aÑ/Ó/ØœF“{ØFÈ!ÈÑM˜ØŸ™×+Ñ+¨CÔ0Ü1°#¸aÑ@Ð@Ø˜Q‘J�EØ—M‘M %Ô(Ü*×.Ñ.�Eøàœ.×,Ñ,Ó,ð �Øð :¸UÀA¸JÑF�Ø—‘×#Ñ# CÔ(Ü)¨#°aÑ8Ð8ð �‰FˆAði
 �&Žjñ|
 	�n f¨dÔ3Ù�n f¨dÔ3Ù�k 6¨E¡>°4Ô8ð ˆŒ
ØˆŒ
ØˆŒ
Ø%9ˆÔ"Ø$7ˆÔ!ð ˆr"   c                ó   • g)a  Finalize this parser, which signals to that we are finished parsing.

Note: It does not currently, but in the future, it will verify that we
are in the final state of the parser (i.e. the end of the multipart
message is well-formed), and, if not, throw an error.
Nr   rÝ   s    r   rÏ   ÚMultipartParser.finalizeë  s   € ð 	r"   c                óP   • U R                   R                   SU R                  < S3$ )Nz
(boundary=rõ   )r÷   r&   r½  rÝ   s    r   rù   ÚMultipartParser.__repr__ö  s%   € Ø—.‘.×)Ñ)Ð*¨*°T·]±]Ñ4EÀQÐGÐGr"   )r¹  rº  r�  r½  r`  r¸  r·  r»  r´  rµ  r€  r�  )r½  zbytes | strr`  r>   r€  rV   r´  r#   rµ  r#   r$   rý   rþ   r±  rÿ   r  )r&   r'   r(   r)   rn   rV   ÚDEFAULT_MAX_HEADER_COUNTÚDEFAULT_MAX_HEADER_SIZErÊ   rÎ   r—  rÏ   rù   r*   rŒ  r�  s   @r   r³  r³  Ó  s„   ø† ñð2 )+Ù ›,ð	#-ð !9Ø6ñ#-àð#-ð &ð#-ð ð	#-ð ð#-ð ð#-ð 
÷#-ñ #-ôJ"ôHvôp	÷Hò Hr"   r³  c            
      ó¤   • \ rS rSr% Sr\" S5      \\SSSSSSS.	rS	\	S
'   SSS0 4               SS jjr
SS jrSS jrSS jrSS jrSrg)Ú
FormParseriú  aj  This class is the all-in-one form parser.  Given all the information
necessary to parse a form, it will instantiate the correct parser, create
the proper :class:`Field` and :class:`File` classes to store the data that
is parsed, and call the two given callbacks with each field and file as
they become available.

Args:
    content_type: The Content-Type of the incoming request.  This is used to select the appropriate parser.
    on_field: The callback to call when a field has been parsed and is ready for usage.  See above for parameters.
    on_file: The callback to call when a file has been parsed and is ready for usage.  See above for parameters.
    on_end: An optional callback to call when all fields and files in a request has been parsed.  Can be None.
    boundary: If the request is a multipart/form-data request, this should be the boundary of the request, as given
        in the Content-Type header, as a bytestring.
    file_name: If the request is of type application/octet-stream, then the body of the request will not contain any
        information about the uploaded file.  In such cases, you can provide the file name of the uploaded file
        manually.
    config: Configuration to use for this FormParser.  The default values are taken from the DEFAULT_CONFIG value,
        and then any keys present in this dictionary will overwrite the default values.
ry  é   NTF)	rW   rX   rY   rQ   rL   rN   rO   rP   rU   rS   ÚDEFAULT_CONFIGc                óJ  ^ ^^^^^^^^^^^^• [         R                  " [        5      T l        UT l        UT l        ST l        S T l        TT l        TT l	        UT l
        T R                  R                  5       T l        T R                  R                  U5        S nUS:X  a:  S mS"UUU 4S jjn	S#U4S jjn
S"UUU 4S jjn[        XšUS.T R                  S   S9nGOCUS	:X  d  US
:X  aJ  / mS mS"S jnS#U4S jjnS#UU4S jjnS"UUU4S jjnS"U 4S jjn[!        UUUUUS.T R                  S   S9nOíUS:X  a½  Uc&  T R                  R#                  S5        [%        S5      e/ m/ m0 mS mS mSmS"U4S jjnS#U4S jjnS"UUUU4S jjnS#U4S jjnS#U4S jjnS"UUU4S jjnS"UUUU U4S jjnS"U U4S jjn['        UUUUUUUUUS.T R                  S   T R                  S   T R                  S   S9nO*T R                  R)                  S U5        [%        S!U 35      eUT l        g )$Nr   zapplication/octet-streamc                 ó0   >• [        TS TR                  S9m g )N)r  )r  r  )Úfiler  r   s   €€€r   r;   Ú%FormParser.__init__.<locals>.on_start?  s   ø€ ä˜I t°D·K±KÑ@‘r"   c                ó6   >• Tc   eTR                  XU 5        g r   ©rÎ   )r[   rZ   r\   r  s      €r   r<   Ú$FormParser.__init__.<locals>.on_dataC  s   ø€ àÑ'Ð'Ð'Ø—
‘
˜4 c˜?Õ+r"   c                 óŠ   >• T c   eT R                  5         T(       a  T" T 5        TR                  b  TR                  5         g g r   ©rÏ   r4   )r  Úon_filer   s   €€€r   Ú_on_endÚ$FormParser.__init__.<locals>._on_endH  s>   ø€ àÑ'Ð'Ð'à—‘”ö Ù˜D”Mð —;‘;Ñ*Ø—K‘K•Mð +r"   )r;   r<   r4   rW   )r`  r€  z!application/x-www-form-urlencodedzapplication/x-url-encodedc                 ó   • g r   r   r   r"   r   r/   Ú+FormParser.__init__.<locals>.on_field_starta  s   € Ør"   c                ó,   >• TR                  XU 5        g r   ©r    )r[   rZ   r\   Úname_buffers      €r   r1   Ú*FormParser.__init__.<locals>.on_field_named  ó   ø€ Ø×"Ñ" 4¨c ?Õ3r"   c                óp   >• Tc  [        SR                  T5      5      mTS S 2	 TR                  XU 5        g ©Nr"   )r¿   rÜ   rÎ   )r[   rZ   r\   r§   r  s      €€r   r2   Ú*FormParser.__init__.<locals>.on_field_datag  s2   ø€ à‘9Ü˜cŸh™h {Ó3Ó4�AØ#¢A˜Ø—‘˜ 3˜Õ(r"   c                 ó¬   >• T c/  [        SR                  T5      5      m TS S 2	 T R                  5         T R                  5         T(       a  T" T 5        S m g r  )r¿   rÜ   rÍ   rÏ   )r§   r  Úon_fields   €€€r   r3   Ú)FormParser.__init__.<locals>.on_field_endn  sG   ø€ ð ‘9ô ˜cŸh™h {Ó3Ó4�AØ#¢A˜Ø—J‘J”Là—
‘
”ÞÙ˜Q”KØ‘r"   c                 óB   >• T R                   b  T R                  5         g g r   rà   rÝ   s   €r   r  r  }  s   ø€ Ø—;‘;Ñ*Ø—K‘K•Mð +r"   )r/   r1   r2   r3   r4   zmultipart/form-datazNo boundary givenFc                 ó
   >• 0 m g r   r   )Úheaderss   €r   r@   Ú*FormParser.__init__.<locals>.on_part_beginš  s
   ø€ ð ‘r"   c                ó6   >• Tc   eTR                  XU 5        g r   r  )r[   rZ   r\   Úwriters      €r   rA   Ú)FormParser.__init__.<locals>.on_part_dataŸ  s   ø€ àÑ)Ð)Ð)Ø—‘˜T¨˜_Õ-r"   c                 óÜ   >• T c   eT R                  5         T(       a(  T(       a   [        T [        5      (       d   eT" T 5        g g T(       a   [        T [        5      (       d   eT" T 5        g g r   )rÏ   r®   r  r¿   )Úf_multiÚis_filer  r
  s   €€€€r   rB   Ú(FormParser.__init__.<locals>.on_part_end¥  sf   ø€ àÑ*Ð*Ð*Ø× Ñ Ô"ÞÞÜ)¨'´4×8Ñ8Ð8Ð8Ù Õ(ð ö  Ü)¨'´5×9Ñ9Ð9Ð9Ù  Õ)ð  r"   c                ó,   >• TR                  XU 5        g r   r  )r[   rZ   r\   Úheader_names      €r   rD   Ú,FormParser.__init__.<locals>.on_header_field²  r  r"   c                ó,   >• TR                  XU 5        g r   r  )r[   rZ   r\   rf   s      €r   rE   Ú,FormParser.__init__.<locals>.on_header_valueµ  s   ø€ Ø×#Ñ# D¨s OÕ4r"   c                 ó|   >• SR                  T5      TSR                  T 5      R                  5       '   T S S 2	 TS S 2	 g r  )rÜ   rž   )r&  rf   r  s   €€€r   rF   Ú*FormParser.__init__.<locals>.on_header_end¸  s6   ø€ Ø9<¿¹À,Ó9O�˜Ÿ™ Ó-×3Ñ3Ó5Ñ6Ø¢�NØ ¢‘Or"   c                 ód  >• Sm
T	R                  S5      n [        U 5      u  pUR                  S5      nUR                  S5      nUc  [        SU < S35      eT	R                  S5      nUb  UR                  S5      OS nUc
  [	        X6S	9mO[        XCTR                  US
9mSm
T	R                  SS5      R                  5       nUS;   a  Tmg US:X  a  [        T5      mg US:X  a  [        T5      mg TR                  R                  SU5        TR                  S   (       a  [        SU< S35      eTmg )NFs   content-dispositions   names   filenamez.Field name not found in Content-Disposition: "r–   s   content-typerª   rÁ   )r  rÂ   Ts   content-transfer-encodingó   7bit)s   binarys   8bitr-  s   base64s   quoted-printablez%Unknown Content-Transfer-Encoding: %rrU   z#Unknown Content-Transfer-Encoding ")r?  r½   r   r¯   r¿   r  r  rž   r   r   r  r1  )Úcontent_dispÚdispr¸   r^   r  Úcontent_type_brÂ   Útransfer_encodingr"  r  r#  r   r  s           €€€€€r   rG   Ú0FormParser.__init__.<locals>.on_headers_finished½  sG  ø€ ð  �ð  'Ÿ{™{Ð+AÓB�Ü 4°\Ó B‘�ð %Ÿ[™[¨Ó1�
Ø#ŸK™K¨Ó4�	àÑ%Ü)Ð,ZÐ[gÑZjÐjkÐ*lÓmÐmð ")§¡¨_Ó!=�ØCQÑC]˜~×4Ñ4°YÔ?Ðcg�ØÑ$Ü# JÑJ‘Gä" 9ÀÇÁÐ[gÑh�GØ"�Gð %,§K¡KÐ0LÈgÓ$V×$\Ñ$\Ó$^Ð!à$Ð(EÓEØ$‘Fà&¨)Ó3Ü*¨7Ó3‘Fà&Ð*=Ó=Ü3°GÓ<‘Fð —K‘K×'Ñ'Ð(OÐQbÔcØ—{‘{Ð#<×=Ü-Ð0SÐTeÑShÐhiÐ.jÓkÐkð ")™r"   c                 óh   >• Tb  TR                  5         T R                  b  T R                  5         g g r   r	  )r   r  s   €€r   r  r  ï  s+   ø€ àÑ%Ø—O‘OÔ%Ø—;‘;Ñ*Ø—K‘K•Mð +r"   )r@   rA   rB   rD   rE   rF   rG   r4   rX   rY   )r`  r€  r´  rµ  zUnknown Content-Type: %rzUnknown Content-Type: rÿ   )r[   r%   rZ   r#   r\   r#   r$   rý   )r	  r
  r&   r  rÂ   r½  Úbytes_receivedÚparserr  r
  r4   r   Úcopyr  Úupdaterx  r�  Úerrorr   r³  r1  ) r   rÂ   r  r
  r4   r½  r  r  r5  r;   r<   r  r/   r1   r2   r3   r@   rA   rB   rD   rE   rF   rG   r§   r"  r  r&  rf   r  r#  r  r  s    ` ``  `                @@@@@@@@@r   rÊ   ÚFormParser.__init__  sG  ÿü€ ô ×'Ò'¬Ó1ˆŒð )ˆÔØ ˆŒØˆÔØˆŒð !ˆŒØˆŒØˆŒð )-×(;Ñ(;×(@Ñ(@Ó(BˆŒØ�‰×Ñ˜6Ô"àQUˆð Ð5Ó5Ø $ˆD÷Añ A÷,÷
"ñ "ô 'Ø'/ÈwÑWØŸ™ _Ñ5ñŠFð
 Ð@Ó@ÀLÐToÓDoØ')ˆKà"ˆAô÷4÷)ð )÷ñ ÷"ô
 'à&4Ø%2Ø%2Ø$0Ø%ñð Ÿ™ _Ñ5ñ	‰Fð Ð2Ó2ØÑØ—‘×!Ñ!Ð"5Ô6Ü%Ð&9Ó:Ð:à')ˆKØ(*ˆLØ*,ˆGà+/ˆGØSWˆFØˆG÷÷
.÷*ò *÷4÷5÷$ñ $÷
0)ó 0)÷d"ð "ô %Øà%2Ø$0Ø#.Ø'6Ø'6Ø%2Ø+>Ø%ñ	ð Ÿ™ _Ñ5Ø!%§¡Ð-?Ñ!@Ø $§¡Ð,=Ñ >ñ‰Fð$ �K‰K×ÑÐ :¸LÔIÜ!Ð$:¸<¸.Ð"IÓJÐJàˆ�r"   c                ó’   • U =R                   [        U5      -  sl         U R                  c   eU R                  R                  U5      $ )z¦Write some data.  The parser will forward this to the appropriate
underlying parser.

Args:
    data: The data to write.

Returns:
    The number of bytes processed.
)r4  rœ   r5  rÎ   rÕ   s     r   rÎ   ÚFormParser.write  s>   € ð 	×Òœs 4›yÑ(Õà�{‰{Ñ&Ð&Ð&Ø�{‰{× Ñ  Ó&Ð&r"   c                óŒ   • U R                   b7  [        U R                   S5      (       a  U R                   R                  5         ggg)zFinalize the parser.NrÏ   )r5  ÚhasattrrÏ   rÝ   s    r   rÏ   ÚFormParser.finalize  s5   € à�;‰;Ñ"¤w¨t¯{©{¸J×'GÑ'GØ�K‰K× Ñ Õ"ð (HÐ"r"   c                óŒ   • U R                   b7  [        U R                   S5      (       a  U R                   R                  5         ggg)zClose the parser.Nrã   )r5  r=  rã   rÝ   s    r   rã   ÚFormParser.close"  s5   € à�;‰;Ñ"¤w¨t¯{©{¸G×'DÑ'DØ�K‰K×ÑÕð (EÐ"r"   c                ól   • U R                   R                   SU R                  < SU R                  < S3$ )Nz(content_type=z	, parser=rõ   )r÷   r&   rÂ   r5  rÝ   s    r   rù   ÚFormParser.__repr__'  s6   € Ø—.‘.×)Ñ)Ð*¨.¸×9JÑ9JÑ8MÈYÐW[×WbÑWbÑVeÐefÐgÐgr"   )	r½  r4  r  rÂ   r  r4   r  r
  r5  )rÂ   r°   r  úCallable[[Field], None] | Noner
  úCallable[[File], None] | Noner4   zCallable[[], None] | Noner½  zbytes | str | Noner  rû   r  údict[Any, Any]r$   rý   rþ   rÿ   r  )r&   r'   r(   r)   rn   rV   rû  rü  r   r6   rÊ   rÎ   rÏ   rã   rù   r*   r   r"   r   rþ  rþ  ú  s·   ‡ ññ. ˜u›Ø4Ø2Ø /ØØ!Ø %Ø"'à#(ñ(€NÐ$ó ð$ -1Ø'+Ø"&Ø!#ðnàðnð 1ðnð /ð	nð
 *ðnð %ðnð  ðnð ðnð 
õnô`'ô#ô
 ÷
hr"   rþ  c                ó
  • U R                  S5      nUc4  [        R                  " [        5      R	                  S5        [        S5      e[        U5      u  pEUR                  S5      nUR                  S5      n[        XAX&US9nU$ )a1  This function is a helper function to aid in creating a FormParser
instances.  Given a dictionary-like headers object, it will determine
the correct information needed, instantiate a FormParser with the
appropriate values and given callbacks, and then return the corresponding
parser.

Args:
    headers: A dictionary-like object of HTTP headers.  The only required header is Content-Type.
    on_field: Callback to call with each parsed field.
    on_file: Callback to call with each parsed file.
    config: Configuration variables to pass to the FormParser.
zContent-TypezNo Content-Type header givenzNo Content-Type header given!s   boundaryrª   )r½  r  )	r?  r	  r
  r&   r1  r  r½   r¯   rþ  )r  r  r
  r  rÂ   Úparamsr½  Úform_parsers           r   Úcreate_form_parserrI  +  s†   € ð$ (/§{¡{°>Ó'B€LØÑÜ×Òœ(Ó#×+Ñ+Ð,JÔKÜÐ8Ó9Ð9ô 0°Ó=Ñ€LØ�z‰z˜+Ó&€Hð  ×&Ñ& yÓ1€Lô ˜\°WÐX^Ñ_€Kð Ðr"   c                ó   • US:  a  [        SU< 35      e[        XU5      nU R                  S5      nUb  [        U5      nUS:  a  [        S5      eO[	        S5      nSn [        [        Xg-
  U5      5      nUR                  U5      n	UR                  U	5        U[        U	5      -  n[        U	5      U:w  d  Xv:X  a  OM^  UR                  5         g)aÚ  This function is useful if you just want to parse a request body,
without too much work.  Pass it a dictionary-like object of the request's
headers, and a file-like object for the input stream, along with two
callbacks that will get called whenever a field or file is parsed.

Args:
    headers: A dictionary-like object of HTTP headers.  The only required header is Content-Type.
    input_stream: A file-like object that represents the request body. The read() method must return bytestrings.
    on_field: Callback to call with each parsed field.
    on_file: Callback to call with each parsed file.
    chunk_size: The maximum size to read from the input stream and write to the parser at one time.
        Defaults to 1 MiB.
r
   z*chunk_size must be a positive number, not zContent-LengthNr   z#Content-Length must be non-negativery  )
r  rI  r?  r#   rV   Úminr    rÎ   rœ   rÏ   )
r  Úinput_streamr  r
  Ú
chunk_sizer5  Úcontent_lengthÚ
bytes_readÚmax_readableÚbuffs
             r   Ú
parse_formrR  Q  sà   € ð( �Aƒ~ÜÐEÀjÁ^ÐTÓUÐUô   °7Ó;€Fð 29·±Ð=MÓ1N€NØÑ!Ü˜^Ó,ˆØ˜AÓÜÐBÓCÐCð ô ˜u›ˆØ€Jà
äœ3˜~Ñ:¸JÓGÓHˆØ× Ñ  Ó.ˆð 	�‰�TÔØ”c˜$“iÑˆ
ô ˆt‹9˜Ó$¨
Ó(DØñ ð ‡O�OÕr"   )r¢   r°   r$   z	list[str])rµ   rK   r$   z tuple[bytes, dict[bytes, bytes]])
r  údict[str, bytes]r  rC  r
  rD  r  rE  r$   rþ  )rÿ  )r  rS  rL  r   r  rC  r
  rD  rM  r#   r$   rý   )HÚ
__future__r   r	  r  r4  rC  rE  Úenumr   Úior   r   Únumbersr   Útypingr   r	   Údecodersr   r   Ú
exceptionsr   r   r   r   Úcollections.abcr   r   r   r   r   r   r   r,   r9   r>   rI   rS   ri   r6   r  rÇ   rk   rs   rÏ  rÐ  râ  rã  ÚCOLONrè  rä  r£  ÚLOWER_AÚLOWER_ZÚNULLræ  Ú	frozensetrÜ  rû  rü  r¼  r¨   r½   r¿   r  r^  rx  r�  r³  rþ  rI  rR  r   r"   r   Ú<module>ra     s"  ðÞ "ã Û 	Û Û 
Û Ý ß &Ý ß &ç ;ß ^Ó ^æÝ(ßCÕCô/�xô /ô#˜y°ò #ô#˜y°ò #ô
	#˜Y¨eò 	#ô"�Y eò "ô˜:ô ð &ð	ñ€L�)ó ñ& ‹8€ô	�wô 	ô�Wô ð. Ð ØÐ ð
 €Ø€Ø€Ø€Ø	€Ø€	Ø
€Ø
€Ø€ðð ñ
 ˜KÓ(€ð Ð Ø Cà$Ð Ø XàÐ ðôô:!,÷HDWñ DW÷N{jñ {j÷|I0ñ I0ôXA0˜
ô A0ôH[
˜
ô [
ô|dH�jô dH÷Nnhñ nhðj	  ð	#Øð#à,ð#ð +ð#ð ð	#ð
 õ#ðV ð4Øð4àð4ð -ð4ð +ð	4ð
 ð4ð 
ö4r"   