File: //proc/self/root/lib/python3/dist-packages/hyperlink/__pycache__/_url.cpython-38.pyc
U
��\ � - @ s` d Z ddlZddlZddlZddlZddlmZ zddlmZ W n ek
rX dZY nX zddl m
Z
W n ek
r� ddlm
Z
Y nX ddlm
ZmZmZ edkr�ddlZG dd� dej�ZejjjZejjjZd d
� Zejd dkZed�Zze W n ek
�r eZY nX ed�Z d�dd�Z!e!d� Z"Z#e$d�Z%e�&d�Z'e�&d�Z(e�&d�Z)e*dd� ej+D ��Z,e�&d�Z-e$d�Z.e$d�Z/e.e/B Z0e%e/B e1d�B Z2e0e2 Z3e2e1d�B Z4e0e4 Z5e4e1d� Z6e0e6 Z7e%e4B e1d�B Z8e0e8 Z9e%e8e1d� B Z:e0e: Z;e%e:e1d� B Z<e0e< Z=d�d!d"�Z>d#d$� Z?e?e2�Z@e>e3�ZAe?e4�ZBe?e6�ZCe>e5�ZDe?e<�ZEe>e=�ZFe?e:�ZGe>e;�ZHe?e8�ZIe>e9�ZJe?e%�ZKe*d%d� e,�L� D ��ZMe$d&�ZNd�d(d)�ZOd�d*d+�ZPd�d,d-�ZQd�d.d/�ZRd�d0d1�ZSd�d2d3�ZTd�d4d5�ZUd�d6d7�ZVd8d9d:d;dd<d=d>d?d@dAdBdBdCdDdEdFdGdHddIdJdKdLdMdNdOdPdQdRdSdTdUdVdTddWdXdYdZd[d?d@dd\�,ZWe1d]d^d_d`dadbdcdddedfdgdhdig
�ZXd�djdk�ZYd�dldm�ZZG dndo� doe[�Z\dpdq� Z]drds� Z^e$� d fdtdu�Z_dvdw� Z`d�dxdy�Zad�dzd{�Zbd�d|d}�Zcd�d~d�Zdd�d�d��Zed�d�d��Zfd d�d d e,fd�d��Zgd�d�� Zhd�d�� Zid�d�� ZjG d�d�� d�ek�ZlelZmG d�d�� d�ek�Znd�d�d��ZodS )�a� Hyperlink provides Pythonic URL parsing, construction, and rendering.
Usage is straightforward::
>>> from hyperlink import URL
>>> url = URL.from_text(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'
As seen here, the API revolves around the lightweight and immutable
:class:`URL` type, documented below.
� N)� normalize)� inet_pton)�Mapping)�encode�decode� IDNAErrorc @ s@ e Zd Zdejfdejfdejd fdejd fdejfgZdS ) � _sockaddr� sa_familyZ__pad1� ipv4_addr� � ipv6_addr� Z__pad2N) �__name__�
__module__�__qualname__�ctypesZc_shortZc_ushortZc_byteZc_ulongZ_fields_� r r �0/usr/lib/python3/dist-packages/hyperlink/_url.pyr ) s �r c C s� t � }|�d�}| |_t�t�|��}t|| d t�|�t�|��dkrTt� t�
� ��| tjkrlt�|j
d�S | tjkr�t�|jd�S t� d��d S )N�asciir r r
zunknown address family)r r r r Zc_intZsizeof�WSAStringToAddressAZbyref�socket�errorZFormatError�AF_INETZ string_atr
�AF_INET6r )Zaddress_familyZ ip_stringZaddrZ addr_sizer r r r 3 s
r � � �_MISSINGc 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 (str): Name of the Sentinel
var_name (str): Set this name to the name of the variable in
its respective module enable pickleability.
>>> 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�r*dd� Zdd� ZeZd S )
zmake_sentinel.<locals>.Sentinelc s � | _ �| _d S �N��name�var_name��selfr r r �__init__l s z(make_sentinel.<locals>.Sentinel.__init__c S s | j r| j S d| jj| jf S )Nz%s(%r))r � __class__r r r! r r r �__repr__p s z(make_sentinel.<locals>.Sentinel.__repr__c S s | j S r )r r! r r r �
__reduce__u s z*make_sentinel.<locals>.Sentinel.__reduce__c S s dS )NFr r! r r r �__nonzero__x s z+make_sentinel.<locals>.Sentinel.__nonzero__N)r r r r# r% r&