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/local/lib/python3.10/dist-packages/yarl/__pycache__/_query.cpython-310.pyc
o

���g��@sdZddlZddlmZmZmZddlmZmZm	Z	m
Z
ddlmZddl
mZmZe
eeefZe
eeefZe
deeeefeeeeffZded	efd
d�Zdeee
eefefd	efd
d�Zdeee
eefefd	efdd�Zdeded	e
edffdd�ZdS)zQuery string handling.�N)�Iterable�Mapping�Sequence)�
TYPE_CHECKING�Any�SupportsInt�Union)�istr�)�QUERY_PART_QUOTER�QUERY_QUOTER�v�returncCs�t|�}|turt|�St|t�rtrt|t�sJ�|S|tus%t|t�rFtr.t|t�s.J�t�|�r7t	d��t�
|�r@t	d��tt|��S|turUt|t�rUtt|��St
d�||���)z%Convert a query variable to a string.zfloat('inf') is not supportedzfloat('nan') is not supportedzMInvalid variable type: value should be str, int or float, got {!r} of type {})�type�int�str�
issubclassr�
isinstance�float�math�isinf�
ValueError�isnan�boolr�	TypeError�format)r
�cls�r�6/usr/local/lib/python3.10/dist-packages/yarl/_query.py�	query_vars*


�r�itemsc� t��fdd�|D�}d�|�S)z�Return a query string from a sequence of (key, value) pairs.

    value is a single value or a sequence of values for the key

    The sequence of values must be a list or tuple.
    csdg|].\}}t|�turt|ttf�r|n|fD]}�|��d�t|�tur(|nt|�����qqS��=)rrr�list�tupler)�.0�k�valr
��quoterrr�
<listcomp>6s"�(��z8get_str_query_from_sequence_iterable.<locals>.<listcomp>�&�r�join�r �pairsrr)r�$get_str_query_from_sequence_iterable,s
	
�
r1cr!)z�Return a query string from an iterable.

    The iterable must contain (key, value) pairs.

    The values are not allowed to be sequences, only single values are
    allowed. For sequences, use `_get_str_query_from_sequence_iterable`.
    cs:g|]\}}�|��d�t|�tur|nt|�����qSr")rrr)r&r'r
r)rrr+Ms.�z/get_str_query_from_iterable.<locals>.<listcomp>r,r-r/rr)r�get_str_query_from_iterable@s


�
r2�args�kwargscOs�|r
|r
d}t|��|}nt|�dkr|d}ntd��|dur"dS|s&dSt|�tur2t|���St|�tus=t|t�rAt|�St|t	�rLt|���St|t
ttf�rZd}t
|��t|t�rct|�St
d��)z*Return a query string from supported args.z7Either kwargs or single query parameter must be presentr
rN�zAInvalid query type: bytes, bytearray and memoryview are forbiddenzRInvalid query type: only str, mapping or sequence of (key, value) pairs is allowed)r�lenr�dictr1r rrrr�bytes�	bytearray�
memoryviewrrr2)r3r4�msg�queryrrr�
get_str_querySs4


�r=)�__doc__r�collections.abcrrr�typingrrrr�	multidictr	�_quotersrrrrr�SimpleQuery�
QueryVariabler%�Queryrr1r2r=rrrr�<module>s.��
��
�"