File: //lib/python3/dist-packages/hyperlink/__pycache__/_url.cpython-310.pyc
o
    G�_cF �                   @   s^  d Z ddlZddlZddlZddlZddlmZmZ zddlmZ W n ey-   e	ZY nw ddl
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ zdd	lmZ W n eys   dd	l mZ Y nw dd
l!m"Z#m$Z% ej&d dkZ'ze( W n e)y�   e*Z(Y nw e+d�Z,eeeee f df Z-eeeee f e-eeeee f  f Z.ed
�Z/d�dd�Z0e0d� Z1Z2e3d�Z4e�5d�Z6e�5d�Z7e�5d�Z8e9dd� ej:D ��Z;e�5d�Z<e3d�Z=e3d�Z>e=e>B Z?e4e>B e@d�B ZAe?eA ZBeAe@d�B ZCe?eC ZDeCe@d� ZEe?eE ZFe4eCB e@d�B ZGe?eG ZHe4eGe@d � B ZIe?eI ZJe4eIe@d!� B ZKe?eK ZLd�d#d$�ZMd%d&� ZNeNeA�ZOeMeB�ZPeNeC�ZQeNeE�ZReMeD�ZSeNeK�ZTeMeL�ZUeNeI�ZVeMeJ�ZWeNeG�ZXeMeH�ZYeNe4�ZZe9d'd� e;�[� D ��Z\e3d(�Z]d�d*d+�Z^d�d,d-�Z_d�d.d/�Z`	"	)	)	)d�d0d1�Zad�d2d3�Zbd�d4d5�Zcd�d6d7�Zdd�d8d9�Zei d:d;�d<d=�d>d?�d@dA�dBd�dCdD�dEdF�dGdH�dIdJ�dKdL�dMdN�dOdP�dQdP�dRdS�dTdU�dVdW�dXdY�i dZd[�d\d]�d^d�d_d`�dadb�dcdd�dedf�dgdh�didj�dkdl�dmdn�dodp�dqdr�dsdt�dudv�dwdx�dydz��dvdd{d|d}d~ddJdLdd��
�Zfe@g d���Zge@� Zh	)d�d�d��Zid�d�d��ZjG d�d�� d�ek�Zld�d�� Zmd�d�� Zne3� d"fd�d��Zod�d�� Zpd�d�d��Zq	"d�d�d��Zrd�d�d��Zsd�d�d��Zt	"d�d�d��Zu	"d�d�d��Zvd"d�d"d"e;fd�d��Zwd�d�� Zxd�d�� Zyd�d�� ZzG d�d�� d�e{�Z|e|Z}e|� Z~d�d�� Zd�d�� Z�G d�d�� d�e{�Z�d�d�d��Z�dS )�a  Hyperlink provides Pythonic URL parsing, construction, and rendering.
Usage is straightforward::
   >>> import hyperlink
   >>> url = hyperlink.parse(u'http://github.com/mahmoud/hyperlink?utm_source=docs')
   >>> url.host
   u'github.com'
   >>> secure_url = url.replace(scheme=u'https')
   >>> secure_url.get('utm_source')[0]
   u'docs'
Hyperlink's API centers on the :class:`DecodedURL` type, which wraps
the lower-level :class:`URL`, both of which can be returned by the
:func:`parse()` convenience function.
�    N)�AF_INET�AF_INET6)�
AddressFamily)�Any�Callable�Dict�Iterable�Iterator�List�Mapping�Optional�Sequence�Text�Tuple�Type�TypeVar�Union�cast)�	normalize�   )�	inet_pton)r   )�encode�decode�   .�T�_MISSING� c                    s   G � �fdd�dt �}|� S )a�  Creates and returns a new **instance** of a new class, suitable for
    usage as a "sentinel", a kind of singleton often used to indicate
    a value is missing when ``None`` is a valid input.
    Args:
        name: Name of the Sentinel
        var_name: Set this name to the name of the variable in its respective
            module enable pickle-ability.
    >>> make_sentinel(var_name='_MISSING')
    _MISSING
    The most common use cases here in boltons are as default values
    for optional function arguments, partly because of its
    less-confusing appearance in automatically generated
    documentation. Sentinels also function well as placeholders in queues
    and linked lists.
    .. note::
        By design, additional calls to ``make_sentinel`` with the same
        values will not produce equivalent objects.
        >>> make_sentinel('TEST') == make_sentinel('TEST')
        False
        >>> type(make_sentinel('TEST')) == type(make_sentinel('TEST'))
        False
    c                       s:   e Zd Z� �fdd�Zdd� Z�rdd� Zdd� ZeZd	S )
zmake_sentinel.<locals>.Sentinelc                    s   � | _ �| _d S �N��name�var_name��selfr   � �0/usr/lib/python3/dist-packages/hyperlink/_url.py�__init__j   s   
z(make_sentinel.<locals>.Sentinel.__init__c                 S   s   | j r| j S d| jj| jf S )Nz%s(%r))r    �	__class__�__name__r   r!   r#   r#   r$   �__repr__o   s   z(make_sentinel.<locals>.Sentinel.__repr__c                 S   �   | j S r   )r    r!   r#   r#   r$   �
__reduce__x   s   z*make_sentinel.<locals>.Sentinel.__reduce__c                 S   s   dS )NFr#   r!   r#   r#   r$   �__nonzero__|   �   z+make_sentinel.<locals>.Sentinel.__nonzero__N)r'