Skip to content

Commit

Permalink
lazy_dist
Browse files Browse the repository at this point in the history
  • Loading branch information
notatallshaw committed Aug 12, 2021
1 parent c2c92c7 commit fd33b5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pip/_internal/resolution/resolvelib/candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,15 @@ def __init__(
self._ireq = ireq
self._name = name
self._version = version
self.dist = self._prepare()
self._is_prepared = False
self._dist = None

@property
def dist(self) -> Distribution:
if not self._is_prepared:
self._dist = self._prepare()
self._is_prepared = True
return self._dist

def __str__(self) -> str:
return f"{self.name} {self.version}"
Expand Down

0 comments on commit fd33b5a

Please sign in to comment.