File: //usr/local/lib/python3.10/dist-packages/yarl/__pycache__/_query.cpython-310.pyc
o
���g� � @ s d Z ddlZddlmZmZmZ ddlmZmZm Z m
Z
ddlmZ ddl
mZmZ e
eeef Ze
eee f Ze
deeeef eeeef f Zded efd
d�Zdeee
eef ef d efd
d�Zdeee
eef ef d efdd�Zdeded e
edf fdd�ZdS )zQuery string handling.� N)�Iterable�Mapping�Sequence)�
TYPE_CHECKING�Any�SupportsInt�Union)�istr� )�QUERY_PART_QUOTER�QUERY_QUOTER�v�returnc C s� t | �}|tu rt| �S t|t�rtrt| t�sJ �| S |tu s%t|t�rFtr.t| t�s.J �t�| �r7t d��t�
| �r@t d��tt| ��S |turUt|t�rUtt| ��S t
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_var s*
�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.
c sd g | ].\}}t |�turt|ttf�r|n|fD ]}� |�� d � t |�tu r(|nt|��� ��qqS ��=)r r r �list�tupler )�.0�k�valr
��quoterr r �
<listcomp>6 s "�(��z8get_str_query_from_sequence_iterable.<locals>.<listcomp>�&�r �join�r �pairsr r) r �$get_str_query_from_sequence_iterable, s
�
r1 c r! )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`.
c s: g | ]\}}� |�� d � t |�tu r|nt|��� ��qS r"