zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
U
 ý°d[    ã@sÂddlmZddlZddlZddlZddlZddlmZddlm    Z    m
Z
e  d¡dZ ej ejejee    fe
fZejeejee    ffZdd    œd
d „Zd d dœdd„Zdd dddœdd„ZdS)é)Ú annotationsN)ÚBytesIOé)Ú_TYPE_FIELD_VALUE_TUPLEÚ RequestFieldzutf-8éÚstr)ÚreturncCst t d¡¡ ¡S)zN
    Our embarrassingly-simple replacement for mimetools.choose_boundary.
    é)ÚbinasciiÚhexlifyÚosÚurandomÚdecode©rrúGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\urllib3/filepost.pyÚchoose_boundarysrÚ _TYPE_FIELDSztyping.Iterable[RequestField])Úfieldsr    ccsFt|tjƒr| ¡}n|}|D]"}t|tƒr4|Vqtj|ŽVqdS)z†
    Iterate over fields.
 
    Supports list of (k, v) tuples and dicts, and lists of
    :class:`~urllib3.fields.RequestField`.
 
    N)Ú
isinstanceÚtypingÚMappingÚitemsrÚ from_tuples)rÚiterableÚfieldrrrÚiter_field_objectss
 
 
rz
str | Noneztuple[bytes, str])rÚboundaryr    cCsÀtƒ}|dkrtƒ}t|ƒD]t}| d|›d d¡¡t|ƒ | ¡¡|j}t|t    ƒrbt
|ƒ}t|t
ƒr|t|ƒ |¡n
| |¡| d¡q| d|›d d¡¡d|›}|  ¡|fS)a¢
    Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
 
    :param fields:
        Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
        Values are processed by :func:`urllib3.fields.RequestField.from_tuples`.
 
    :param boundary:
        If not specified, then a random boundary will be generated using
        :func:`urllib3.filepost.choose_boundary`.
    Nz--z
zlatin-1s
z--
zmultipart/form-data; boundary=) rrrÚwriteÚencodeÚwriterÚrender_headersÚdatarÚintrÚgetvalue)rrÚbodyrr"Ú content_typerrrÚencode_multipart_formdata3s  
 
 
 
r')N)Ú
__future__rr Úcodecsr rÚiorrrrÚlookupr ÚSequenceÚUnionÚTuplerZ_TYPE_FIELDS_SEQUENCErrrrr'rrrrÚ<module>s&  ÿ ÿÿÿ