a [f@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZeeZGdddZdS) N)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlc@sreZdZdZddgZeeeeeddddZeeeedddd Z ed d d Z eeed ddZ dS) SearchScopezF Encapsulates the locations that pip is configured to search. find_links index_urls)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 ) startswithrospathexistsappendr itertoolschainurllibparseurlparseschemeloggerwarning)clsr r Zbuilt_find_linkslinkZnew_linkparsedrE/usr/lib/python3.9/site-packages/pip/_internal/models/search_scope.pycreates&     zSearchScope.createNcCs||_||_dSNr)selfr r rrr __init__AszSearchScope.__init__)r cCsg}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|VqdSr")r.0urlrrr hz6SearchScope.get_formatted_locations.. )r rZ simple_urlrrrurlsplitrnetlocrrrformatjoinr )r#linesZredacted_index_urlsr'Zredacted_index_urlZpurlrrr get_formatted_locationsIs,    z#SearchScope.get_formatted_locations) project_namer cs(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'r cs.t|tjt}|ds*|d}|S)N/) posixpathr.rrquoterendswith)r'loc)r1rr mkurl_pypi_urlts  z.mkurl_pypi_urlcsg|] }|qSrrr%)r7rr r)z8SearchScope.get_index_urls_locations..)strr )r#r1r)r7r1r get_index_urls_locationsms z$SearchScope.get_index_urls_locations) __name__ __module__ __qualname____doc__ __slots__ classmethodrr9r!r$r0r:rrrr rs) $r)rZloggingrr3 urllib.parsertypingrZpip._vendor.packaging.utilsrZpip._internal.models.indexrZpip._internal.utils.compatrZpip._internal.utils.miscrrZ getLoggerr;rrrrrr s