3 ”Re.ã@s´ddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z ddlmZddlmZmZer ddlmZmZmZmZdd lmZdd lmZGd d „d e ƒZdS) éN)Úparse)ÚWHEEL_EXTENSION)Úredact_auth_from_urlÚsplit_auth_from_netlocÚsplitext)ÚKeyBasedCompareMixin)ÚMYPY_CHECK_RUNNING)Ú path_to_urlÚ url_to_path)ÚOptionalÚTextÚTupleÚUnion)ÚHTMLPage)ÚHashescsPeZdZdZddddddgZd=‡fd d „ Zd d „Zdd„Zedd„ƒZ edd„ƒZ edd„ƒZ edd„ƒZ edd„ƒZ edd„ƒZdd„Zedd„ƒZed d!„ƒZejd"ƒZed#d$„ƒZejd%ƒZed&d'„ƒZejd(ƒZed)d*„ƒZed+d,„ƒZed-d.„ƒZed/d0„ƒZd1d2„Zed3d4„ƒZed5d6„ƒZed7d8„ƒZ ed9d:„ƒZ!d;d<„Z"‡Z#S)>ÚLinkz?Represents a parsed link from a Package Index's simple URL Ú _parsed_urlÚ_urlÚ comes_fromÚrequires_pythonÚ yanked_reasonÚcache_link_parsingNTcs\|jdƒrt|ƒ}tj|ƒ|_||_||_|r2|nd|_||_t t |ƒj |t d�||_ 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\\N)ÚkeyÚdefining_class) Ú startswithr Ú urllib_parseÚurlsplitrrrrrÚsuperrÚ__init__r)ÚselfÚurlrrrr)Ú __class__©úˆ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/models/link.pyr$s  z Link.__init__cCsF|jrdj|jƒ}nd}|jr4djt|jƒ|j|ƒStt|jƒƒSdS)Nz (requires-python:{})Úz{} (from {}){})rÚformatrrrÚstr)rÚrpr"r"r#Ú__str__Ssz Link.__str__cCs dj|ƒS)Nz )r%)rr"r"r#Ú__repr___sz Link.__repr__cCs|jS)N)r)rr"r"r#r cszLink.urlcCsP|jjdƒ}tj|ƒ}|s,t|jƒ\}}|Stj|ƒ}|sLtdj ft ƒŽƒ‚|S)Nú/z&URL {self._url!r} produced no filename) ÚpathÚrstripÚ posixpathÚbasenamerÚnetlocrÚunquoteÚAssertionErrorr%Úlocals)rr+Únamer/Ú user_passr"r"r#Úfilenamehs   z Link.filenamecCs t|jƒS)N)r r )rr"r"r#Ú file_pathxszLink.file_pathcCs|jjS)N)rÚscheme)rr"r"r#r7}sz Link.schemecCs|jjS)z4 This can contain auth information. )rr/)rr"r"r#r/‚sz Link.netloccCstj|jjƒS)N)rr0rr+)rr"r"r#r+Šsz Link.pathcCsttj|jjdƒƒƒS)Nr*)rr-r.r+r,)rr"r"r#r�sz Link.splitextcCs |jƒdS)Né)r)rr"r"r#Úext“szLink.extcCs$|j\}}}}}tj||||dfƒS)N)rrÚ urlunsplit)rr7r/r+ÚqueryÚfragmentr"r"r#Úurl_without_fragment˜szLink.url_without_fragmentz[#&]egg=([^&]*)cCs |jj|jƒ}|sdS|jdƒS)Nr8)Ú_egg_fragment_reÚsearchrÚgroup)rÚmatchr"r"r#Ú egg_fragment szLink.egg_fragmentz[#&]subdirectory=([^&]*)cCs |jj|jƒ}|sdS|jdƒS)Nr8)Ú_subdirectory_fragment_rer?rr@)rrAr"r"r#Úsubdirectory_fragmentªszLink.subdirectory_fragmentz2(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)cCs |jj|jƒ}|r|jdƒSdS)Né)Ú_hash_rer?rr@)rrAr"r"r#Úhash¶s z Link.hashcCs |jj|jƒ}|r|jdƒSdS)Nr8)rFr?rr@)rrAr"r"r#Ú hash_name¾s zLink.hash_namecCs$tj|jjddƒdjddƒdƒS)Nú#r8rú?)r-r.rÚsplit)rr"r"r#Úshow_urlÆsz Link.show_urlcCs |jdkS)NÚfile)r7)rr"r"r#Úis_fileËsz Link.is_filecCs|jotjj|jƒS)N)rNÚosr+Úisdirr6)rr"r"r#Úis_existing_dirÐszLink.is_existing_dircCs |jtkS)N)r9r)rr"r"r#Úis_wheelÔsz Link.is_wheelcCsddlm}|j|jkS)Nr)Úvcs)Úpip._internal.vcsrSr7Ú all_schemes)rrSr"r"r#Úis_vcsÙs z Link.is_vcscCs |jdk S)N)r)rr"r"r#Ú is_yankedàszLink.is_yankedcCs |jdk S)N)rH)rr"r"r#Úhas_hashåsz Link.has_hashcCsB|dks|j rdS|jdk s"t‚|jdk s0t‚|j|j|jd�S)zG Return True if the link has a hash and it is allowed. NF)Ú hex_digest)rXrHr1rGÚis_hash_allowed)rÚhashesr"r"r#rZês zLink.is_hash_allowed)NNNT)$Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú __slots__rr(r)Úpropertyr r5r6r7r/r+rr9r=ÚreÚcompiler>rBrCrDrFrGrHrLrNrQrRrVrWrXrZÚ __classcell__r"r")r!r#rsL)                     r)rOr-rbZpip._vendor.six.moves.urllibrrÚpip._internal.utils.filetypesrÚpip._internal.utils.miscrrrÚpip._internal.utils.modelsrÚpip._internal.utils.typingrÚpip._internal.utils.urlsr r Útypingr r r rÚpip._internal.index.collectorrÚpip._internal.utils.hashesrrr"r"r"r#Ús