Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j��	��%SrSSKJr SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK3r4SSKrSSKrSSK
r
SSKJr SSKJrJr SSKJrJrJrJrJrJr SSKJrJr SS	KJr SS5KJr SSK J!r!J"r"J#r#J$r$ SSK%J&r' SS
K(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5 SSK(J6r7 SSK8J9r9 SSK:J;r;J<r<J=r=J>r> SSK?J@r@ \(aSSKAJBrB SSKJCrC SSKJ%rD SSKEJFrFJGrGJHrH SrIS\JS'\R�"5rLS\JS'SSS.rMS\JS'\"S5rN\"S 5rOS!R�\R�"S"\"S#S$9S%55rRS\JS&'\6R�S':Xa7S\S(jrTS\S)jr/S]S*jrUS^S+jrVS_S`S,jjrWSaS-jrXSbS.jrY\R�ScS/j5r[SdS0jr\\SeS1j5r]\SfS2j5r]SgS3jr]ShS4jr^SiS5jr_S_SjS6jjr`SkS7jraSlS8jrbSmS9jrcSnS:jrdSoS;jreSpS<jrf\SqS=j5rg\SrS>j5rgSsS?jrgStS@jrh\i"SA5rjS\JSB'SuSCjrkSuSDjrlSvSEjrmSwSFjrnSxSGjroSySHjrp\R�SzSIj5rqS{SJjrrS|S}SKjjrsS~SLjrtSS�SMjjruS�S�SNjjrvS�SOjrwS�SPjrxSQR�SR5rz\zSS-r{\zST-r|S�SUjr}S�SVjr~S�SWjrS�SXjr�S�SYjr�S�SZjr�S�S[jr�g)�z�8requests.utils9~~~~~~~~~~~~~~10 11This module provides utility functions that are used within Requests12that are also useful for external consumption.13�)�annotationsN)�OrderedDict)�	Generator�Iterable)�
TYPE_CHECKING�Any�Final�TypeVar�cast�overload)�make_headers�	parse_url�)�certs��__version__)�_HEADER_VALIDATORS_BYTE�_HEADER_VALIDATORS_STR�HEADER_VALIDATORS�to_native_string)�
SupportsItems)
�Mapping�bytes�14getproxies�getproxies_environment�
integer_types�is_urllib3_1�proxy_bypass�proxy_bypass_environment�quote�str�unquote�urlparse�15urlunparse)�parse_http_list��cookiejar_from_dict)�FileModeWarning�
InvalidHeader�16InvalidURL�UnrewindableBodyError)�CaseInsensitiveDict)�	CookieJar)�BufferedWriter)�_types)�PreparedRequest�Request�Response)z.netrc�_netrcr	�NETRC_FILESr!�DEFAULT_CA_BUNDLE_PATH�Pi�)�http�https�
DEFAULT_PORTS�_KT�_VTz, z,\s*T)�accept_encodingzaccept-encoding�DEFAULT_ACCEPT_ENCODING�win32c�D�SSKnURURS5n[	URUS5S5nURUS5SnU(aU(dgURS5n[SU5nUHsnUS:XaSU;a g	URSS175nURSS5nURS
S5n[R"XP[R5(dMs g	 g![a gf=f![[4a gf=f)NrFz;Software\Microsoft\Windows\CurrentVersion\Internet Settings�ProxyEnable�
ProxyOverride�;z<local>�.Tz\.�*z.*�?)�winreg�ImportError�OpenKey�HKEY_CURRENT_USER�int�QueryValueEx�OSError�18ValueError�split�filter�replace�re�match�I)�hostrF�internetSettings�proxyEnable�
proxyOverride�tests      �TD:\code\apps\devtools\python\user_packages\Python313\site-packages\requests/utils.py�proxy_bypass_registryrZcs!��	��19	�%�~�~��(�(�N� ��20�f�1�1�2B�M�R�ST�U�V�K�"�/�/�0@�/�R�ST�U�M��-��21&�+�+�C�0�
��t�]�3�
�!�D��y� ��d�?���<�<��U�+�D��<�<��U�+�D��<�<��T�*�D��x�x��B�D�D�)�)��"���C�	��	����$�	��	�s#�C<�AD�<22D	�D	�D�Dc�L�[5(a[U5$[U5$)z�Return True, if the host should be bypassed.23 24Checks proxy settings gathered from the environment, if specified,25or the registry.26)rrrZ)rTs rYrr�s#��"�#�#�+�D�1�1�(��.�.�c�P�[U[5(aUR5$U$)z/Returns an internal sequence dictionary update.)�27isinstance�_SupportsItems�items)�ds rY�dict_to_sequencerb�s"��28�!�^�$�$��w�w�y���Hr\c�V�SnSn[(d&[U[5(aURS5n[	US5(a[U5nO�[	US5(a
UR29nOm[	US5(a\UR
5n[R"U5RnSUR;a[R"S[5 [	US5(abUR#5n[	US	5(a@Uc=UR%SS305 UR#5nUR%U=(d S5 UcSn[)SX-315$![R[ 4a N�f=f![&a SnNAf=f![&a UbUnNVf=f)Nr�utf-8�__len__�len�fileno�ba%Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.�tell�seek�)rr^r!�encode�hasattrrfrg�os�fstat�st_size�mode�warnings�warnr(�io�UnsupportedOperation�AttributeErrorrirjrL�max)�o�total_length�current_positionrgs    rY�	super_lenr{�s����L����<�J�q�#�.�.�
�H�H�W����q�)����1�v��	��E�	�	��u�u��	��H�	�	�	��X�X�Z�F��8�8�F�+�3�3�L��!�&�&� ��
�
�2�$�32��q�&���	%� �v�v�x���q�&�!�!�l�&:�	%��F�F�1�a�L�#$�6�6�8�L��F�F�+�0�q�1������q�,�1�2�2��e�'�'��8�	�
�		��X�%�#$�L�%��%�	0�33�'�#/� ��
	0�s6�E$�0F�<F�$F�F�F�F�F(�'F(c��[U[5(aURS5n[RRS5nUbU4nO
S[5nSSKJnJn SnUHJn[RRU5n[RRU5(dMHUn O Ucg[U5n	U	Rn34U35cgU"U5RU365nU(a:[U5(a)US(aSOSnX�=(d SUS	=(d S4$gg!U[ 4a U(aegf=f!["[$4a gf=f)37z;Returns the Requests tuple auth for a given url from netrc.rd�NETRCNc3�,# �UH38nSU3v� M g7f)z~/N�)�.0�fs  rY�	<genexpr>�!get_netrc_auth.<locals>.<genexpr>�s���9�[��R��s�8�[�s�r)�NetrcParseError�netrcr�rk)r^r�decodern�environ�getr4r�r��path�39expanduser�existsr#�hostname�authenticators�anyrLrGrv)
�url�raise_errors�40netrc_file�netrc_locationsr�r��41netrc_pathr��loc�rirTr3�login_is
             rY�get_netrc_authr��sA��42�#�u����j�j��!��������(�J���%�-��9�[�9��#
�0��43� �A��'�'�$�$�Q�'�C��w�w�~�~�c�"�"� �44��	!����
�c�]���{�{���<��45	��:�&�5�5�d�;�F��#�f�+�+�%�a�y�!�a����-�2�v�a�y��B�?�?�&�v�� ��)�	����	��
��(�
��
�s>�AE�/	E�9E�AD.�.E�E�E�E�E�Ec���[USS5nU(aO[U[[45(a3USS:wa)USS:wa[R46R
U5$gggg)z0Tries to guess the filename of the given object.�nameNr�<������>)�getattrr^r!rrnr��basename)�objr�s  rY�guess_filenamer�s[���3���%�D��47�4�#�u��.�.�4��7�c�>�d�2�h�RU�o��w�w����%�%�GV�>�.�tr\c��[RRU5(aU$[RRU5upU(a�[RRU5(dh[RRU5upU(dO?SR	X2/5nU(a&[RRU5(dMh[48R"U5(dU$[49R"U5nX$R5;aU$[RRURS5S5Sn[R"US9upg[R"XdRU55 [R"U5 U$![R"U5 f=f)z�Replace nonexistent paths that look like they refer to a member of a zip50archive with the location of an extracted copy of the target, or else51just return the provided path unchanged.52�/r�)�suffix)rnr�r�rN�join�zipfile�53is_zipfile�ZipFile�namelist�splitext�tempfile�mkstemp�write�read�close)r��archive�member�prefix�zip_filer��fd�extracted_paths        rY�extract_zipped_pathsr�"s;��5455�w�w�~�~�d������g�g�m�m�D�)�O�G�56�"�'�'�.�.��1�1��'�'�-�-��0����
����6�*�+��
�"�'�'�.�.��1�1����g�&�&������w�'�H�
�&�&�(�(����W�W�
�
�f�l�l�3�/��3�
4�R�
8�F�!�)�)��8��B��57����]�]�6�*�+�58��������	�����s�.%F+�+Gc#�T# �[R"[RR	U5S9up[R59"US5nUv� SSS5 [R"X 5 g!,(df   N%=f![a [R"U5 ef=f7f)z-Write a file to the disk in an atomic fashion)�dir�wbN)	r�r�rnr��dirname�fdopenrP�
BaseException�remove)�filename�tmp_descriptor�tmp_name�tmp_handlers    rY�atomic_openr�Hsz��� (�/�/�B�G�G�O�O�H�4M�N��N��
�Y�Y�~�t�
,����-�60�61�62�8�&�-�
,����63�	�	�(��
��s4�4B(�B�A2�B�1B(�264B�<B�"B%�%B(c��Ucg[U[[[[45(a[S5e[
U5$)a�Take an object and test to see if it can be represented as a65dictionary. Unless it can not be represented as such, return an66OrderedDict, e.g.,67 68::69 70    >>> from_key_val_list([('key', 'val')])71    OrderedDict([('key', 'val')])72    >>> from_key_val_list('string')73    Traceback (most recent call last):74    ...75    ValueError: cannot encode objects that are not 2-tuples76    >>> from_key_val_list({'key': 'val'})77    OrderedDict([('key', 'val')])78 79:rtype: OrderedDict80N�+cannot encode objects that are not 2-tuples)r^r!r�boolrJrMr��values rY�from_key_val_listr�Us9��(
�}���%�#�u�d�C�0�1�1��F�G�G��u��r\c��g�Nrr�s rY�to_key_val_listr�rs��*-r\c��gr�rr�s rYr�r�ts�� r\c���Ucg[U[[[[45(a[S5e[U[5(a[UR55$[U5$)a�Take an object and test to see if it can be represented as a81dictionary. If it can be, return a list of tuples, e.g.,82 83::84 85    >>> to_key_val_list([('key', 'val')])86    [('key', 'val')]87    >>> to_key_val_list({'key': 'val'})88    [('key', 'val')]89    >>> to_key_val_list('string')90    Traceback (most recent call last):91    ...92    ValueError: cannot encode objects that are not 2-tuples93 94:rtype: list95Nr�)	r^r!rr�rJrMr_�listr`r�s rYr�r�xsV��&
�}���%�#�u�d�C�0�1�1��F�G�G��%��(�(��E�K�K�M�"�"���;�r\c��/n[U5H8nUSSUSSs=:XaS:XaO O[USS5nURU5 M: U$)a�Parse lists as described by RFC 2068 Section 2.96 97In particular, parse comma-separated lists where the elements of98the list may include quoted-strings.  A quoted-string could99contain a comma.  A non-quoted string could have quotes in the100middle.  Quotes are removed automatically after parsing.101 102It basically works like :func:`parse_set_header` just that items103may appear multiple times and case sensitivity is preserved.104 105The return value is a standard :class:`list`:106 107>>> parse_list_header('token, "quoted value"')108['token', 'quoted value']109 110To create a header from the :class:`list` again, use the111:func:`dump_header` function.112 113:param value: a string with a list header.114:return: :class:`list`115:rtype: list116Nrr��")�_parse_list_header�unquote_header_value�append)r��result�items   rY�parse_list_headerr��sT��.�F�"�5�)�����8�t�B�C�y�'�C�'�'��Q�r�117�3�D��
�
�d��*��Mr\c��0n[U5HKnSU;aSX'MURSS5up0USSUSSs=:XaS:XaO O[USS5nXU'MM U$)a"Parse lists of key, value pairs as described by RFC 2068 Section 2 and118convert them into a python dict:119 120>>> d = parse_dict_header('foo="is a fish", bar="as well"')121>>> type(d) is dict122True123>>> sorted(d.items())124[('bar', 'as well'), ('foo', 'is a fish')]125 126If there is no value for a key it will be `None`:127 128>>> parse_dict_header('key_without_value')129{'key_without_value': None}130 131To create a header from the :class:`dict` again, use the132:func:`dump_header` function.133 134:param value: a string with a dict header.135:return: :class:`dict`136:rtype: dict137�=Nrr�r�)r�rNr�)r�r�r�r�s    rY�parse_dict_headerr��sr��,%'�F�"�5�)���d�?��F�L���j�j��a�(�����!�9��b�c�138�)�c�)�(��q���5�E��t��*��Mr\c��U(aNUSUSs=:XaS:Xa;O U$USSnU(a	USSS:wa"URSS5RS	S5$U$)139z�Unquotes a header value.  (Reversal of :func:`quote_header_value`).140This does not use the real unquoting but what browsers are actually141using for quoting.142 143:param value: the header value to unquote.144:rtype: str145rr�r�rNrkz\\�\z\")rP)r��is_filenames  rYr�r��sd��
��q��U�2�Y�-�#�-��L��a�����e�B�Q�i�6�1��=�=���.�6�6�u�c�B�B��Lr\c�\�UVs0sHoRUR_M nnU$s snf)ztReturns a key/value dictionary from a CookieJar.146 147:param cj: CookieJar object to extract cookies from.148:rtype: dict149)r�r�)�cj�cookie�cookie_dicts   rY�dict_from_cookiejarr��s.��<>�>�2��;�;����,�2�K�>����?s� )c��[X5$)z�Returns a CookieJar from a key/value dictionary.150 151:param cj: CookieJar to insert cookies into.152:param cookie_dict: Dict of key/values to insert into CookieJar.153:rtype: CookieJar154r&)r�r�s  rY�add_dict_to_cookiejarr��s���{�/�/r\c�Z�[R"S[5 [R"S[R155S9n[R"S[R156S9n[R"S5nUR
U5UR
U5-UR
U5-$)zdReturns encodings from given content string.157 158:param content: bytestring to extract encodings from.159z�In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)z!<meta.*?charset=["\']*(.+?)["\'>])�flagsz+<meta.*?content=["\']*;?charset=(.+?)["\'>]z$^<\?xml.*?encoding=["\']*(.+?)["\'>])rrrs�DeprecationWarningrQ�compilerS�findall)�content�160charset_re�	pragma_re�xml_res    rY�get_encodings_from_contentr�161s���162
�M�M�
1�	�
����@����M�J��163�164�I�QS�QU�QU�V�I�
�Z�Z�?�
@�F�	���7�#�165�166�167�G�168$�	%�169�.�.��170!�	"�r\c�N�URS5nUSR5USSp20nSnUHqnUR5nU(dMURS5=nS:wdM5USURU5nXgS-SRU5n	X�UR5'Ms X$4$)z�Returns content type and parameters from given header.171 172:param header: string173:return: tuple containing content type and dictionary of174     parameters.175rBrrNz"' r�r�)rN�strip�find�lower)176�header�tokens�content_type�params�params_dict�strip_chars�param�idx�keyr�s177          rY�_parse_content_type_headerr�#s����\�\�#�
�F�!�!�9�?�?�,�f�Q�R�j�&�)+�K��K������
���5�U�Z�Z��_�,�c��3����+�#�#�K�0�C���'�)�$�*�*�;�7�E�',��	�	��$���$�$r\c��URS5nU(dg[U5upSU;aUSRS5$SU;agSU;agg)	zqReturns encodings from given HTTP Header Dict.178 179:param headers: dictionary to extract encoding from.180:rtype: str181zcontent-typeN�charsetz'"�textz182ISO-8859-1zapplication/jsonrd)r�r�r�)�headersr�r�s   rY�get_encoding_from_headersr9s^���;�;�~�.�L���5�l�C��L��F���i� �&�&�u�-�-�
�����\�)��*r\c#�# �URcUShv�N g[R"UR5"SS9nUH!nURU5nU(dMUv� M# URSSS9nU(aUv� ggNm7f)zStream decodes an iterator.NrP��errorsr\T)�final)�encoding�codecs�getincrementaldecoderr�)�iterator�r�decoder�chunk�rvs     rY�stream_decode_response_unicoder
Rs~���183	�z�z�������*�*�1�:�:�6�i�H�G���
�^�^�E�
"��
�2��H��184����4��	(�B�	���185�	�s�B�B�AB�&Bc��gr�r��string�slice_lengths  rY�iter_slicesres��$'r\c��gr�rrs  rYrris��"%r\c#�# �SnUbUS::a[U5nU[U5:aXX!-v� X!-
nU[U5:aMgg7f)z Iterate over slices of a string.rN)rf)rr�poss   rYrrmsR����C���|�q�0��6�{��186
��F��187��3�-�.�.������F��188�s�AA�Ac�v�[R"S[5 URcg/n[	UR1895nU(a[
URU5$[
URU=(d SSS9$![a URU5 N<f=f![a URs$f=f)z�Returns the requested content back in unicode.190 191:param r: Response object to get unicode content from.192 193Tried:194 1951. charset from content-type1962. fall back and replace all unicode characters197 198:rtype: str199z�In requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)NrdrPr)200rrrsr�r�rr�r!�UnicodeErrorr��	TypeError)r	�tried_encodingsrs   rY�get_unicode_from_responserys���
�M�M�
1�	�
�	�y�y���!#�O�)����3�H��	-��q�y�y�(�+�+�201��1�9�9�h�1�'�)�D�D���	-��"�"�8�,�	-�����y�y���s$�	A>� B�>B�B�B8�7B8zBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~�UNRESERVED_SETc��URS5n[S[U55HpnXSSn[U5S:XaNUR5(a9[	[US55nU[;aXAUSS-X'M\SX3X'MgSX3X'Mr S	RU5$![a [SUS35ef=f)202z�Un-escape any percent-escape sequences in a URI that are unreserved203characters. This leaves all reserved, illegal and non-ASCII bytes encoded.204 205:rtype: str206�%rrrk�z"Invalid percent-escape sequence: '�'Nr�)207rN�rangerf�isalnum�chrrJrMr*rr�)�uri�parts�i�h�cs     rY�unquote_unreservedr(�s���
�I�I�c�N�E�
�1�c�%�j�
!���H�Q�q�M���q�6�Q�;�1�9�9�;�;�
L���A�r�208�O���N�"��Q�x���|�+����u�x�j�>����5�8�*�~�E�H�"��7�7�5�>����
L� �#E�a�S��!J�K�K�
L�s�B,�,Cc�d�SnSn[[U5US9$![a [XS9s$f=f)z�Re-quote the given URI.209 210This function passes the given URI through an unquote/quote cycle to211ensure that it is fully and consistently quoted.212 213:rtype: str214z!#$%&'()*+,/:;=?@[]~z!#$&'()*+,/:;=?@[]~)�safe)r r(r*)r#�safe_with_percent�safe_without_percents   rY�requote_urir-�sG��/��0��	5��'��,�3D�E�E���5��S�4�4�	5�s��/�/c215�x�[R"S[R"U55SnUR	S5up4[R"S[R"[[
U5555Sn[R"S[R"U55SU-nX%-Xe-:H$)z�This function allows you to check if an IP belongs to a network subnet216 217Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24218         returns False if ip = 192.168.1.1 and net = 192.168.100.0/24219 220:rtype: bool221z=Lrr�)�struct�unpack�socket�	inet_atonrN�dotted_netmaskrJ)�ip�net�ipaddr�netaddr�bits�netmask�networks       rY�address_in_networkr;�s����]�]�4��!1�!1�"�!5�
6�q�
9�F��I�I�c�N�M�G��m�m�D�&�"2�"2�>�#�d�)�3L�"M�N�q�Q�G��m�m�D�&�"2�"2�7�";�<�Q�?�'�I�G���'�"3�4�4r\c�t�SSSU-222-S-223-n[R"[R"SU55$)zuConverts mask from /xx format to xxx.xxx.xxx.xxx224 225Example: if mask is 24 function returns 255.255.255.0226 227:rtype: str228l��r� z>I)r1�	inet_ntoar/�pack)�maskr8s  rYr3r3�s7����b�4�i��1�,�,�D����F�K�K��d�3�4�4r\c�R�[R"U5 g![a gf=f)z229:rtype: bool230FT)r1r2rL)�	string_ips rY�is_ipv4_addressrC�s.�������#�������s��231&�&c��URS5S:XaU[URS5S5nUS:dUS:�ag[R232"URS5S5 gg![a gf=f![a gf=f)zJ233Very simple check of the cidr format in no_proxy variable.234 235:rtype: bool236r�rFr=rT)�countrJrNrMr1r2rL)�string_networkr@s  rY�
is_valid_cidrrG�s������C� �A�%�	��~�+�+�C�0��3�4�D��!�8�t�b�y��	����^�1�1�#�6�q�9�:�237����	��	���	��	�s#�A,�(A<�,238A9�8A9�<239B	�B	c#�^# �USLnSnU(a2[RRU5nU[RU'Sv� U(a)Uc[RU	gU[RU'gg!U(a)Uc[RU	fU[RU'ff=f7f)z�Set the environment variable 'env_name' to 'value'240 241Save previous value, yield, and then restore the previous value stored in242the environment variable 'env_name'.243 244If 'value' is None, do nothingN)rnr�r�)�env_namer��
value_changed�	old_values    rY�set_environrLs������%�M� �I���J�J�N�N�8�,�	�$��245�246�8��1�
��� ��J�J�x�(�'0��247�248�8�$�	��=�� ��J�J�x�(�'0��249�250�8�$�	�s�AB-�A8�1B-�82B*�*B-c���SSjnUnUcU"S5n[U5nURnUcgU(a�SURSS5RS55n[	U5(a5UH.n[U5(a[
XW5(a gM'XW:XdM. g O~UnUR(aUS	UR3-
nUHSn	U	RS2515n	XY:XdX�:Xa gS252U	-n	URU	5(dURU	5(dMS g [SU5 [U5n253SSS5 W254(agg![[R4a Sn255N/f=f!,(df   N9=f)
z@256Returns whether we should bypass proxies or not.257 258:rtype: bool259c��[RRU5=(d- [RRUR55$r�)rnr�r��upper)r�s rY�	get_proxy�(should_bypass_proxies.<locals>.get_proxy3s-���z�z�~�~�c�"�A�b�j�j�n�n�S�Y�Y�[�&A�Ar\N�no_proxyTc3�6# �UHo(dMUv� M g7fr�r)r�rTs  rYr��(should_bypass_proxies.<locals>.<genexpr>Es���X�+O�4�SW�$�$�+O�s�260�	� r��,�:rCF)r�r!�return�261str | None)r#r�rPrNrCrGr;�port�lstrip�endswithrLrrr1�gaierror)r�rRrP�no_proxy_arg�parsedr��no_proxy_hosts�proxy_ip�host_with_portrT�bypasss           rY�should_bypass_proxiesrd*si��B�262�L����Z�(��
�c�]�F����H�����Y�8�+;�+;�C��+D�+J�+J�3�+O�X���8�$�$�*�� ��*�*�)�(�=�=�#�>��)� �+�&�N��{�{��A�f�k�k�]�"3�3��&���{�{�3�'���#�~�'=���T�z���$�$�T�*�*�n�.E�.E�d�.K�.K��
'�263�Z��	.�	�!�(�+�F�264/�����
�6�?�?�+�	��F�	��265/�	.�s*�,E,�.E266�267E)�&E,�(E)�)E,�,268E:c�6�[XS9(a0$[5$)z5269Return a dict of environment proxies.270 271:rtype: dict272�rR)rdr)r�rRs  rY�get_environ_proxiesrgis���S�4��	��|�r\c�>�U=(d 0n[U5nURc+URURURS55$URS-UR-URSUR-S/nSnUHnXQ;dM273Xn U$ U$)z�Select a proxy for the url, if applicable.274 275:param url: The url being for the request276:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs277N�allz://zall://)r#r�r��scheme)r��proxies�urlparts�278proxy_keys�proxy�	proxy_keys      rY�select_proxyrpus����m��G���}�H���� ��{�{�8�?�?�G�K�K��,>�?�?�	���%��(�"3�"3�3�����8�$�$�$�
�	�J�
�E��	����&�E���L� �279�Lr\c�`�UbUO0n[[UR5n[U5RnURS5nUR
5nU(aO[X5S9(dA[X5S9nURXGRS55nU(aURXH5 U$)a�This method takes proxy information from a request and configuration280input to resolve a mapping of target proxies. This will consider settings281such as NO_PROXY to strip proxy configurations.282 283:param request: Request or PreparedRequest284:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs285:param trust_env: Boolean declaring whether to trust environment configs286 287:rtype: dict288rRrfri)289rr!r�r#rjr��copyrdrg�290setdefault)	�requestrk�	trust_envr�rjrR�new_proxies�environ_proxiesrns	         rY�resolve_proxiesrx�s���!�,�g�"�G�291�s�G�K�K�292 �C�
�c�]�
!�
!�F��{�{�:�&�H��,�,�.�K��.�s�F�-�c�E���#�#�F�,?�,?��,F�G����"�"�6�1��r\c��US[3$)zC293Return a string representing the default user agent.294 295:rtype: str296r�r)r�s rY�default_user_agentrz�s���V�1�[�M�"�"r\c�:�[[5[SSS.5$)z1297:rtype: requests.structures.CaseInsensitiveDict298z*/*z299keep-alive)z300User-AgentzAccept-Encoding�Accept�301Connection)r,rzr=rr\rY�default_headersr~�s%���,�.�6��&�		302��r\c���/nSnURU5nU(dU$[R"SU5H�nURSS5upESURS50nURS5H9nURS5up�URU5XhRU5'M; UR	U5 M� U$![a USpTN�f=f![a  M8f=f)	z�Return a list of parsed link headers proxies.303 304i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"305 306:rtype: list307z '"z, *<rBrr�r�z<> '"r�)r�rQrNrMr�)	r��links�
replace_chars�valr�r��linkr�r�s	         rY�parse_header_linksr��s���#%�E��M��K�K�
�&�E�����x�x���&��	"��)�)�C��+�K�C�!&�s�y�y��':�;���\�\�#�&�E�
�"�[�[��-�308��.3�[�[��-G�D���=�)�*�
'�	���T��!'�$�L���	"��r��	"���
��
�s#�C�6C�
C�C�309C(�'C(��asciirk�c��USSnU[R[R4;agUSS[R:XagUSS[R[R3104;agUR
[5nUS:Xag	US:Xa"USSS2[:Xag311USSS2[:XagUS:XaUSS[:Xag
USS[:Xagg)z
312:rtype: str313N�zutf-32r�z	utf-8-sigrkzutf-16rrdz	utf-16-berz	utf-16-lez	utf-32-bez	utf-32-le)314r�BOM_UTF32_LE�BOM_UTF32_BE�BOM_UTF8�BOM_UTF16_LE�BOM_UTF16_BErE�_null�_null2�_null3)�data�sample�	nullcounts   rY�guess_json_utfr��s����"�1�X�F�
�&�%�%�v�':�':�;�;��
�b�q�z�V�_�_�$��
�b�q�z�f�)�)�6�+>�+>�?�?�����U�#�I��A�~���A�~��#�A�#�;�&� ���!�$�Q�$�<�6�!���A�~��"�1�:�����!�"�:����r\c���[U5nUup4pVpxn	URn315U316(dXzpzU(a"[[U3175n318SR	XJ/5n319UcUnUcSn[X:USX�45$)z�Given a URL that may or may not have a scheme, prepend the given scheme.320Does not replace a present scheme with the one provided as an argument.321 322:rtype: str323�@r�)r�netlocrr!r�r$)r��324new_schemer_rj�auth�_host�_portr��query�fragmentr�s           rY�prepend_scheme_if_neededr�sw���s�^�F�8>�5�F�%��X��]�]�F������c�6�"�����4�.�)��
�~����|����v�t�R��A�B�Br\c��[U5n[UR5[UR54nU$![[3254a SnU$f=f)zoGiven a url with authentication components, extract them into a tuple of326username,password.327 328:rtype: (str,str)329)r�r�)r#r"�username�passwordrvr)r�r_r�s   rY�get_auth_from_urlr�.sU���c�]�F������(�'�&�/�/�*B�C���K��
�I�&�����K��s�*9�A�Ac�<�Uup[XS5 [XS5 g)z�Verifies that header parts don't contain leading whitespace330reserved characters, or return characters.331 332:param header: tuple, in the format (name, value).333rrN)�_validate_header_part)r�r�r�s   rY�check_header_validityr�?s���K�D��&��*��&��+r\c334� �[U[5(a335[UnO=[U[5(a336[UnO[SU<SUS[
U535eURU5(dUS:XaSOSn[SUSU<35eg)	Nz
Header part (z) from z# must be of type str or bytes, not rr�r�zTInvalid leading whitespace, reserved character(s), or return character(s) in header z: )r^r!rrrr)�typerR)r��header_part�header_validator_index�	validator�header_kinds     rYr�r�Js���337�+�s�#�#�*�+A�B�	�	�K��	'�	'�+�,B�C�	���K�?�'�&��:1�15�k�1B�0C�
E�338�	339�340�?�?�;�'�'� 6�!� ;�f����&�&1�]�"�[�O�
E�341�	342�(r\c�z�[U5upp4pVU(dX2p2URSS5Sn[XX4US45$)zK343Given a url remove the fragment and the authentication part.344 345:rtype: str346r�rr�r�)r#�rsplitr$)r�rjr�r�r�r��	_fragments       rY�
urldefragauthr�bsG��6>�c�]�2�F�D�%����
�]�]�3��
"�2�
&�F��v�t�U�B�?�@�@r\c���[URSS5nUb3[UR[5(aU"UR5 g[
S5e![347a [
S5ef=f)z^Move file pointer back to its recorded starting position348so it can be read again on redirect.349rjNz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)r��bodyr^�_body_positionrrLr+)�prepared_request�	body_seeks  rY�rewind_bodyr�ssz���(�-�-�v�t�<�I�����'�'��"�"�	��&�5�5�6�$�$Q�R�R���	�'�M��
�	�s�A�A/)rTr!rXr�)raz6_t.SupportsItems[Any, Any] | Iterable[tuple[Any, Any]]rXzIterable[tuple[Any, Any]])rxrrXrJ)F)r�z350_t.UriTyper�r�rXztuple[str, str] | None)r�rrXrY)r�r!rXr!)r�r!rXz%Generator[BufferedWriter, None, None])r�z4Mapping[Any, Any] | Iterable[tuple[Any, Any]] | NonerXzdict[Any, Any] | None)r��NonerXr�)r�z6_t.SupportsItems[_KT, _VT] | Iterable[tuple[_KT, _VT]]rXzlist[tuple[_KT, _VT]])r�z=_t.SupportsItems[_KT, _VT] | Iterable[tuple[_KT, _VT]] | NonerXzlist[tuple[_KT, _VT]] | None)r�r!rX�	list[str])r�r!rX�dict[str, str | None])r�r!r�r�rXr!)r�r-rXr�)r�r-r��dict[str, str]rXr-)r�r!rXr�)r�r!rXztuple[str, dict[str, Any]])r��CaseInsensitiveDict[str]rXrY)rzIterable[bytes]r	r2rXz"Generator[str | bytes, None, None])rrr�351int | NonerXzGenerator[bytes, None, None])rr!rr�rXzGenerator[str, None, None])rzbytes | strrr�rXz"Generator[bytes | str, None, None])r	r2rXzstr | bytes | None)r#r!rXr!)r4r!r5r!rXr�)r@rJrXr!)rBr!rXr�)rFr!rXr�)rIr!r�rYrXzGenerator[None, None, None])r�r!rRrYrXr�r�)r�r!rRrYrXr�)r�r!rk�dict[str, str] | NonerXrY)T)rtzRequest | PreparedRequestrkr�rur�rXr�)zpython-requests)r�r!rXr!)rXr�)r�r!rXzlist[dict[str, str]])r�rrXrY)r�r!r�r!rXr!)r�r!rXztuple[str, str])r��tuple[str | bytes, str | bytes]rXr�)r�r�r�zstr | bytesr�rJrXr�)r�r!rXr!)r�r0rXr�)��__doc__�352__future__rr�353contextlibrtrnrQr1r/�sysr�rrr��collectionsr�collections.abcrr�typingrrr	r354rr�urllib3.utilr
rr�rr�_internal_utilsrrrrr/rr_�compatrrrrrrrrr r!r"r#r$r%r��cookiesr'�355exceptionsr(r)r*r+�356structuresr,�http.cookiejarr-r.�_t�modelsr0r1r2r4�__annotations__�wherer5r9r:r;r�rNr=�platformrZrbr{r�r�r��contextmanagerr�r�r�r�r�r�r�r�r�r�rr
rr�	frozensetrr(r-r;r3rCrGrLrdrgrprxrzr~r�rlr�r�r�r�r�r�r�r�r�r�rr\rY�<module>r�s����#�
��	�	�	�
�
�357����#�/���1��$���4�����:�(���,��(�!��:�:�)��U�)�$�k�k�m���+�!#�S�1�
�u�1�
�e�n��
�e�n��"&����H�H�W�l�4�8�9J�K�L�"����358�<�<�7��$�L	/�
�=�
��
�D3�P+0�1
�	�1
�#'�1
��1
�h&�#�L���	��	��?����:359�-�360�-�	� �A� �� �361� ��H��!��@�@�F�2�0��2%�,�2���"*��'��&362�'��'�!+�'�!�'�363�'�364�%��%�)�%��%�365�%�	��	�'1�	�'�	�&�T"�M�����366�05�,5�5���0���1��1�,<�~	��:��
&��
"�����	�>#��"�L	�
�
�g���	����	�����@C�<�",�367�+�368��369� �370�371�	372�0A�"Sr\
codekingpro/portable-devtools · Team Ai