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:
parent
ec73362a76
commit
0786536634
10
pip.py
10
pip.py
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue