????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/iri.pyc

�
}�\]c@s�dZddlmZddlmZddlmZddlmZddlmZddlmZydd	l	m
Z
Wnek
r�dZ
nXd
ed
ej
�ejfd��YZdS(
s?Module containing the implementation of the IRIReference class.i����(t
namedtuplei(tcompat(t
exceptions(tmisc(tnormalizers(turi(tidnatIRIReferencecBsPeZdZdZdd�Zd�Zd�Zedd��Zdd�Z
RS(	sAImmutable object representing a parsed IRI Reference.

    Can be encoded into an URIReference object via the procedure
    specified in RFC 3987 Section 3.1

     .. note::
        The IRI submodule is a new interface and may possibly change in
        the future. Check for changes to the interface when upgrading.
    sutf-8c
CsFtt|�j||pd|p$d|p-d||�}||_|S(sCreate a new IRIReference.N(tsuperRt__new__tNonetencoding(tclstschemet	authoritytpathtquerytfragmentRtref((sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pyR	.s					cCs�|}t|t�r'|j|�}nft|t�s�y|jj|�}Wq�tk
r�tdjt|�jt|�j���q�Xnt|�t|�kS(s"Compare this reference to another.s Unable to compare {0}() to {1}()(	t
isinstancettuplet	__class__Rtfrom_stringt	TypeErrortformatttypet__name__(tselftothert	other_ref((sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pyt__eq__;s
(cCstjj|j�S(N(RtISUBAUTHORITY_MATCHERtmatchR(R((sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pyt_match_subauthorityKscCs{tj||�}tjj|�j�}||d|dtj|d|�tj|d|�tj|d|�|�S(s	Parse a IRI reference from the given unicode IRI string.

        :param str iri_string: Unicode IRI to be parsed into a reference.
        :param str encoding: The encoding of the string provided
        :returns: :class:`IRIReference` or subclass thereof
        R
RRRR(Rtto_strRtIRI_MATCHERR t	groupdictRtencode_component(Rt
iri_stringRt	split_iri((sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pyRNscs/�j}|r�|dkrKtdkr9tjd��n�fd�}nd}�jr�djg�jjd�D]}tj	||��^qs�}n�j
dk	r�tj�j
�j
�d|}n�jdk	r�|dt�j�7}q�ntj�j|d�jd�jd	�jd
�j
�S(s�Encode an IRIReference into a URIReference instance.

        If the ``idna`` module is installed or the ``rfc3986[idna]``
        extra is used then unicode characters in the IRI host
        component will be encoded with IDNA2008.

        :param idna_encoder:
            Function that encodes each part of the host component
            If not given will raise an exception if the IRI
            contains a host component.
        :rtype: uri.URIReference
        :returns: A URI reference
        sICould not import the 'idna' module and the IRI hostname requires encodingcsitd�|D��rey#tj|j�dtdt�SWqetjk
ratj�j��qeXn|S(Ncss!|]}t|�dkVqdS(i�N(tord(t.0tc((sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pys	<genexpr>yststrictt
std3_rules(	tanyRtencodetlowertTruet	IDNAErrorRtInvalidAuthorityR(tname(R(sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pytidna_encoderxstt.t@t:RRRRN(RR
RRtMissingDependencyErrorthosttjointsplitRR"tuserinfoRR%RtporttstrRtURIReferenceR
RRR(RR4Rtpart((RsG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pyR.as*	
		7#			(N(Rt
__module__t__doc__tslotsR	RR!tclassmethodRR
R.(((sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pyR s
		N(RCtcollectionsRR5RRRRRtpip._vendorRtImportErrorR
tURI_COMPONENTStURIMixinR(((sG/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/iri.pyt<module>s