Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/models/__pycache__/link.cpython-35.pyc



t_.@sddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZmZerddlmZmZmZmZdd	lmZdd
lmZGddde
ZdS)
N)parse)WHEEL_EXTENSION)redact_auth_from_urlsplit_auth_from_netlocsplitext)KeyBasedCompareMixin)MYPY_CHECK_RUNNING)path_to_urlurl_to_path)OptionalTextTupleUnion)HTMLPage)HashescseZdZdZddddddgZdddd	fd
dZdd
ZddZeddZ	eddZ
eddZeddZeddZ
eddZddZeddZed d!Zejd"Zed#d$Zejd%Zed&d'Zejd(Zed)d*Zed+d,Zed-d.Zed/d0Zd1d2Zed3d4Zed5d6Zed7d8Z ed9d:Z!d;d<Z"S)=Linkz?Represents a parsed link from a Package Index's simple URL
    _parsed_url_url
comes_fromrequires_python
yanked_reasoncache_link_parsingNTcs|jdrt|}tj||_||_||_|rK|nd|_||_t	t
|jd|dt
||_dS)a
        :param url: url of the resource pointed to (href of the link)
        :param comes_from: instance of HTMLPage where the link was found,
            or string.
        :param requires_python: String containing the `Requires-Python`
            metadata field, specified in PEP 345. This may be specified by
            a data-requires-python attribute in the HTML link tag, as
            described in PEP 503.
        :param yanked_reason: the reason the file has been yanked, if the
            file has been yanked, or None if the file hasn't been yanked.
            This is the value of the "data-yanked" attribute, if present, in
            a simple repository HTML link. If the file has been yanked but
            no reason was provided, this should be the empty string. See
            PEP 592 for more information and the specification.
        :param cache_link_parsing: A flag that is used elsewhere to determine
                                   whether resources retrieved from this link
                                   should be cached. PyPI index urls should
                                   generally have this set to False, for
                                   example.
        z\\Nkeydefining_class)
startswithr	urllib_parseurlsplitrrrrrsuperr__init__r)selfurlrrrr)	__class__/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-1.el7.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/models/link.pyr$s			z
Link.__init__cCsc|jrdj|j}nd}|jrLdjt|j|j|Stt|jSdS)Nz (requires-python:{})z{} (from {}){})rformatrrrstr)rrpr"r"r#__str__Ss		zLink.__str__cCs
dj|S)Nz	<Link {}>)r%)rr"r"r#__repr___sz
Link.__repr__cCs|jS)N)r)rr"r"r#r cszLink.urlcCsq|jjd}tj|}|s@t|j\}}|Stj|}|smtdj	t
|S)N/z&URL {self._url!r} produced no filename)pathrstrip	posixpathbasenamernetlocrunquoteAssertionErrorr%locals)rr+namer/	user_passr"r"r#filenamehs	z
Link.filenamecCs
t|jS)N)r
r )rr"r"r#	file_pathxszLink.file_pathcCs
|jjS)N)rscheme)rr"r"r#r7}szLink.schemecCs
|jjS)z4
        This can contain auth information.
        )rr/)rr"r"r#r/szLink.netloccCstj|jjS)N)rr0rr+)rr"r"r#r+sz	Link.pathcCsttj|jjdS)Nr*)rr-r.r+r,)rr"r"r#rsz
Link.splitextcCs|jdS)N)r)rr"r"r#extszLink.extcCs4|j\}}}}}tj||||dfS)N)rr
urlunsplit)rr7r/r+queryfragmentr"r"r#url_without_fragmentszLink.url_without_fragmentz[#&]egg=([^&]*)cCs,|jj|j}|sdS|jdS)Nr8)_egg_fragment_researchrgroup)rmatchr"r"r#egg_fragmentszLink.egg_fragmentz[#&]subdirectory=([^&]*)cCs,|jj|j}|sdS|jdS)Nr8)_subdirectory_fragment_rer?rr@)rrAr"r"r#subdirectory_fragmentszLink.subdirectory_fragmentz2(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)cCs,|jj|j}|r(|jdSdS)N)_hash_rer?rr@)rrAr"r"r#hashs
z	Link.hashcCs,|jj|j}|r(|jdSdS)Nr8)rFr?rr@)rrAr"r"r#	hash_names
zLink.hash_namecCs0tj|jjdddjdddS)N#r8r?)r-r.rsplit)rr"r"r#show_urlsz
Link.show_urlcCs
|jdkS)Nfile)r7)rr"r"r#is_fileszLink.is_filecCs|jotjj|jS)N)rNosr+isdirr6)rr"r"r#is_existing_dirszLink.is_existing_dircCs
|jtkS)N)r9r)rr"r"r#is_wheelsz
Link.is_wheelcCs ddlm}|j|jkS)Nr)vcs)pip._internal.vcsrSr7all_schemes)rrSr"r"r#is_vcsszLink.is_vcscCs
|jdk	S)N)r)rr"r"r#	is_yankedszLink.is_yankedcCs
|jdk	S)N)rH)rr"r"r#has_hashsz
Link.has_hashcCs]|dks|jrdS|jdk	s/t|jdk	sDt|j|jd|jS)zG
        Return True if the link has a hash and it is allowed.
        NF
hex_digest)rXrHr1rGis_hash_allowed)rhashesr"r"r#rZs
zLink.is_hash_allowed)#__name__
__module____qualname____doc__	__slots__rr(r)propertyr r5r6r7r/r+rr9r=recompiler>rBrCrDrFrGrHrLrNrQrRrVrWrXrZr"r")r!r#rsL	)	r)rOr-rbZpip._vendor.six.moves.urllibrrpip._internal.utils.filetypesrpip._internal.utils.miscrrrpip._internal.utils.modelsrpip._internal.utils.typingrpip._internal.utils.urlsr	r
typingrrr
rpip._internal.index.collectorrpip._internal.utils.hashesrrr"r"r"r#<module>s"
Back to Directory File Manager