Mercurial > repos > guerler > hhblits
comparison lib/python3.8/site-packages/pip/_internal/models/candidate.py @ 0:9e54283cc701 draft
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
| author | guerler |
|---|---|
| date | Mon, 27 Jul 2020 03:47:31 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:9e54283cc701 |
|---|---|
| 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 | |
| 10 | |
| 11 class InstallationCandidate(KeyBasedCompareMixin): | |
| 12 """Represents a potential "candidate" for installation. | |
| 13 """ | |
| 14 | |
| 15 def __init__(self, name, version, link): | |
| 16 # type: (str, str, Link) -> None | |
| 17 self.name = name | |
| 18 self.version = parse_version(version) # type: _BaseVersion | |
| 19 self.link = link | |
| 20 | |
| 21 super(InstallationCandidate, self).__init__( | |
| 22 key=(self.name, self.version, self.link), | |
| 23 defining_class=InstallationCandidate | |
| 24 ) | |
| 25 | |
| 26 def __repr__(self): | |
| 27 # type: () -> str | |
| 28 return "<InstallationCandidate({!r}, {!r}, {!r})>".format( | |
| 29 self.name, self.version, self.link, | |
| 30 ) | |
| 31 | |
| 32 def __str__(self): | |
| 33 # type: () -> str | |
| 34 return '{!r} candidate (version {} at {})'.format( | |
| 35 self.name, self.version, self.link, | |
| 36 ) |
