Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/pip/_internal/models/candidate.py @ 1:56ad4e20f292 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
| author | guerler |
|---|---|
| date | Fri, 31 Jul 2020 00:32:28 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:d30785e31577 | 1:56ad4e20f292 |
|---|---|
| 1 from pip._vendor.packaging.version import parse as parse_version | |
| 2 | |
| 3 from pip._internal.utils.models import KeyBasedCompareMixin | |
| 4 from pip._internal.utils.typing import MYPY_CHECK_RUNNING | |
| 5 | |
| 6 if MYPY_CHECK_RUNNING: | |
| 7 from pip._vendor.packaging.version import _BaseVersion | |
| 8 from pip._internal.models.link import Link | |
| 9 from typing import Any | |
| 10 | |
| 11 | |
| 12 class InstallationCandidate(KeyBasedCompareMixin): | |
| 13 """Represents a potential "candidate" for installation. | |
| 14 """ | |
| 15 | |
| 16 def __init__(self, project, version, link): | |
| 17 # type: (Any, str, Link) -> None | |
| 18 self.project = project | |
| 19 self.version = parse_version(version) # type: _BaseVersion | |
| 20 self.link = link | |
| 21 | |
| 22 super(InstallationCandidate, self).__init__( | |
| 23 key=(self.project, self.version, self.link), | |
| 24 defining_class=InstallationCandidate | |
| 25 ) | |
| 26 | |
| 27 def __repr__(self): | |
| 28 # type: () -> str | |
| 29 return "<InstallationCandidate({!r}, {!r}, {!r})>".format( | |
| 30 self.project, self.version, self.link, | |
| 31 ) | |
| 32 | |
| 33 def __str__(self): | |
| 34 return '{!r} candidate (version {} at {})'.format( | |
| 35 self.project, self.version, self.link, | |
| 36 ) |
