�
Zճc9 � � � d Z dZdZg ZdZdZddlZg d�Zd� Z d � Z
ed
k r(ddlZ G d� dej
� � Z ej � � dS dS )
zConverts an IRI to a URI.z!Joe Gregorio (joe@bitworking.org)zCopyright 2006, Joe Gregorioz1.0.0�MIT� N))� i�� )i � i�� )i � i� )i� i� )i i�� )i i�� )i i�� )i i�� )i i�� )i i�� )i i�� )i i�� )i i�� )i
i��
)i i�� )i i�� )i
i��
)i i�� )i i�� )i i�� c �� � | }t | � � }t D ]M\ }}||k r nA||k r:||k r4d� d� | � d� � D � � � � } n�N|S )N� c � � g | ]}d |z ��S )z%%%2X� )�.0�os �2/usr/lib/python3/dist-packages/httplib2/iri2uri.py�
<listcomp>zencode.<locals>.<listcomp>7 s � �E�E�E�a�g��k�E�E�E� �utf-8)�ord�escape_range�join�encode)�c�retval�i�low�highs r r r 0 s{ � �
�F��A���A�!� � � ��T��s�7�7��E���8�8��T� � ��W�W�E�E�1�8�8�G�3D�3D�E�E�E�F�F�F��E���Mr
c �P � t | t � � r�t j � | � � \ }}}}}|� d� � � d� � }t j � |||||f� � } d� d� | D � � � � } | S )z�Convert an IRI to a URI. Note that IRIs must be
passed in a unicode strings. That is, do not utf-8 encode
the IRI before passing it into the function.�idnar r c �, � g | ]}t |� � ��S r )r )r r s r r ziri2uri.<locals>.<listcomp>G s � �.�.�.�Q�v�a�y�y�.�.�.r
) �
isinstance�str�urllib�parse�urlsplitr �decode�
urlunsplitr )�uri�scheme� authority�path�query�fragments r �iri2urir( < |