????

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/_mixin.pyc

�
}�\]c@sldZddlZddlmZddlmZddlmZddlmZdefd	��YZ	dS(
s;Module containing the implementation of the URIMixin class.i����Ni(t
exceptions(tmisc(tnormalizers(t
validatorstURIMixincBs�eZdZejZd�Zd�Zed��Zed��Z	ed��Z
d�Zd�Ze
d�Ze
d	�Ze
d
�Ze
d�Ze
d�Zd
�Ze
d�Zd�Zejejejejejd�ZRS(s0Mixin with all shared methods for URIs and IRIs.cCs�|js"idd6dd6dd6S|j�}|dkr[tj|jj|j���n|j�}|jd�}|r�t	j
j|�r�tj
|�r�tj|jj|j���n|S(s�Return a dictionary with the ``userinfo``, ``host``, and ``port``.

        If the authority is not valid, it will raise a
        :class:`~rfc3986.exceptions.InvalidAuthority` Exception.

        :returns:
            ``{'userinfo': 'username:password', 'host': 'www.example.com',
            'port': '80'}``
        :rtype: dict
        :raises rfc3986.exceptions.InvalidAuthority:
            If the authority is not ``None`` and can not be parsed.
        tuserinfothosttportN(t	authoritytNonet_match_subauthoritytexctInvalidAuthoritytencodetencodingt	groupdicttgetRtIPv4_MATCHERtmatchRtvalid_ipv4_host_address(tselfRtmatchesR((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pytauthority_infos
	!!cCstjj|j�S(N(RtSUBAUTHORITY_MATCHERRR(R((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR
5scCs0y|j�}Wntjk
r'dSX|dS(s+If present, a string representing the host.RN(RRRR	(RR((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR8s
cCs0y|j�}Wntjk
r'dSX|dS(s2If present, the port extracted from the authority.RN(RRRR	(RR((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyRAs
cCs0y|j�}Wntjk
r'dSX|dS(s6If present, the userinfo extracted from the authority.RN(RRRR	(RR((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyRJs
cCsttjj|j���S(s�Determine if this URI Reference is an absolute URI.

        See http://tools.ietf.org/html/rfc3986#section-4.3 for explanation.

        :returns: ``True`` if it is an absolute URI, ``False`` otherwise.
        :rtype: bool
        (tboolRtABSOLUTE_URI_MATCHERRtunsplit(R((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pytis_absoluteSscKs�tjdt�|j|jdt�f|j|jdt�f|j|jdt�f|j|jdt�f|j	|jdt�fg}t
d�|D��S(sbDetermine if the URI is valid.

        .. deprecated:: 1.1.0

            Use the :class:`~rfc3986.validators.Validator` object instead.

        :param bool require_scheme: Set to ``True`` if you wish to require the
            presence of the scheme component.
        :param bool require_authority: Set to ``True`` if you wish to require
            the presence of the authority component.
        :param bool require_path: Set to ``True`` if you wish to require the
            presence of the path component.
        :param bool require_query: Set to ``True`` if you wish to require the
            presence of the query component.
        :param bool require_fragment: Set to ``True`` if you wish to require
            the presence of the fragment component.
        :returns: ``True`` if the URI is valid. ``False`` otherwise.
        :rtype: bool
        sXPlease use rfc3986.validators.Validator instead. This method will be eventually removed.trequire_schemetrequire_authoritytrequire_patht
require_querytrequire_fragmentcss!|]\}}||�VqdS(N((t.0tvtr((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pys	<genexpr>{s(twarningstwarntDeprecationWarningtscheme_is_validRtFalsetauthority_is_validt
path_is_validtquery_is_validtfragment_is_validtall(RtkwargsR((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pytis_valid]s	cCsUtjdt�y|j�Wntjk
r5tSXtj|j	d|j
d|�S(sDetermine if the authority component is valid.

        .. deprecated:: 1.1.0

            Use the :class:`~rfc3986.validators.Validator` object instead.

        :param bool require:
            Set to ``True`` to require the presence of this component.
        :returns:
            ``True`` if the authority is valid. ``False`` otherwise.
        :rtype:
            bool
        sXPlease use rfc3986.validators.Validator instead. This method will be eventually removed.Rtrequire(R$R%R&RRRR(RR)RR(RR0((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR)}s			cCs#tjdt�tj|j|�S(s`Determine if the scheme component is valid.

        .. deprecated:: 1.1.0

            Use the :class:`~rfc3986.validators.Validator` object instead.

        :param str require: Set to ``True`` to require the presence of this
            component.
        :returns: ``True`` if the scheme is valid. ``False`` otherwise.
        :rtype: bool
        sXPlease use rfc3986.validators.Validator instead. This method will be eventually removed.(R$R%R&RR'tscheme(RR0((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR'�s	cCs#tjdt�tj|j|�S(s\Determine if the path component is valid.

        .. deprecated:: 1.1.0

            Use the :class:`~rfc3986.validators.Validator` object instead.

        :param str require: Set to ``True`` to require the presence of this
            component.
        :returns: ``True`` if the path is valid. ``False`` otherwise.
        :rtype: bool
        sXPlease use rfc3986.validators.Validator instead. This method will be eventually removed.(R$R%R&RR*tpath(RR0((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR*�s	cCs#tjdt�tj|j|�S(s^Determine if the query component is valid.

        .. deprecated:: 1.1.0

            Use the :class:`~rfc3986.validators.Validator` object instead.

        :param str require: Set to ``True`` to require the presence of this
            component.
        :returns: ``True`` if the query is valid. ``False`` otherwise.
        :rtype: bool
        sXPlease use rfc3986.validators.Validator instead. This method will be eventually removed.(R$R%R&RR+tquery(RR0((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR+�s	cCs#tjdt�tj|j|�S(sGDetermine if the fragment component is valid.

        .. deprecated:: 1.1.0

            Use the Validator object instead.

        :param str require: Set to ``True`` to require the presence of this
            component.
        :returns: ``True`` if the fragment is valid. ``False`` otherwise.
        :rtype: bool
        sXPlease use rfc3986.validators.Validator instead. This method will be eventually removed.(R$R%R&RR,tfragment(RR0((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR,�s	cCs"t|j��t|j��kS(sCompare this URIReference to another URIReference.

        :param URIReference other_ref: (required), The reference with which
            we're comparing.
        :returns: ``True`` if the references are equal, ``False`` otherwise.
        :rtype: bool
        (ttuplet	normalize(Rt	other_ref((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pytnormalized_equality�sc
Cs�t|t�s't|�j|�}n|j�sEtj|��n|j�}|}|r�|j|jkr�|j	dd�}n|jdk	r�|j	dtj|j
��}n|jdk	r�|j	d|jdtj|j
��}n�|j
dkrQ|jdk	r|j}n	|j}|j	d|jd|jd|j
d|�}nr|j
jd�rxtj|j
�}ntjtj||j
��}|j	d|jd|jd|d|j�}|S(s�Use an absolute URI Reference to resolve this relative reference.

        Assuming this is a relative reference that you would like to resolve,
        use the provided base URI to resolve it.

        See http://tools.ietf.org/html/rfc3986#section-5 for more information.

        :param base_uri: Either a string or URIReference. It must be an
            absolute URI or it will raise an exception.
        :returns: A new URIReference which is the result of resolving this
            reference using ``base_uri``.
        :rtype: :class:`URIReference`
        :raises rfc3986.exceptions.ResolutionError:
            If the ``base_uri`` is not an absolute URI.
        R1R2RR3t/N(t
isinstanceRttypetfrom_stringRRtResolutionErrorR6R1t	copy_withR	Rtnormalize_pathR2RR3t
startswithRtmerge_paths(Rtbase_uritstrictt	resolvingttargetR3R2((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pytresolve_with�sD											cCs�g}|jr(|j|jdg�n|jrJ|jd|jg�n|jrf|j|j�n|jdk	r�|jd|jg�n|jdk	r�|jd|jg�ndj|�S(s�Create a URI string from the components.

        :returns: The URI Reference reconstituted as a string.
        :rtype: str
        t:s//t?t#tN(	R1textendRR2tappendR3R	R4tjoin(Rtresult_list((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR-s			c
Cs�i|d6|d6|d6|d6|d6}x9t|j��D]%\}}|tjkr<||=q<q<W|j|�}	|j|	_|	S(sCreate a copy of this reference with the new components.

        :param str scheme:
            (optional) The scheme to use for the new reference.
        :param str authority:
            (optional) The authority to use for the new reference.
        :param str path:
            (optional) The path to use for the new reference.
        :param str query:
            (optional) The query to use for the new reference.
        :param str fragment:
            (optional) The fragment to use for the new reference.
        :returns:
            New URIReference with provided components.
        :rtype:
            URIReference
        R1RR2R3R4(tlisttitemsRtUseExistingt_replaceR(
RR1RR2R3R4t
attributestkeytvalueturi((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR>As
(t__name__t
__module__t__doc__R5t__hash__RR
tpropertyRRRRR/R(R)R'R*R+R,R8RFRRRQR>(((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyR
s(		&					
	 	
F	(
RYR$RJRRRRRtobjectR(((sJ/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/_mixin.pyt<module>s