← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/httpx/__pycache__/_utils.cpython-312.pyc

86 lines

�

c�bj] ����ddlmZddlZddlZddlZddlZddlmZddlm	Z	ejrddlmZdd�Z
dd�Zddd	�Zddd
�Zdd�Zdd�Zdd
�ZGd�d�Zdd�Zdd�Zy)�)�annotationsN)�
getproxies�)�
PrimitiveData��URLc�2�|dury|dury|�yt|�S)z�
    Coerce a primitive data type into a string value.

    Note that we prefer JSON-style 'true'/'false' for boolean values here.
    T�trueF�false�)�str��values �c/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/httpx/_utils.py�primitive_value_to_strrs*��
��}��	�%���	����u�:��c���t�}i}dD]*}|j|�s�||}d|vr|nd|��||�d�<�,|jdd�jd�D�cgc]}|j���}}|D]e}|dk(ricS|s�d|vrd||<�t	|�r	d|d	|��<�-t|�r
d|d
|�d�<�B|j
�dk(r	d|d	|��<�^d|d
|��<�g|Scc}w)z+Gets proxy information from the environment)�http�https�allz://zhttp://�nor�,�*Nzall://zall://[�]�	localhostzall://*)r�get�split�strip�is_ipv4_hostname�is_ipv6_hostname�lower)�
proxy_info�mounts�scheme�hostname�host�no_proxy_hostss      r�get_environment_proxiesr(s*����J�$&�F�*���>�>�&�!�!�&�)�H�!�X�-��W�X�J�3G�
�f�X�S�>�"�+�0:�~�~�d�B�/G�/M�/M�c�/R�S�/R�t�d�j�j�l�/R�N�S�"���s�?�
�I�
��� �#'��x� �!�(�+�.2����z�*�+�!�(�+�04����
�!�,�-����!�[�0�.2����z�*�+�/3����
�+�,�5#�8�M��;Ts�C$c�H�t|t�r|j|�S|S�N��
isinstancer
�encode�r�encodings  r�to_bytesr0Os��%/��s�%;�5�<�<��!�F��Frc�H�t|t�r|S|j|�Sr*)r,r
�decoder.s  r�to_strr3Ss���u�c�*�5�F����X�0F�Frc�F�t|t�r|S|j�Sr*r+)r�
match_type_ofs  r�to_bytes_or_strr6Ws���}�c�2�5�F�����Frc�8�|d|dcxk(rdk(rnn|ddS|S)Nr������"r�rs r�unquoter;[s'����(�e�B�i�6�3�6�5��2�;�A�E�Arc�B�	|j�}tj|�j}|S#tt
f$r\	|j
�}|jdtj�}|j|�Y|S#tt
f$rYYywxYwwxYw)zs
    Given a file-like stream object, return its length in number of bytes
    without reading it into memory.
    rN)	�fileno�os�fstat�st_size�AttributeError�OSError�tell�seek�SEEK_END)�stream�fd�length�offsets    r�peek_filelike_lengthrJ_s���
