Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
fields.cpython-313.pyc161 linesDownload Raw Back to __pycache__
1�

2��j1*����SSKJr SSKrSSKrSSKr\R\\4r	\R\	\3\\	4\4\\	\44rS5SSjjrSSjr
SSjrSSjrSSjr"SS	5rg)
�)�annotationsNc�X�U(a"[R"U5S=(d U$U$)z�6Guess the "Content-Type" of a file.7 8:param filename:9    The filename to guess the "Content-Type" of using :mod:`mimetypes`.10:param default:11    If no "Content-Type" can be guessed, default to `default`.12r)�	mimetypes�13guess_type)�filename�defaults  �TD:\code\apps\devtools\python\user_packages\Python313\site-packages\urllib3/fields.py�guess_content_typer14s'����#�#�H�-�a�0�;�G�;��N�c�l^�SSKnURS[SS9 [T[5(aTRS5m[
U4SjS55(dUS	TS153nURS5 U$[RRTS5mUST3mT$![[4a N;f=f)
av16Helper function to format and quote a single header parameter using the17strategy defined in RFC 2231.18 19Particularly useful for header parameters which might contain20non-ASCII values, like file names. This follows21`RFC 2388 Section 4.4 <https://tools.ietf.org/html/rfc2388#section-4.4>`_.22 23:param name:24    The name of the parameter, a string expected to be ASCII only.25:param value:26    The value of the parameter, provided as ``bytes`` or `str``.27:returns:28    An RFC-2231-formatted unicode string.29 30.. deprecated:: 2.0.031    Will be removed in urllib3 v3.0. This is not valid for32    ``multipart/form-data`` header parameters.33rNz�'format_header_param_rfc2231' is insecure, deprecated and will be removed in urllib3 v3.0. This is not valid for multipart/form-data header parameters.���34stacklevel�utf-8c3�,># �UH	oT;v� M g7f�N�)�.0�ch�values  �r	�	<genexpr>�.format_header_param_rfc2231.<locals>.<genexpr>@s����/�Y�r�U�{�Y�s�z"\
35�="�"�asciiz*=)
�warnings�warn�
FutureWarning�36isinstance�bytes�decode�any�encode�UnicodeEncodeError�UnicodeDecodeError�email�utils�encode_rfc2231)�namerr�results `  r	�format_header_param_rfc2231r+s����(��M�M�	1�	�����%�������W�%���/�Y�/�/�/��6��E�7�!�$��	��M�M�'�"��M��K�K�&�&�u�g�6�E��f�B�u�g��E��L��#�$6�7�	��	�s�$B � B3�2B3c��[U[5(aURS5nURSSSS.5nUSUS3$)a�37Format and quote a single multipart header parameter.38 39This follows the `WHATWG HTML Standard`_ as of 2021/06/10, matching40the behavior of current browser and curl versions. Values are41assumed to be UTF-8. The ``\n``, ``\r``, and ``"`` characters are42percent encoded.43 44.. _WHATWG HTML Standard:45    https://html.spec.whatwg.org/multipage/46    form-control-infrastructure.html#multipart-form-data47 48:param name:49    The name of the parameter, an ASCII-only ``str``.50:param value:51    The value of the parameter, a ``str`` or UTF-8 encoded52    ``bytes``.53:returns:54    A string ``name="value"`` with the escaped value.55 56.. versionchanged:: 2.0.057    Matches the WHATWG HTML Standard as of 2021/06/10. Control58    characters are no longer percent encoded.59 60.. versionchanged:: 2.0.061    Renamed from ``format_header_param_html5`` and62    ``format_header_param``. The old names will be removed in63    urllib3 v3.0.64rz%0Az%0Dz%22)�65�
�"rr)rr r!�	translate)r)rs  r	�format_multipart_header_paramr1OsI��<�%�������W�%��
�O�O��E�u�=�>�E��V�2�e�W�A��rc�J�SSKnURS[SS9 [X5$)�r66.. deprecated:: 2.0.067    Renamed to :func:`format_multipart_header_param`. Will be68    removed in urllib3 v3.0.69rNz~'format_header_param_html5' has been renamed to 'format_multipart_header_param'. The old name will be removed in urllib3 v3.0.r
r�rrrr1�r)rrs   r	�format_header_param_html5r6u�2����M�M�	#�	����)��5�5rc�J�SSKnURS[SS9 [X5$)r3rNzx'format_header_param' has been renamed to 'format_multipart_header_param'. The old name will be removed in urllib3 v3.0.r
rr4r5s   r	�format_header_paramr9�r7rc��\rSrSrSrSSSjjr\S
SSjj5rSSjrSSjr	SSjr70SSS	jjrS71rg)�RequestField�a�72A data container for request body parameters.73 74:param name:75    The name of this request field. Must be unicode.76:param data:77    The data/value body.78:param filename:79    An optional filename of the request field. Must be unicode.80:param headers:81    An optional dict-like object of headers to initially use for the field.82 83.. versionchanged:: 2.0.084    The ``header_formatter`` parameter is deprecated and will85    be removed in urllib3 v3.0.86Nc���XlX0lX l0UlU(a[	U5UlUb SSKnUR
S[SS9 XPlg[Ulg)NrzSThe 'header_formatter' parameter is deprecated and will be removed in urllib3 v3.0.r
r)87�_name�	_filename�data�headers�dictrrr�header_formatterr1)�selfr)r@rrArCrs       r	�__init__�RequestField.__init__�s]���88�!���	�.0������=�D�L��'���M�M�3���	
�
�%5�!�$A�D�!rc��[U[5(a%[U5S:XaUupEnOUupE[U5nOSnSnUnU"XXCS9nUR	US9 U$)aS89A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.90 91Supports constructing :class:`~urllib3.fields.RequestField` from92parameter of key/value strings AND key/filetuple. A filetuple is a93(filename, data, MIME type) tuple where the MIME type is optional.94For example::95 96    'foo': 'bar',97    'fakefile': ('foofile.txt', 'contents of foofile'),98    'realfile': ('barfile.txt', open('realfile').read()),99    'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'),100    'nonamefile': 'contents of nonamefile field',101 102Field names and filenames must be unicode.103�N)rrC)�content_type)r�tuple�lenr104�make_multipart)�cls�	fieldnamerrCrr@rI�
request_params        r	�from_tuples�RequestField.from_tuples�sn��6�e�U�#�#��5�z�Q��/4�,���!&���1�(�;���H��L��D���h�105�
�	�$�$�,�$�?��rc�$�URX5$)a;106Override this method to change how each multipart header107parameter is formatted. By default, this calls108:func:`format_multipart_header_param`.109 110:param name:111    The name of the parameter, an ASCII-only ``str``.112:param value:113    The value of the parameter, a ``str`` or UTF-8 encoded114    ``bytes``.115 116:meta public:117)rC)rDr)rs   r	�_render_part�RequestField._render_part�s���$�$�T�1�1rc���/n[U[5(aUR5nOUnUH*upEUcM118URUR	XE55 M, SRU5$)a119Helper function to format and quote a single header.120 121Useful for single headers that are composed of multiple items. E.g.,122'Content-Disposition' fields.123 124:param header_parts:125    A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format126    as `k1="v1"; k2="v2"; ...`.127�; )rrB�items�appendrS�join)rD�header_parts�parts�iterabler)rs      r	�
_render_parts�RequestField._render_partssc��&���l�D�)�)�#�)�)�+�H�#�H�#�K�D�� ����T�.�.�t�;�<�$��y�y���rc��/n/SQnUHInURRUS5(dM&URUSURU35 MK URR5H+upEXB;dMU(dMURUSU35 M- URS5 SR	U5$)z-128Renders the headers for this request field.129)�Content-Disposition�Content-Type�Content-LocationFz: z
130)rA�getrXrWrY)rD�lines�	sort_keys�sort_key�header_name�header_values      r	�render_headers�RequestField.render_headers#s�����O�	�!�H��|�|����%�0�0�����z��D�L�L��,B�+C�D�E�"�*.���);�);�)=�%�K��+��<��L�L�K�=��<�.�!A�B�*>�131	���V���{�{�5�!�!rc	���U=(d SSRSURSUR4SUR445/5-nXRS'X RS'X0RS'g	)132a�133Makes this request field into a multipart request field.134 135This method overrides "Content-Disposition", "Content-Type" and136"Content-Location" headers to the request parameter.137 138:param content_disposition:139    The 'Content-Disposition' of the request body. Defaults to 'form-data'140:param content_type:141    The 'Content-Type' of the request body.142:param content_location:143    The 'Content-Location' of the request body.144 145z	form-datarV�r)rr`rarbN)rYr]r>r?rA)rD�content_dispositionrI�content_locations    r	rL�RequestField.make_multipart6sy��( 3�A�k�T�Y�Y���"�"��d�j�j�)�J����+G�H��
�F146�147��/B���*�+�'3���^�$�+;���'�(r)r?r>r@rCrA)NNN)148r)�strr@�_TYPE_FIELD_VALUEr�149str | NonerAztyping.Mapping[str, str] | NonerC�5typing.Callable[[str, _TYPE_FIELD_VALUE], str] | Noner)rNrpr�_TYPE_FIELD_VALUE_TUPLErCrs�returnr;�r)rprrqrurp)rZz[dict[str, _TYPE_FIELD_VALUE | None] | typing.Sequence[tuple[str, _TYPE_FIELD_VALUE | None]]rurp)rurp)rmrrrIrrrnrrru�None)
�__name__�150__module__�__qualname__�__firstlineno__�__doc__rE�classmethodrPrSr]rirL�__static_attributes__rrr	r;r;�s����* $�37�RV�
B��B� �B��	B�1511�B�P�
B�8�152SW�	*��*�'�*�P�	*�153154�*��*�X2�  �
D� �155
�
 �>"�*+/�#'�'+�	<�'�<�!�<�%�	<�156157�<�<rr;)zapplication/octet-stream)rrrrrprurprv)�158__future__r�email.utilsr&r�typing�Unionrpr rqrJrtr159r+r1r6r9r;rrr	�<module>r�s���"���
��L�L��e��,�� �,�,��	�#� �160 �!�	�#� �#�161%�&�(���*D�
��
�#&�
��
� -�`#�L6�$6�$|<�|<r
codekingpro/portable-devtools · Team Ai