Current File : //usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/__pycache__/utils.cpython-312.pyc
�

&�`���^�dZddlZddlZddlmZmZddlmZd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)zp
oauthlib.utils
~~~~~~~~~~~~~~

This module contains utility methods used by various parts of the OAuth 2 spec.
�N)�quote�urlparse)�	urldecodec���t|t�s|�|St|tttf�r(dj|D�cgc]
}t|���c}�St
d|z��cc}w)z5Convert a list of scopes to a space separated string.� z8Invalid scope (%s), must be string, tuple, set, or list.)�
isinstance�str�set�tuple�list�join�
ValueError��scope�ss  �?/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/utils.py�
list_to_scopers[���%�������	�E�C���-�	.��x�x��/�A��Q��/�0�0��S�V[�[�\�\��0s�A&c��t|tttf�r|D�cgc]
}t	|���c}S|�y|j�j
d�Scc}w)z5Convert a space separated string to a list of scopes.Nr)rrrr
r	�strip�splitrs  r�
scope_to_listrsL���%�%��s�+�,� %�&�1��A��&�&�	����{�{�}�"�"�3�'�'��	's�Ac�~�ttt|�j��}d|vrt	|d�|d<|S)Nr)�dictrr�queryr)�uri�paramss  r�params_from_urir"s:��
�)�H�S�M�/�/�0�
1�F��&��'��w��8��w���M�c��ddd�}t|�\}}}}}}d|vr|jdd�\}}||fS|j|j��}||fS)zuExtract hostname and port from URI.

    Will use default port for HTTP and HTTPS if none is present in the URI.
    �80�443)�HTTP�HTTPS�:�)rr�get�upper)	r�
default_ports�sch�netloc�path�parr�fra�ports	         r�
host_from_urir/)sr�����M�
*2�#��&�C���s�E�3�
�f�}��|�|�C��+�����4�<��� � �����-���4�<�rc�p�t|t�std��t|j	d�d��S)ztEscape a string in an OAuth-compatible fashion.

    TODO: verify whether this can in fact be used for OAuth 2

    z#Only unicode objects are escapable.zutf-8�~)�safe)rr	rr�encode)�us r�escaper5<s0���a����>�?�?�����'�"��.�.rc��tjj�|z
}|j|j|jdzdzzdzzdz}t|�S)z9Generate a age parameter for MAC authentication draft 00.�ii@B)�datetime�now�microseconds�seconds�daysr	)�
issue_time�td�ages   r�generate_ager@GsZ��	�	�	�	�	�	 �:�	-�B�
�?�?�b�j�j�2�7�7�R�<�$�+>�>�
���� �C��s�8�Orc��tjjd�ry|j�j	d�S)zCheck if the uri is over ssl.�OAUTHLIB_INSECURE_TRANSPORTTzhttps://)�os�environr&�lower�
startswith)rs r�is_secure_transportrGOs-��	�z�z�~�~�3�4���9�9�;�!�!�*�-�-r)�__doc__r8rC�urllib.parserr�oauthlib.commonrrrrr/r5r@rG�rr�<module>rLs<����	�(�%�]�(���&/��.r