�
�]�]�_�����"��%�%���M��
�G�$�
�	��[�[�]�F��[�[��B�K�K�0�F��K�K���
�M��	��(�	��	��
�s(�/3�B�AB�B�B�B�Bc�J�eZdZdZd	d�Zd
d�Zedd��Zdd�Zd
d�Z	dd�Z
y)�
URLPatterna�
    A utility class currently used for making lookups against proxy keys...

    # Wildcard matching...
    >>> pattern = URLPattern("all://")
    >>> pattern.matches(httpx.URL("http://example.com"))
    True

    # Witch scheme matching...
    >>> pattern = URLPattern("https://")
    >>> pattern.matches(httpx.URL("https://example.com"))
    True
    >>> pattern.matches(httpx.URL("http://example.com"))
    False

    # With domain matching...
    >>> pattern = URLPattern("https://example.com")
    >>> pattern.matches(httpx.URL("https://example.com"))
    True
    >>> pattern.matches(httpx.URL("http://example.com"))
    False
    >>> pattern.matches(httpx.URL("https://other.com"))
    False

    # Wildcard scheme, with domain matching...
    >>> pattern = URLPattern("all://example.com")
    >>> pattern.matches(httpx.URL("https://example.com"))
    True
    >>> pattern.matches(httpx.URL("http://example.com"))
    True
    >>> pattern.matches(httpx.URL("https://other.com"))
    False

    # With port matching...
    >>> pattern = URLPattern("https://example.com:1234")
    >>> pattern.matches(httpx.URL("https://example.com:1234"))
    True
    >>> pattern.matches(httpx.URL("https://example.com"))
    False
    c�8�ddlm}|rd|vrtd|�d|�d���||�}||_|jdk(rdn|j|_|j
d	k(rdn|j
|_|j|_|j
r|j
d	k(rd|_y|j
jd
�rAtj|j
dd�}tjd|�d
��|_y|j
jd	�rAtj|j
dd�}tjd|�d
��|_ytj|j
�}tjd|�d
��|_y)Nrr�:zUProxy keys should use proper URL forms rather than plain scheme strings. Instead of "z", use "z://"rrrz*.�z^.+\.�$z^(.+\.)?�^)�_urlsr�
ValueError�patternr$r&�port�
host_regex�
startswith�re�escape�compile)�selfrTr�url�domains     r�__init__zURLPattern.__init__�sI����s�'�)���&�i�x��y��>��
��'�l������J�J�%�/�b�S�Z�Z����(�(�c�/�B�s�x�x��	��H�H��	��x�x�3�8�8�s�?�:>�D�O�
�X�X�
 �
 ��
&��Y�Y�s�x�x���|�,�F� �j�j�6�&���);�<�D�O�
�X�X�
 �
 ��
%��Y�Y�s�x�x���|�,�F� �j�j�9�V�H�A�)>�?�D�O��Y�Y�s�x�x�(�F� �j�j�1�V�H�A��7�D�Orc��|jr|j|jk7ry|jr2|j�&|jj|j�sy|j�|j|jk7ryy)NFT)r$r&rV�matchrU�r[�others  r�matcheszURLPattern.matches�sd���;�;�4�;�;�%�,�,�6���I�I����+��O�O�)�)�%�*�*�5���9�9� �T�Y�Y�%�*�*�%<��rc��|j�dnd}t|j�}t|j�}|||fS)z�
        The priority allows URLPattern instances to be sortable, so that
        we can match from most specific to least specific.
        rr)rU�lenr&r$)r[�
port_priority�
host_priority�scheme_prioritys    r�priorityzURLPattern.priority�sA��"�Y�Y�2���
��T�Y�Y���
��t�{�{�+�+���}�o�>�>rc�,�t|j�Sr*)�hashrT)r[s r�__hash__zURLPattern.__hash__�s���D�L�L�!�!rc�4�|j|jkSr*)riras  r�__lt__zURLPattern.__lt__�s���}�}�u�~�~�-�-rc�X�t|t�xr|j|jk(Sr*)r,rLrTras  r�__eq__zURLPattern.__eq__�s!���%��,�N�������1N�NrN)rTr
�return�None)rbrrq�bool)rqztuple[int, int, int])rq�int)rbrLrqrs)rb�
typing.Anyrqrs)�__name__�
__module__�__qualname__�__doc__r^rc�propertyrirlrnrpr:rrrLrLxs6��'�R8�<��?��?�"�.�OrrLc�r�	tj|jd�d�y#t$rYywxYw�N�/rFT)�	ipaddress�IPv4Addressr�	Exception�r%s rrr��<������h�n�n�S�1�!�4�5���������'*�	6�6c�r�	tj|jd�d�y#t$rYywxYwr|)r~�IPv6Addressrr�r�s rr r �r�r�)rrrqr
)rqzdict[str, str | None])zutf-8)r�str | bytesr/r
rq�bytes)rr�r/r
rqr
)rr
r5�
typing.AnyStrrqr�)rr
rqr
)rFrurqz
int | None)r%r
rqrs)�
__future__rr~r>rX�typing�urllib.requestr�_typesr�
TYPE_CHECKINGrRrrr(r0r3r6r;rJrLrr r:rr�<module>r�sg��"��	�	�
�%�!�	�����.�bG�G�G�B��2jO�jO�Z�r