ó ½z]c@sdZddlmZddlmZddlmZddlmZddlmZdedej ƒefd „ƒYZ d S( s?Module containing the implementation of the URIReference class.iÿÿÿÿ(t namedtuplei(tcompat(tmisc(t normalizers(tURIMixint URIReferencecBsMeZdZdZdd„ZejZd„Zd„Ze dd„ƒZ RS(sİImmutable object representing a parsed URI Reference. .. note:: This class is not intended to be directly instantiated by the user. This object exposes attributes for the following components of a URI: - scheme - authority - path - query - fragment .. attribute:: scheme The scheme that was parsed for the URI Reference. For example, ``http``, ``https``, ``smtp``, ``imap``, etc. .. attribute:: authority Component of the URI that contains the user information, host, and port sub-components. For example, ``google.com``, ``127.0.0.1:5000``, ``username@[::1]``, ``username:password@example.com:443``, etc. .. attribute:: path The path that was parsed for the given URI Reference. For example, ``/``, ``/index.php``, etc. .. attribute:: query The query component for a given URI Reference. For example, ``a=b``, ``a=b%20c``, ``a=b+c``, ``a=b,c=d,e=%20f``, etc. .. attribute:: fragment The fragment component of a URI. For example, ``section-3.1``. This class also provides extra attributes for easier access to information like the subcomponents of the authority component. .. attribute:: userinfo The user information parsed from the authority. .. attribute:: host The hostname, IPv4, or IPv6 adddres parsed from the authority. .. attribute:: port The port parsed from the authority. sutf-8cCsFtt|ƒj||pd|p$d|p-d||ƒ}||_|S(sCreate a new URIReference.N(tsuperRt__new__tNonetencoding(tclstschemet authoritytpathtquerytfragmentR tref((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/uri.pyRUs     cCs¦|}t|tƒr$t|Œ}nWt|tƒs{ytj|ƒ}Wq{tk rwtdjt|ƒjƒƒ‚q{Xnt|ƒt|ƒk}|p¥|j|ƒS(s"Compare this reference to another.s)Unable to compare URIReference() to {0}()( t isinstancettupleRt from_stringt TypeErrortformatttypet__name__tnormalized_equality(tselftothert other_reftnaive_equality((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/uri.pyt__eq__ds cCssttj|jpdƒtj|j|j|jfƒtj|j pHdƒtj |j ƒtj |j ƒ|jƒS(sNormalize this reference as described in Section 6.2.2. This is not an in-place normalization. Instead this creates a new URIReference. :returns: A new reference object with normalized components. :rtype: URIReference t(RRtnormalize_schemeR tnormalize_authoritytuserinfothosttporttnormalize_pathR tnormalize_queryRtnormalize_fragmentRR (R((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/uri.pyt normalizeus cCs{tj||ƒ}tjj|ƒjƒ}||d|dtj|d|ƒtj|d|ƒtj|d|ƒ|ƒS(s Parse a URI reference from the given unicode URI string. :param str uri_string: Unicode URI to be parsed into a reference. :param str encoding: The encoding of the string provided :returns: :class:`URIReference` or subclass thereof R R R RR(Rtto_strRt URI_MATCHERtmatcht groupdictRtencode_component(R t uri_stringR t split_uri((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/uri.pyRˆs(( Rt __module__t__doc__tslotsRRt__hash__RR't classmethodR(((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/uri.pyRs8   N( R0t collectionsRRRRRt_mixinRtURI_COMPONENTSR(((s=/tmp/pip-build-kBFYxq/urllib3/urllib3/packages/rfc3986/uri.pyts