Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
common.cpython-313.pyc140 linesDownload Raw Back to __pycache__
1�

2x�j4����SrSSKrSSKrSSKrSSKrSSKrSSKJr SSKJ	r3JrJ
r SSKJr SSKJrJr SrS	r\R2"S4\R45r\R2"S5rSr\R<"S
5rS%Sjr	SrSr
Sr Sr!\""\5\""S5-r#Sr$Sr%Sr&Sr'S\4Sjr(Sr)Sr*S\4Sjr+Sr,S&Sjr-Sr.S'S jr/"S!S"\05r1"S#S$5r2g!\a SSKJrJr N�f=f)(z|5oauthlib.common6~~~~~~~~~~~~~~7 8This module provides data structures and utilities common9to all implementations of OAuth.10�N)�quote�unquote�	urlencode�)�	get_debug)�SystemRandom�randbits)r�getrandbits�>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789z_ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}z&([^&;]*(?:password|token)[^=]*=)[^&;]+z&%[^0-9A-Fa-f]|%[0-9A-Fa-f][^0-9A-Fa-f]zAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-�oauthlibc��[U[5(aURS5OUn[X5n[U[5(aURS5nU$�N�utf-8)�11isinstance�str�encode�_quote�bytes�decode)�s�safes  �UD:\code\apps\devtools\python\user_packages\Python313\site-packages\oauthlib/common.pyrr+sI��'��3�/�/������Q�A��q��A��!�U���
�H�H�W����H�c�h�[U5n[U[5(aURS5nU$r)�_unquoterrr)rs rrr5s-�����A��!�U���
�H�H�W����Hrc�~�[U5n[U5n[U[5(aU$UR	S5$r)�encode_params_utf8�12_urlencoderrr)�params�utf8_params�13urlencodeds   rrr?s:��$�V�,�K��K�(�J��*�c�"�"���� � ��)�)rc���/nUHdup#UR[U[5(aURS5OU[U[5(aURS5OU45 Mf U$)zaEnsures that all parameters in a list of 2-element tuples are encoded to14bytestrings using UTF-815r)�appendrrr)r�encoded�k�vs    rrrHsa���G�������!+�A�s�!3�!3�A�H�H�W���!+�A�s�!3�!3�A�H�H�W���<�	=���Nrc���/nUHdup#UR[U[5(aURS5OU[U[5(aURS5OU45 Mf U$)z^Ensures that all parameters in a list of 2-element tuples are decoded to16unicode using UTF-8.17r)r#rrr)r�decodedr%r&s    r�decode_params_utf8r)Tsa���G�������!+�A�u�!5�!5�A�H�H�W��1�!+�A�u�!5�!5�A�H�H�W��1�>�	?���Nrz=&;:%+~,*@!()/?'$c��U(a5[U5[::d"Sn[U[U5[-18U4-5e[R	U5(a[S5e[19R"USS9n[U5$)ajDecode a query string in x-www-form-urlencoded format into a sequence20of two-element tuples.21 22Unlike urlparse.parse_qsl(..., strict_parsing=True) urldecode will enforce23correct formatting of the query string by validation. If validation fails24a ValueError will be raised. urllib.parse_qsl will only raise errors if25any of name-value pairs omits the equals sign.26z�Error trying to decode a non urlencoded string. Found invalid characters: %s in the string: '%s'. Please ensure the request/response body is x-www-form-urlencoded.z%Invalid hex encoding in query string.T��keep_blank_values)�setr!�27ValueError�INVALID_HEX_PATTERN�search�urlparse�	parse_qslr))�query�errorrs   r�	urldecoder5csy��
�S��Z�:�-�*��28��#�e�*�z�"9�5�!A�A�B�B��!�!�%�(�(��@�A�A��
�
���
>�F��f�%�%rc�x�[U[[45(a[U5nU$[US5(aI[
U5 [[U[5(aUR5OU5n[U5nU$SnU$![a SnU$f=f![a SnU$[a SnU$f=f)aExtract parameters and return them as a list of 2-tuples.29 30Will successfully extract parameters from urlencoded query strings,31dicts, or lists of 2-tuples. Empty strings/dicts/lists will return an32empty list of parameters. Any other input will result in a return33value of None.34N�__iter__)rrrr5r.�hasattr�dict�list�itemsr)�	TypeError)�rawrs  r�extract_paramsr>�s����#��s�|�$�$�	��s�^�F� �M�35��j�	!�	!�	0���I���C��)>�)>�#�)�)�+�C�H�F�'��/�F��M����M���	��F��M�	��36�	��F��M��	��F��M�	�s(�B�B�B�B�B9�*B9�8B9c�R�[[[S55[5-5$)a�Generate pseudorandom nonce that is unlikely to repeat.37 38Per `section 3.3`_ of the OAuth 1 RFC 5849 spec.39Per `section 3.2.1`_ of the MAC Access Authentication spec.40 41A random 64-bit number is appended to the epoch timestamp for both42randomness and to decrease the likelihood of collisions.43 44.. _`section 3.2.1`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-3.2.145.. _`section 3.3`: https://tools.ietf.org/html/rfc5849#section-3.346�@)rr	�generate_timestamp�rr�generate_noncerC�s!���s�8�B�<� �#5�#7�7�8�8rc�P�[[[R"555$)a0Get seconds since epoch (UTC).47 48Per `section 3.3`_ of the OAuth 1 RFC 5849 spec.49Per `section 3.2.1`_ of the MAC Access Authentication spec.50 51.. _`section 3.2.1`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-3.2.152.. _`section 3.3`: https://tools.ietf.org/html/rfc5849#section-3.353)r�int�timerBrrrArA�s���s�4�9�9�;�� � r�c�d^^�[5mSRUU4Sj[U555$)aDGenerates a non-guessable OAuth token54 55OAuth (1 and 2) does not specify the format of tokens except that they56should be strings of random characters. Tokens should not be guessable57and entropy when generating the random characters is important. Which is58why SystemRandom is used instead of the default random.choice method.59�c3�F># �UHnTRT5v� M g7f�N)�choice)�.0�x�chars�rands  ��r�	<genexpr>�!generate_token.<locals>.<genexpr>�s����=�}�!�4�;�;�u�%�%�}�s�!)r�join�range)�lengthrOrPs `@r�generate_tokenrV�s%����>�D�
�7�7�=�u�V�}�=�=�=rc��SSKn[RR5nURU[R"UR60S9-S.nUR
UR5 URX@S5n[US5nU$)Nr)�seconds)�scope�exp�RS256�UTF-8)61�jwt�datetime�utcnowrY�	timedelta�62expires_in�update�claimsr�63to_unicode)�private_pem�requestr]�nowrc�tokens      r�generate_signed_tokenri�su���64�65�66�67"�68"�69$�C�����X�'�'��0B�0B�C�C��F�70�M�M�'�.�.�!��J�J�v�G�4�E��u�g�&�E��Lrc�,�SSKnURXS/S9$)Nrr[)�71algorithms)r]r)�72public_pemrhr]s   r�verify_signed_tokenrm�s����:�:�e�W�I�:�>�>rc��[X5$)zyGenerates an OAuth client_id73 74OAuth 2 specify the format of client_id in75https://tools.ietf.org/html/rfc6749#appendix-A.76)rV)rUrOs  r�generate_client_idro�s���&�(�(rc��[U[5(aUR5n[R"USS9nURU5 [
U5$)z)Extend a query with a list of two-tuples.Tr+)rr9r;r1r2�extendr)r3r�queryparamss   r�add_params_to_qsrs�sE���&�$���������$�$�U�d�C�K����v���[�!�!rc��[R"U5up4pVpxU(a[X�5nO[Xq5n[R"X4XVXx45$)z5Add a list of two-tuples to the uri query components.)r1rs�77urlunparse)	�urir�fragment�sch�net�path�parr3�fras	         r�add_params_to_urir}�sH��&.�&7�&7��&<�#�C�d����s�+�� ��/������$�U�@�A�Arc��[U5[U5:wagSn[X5Hup4U[U5[U5--nM! US:H$)z�Near-constant time string comparison.78 79Used in order to avoid timing attacks on sensitive information such80as secret keys during request verification (`rootLabs`_).81 82.. _`rootLabs`: http://rdist.root.org/2010/01/07/timing-independent-array-comparison/83 84Fr)�len�zip�ord)�a�b�resultrN�ys     r�safe_string_equalsr��sL���1�v��Q����
�F��A�	����#�a�&�3�q�6�/�!����Q�;�rc	�^�[U[5(aU$[U[5(a85[UTS9$[US5(aY[	U5 [US5(aUR5nUVVs0sHup#[
UT5[
UT5_M snn$U$s snnf![a U$[a U4SjU5s$f=f)z:Convert a number of different types of objects to unicode.)�encodingr7r;c3�<># �UHn[UT5v� M g7frK�rd)rM�ir�s  �rrQ�to_unicode.<locals>.<genexpr>s����:�T��J�q�(�+�+�T�s�)	rrrr8r9r;rdr<r.)�datar�r%r&s `  rrdrds�����$�������$�����4�(�+�+��t�Z� � �	W���J��t�W�%�%��z�z�|��QU�V�QU���J�q�(�+�Z��8�-D�D�QU�V�V��K��W���	���K��	;�:�T�:�:�	;�s�86B*�;#B$�*87C�7C�Cc�j^�\rSrSrSr0rSrSrU4SjrU4Sjr	SSjr88U4SjrU4S	jrS89r
U=r$)�CaseInsensitiveDicti'z3Basic case insensitive dict with strings only keys.c�x�UVs0sHo"R5U_M snUlUH	nXX'M gs snfrK��lower�proxy)�selfr�r%s   r�__init__�CaseInsensitiveDict.__init__-s8��,0�1�D�q�g�g�i��l�D�1��90��A��g�D�G���2s�7c�<�UR5UR;$rKr�)r�r%s  r�__contains__� CaseInsensitiveDict.__contains__2s���w�w�y�D�J�J�&�&rc�>�URUR5n[TU]
U5 URUR5	grK)r�r��super�__delitem__�r�r%�key�	__class__s   �rr��CaseInsensitiveDict.__delitem__5s6����j�j�����#��
���C� ��J�J�q�w�w�y�!rc�\>�URUR5n[TU]
U5$rK)r�r�r��__getitem__r�s   �rr��CaseInsensitiveDict.__getitem__:s'����j�j�����#���w�"�3�'�'rc��X;aX$U$rKrB)r�r%�defaults   r�get�CaseInsensitiveDict.get>s���)�t�w�0��0rc�\>�[TU]X5 XRUR5'grK)r��__setitem__r�r�)r�r%r&r�s   �rr��CaseInsensitiveDict.__setitem__As"���
���A�!� !�91�92�1�7�7�9�rc�>�[TU]"U0UD6 [U0UD6HnX0RUR	5'M! grK)r�rbr9r�r�)r��args�kwargsr%r�s    �rrb�CaseInsensitiveDict.updateEs:���
����'��'��t�&�v�&�A�$%�J�J�q�w�w�y�!�'r)r�rK)�__name__�93__module__�__qualname__�__firstlineno__�__doc__r�r�r�r�r�r�r�rb�__static_attributes__�
__classcell__)r�s@rr�r�'s3���=��E��94'�"�95(�1�"�&�&rr�c�b�\rSrSrSrSSjrSrSr\S5r	\S5r96\S	5rS97rg)�RequestiKaA malleable representation of a signable HTTP request.98 99Body argument may contain any data, but parameters will only be decoded if100they are one of:101 102* urlencoded query string103* dict104* list of 2-tuples105 106Anything else will be treated as raw body data to be passed through107unmolested.108Nc�^^�U4SjnU"U5UlU"U5Ul[U"U=(d 055UlU"U5Ul[UR5Ul/Ul0Ul0SS_SS_SS_SS_SS_SS_SS_S	S_S109S_SS_SS_S
S_SS_SS_SS_SS_SS_SSSSSSSSSSSSSS.
EUl	URR[[UR555 URR[UR=(d /55 g)Nc�.>�T(a[UT5$U$rKr�)rNr�s �rr� Request.__init__.<locals>.encode]s���.6�:�a��*�=�A�=r�access_token�client�	client_id�
client_secret�code�code_challenge�code_challenge_method�
code_verifier�extra_credentials�110grant_type�redirect_uri�
refresh_token�
request_token�
response_typerY�scopes�state)
rh�user�token_type_hint�
response_mode�nonce�display�promptrc�max_age�111ui_locales�
id_token_hint�112login_hint�113acr_values)rv�http_methodr��headers�bodyr>�decoded_body�oauth_params�
validator_log�_paramsrbr9r5�	uri_query)r�rvr�r�r�r�rs     ` rr��Request.__init__Zs����	>��#�;���!�+�.���*�6�'�-�R�+@�A����4�L��	�*�4�9�9�5���������!114��D�!115��d�!116�
��!117�
�T�	!118�119
�D�!120�
�d�
!121�
$�T�!122�
�T�!123�
 ��!124�
�$�!125�
�D�!126�
�T�!127�
�T�!128�
�T�!129�
�T�!130� 
�d�!!131�"
�T�#!132�$��#�"�������!���A!133���D	
�����D��4�>�>�!:�;�<������D��!2�!2�!8�b�9�:rc�T�XR;aURU$[U5erK)r��AttributeError)r��names  r�__getattr__�Request.__getattr__�s&���<�<���<�<��%�%� ��&�&rc��[5(dgURnURR5nU(a[RS[
U55nSU;aSUS'SRURURX!5$)Nz<oauthlib.Request SANITIZED>z<SANITIZED>�
Authorizationz<SANITIZED>zF<oauthlib.Request url="{}", http_method="{}", headers="{}", body="{}">)134rr�r��copy�SANITIZE_PATTERN�subr�formatrvr�)r�r�r�s   r�__repr__�Request.__repr__�sv���{�{�1��y�y���,�,�#�#�%���#�'�'���T��C�D��g�%�'4�G�O�$�W�^�^��H�H�d�&�&��7�	7rc�V�[R"UR5R$rK)r1rvr3�r�s rr��Request.uri_query�s��� � ����*�0�0�0rc�h�UR(d/$[R"URSSS9$)NT)r,�strict_parsing)r�r1r2r�s r�uri_query_params�Request.uri_query_params�s,���~�~��I��!�!�$�.�.�D�15�7�	7rc��[R"[5nSUR=(d /UR-5nUHnX==S-
ss'M UR5VVs/sHup4US:�dM
UPM snn$s snnf)Nc3�,# �UH135nUSv� M g7f)rNrB)rM�ps  rrQ�+Request.duplicate_params.<locals>.<genexpr>�s���P�N���a�D�N�s�r)�collections�defaultdictrEr�r�r;)r��	seen_keys�all_keysr%�cs     r�duplicate_params�Request.duplicate_params�sx���+�+�C�0�	�P�"�/�/�5�2��9N�9N�N�P���A��L�A��L��'�o�o�/�9�/�d�a�1�q�5��/�9�9��9s�,B�<B)r�r�r�r�r�r�rvr�)�GETNNr)
r�r�r�r�r�r�r�r��propertyr�r�r�r�rBrrr�r�Ks]���CG�!�1;�f'�1367��1��1��7��7��:��:rr�)�/)F)r\)3r�r�r^�logging�rerF�urllib.parse�parser1rrrrrrrIr�secretsrr	�ImportError�randomr137�UNICODE_ASCII_CHARACTER_SET�CLIENT_ID_CHARACTER_SET�compile�138IGNORECASEr�r/�always_safe�	getLogger�logrr)r-r!r5r>rCrArVrirmrorsr}r�rdr9r�r�rBrr�<module>rs6������	������=�.� ,��N���:�:�G����W���j�j�!J�K�������139�#��
�
�*�	�	���
��$8� 9�
9�140�&�B�:9�	!��$?�	>��$?�!�(?�)�"�B��$�2!&�$�!&�Hf:�f:��k	�=�<�<�=�s�C%�%C6�5C6
codekingpro/portable-devtools · Team Ai