ó ½z]c@sĵdZddlmZddlmZddlmZddlmZddlmZddlmZydd l Z Wne k rd Z nXd ed ej ƒej fd „ƒYZd S( s?Module containing the implementation of the IRIReference class.i˙˙˙˙(t namedtuplei(tcompat(t exceptions(tmisc(t normalizers(turiNt 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-8cCsFtt|ƒj||pd|p$d|p-d||ƒ}||_|S(sCreate a new IRIReference.N(tsuperRt__new__tNonetencoding(tclstschemet authoritytpathtquerytfragmentR tref((s=/tmp/pip-build-kBFYxq/urllib3/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__Rt from_stringt TypeErrortformatttypet__name__(tselftothert other_ref((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/iri.pyt__eq__;s (cCstjj|jƒS(N(RtISUBAUTHORITY_MATCHERtmatchR (R((s=/tmp/pip-build-kBFYxq/urllib3/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 R RRR(Rtto_strRt IRI_MATCHERRt groupdictRtencode_component(R t iri_stringR t split_iri((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/iri.pyRNsc s/ˆj}|rĝ|d krKtd kr9tjdƒ‚n‡fd†}nd}ˆjršdjgˆjjdƒD]}tj ||ƒƒ^qsƒ}nˆj d k rÌt j ˆj ˆj ƒd|}nˆjd k 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((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/iri.pys yststrictt std3_rules( tanytidnatencodetlowertTruet IDNAErrorRtInvalidAuthorityR (tname(R(s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/iri.pyt idna_encoderxs tt.t@t:RRRR N(R R R-RtMissingDependencyErrorthosttjointsplitRR!tuserinfoRR$R tporttstrRt URIReferenceR RRR(RR4R tpart((Rs=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/iri.pyR.as*       7#    (N( Rt __module__t__doc__tslotsRRR t classmethodRR R.(((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/iri.pyR s   (RCt collectionsRR5RRRRRR-t ImportErrorR tURI_COMPONENTStURIMixinR(((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/iri.pyts