1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

instance cache the value for HTMLPage.base_url to speed up installation.

HTMLPage.base_url was being called excessively since it is used as a property
and called on every link found on the page (if not more).
This commit is contained in:
Brian Rosner 2009-08-11 13:57:55 -06:00
parent ec73362a76
commit 0786536634

10
pip.py
View file

@ -2388,10 +2388,12 @@ class HTMLPage(object):
@property
def base_url(self):
match = self._base_re.search(self.content)
if match:
return match.group(1)
return self.url
if not hasattr(self, "_base_url"):
match = self._base_re.search(self.content)
if match:
self._base_url = match.group(1)
self._base_url = self.url
return self._base_url
@property
def links(self):