Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��jrD��B�SSKJr SSKrSSKJr SSKJrJr SSKJ	r	 \R(aSSKJr SSKJ
r
 "SS	\5rS3S/r\R "S5r\R "S
5r\R "S5r\R(S\R*\\4\R.\\\4S	4r"SS\5rSSjr"SS4\R8\\4\R:\\45r"SS\\\\45r "SS\R:\\45r!g)�)�annotationsN)�OrderedDict)�Enum�auto)�RLock)�Protocol)�Selfc�(�\rSrSrSSjrSSjrSrg)�HasGettableStringKeys�c��g�N���selfs �ZD:\code\apps\devtools\python\user_packages\Python313\site-packages\urllib3/_collections.py�keys�HasGettableStringKeys.keys����c��grr�r�keys  r�__getitem__�!HasGettableStringKeys.__getitem__rrrN��returnztyping.Iterator[str]�r�strrr)�__name__�5__module__�__qualname__�__firstlineno__rr�__static_attributes__rrrrrs��3�3rr�RecentlyUsedContainer�HTTPHeaderDict�_KT�_VT�_DTc�"�\rSrSr\"5rSrg)�	_Sentinel�'rN)r r!r"r#r�6not_passedr$rrrr+r+'s	����Jrr+c���[U[5(aU$[U[R5(a2[R"[R[7[84U5$[U[R5(a9[R"[R[[9[104U5$[US5(a([US5(a[R"SU5$g)Nrrr)	�11isinstancer&�typing�Mapping�castr�Iterable�tuple�hasattr)�	potentials r�%ensure_can_construct_http_header_dictr7+s����)�^�,�,���	�I�v�~�~�	.�	.��{�{�6�>�>�#�s�(�3�Y�?�?�	�I�v���	/�	/��{�{�6�?�?�5��c��?�;�Y�G�G�	��F�	#�	#��	�=�(I�(I��{�{�2�I�>�>�rc�^�\rSrSr%SrS\S'S\S'S\S'S	\S12'SSU4SjjjrSSjrSS
jrSSjr	SSjr13SSjrSSjrSSjr
SrU=r$)r%�?am14Provides a thread-safe dict-like container which maintains up to15``maxsize`` keys while throwing away the least-recently-used keys beyond16``maxsize``.17 18:param maxsize:19    Maximum number of recent elements to retain.20 21:param dispose_func:22    Every time an item is evicted from the container,23    ``dispose_func(value)`` is called.  Callback which will get called24ztyping.OrderedDict[_KT, _VT]�25_container�int�_maxsize�#typing.Callable[[_VT], None] | None�dispose_funcr�lockc�v>�[TU]5 XlX l[	5Ul[
5Ulgr)�super�__init__r<r>rr:rr?)r�maxsizer>�	__class__s   �rrB�RecentlyUsedContainer.__init__Rs-���26	�����
�(��%�-����G��	rc��UR URRU5nX RU'UsSSS5 $!,(df   g=fr)r?r:�pop)rr�items   rr�!RecentlyUsedContainer.__getitem__]s6��
�Y�Y��?�?�&�&�s�+�D�#'�O�O�C� ���Y�Y�s�+A�27Ac��SnUR XRRU54nX RU'SSS5 Ub(UR(aUupEURU5 ggg![aM X RU'[	UR5UR28:�aURR
SS9nN�f=f!,(df   N�=f)NF)�last)r?r:rG�KeyError�lenr<�popitemr>)rr�value�evicted_item�_�
evicted_values      r�__setitem__�!RecentlyUsedContainer.__setitem__ds�����
�Y�Y�
G� #�O�O�$7�$7��$<�<��',����$��&�#��(9�(9�+��A����m�,�):�#���
G�(-����$��t���'�$�-�-�7�$(�?�?�#:�#:��#:�#F�L��
G���Y�s)�C	�*A/�/AC�C	�C�C	�	29Cc���UR URRU5nSSS5 UR(aURW5 gg!,(df   N2=fr)r?r:rGr>)rrrOs   r�__delitem__�!RecentlyUsedContainer.__delitem__}sH��
�Y�Y��O�O�'�'��,�E��������e�$���Y�s�A�30A#c�z�UR [UR5sSSS5 $!,(df   g=fr)r?rMr:rs r�__len__�RecentlyUsedContainer.__len__�s��
�Y�Y��t���'��Y�Y�s�,�31:c��[S5e)Nz7Iteration over this class is unlikely to be threadsafe.)�NotImplementedErrorrs r�__iter__�RecentlyUsedContainer.__iter__�s��!�E�32�	33rc�"�UR [URR55nURR	5 SSS5 UR34(aWHnURU5 M gg!,(df   N;=fr)r?�listr:�values�clearr>)rrarOs   rrb�RecentlyUsedContainer.clear�se��
�Y�Y��$�/�/�0�0�2�3�F��O�O�!�!�#��35������!�!�%�(� ���Y�s�>B�36Bc��UR [URR55sSSS5 $!,(df   g=fr)r?�setr:rrs rr�RecentlyUsedContainer.keys�s(��
�Y�Y��t���+�+�-�.��Y�Y�s	�#:�37A)r:r<r>r?)�38N)rCr;r>r=r�None)rr'rr()rr'rOr(rrh)rr'rrh�rr;)rztyping.NoReturn)rrh)rzset[_KT])r r!r"r#�__doc__�__annotations__rBrrSrVrYr]rbrr$�
__classcell__�rDs@rr%r%?sv����-�,��M�5�5�39�K��<@�	��	�:�	�40�		�	��-�2%�(�41�42)�/�/rc�L�\rSrSr%SrS\S'SSjrSSjrS
SjrSSjr	S	r43g44)�HTTPHeaderDictItemView�a;45HTTPHeaderDict is unusual for a Mapping[str, str] in that it has two modes of46address.47 48If we directly try to get an item with a particular name, we will get a string49back that is the concatenated version of all the values:50 51>>> d['X-Header-Name']52'Value1, Value2, Value3'53 54However, if we iterate over an HTTPHeaderDict's items, we will optionally combine55these values based on whether combine=True was called when building up the dictionary56 57>>> d = HTTPHeaderDict({"A": "1", "B": "foo"})58>>> d.add("A", "2", combine=True)59>>> d.add("B", "bar")60>>> list(d.items())61[62    ('A', '1, 2'),63    ('B', 'foo'),64    ('B', 'bar'),65]66 67This class conforms to the interface required by the MutableMapping ABC while68also giving us the nonstandard iteration behavior we want; items with duplicate69keys, ordered by time of first insertion.70r&�_headersc��Xlgr�rq)r�headerss  rrB�HTTPHeaderDictItemView.__init__�s���
rc�Z�[[URR555$r)rMr`rq�	iteritemsrs rrY�HTTPHeaderDictItemView.__len__�s���4��
�
�/�/�1�2�3�3rc�6�URR5$r)rqrwrs rr]�HTTPHeaderDictItemView.__iter__�s���}�}�&�&�(�(rc���[U[5(aX[U5S:XaIUup#[U[5(a0[U[5(aURRX#5$g)N�F)r/r4rMrrq�_has_value_for_header)rrH�71passed_key�72passed_vals    r�__contains__�#HTTPHeaderDictItemView.__contains__�sR���d�E�"�"�s�4�y�A�~�%)�"�J��*�c�*�*�z�*�c�/J�/J��}�}�:�:�:�R�R�rrsN)rtr&rrhri�rz typing.Iterator[tuple[str, str]])rH�objectr�bool)r r!r"r#rjrkrBrYr]r�r$rrrroro�s#���8�� �4�)�rroc��^�\rSrSr%SrS\S'S#S$U4SjjjrS%SjrS&SjrS'Sjr	S(S	jr73S)S*U4S74jjjrS+SjrS+Sjr
S,S
jrS-SjrS'SjrSS.S.SjjrS/Sjr\R(S0Sj5r\R(S1Sj5r\R.4S2SjjrS3Sjr\r\r\r\rS4SjrS5SjrS3SjrS6Sjr S6Sjr!S7Sjr"S8Sjr#S9Sjr$S:S jr%S:S!jr&S"r'U=r($);r&��a75:param headers:76    An iterable of field-value pairs. Must not contain multiple field names77    when compared case-insensitively.78 79:param kwargs:80    Additional field-value pairs to pass in to ``dict.update``.81 82A ``dict`` like container for storing HTTP Headers.83 84Field names are stored and compared case-insensitively in compliance with85RFC 7230. Iteration provides the first case-sensitive key seen for each86case-insensitive pair.87 88Using ``__setitem__`` syntax overwrites fields that compare equal89case-insensitively in order to maintain ``dict``'s api. For fields that90compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add``91in a loop.92 93If multiple fields that are equal case-insensitively are passed to the94constructor or ``.update``, the behavior is undefined and some will be95lost.96 97>>> headers = HTTPHeaderDict()98>>> headers.add('Set-Cookie', 'foo=bar')99>>> headers.add('set-cookie', 'baz=quxx')100>>> headers['content-length'] = '7'101>>> headers['SET-cookie']102'foo=bar, baz=quxx'103>>> headers['Content-Length']104'7'105z%typing.MutableMapping[str, list[str]]r:c��>�[TU]5 0UlUb8[U[5(aURU5 OUR
U5 U(aUR
U5 ggr)rArBr:r/r&�106_copy_from�extend)rrt�kwargsrDs   �rrB�HTTPHeaderDict.__init__�sT���
����������'�>�2�2�����(����G�$���K�K���rc��[U[5(aURS5nX/URUR	5'g�N�latin-1�r/�bytes�decoder:�lower�rr�vals   rrS�HTTPHeaderDict.__setitem__�s3���c�5�!�!��*�*�Y�'�C�(+�z�����	�	��$rc��[U[5(aURS5nURUR	5nSRUSS5$)Nr��, �)r/r�r�r:r��joinr�s   rr�HTTPHeaderDict.__getitem__sF���c�5�!�!��*�*�Y�'�C��o�o�c�i�i�k�*���y�y��Q�R��!�!rc��[U[5(aURS5nURUR	5	gr�r�rs  rrV�HTTPHeaderDict.__delitem__s/���c�5�!�!��*�*�Y�'�C��O�O�C�I�I�K�(rc��[U[5(aURS5n[U[5(aUR	5UR107;$g)Nr�F)r/r�r�rr�r:rs  rr��HTTPHeaderDict.__contains__sB���c�5�!�!��*�*�Y�'�C��c�3����9�9�;�$�/�/�1�1�rc�">�[TU]X5$r)rA�108setdefault)rr�defaultrDs   �rr��HTTPHeaderDict.setdefaults����w�!�#�/�/rc�,�[U5nUcg[U5"U5nUR5VVs0sHupEUR5U_M snnUR5VVs0sHupEUR5U_M snn:H$s snnfs snnf)NF)r7�type�109itermergedr�)r�other�maybe_constructable�other_as_http_header_dict�k�vs      r�__eq__�HTTPHeaderDict.__eq__s���C�E�J���&��(,�T�110�3F�(G�%�)-���):�;�):������	�1��):�;�%>�%I�%I�%K�@111�%K�T�Q�A�G�G�I�q�L�%K�@112�113�	114��;��@115s�B116�'Bc�.�URU5(+$r)r�)rr�s  r�__ne__�HTTPHeaderDict.__ne__!s���;�;�u�%�%�%rc�,�[UR5$r)rMr:rs rrY�HTTPHeaderDict.__len__$s���4�?�?�#�#rc#�\# �URR5H117nUSv� M g7f)Nr)r:ra)r�valss  rr]�HTTPHeaderDict.__iter__'s%����O�O�*�*�,�D��q�'�M�-�s�*,c�*�X	g![a gf=fr)rLrs  r�discard�HTTPHeaderDict.discard,s��	��	���	��	�s��118�F)�combinec�&�[U[5(aURS5nUR5nX/nURRXE5nXVLa9[
U5S:�deU(aUSS-U-US'gURU5 gg)a�Adds a (name, value) pair, doesn't overwrite the value if it already119exists.120 121If this is called with combine=True, instead of adding a new header value122as a distinct item during iteration, this will instead append the value to123any existing header value with a comma. If no existing header value exists124for the key, then the value will simply be added, ignoring the combine parameter.125 126>>> headers = HTTPHeaderDict(foo='bar')127>>> headers.add('Foo', 'baz')128>>> headers['foo']129'bar, baz'130>>> list(headers.items())131[('foo', 'bar'), ('foo', 'baz')]132>>> headers.add('foo', 'quz', combine=True)133>>> list(headers.items())134[('foo', 'bar, baz, quz')]135r�r|�����r�N)r/r�r�r�r:r�rM�append)rrr�r��	key_lower�new_valsr�s       r�add�HTTPHeaderDict.add2s���(�c�5�!�!��*�*�Y�'�C��I�I�K�	��:�����)�)�)�>�����t�9��>�!�>����8�d�?�S�0��R�����C� � rc���[U5S:�a[S[U5S35e[U5S:�aUSOSn[U[5(a+UR	5HupEURXE5 M O�[U[R5(a+UR5HupEURXE5 M O�[U[R5(aUHupFURXF5 M OM[US5(a<[US5(a+UR5HnURXCU5 M UR5HupFURXF5 M g)	z�Generic import function for any type of header-like object.136Adapted version of MutableMapping.update in order to insert items137with self.add instead of self.__setitem__138r�z/extend() takes at most 1 positional arguments (z given)rrrrN)rM�	TypeErrorr/r&rwr�r0r1�itemsr3r5r)r�argsr�r�rr�rOs       rr��HTTPHeaderDict.extendUs"��139�t�9�q�=��A�#�d�)��G�T��
��t�9��>��Q��r���e�^�,�,�!�O�O�-�������"�.�
��v�~�~�
.�
.�!�K�K�M�������"�*�
��v���
/�
/�#�140������$�$�
�U�F�
#�
#���}�(E�(E��z�z�|������C�j�)�$�!�,�,�.�J�C��H�H�S� �)rc��grrrs  r�getlist�HTTPHeaderDict.getlistus��.1rc��grr)rrr�s   rr�r�xs��BErc���[U[5(aURS5nURUR	5nUSS$![141a U[RLa/s$Us$f=f)zeReturns a list of all the values for the named field. Returns an142empty list if the key doesn't exist.r�r�N)r/r�r�r:r�rLr+r-)rrr�r�s    rr�r�{sn��143�c�5�!�!��*�*�Y�'�C�	��?�?�3�9�9�;�/�D����8�O���	��)�.�.�.��	��N�	�s�A144�145A0�+A0�/A0c�B�/SQnUHnURU5 M U$)z~146Remove content-specific header fields before changing the request147method to GET or HEAD according to RFC 9110, Section 15.4.148)zContent-EncodingzContent-LanguagezContent-LocationzContent-TypezContent-Length�Digestz
Last-Modified)r�)r�content_specific_headers�headers   r�_prepare_for_method_change�)HTTPHeaderDict._prepare_for_method_change�s'��149$150� �/�F��L�L�� �/��rc�f�[U5RS[UR55S3$)N�(�))r�r �dictr�rs r�__repr__�HTTPHeaderDict.__repr__�s-���t�*�%�%�&�a��T�_�_�->�(?�'@��B�Brc�x�UH4nURU5nU/UQURUR5'M6 gr)r�r:r�)rr�rr�s    rr��HTTPHeaderDict._copy_from�s4���C��-�-��$�C�,/�;�#�;�D�O�O�C�I�I�K�(�rc�H�[U5"5nURU5 U$r)r�r�)r�clones  r�copy�HTTPHeaderDict.copy�s ���T�151���
������rc#�# �UH5nURUR5nUSSHnUSU4v� M M7 g7f)z8Iterate over all header lines, including duplicate ones.r�Nr�r:r�)rrr�r�s    rrw�HTTPHeaderDict.iteritems�sA����C��?�?�3�9�9�;�/�D��A�B�x���1�g�s�l�"� ��s�=?c#�# �UH;nURUR5nUSSRUSS54v� M= g7f)z:Iterate over all headers, merging duplicate ones together.rr�r�N)r:r�r�r�s   rr��HTTPHeaderDict.itermerged�sA����C��/�/�#�)�)�+�.�C��a�&�$�)�)�C���G�,�,�,��s�AAc��[U5$r)rors rr��HTTPHeaderDict.items�s
��%�d�+�+rc�R�X;a"X RUR5SS;$g)Nr�Fr�)r�header_name�potential_values   rr}�$HTTPHeaderDict._has_value_for_header�s-����"�o�o�k�6G�6G�6I�&J�1�2�&N�N�N�rc�P�[U5nUc[$URU5 U$r)r7�NotImplementedr�)rr�r�s   r�__ior__�HTTPHeaderDict.__ior__�s.��D�E�J���&�!�!����'�(��rc�p�[U5nUc[$UR5nURU5 U$r)r7r�r�r��rr�r��results    r�__or__�HTTPHeaderDict.__or__�s9��D�E�J���&�!�!�������
�
�)�*��
rc�r�[U5nUc[$[U5"U5nURU5 U$r)r7r�r�r�r�s    r�__ror__�HTTPHeaderDict.__ror__�s<��D�E�J���&�!�!��d��/�0���
�
�d���
r)r:r)rt�ValidHTTPHeaderSource | Noner�r)rrr�rrrhr)rrrrh)rr�rr�)�)rrr�rrr)r�r�rr�rir)rrr�rr�r�rrh)r��ValidHTTPHeaderSourcer�rrrh)rrrz	list[str])rrr�r)r�list[str] | _DT)rrr�z_Sentinel | _DTrr�)rr	)rr)r�r&rrhr�)rro)r�rr�rrr�)r�r�rr&)r�r�rr	))r r!r"r#rjrkrBrSrrVr�r�r�r�rYr]r�r�r�r0�overloadr�r+r-r��152getheaders�getallmatchingheaders�iget�get_allr�r�r�rwr�r�r}r�r�r�r$rlrms@rr&r&�s����B6�5�	 �	 �2�"�)�153�0�0�	154�&�$��155�:?�!!�F!�@�_�_�1��1��_�_�E��E�4=�3G�3G����!0��	��(�&�J�#���D��G�C�7�156�157#�-�,��158���r)r6r�rr�)"�159__future__rr0�collectionsr�enumrr�	threadingr�
TYPE_CHECKINGr�typing_extensionsr	r�__all__�TypeVarr'r(r)�Unionr1rr3r4r�r+r7�Generic�MutableMappingr%reror&rrr�<module>rs.��"�
�#���	��� �&�4��4�#�$4�1605��
�n�n�U����n�n�U����n�n�U�������161�N�N�3��8��162�O�O�E�#�s�(�O�$�����������!��(Z/�F�N�N�3��8�4�f�6K�6K�C�QT�H�6U�Z/�z-�S��s�C�x��1�-�`Z�V�*�*�3��8�4�Zr
codekingpro/portable-devtools · Team Ai