o 7]h@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZeeZGdddZdS) N)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlc@s|eZdZdZddgZedeedeeddfddZdeedeeddfdd Z defd d Z d edeefd dZ dS) SearchScopezF Encapsulates the locations that pip is configured to search. find_links index_urlsreturncCsg}|D]}|drt|}tj|r|}||qts;t||D]}t j |}|j dkr:t dnq&|||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 built_find_linkslinknew_linkparsedr!C/usr/lib/python3/dist-packages/pip/_internal/models/search_scope.pycreates(     zSearchScope.createNcCs||_||_dSNr)selfr r r!r!r"__init__As zSearchScope.__init__cCsg}g}|jr:|jtjgkr:|jD]}t|}tj|}|js)|js)t d|| |q| d d ||jrN| 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.0urlr!r!r" hsz6SearchScope.get_formatted_locations.. )r r simple_urlrrrurlsplitrnetlocrrrformatjoinr )r%linesredacted_index_urlsr)redacted_index_urlpurlr!r!r"get_formatted_locationsIs,     z#SearchScope.get_formatted_locations project_namecs*dtdtffdd 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/) posixpathr0rrquoterendswith)r)loc)r6r!r"mkurl_pypi_urlts  z.mkurl_pypi_urlcsg|]}|qSr!r!r')r<r!r" sz8SearchScope.get_index_urls_locations..)strr )r%r6r!)r<r6r"get_index_urls_locationsms z$SearchScope.get_index_urls_locations) __name__ __module__ __qualname____doc__ __slots__ classmethodrr>r#r&r5r?r!r!r!r"rs( ' $r)rloggingrr8 urllib.parsertypingrpip._vendor.packaging.utilsrpip._internal.models.indexrpip._internal.utils.compatrpip._internal.utils.miscrr getLoggerr@rrr!r!r!r"s