HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/__pycache__/utils.cpython-310.pyc
o

���a��@sldZddlZddlZddlmZmZddlmZdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�ZdS)zp
oauthlib.utils
~~~~~~~~~~~~~~

This module contains utility methods used by various parts of the OAuth 2 spec.
�N)�quote�urlparse)�	urldecodecCsFt|t�s	|dur|St|tttf�rd�dd�|D��Std|��)z5Convert a list of scopes to a space separated string.N� cS�g|]}t|��qS���str��.0�srr�?/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/utils.py�
<listcomp>�z!list_to_scope.<locals>.<listcomp>z8Invalid scope (%s), must be string, tuple, set, or list.)�
isinstancer	�set�tuple�list�join�
ValueError��scoperrr
�
list_to_scopes
rcCs8t|tttf�rdd�|D�S|durdS|���d�S)z5Convert a space separated string to a list of scopes.cSrrrr
rrr
rrz!scope_to_list.<locals>.<listcomp>Nr)rrrr�strip�splitrrrr
�
scope_to_lists
rcCs.ttt|�j��}d|vrt|d�|d<|S)Nr)�dictrr�queryr)�uri�paramsrrr
�params_from_uri"sr c	CsTddd�}t|�\}}}}}}d|vr|�dd�\}}||fS|�|���}||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�portrrr
�
host_from_uri)s��r0cCs$t|t�s	td��t|�d�dd�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)�urrr
�escape<s
r5cCs8tj��|}|j|j|jdddd}t|�S)z9Generate a age parameter for MAC authentication draft 00.�ii@B)�datetime�now�microseconds�seconds�daysr	)�
issue_time�td�agerrr
�generate_ageGs��r?cCstj�d�rdS|���d�S)zCheck if the uri is over ssl.�OAUTHLIB_INSECURE_TRANSPORTTzhttps://)�os�environr'�lower�
startswith)rrrr
�is_secure_transportOsrE)�__doc__r7rA�urllib.parserr�oauthlib.commonrrrr r0r5r?rErrrr
�<module>s