[docs]classFetcherBase(AbstractClass):""" A fetcher takes a Requirement and tells us where to crawl to find it. """@abstractmethoddefurls(self,req):raiseNotImplementedError

classFetcher(FetcherBase):def__init__(self,urls):self._urls=urlsdefurls(self,_):returnself._urlsdef__eq__(self,other):ifnotisinstance(other,Fetcher):returnFalsereturnself._urls==other._urlsclassPyPIFetcher(FetcherBase):PYPI_BASE='https://pypi.python.org/simple/'def__init__(self,pypi_base=PYPI_BASE,use_mirrors=False):ifuse_mirrors:warnings.warn('use_mirrors is now deprecated.')ifnotpypi_base.endswith('/'):pypi_base+='/'pypi_url=urlparse.urlparse(pypi_base)ifnotpypi_url.scheme:self._pypi_base='http://'+pypi_baseelse:self._pypi_base=pypi_basedefurls(self,req):req=maybe_requirement(req)return[urljoin(self._pypi_base,'%s/'%req.project_name)]def__eq__(self,other):ifnotisinstance(other,PyPIFetcher):returnFalsereturnself._pypi_base==other._pypi_basedef__repr__(self):return'PyPIFetcher(%r)'%self._pypi_base