Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/pip/_internal/models/candidate.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
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 | |
9 from pip._internal.models.link import Link | |
10 | |
11 | |
12 class InstallationCandidate(KeyBasedCompareMixin): | |
13 """Represents a potential "candidate" for installation. | |
14 """ | |
15 | |
16 __slots__ = ["name", "version", "link"] | |
17 | |
18 def __init__(self, name, version, link): | |
19 # type: (str, str, Link) -> None | |
20 self.name = name | |
21 self.version = parse_version(version) # type: _BaseVersion | |
22 self.link = link | |
23 | |
24 super().__init__( | |
25 key=(self.name, self.version, self.link), | |
26 defining_class=InstallationCandidate | |
27 ) | |
28 | |
29 def __repr__(self): | |
30 # type: () -> str | |
31 return "<InstallationCandidate({!r}, {!r}, {!r})>".format( | |
32 self.name, self.version, self.link, | |
33 ) | |
34 | |
35 def __str__(self): | |
36 # type: () -> str | |
37 return '{!r} candidate (version {} at {})'.format( | |
38 self.name, self.version, self.link, | |
39 ) |