U 巀g@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZddlmZmZeeZedd Gd d d ZdS) N) dataclass)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlT)frozenc@s~eZdZUdZdddgZeeed<eeed<eed<e eeeeeddddZ edd d Z eeed d d Z dS) SearchScopezF Encapsulates the locations that pip is configured to search. find_links index_urlsno_index)r r r returncCsg}|D]0}|dr.t|}tj|r.|}||qtsvt||D](}t j |}|j dkrLt dqvqL||||dS)zQ Create a SearchScope object after normalizing the `find_links`. ~httpszipip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.)r r r ) startswithrospathexistsappendr itertoolschainurllibparseurlparseschemeloggerwarning)clsr r r built_find_linkslinknew_linkparsedr#O/opt/hc_python/lib/python3.8/site-packages/pip/_internal/models/search_scope.pycreates(     zSearchScope.create)rcCsg}g}|jrt|jtjgkrt|jD]:}t|}tj|}|jsR|jsRt d|| |q"| d d ||jr| d d dd|jDd |S)Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}css|]}t|VqdS)N)r.0urlr#r#r$ fsz6SearchScope.get_formatted_locations.. )r r simple_urlrrrurlsplitrnetlocrrrformatjoinr )selflinesredacted_index_urlsr(redacted_index_urlpurlr#r#r$get_formatted_locationsHs,    z#SearchScope.get_formatted_locations) project_namercs(ttdfdd fdd|jDS)zReturns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations )r(rcs.t|tjt}|ds*|d}|S)N/) posixpathr/rrquoterendswith)r(loc)r6r#r$mkurl_pypi_urlrs z.mkurl_pypi_urlcsg|] }|qSr#r#r&)r<r#r$ sz8SearchScope.get_index_urls_locations..)strr )r0r6r#)r<r6r$get_index_urls_locationsks z$SearchScope.get_index_urls_locationsN) __name__ __module__ __qualname____doc__ __slots__rr>__annotations__bool classmethodr%r5r?r#r#r#r$r s    )#r )rloggingrr8 urllib.parser dataclassesrtypingrZpip._vendor.packaging.utilsrpip._internal.models.indexrpip._internal.utils.compatrpip._internal.utils.miscrr getLoggerr@rr r#r#r#r$s