Path: blob/master/venv/Lib/site-packages/pip/_internal/models/index.py
811 views
from pip._vendor.six.moves.urllib import parse as urllib_parse123class PackageIndex(object):4"""Represents a Package Index and provides easier access to endpoints5"""67def __init__(self, url, file_storage_domain):8# type: (str, str) -> None9super(PackageIndex, self).__init__()10self.url = url11self.netloc = urllib_parse.urlsplit(url).netloc12self.simple_url = self._url_for_path('simple')13self.pypi_url = self._url_for_path('pypi')1415# This is part of a temporary hack used to block installs of PyPI16# packages which depend on external urls only necessary until PyPI can17# block such packages themselves18self.file_storage_domain = file_storage_domain1920def _url_for_path(self, path):21# type: (str) -> str22return urllib_parse.urljoin(self.url, path)232425PyPI = PackageIndex(26'https://pypi.org/', file_storage_domain='files.pythonhosted.org'27)28TestPyPI = PackageIndex(29'https://test.pypi.org/', file_storage_domain='test-files.pythonhosted.org'30)313233